Java Code Examples for org.apache.commons.lang.StringUtils#substringBetween()
The following examples show how to use
org.apache.commons.lang.StringUtils#substringBetween() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PurchasingActionBase.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
public ActionForward deleteCapitalAssetLocationByDocument(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PurchasingFormBase purchasingForm = (PurchasingFormBase) form; CapitalAssetLocation location = purchasingForm.getNewPurchasingCapitalAssetLocationLine(); PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument(); boolean rulePassed = true; // SpringContext.getBean(KualiRuleService.class).applyRules(new // AddPurchasingAccountsPayableItemEvent("", purDocument, item)); if (rulePassed) { String fullParameter = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE); String systemIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL); String locationIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL); // get specific asset item and grab system as well and attach asset number CapitalAssetSystem system = purDocument.getPurchasingCapitalAssetSystems().get(Integer.parseInt(systemIndex)); system.getCapitalAssetLocations().remove(Integer.parseInt(locationIndex)); } return mapping.findForward(KFSConstants.MAPPING_BASIC); }
Example 2
Source File: ActsComponentUtil.java From sofa-acts with Apache License 2.0 | 6 votes |
public static Object run(String command) { String id = ""; if (StringUtils.contains(command, "?")) { id = StringUtils.substringBetween(command, "@", "?"); } else { id = StringUtils.substringAfter(command, "@"); } try { return actsComponents.get(id).execute(command); } catch (Exception e) { log.error("execute acts component error!", e); } return null; }
Example 3
Source File: TravelActionBase.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
public ActionForward deleteRelatedDocumentLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { TravelFormBase travelReqForm = (TravelFormBase) form; String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); if (StringUtils.isNotBlank(parameterName)) { String relDocumentNumber = StringUtils.substringBetween(parameterName, "deleteRelatedDocumentLine.", "."); List<AccountingDocumentRelationship> adrList = getAccountingDocumentRelationshipService().find(new AccountingDocumentRelationship(travelReqForm.getDocument().getDocumentNumber(), relDocumentNumber)); if (adrList != null && adrList.size() == 1) { if (adrList.get(0).getPrincipalId().equals(GlobalVariables.getUserSession().getPerson().getPrincipalId())) { getAccountingDocumentRelationshipService().delete(adrList.get(0)); } } } return mapping.findForward(KFSConstants.MAPPING_BASIC); }
Example 4
Source File: PurchasingActionBase.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
public ActionForward useOffCampusAssetLocationBuildingByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PurchasingFormBase baseForm = (PurchasingFormBase) form; PurchasingDocument document = (PurchasingDocument) baseForm.getDocument(); String fullParameter = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE); String assetItemIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL); String assetLocationIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL); PurchasingCapitalAssetItem assetItem = document.getPurchasingCapitalAssetItems().get(Integer.parseInt(assetItemIndex)); CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem(); if ("new".equals(assetLocationIndex)) { useOffCampusAssetLocationBuilding(system.getNewPurchasingCapitalAssetLocationLine()); } else { useOffCampusAssetLocationBuilding(system.getCapitalAssetLocations().get(Integer.parseInt(assetLocationIndex))); } return mapping.findForward(KFSConstants.MAPPING_BASIC); }
Example 5
Source File: ZonePlayerHandler.java From smarthome with Eclipse Public License 2.0 | 5 votes |
private String extractStationId(String uri) { String stationID = null; if (isPlayingStream(uri)) { stationID = StringUtils.substringBetween(uri, ":s", "?sid"); } else if (isPlayingRadioStartedByAmazonEcho(uri)) { stationID = StringUtils.substringBetween(uri, "sid=s", "&"); } return stationID; }
Example 6
Source File: SoqlParser.java From enforce-sonarqube-plugin with MIT License | 5 votes |
/** * Re-parses a query that was retrieved as a String. * * @param astNode The String's node. * @return The query as a new QUERY_EXPRESSION node. */ public static AstNode parseQuery(AstNode astNode) { AstNode parsedQuery = null; try { String string = astNode.getTokenOriginalValue(); String queryAsString = StringUtils.substringBetween(string, "'", "'"); Parser<Grammar> queryParser = ApexParser.create(new ApexConfiguration(Charsets.UTF_8)); queryParser.setRootRule(queryParser.getGrammar().rule(ApexGrammarRuleKey.QUERY_EXPRESSION)); parsedQuery = queryParser.parse(queryAsString); } catch (Exception e) { ChecksLogger.logCheckError(CLASS_TO_LOG, METHOD_TO_LOG, e.toString()); } return parsedQuery; }
Example 7
Source File: MaintainableXMLConversionServiceImpl.java From rice with Educational Community License v2.0 | 5 votes |
public String transformMaintainableXML(String xml) { String beginning = StringUtils.substringBefore(xml, "<" + OLD_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">"); String oldMaintainableObjectXML = StringUtils.substringBetween(xml, "<" + OLD_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">", "</" + OLD_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">"); String newMaintainableObjectXML = StringUtils.substringBetween(xml, "<" + NEW_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">", "</" + NEW_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">"); String ending = StringUtils.substringAfter(xml, "</" + NEW_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">"); String convertedOldMaintainableObjectXML = transformSection(oldMaintainableObjectXML); String convertedNewMaintainableObjectXML = transformSection(newMaintainableObjectXML); String convertedXML = beginning + "<" + OLD_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">" + convertedOldMaintainableObjectXML + "</" + OLD_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">" + "<" + NEW_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">" + convertedNewMaintainableObjectXML + "</" + NEW_MAINTAINABLE_OBJECT_ELEMENT_NAME + ">" + ending; return convertedXML; }
Example 8
Source File: TravelActionBase.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
@Override public ActionForward performLookup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { TravelFormBase travelForm = (TravelFormBase) form; // parse out the important strings from our methodToCall parameter String fullParameter = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); validateLookupInquiryFullParameter(request, form, fullParameter); String boClassName = StringUtils.substringBetween(fullParameter, KRADConstants.METHOD_TO_CALL_BOPARM_LEFT_DEL, KRADConstants.METHOD_TO_CALL_BOPARM_RIGHT_DEL); if (!StringUtils.isBlank(boClassName) && boClassName.equals(HistoricalTravelExpense.class.getName())) { TravelDocument document = travelForm.getTravelDocument(); boolean success = true; if (document.getTemProfileId() == null) { String identifier = TemConstants.documentProfileNames().get(document.getFinancialDocumentTypeCode()); GlobalVariables.getMessageMap().putError(KRADPropertyConstants.DOCUMENT + "." + KIMPropertyConstants.Person.FIRST_NAME, TemKeyConstants.ERROR_TEM_IMPORT_EXPENSES_PROFILE_MISSING, identifier); success = false; } if (!success) { return mapping.findForward(KFSConstants.MAPPING_BASIC); } travelForm.setRefreshCaller(KFSConstants.MULTIPLE_VALUE); GlobalVariables.getUserSession().addObject(TemPropertyConstants.TemProfileProperties.PROFILE_ID, document.getTemProfileId()); GlobalVariables.getUserSession().addObject(TemPropertyConstants.ARRANGER_PROFILE_ID, getTemProfileService().findTemProfileByPrincipalId(GlobalVariables.getUserSession().getPrincipalId()).getProfileId()); GlobalVariables.getUserSession().addObject(KFSPropertyConstants.DOCUMENT_TYPE_CODE, document.getFinancialDocumentTypeCode()); } return super.performLookup(mapping, form, request, response); }
Example 9
Source File: PagingBannerUtils.java From rice with Educational Community License v2.0 | 5 votes |
/** * same as method above except for use when it is not feasible to use ordinals to identify columns -- for example, * if dynamic attributes may be used */ public static String getStringValueAfterPrefix(String paramPrefix, Enumeration<String> parameterNames) { for (String parameterName : CollectionUtils.toIterable(parameterNames)) { if (parameterName.startsWith(paramPrefix)) { parameterName = WebUtils.endsWithCoordinates(parameterName) ? parameterName : parameterName + ".x"; return StringUtils.substringBetween(parameterName, paramPrefix, "."); } } return ""; }
Example 10
Source File: KualiAction.java From rice with Educational Community License v2.0 | 5 votes |
/** * This method takes the {@link org.kuali.rice.krad.util.KRADConstants.METHOD_TO_CALL_ATTRIBUTE} out of the request * and parses it returning the required fields needed for a text area. The fields returned * are the following in this order. * <ol> * <li>{@link #TEXT_AREA_FIELD_NAME}</li> * <li>{@link #FORM_ACTION}</li> * <li>{@link #TEXT_AREA_FIELD_LABEL}</li> * <li>{@link #TEXT_AREA_READ_ONLY}</li> * <li>{@link #TEXT_AREA_MAX_LENGTH}</li> * </ol> * * @param request the request to retrieve the textarea parameters * @return a string array holding the parsed fields */ private String[] getTextAreaParams(HttpServletRequest request) { // parse out the important strings from our methodToCall parameter String fullParameter = (String) request.getAttribute( KRADConstants.METHOD_TO_CALL_ATTRIBUTE); // parse textfieldname:htmlformaction String parameterFields = StringUtils.substringBetween(fullParameter, KRADConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL); if ( LOG.isDebugEnabled() ) { LOG.debug( "fullParameter: " + fullParameter ); LOG.debug( "parameterFields: " + parameterFields ); } String[] keyValue = null; if (StringUtils.isNotBlank(parameterFields)) { String[] textAreaParams = parameterFields.split( KRADConstants.FIELD_CONVERSIONS_SEPARATOR); if ( LOG.isDebugEnabled() ) { LOG.debug( "lookupParams: " + textAreaParams ); } for (final String textAreaParam : textAreaParams) { keyValue = textAreaParam.split(KRADConstants.FIELD_CONVERSION_PAIR_SEPARATOR, 2); if ( LOG.isDebugEnabled() ) { LOG.debug( "keyValue[0]: " + keyValue[0] ); LOG.debug( "keyValue[1]: " + keyValue[1] ); LOG.debug( "keyValue[2]: " + keyValue[2] ); LOG.debug( "keyValue[3]: " + keyValue[3] ); LOG.debug( "keyValue[4]: " + keyValue[4] ); } } } return keyValue; }
Example 11
Source File: PurapAccountingLineAuthorizer.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * Overrides the method in AccountingLineAuthorizerBase so that the balance inquiry button would * have both the line item number and the accounting line number for methodToCall when the user * clicks on the balance inquiry button. * @see org.kuali.kfs.sys.document.authorization.AccountingLineAuthorizerBase#getBalanceInquiryMethod(org.kuali.kfs.sys.businessobject.AccountingLine, java.lang.String, java.lang.Integer) */ @Override protected String getBalanceInquiryMethod(AccountingLine accountingLine, String accountingLineProperty, Integer accountingLineIndex) { final String infix = getActionInfixForNewAccountingLine(accountingLine, accountingLineProperty); String lineNumber = StringUtils.substringBetween(accountingLineProperty, "item[", "].sourceAccountingLine"); if (lineNumber == null) { lineNumber = "-2"; } String accountingLineNumber = StringUtils.substringBetween(accountingLineProperty, "sourceAccountingLine[", "]"); return "performBalanceInquiryFor"+infix+"Line.line"+ ":" + lineNumber + ":" + accountingLineNumber + ".anchoraccounting"+infix+ "existingLineLineAnchor"+accountingLineNumber; }
Example 12
Source File: WemoHandler.java From smarthome with Eclipse Public License 2.0 | 5 votes |
/** * The {@link updateWemoState} polls the actual state of a WeMo device and * calls {@link onValueReceived} to update the statemap and channels.. * */ protected void updateWemoState() { String action = "GetBinaryState"; String variable = "BinaryState"; String actionService = "basicevent"; String value = null; if (getThing().getThingTypeUID().getId().equals("insight")) { action = "GetInsightParams"; variable = "InsightParams"; actionService = "insight"; } String soapHeader = "\"urn:Belkin:service:" + actionService + ":1#" + action + "\""; String content = "<?xml version=\"1.0\"?>" + "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" + "<s:Body>" + "<u:" + action + " xmlns:u=\"urn:Belkin:service:" + actionService + ":1\">" + "</u:" + action + ">" + "</s:Body>" + "</s:Envelope>"; try { String wemoURL = getWemoURL(actionService); if (wemoURL != null) { String wemoCallResponse = wemoHttpCaller.executeCall(wemoURL, soapHeader, content); if (wemoCallResponse != null) { logger.trace("State response '{}' for device '{}' received", wemoCallResponse, getThing().getUID()); if (variable.equals("InsightParams")) { value = StringUtils.substringBetween(wemoCallResponse, "<InsightParams>", "</InsightParams>"); } else { value = StringUtils.substringBetween(wemoCallResponse, "<BinaryState>", "</BinaryState>"); } if (value != null) { logger.trace("New state '{}' for device '{}' received", value, getThing().getUID()); this.onValueReceived(variable, value, actionService + "1"); } } } } catch (Exception e) { logger.error("Failed to get actual state for device '{}': {}", getThing().getUID(), e.getMessage()); } }
Example 13
Source File: LookupUtils.java From rice with Educational Community License v2.0 | 5 votes |
/** * Retrieves the value for the given parameter name to send as a lookup parameter. * * @param form form instance to retrieve values from * @param request request object to retrieve parameters from * @param lookupObjectClass data object class associated with the lookup, used to check whether the * value needs to be encyrpted * @param propertyName name of the property associated with the parameter, used to check whether the * value needs to be encrypted * @param parameterName name of the parameter to retrieve the value for * @return String parameter value or empty string if no value was found */ public static String retrieveLookupParameterValue(UifFormBase form, HttpServletRequest request, Class<?> lookupObjectClass, String propertyName, String parameterName) { // return a null value if it is secure if (KRADUtils.isSecure(propertyName, lookupObjectClass)) { LOG.warn("field name " + propertyName + " is a secure value and not returned in parameter result value"); return null; } String parameterValue = ""; // get literal parameter values first if (StringUtils.startsWith(parameterName, "'") && StringUtils.endsWith(parameterName, "'")) { parameterValue = StringUtils.substringBetween(parameterName, "'"); } else if (parameterValue.startsWith(KRADConstants.LOOKUP_PARAMETER_LITERAL_PREFIX + KRADConstants.LOOKUP_PARAMETER_LITERAL_DELIMITER)) { parameterValue = StringUtils.removeStart(parameterValue, KRADConstants.LOOKUP_PARAMETER_LITERAL_PREFIX + KRADConstants.LOOKUP_PARAMETER_LITERAL_DELIMITER); } // check if parameter is in request else if (request.getParameterMap().containsKey(parameterName)) { parameterValue = request.getParameter(parameterName); } // get parameter value from form object else { parameterValue = ObjectPropertyUtils.getPropertyValueAsText(form, parameterName); } return parameterValue; }
Example 14
Source File: AccountsPayableActionBase.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * Will return an array of Strings containing 2 indexes, the first String is the item index and the second String is the account * index. These are obtained by parsing the method to call parameter from the request, between the word ".line" and "." The * indexes are separated by a semicolon (:) * * @param request The HttpServletRequest * @return An array of Strings containing pairs of two indices, an item index */ protected String[] getSelectedItemNumber(HttpServletRequest request) { String itemString = new String(); String parameterName = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE); if (StringUtils.isNotBlank(parameterName)) { itemString = StringUtils.substringBetween(parameterName, ".line", "."); } String[] result = StringUtils.split(itemString, ":"); return result; }
Example 15
Source File: GenericResponse.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
private String getAttachmentPartId(AttachmentPart element) { return "cid:" + StringUtils.substringBetween(element.getContentId(), "<", ">"); }
Example 16
Source File: GroupLookupableHelperServiceImpl.java From rice with Educational Community License v2.0 | 4 votes |
/** * Converts GroupInfo objects to GroupBo objects. * * @param fieldValues names and values returned by the Group Lookup screen * @return groupImplList a list of GroupImpl objects */ @Override public List<GroupBo> getSearchResults(java.util.Map<String,String> fieldValues) { Map<String, String> criteriaMap = new HashMap<String, String>(fieldValues); QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create(); criteriaMap.remove(KRADConstants.DOC_FORM_KEY); criteriaMap.remove(KRADConstants.BACK_LOCATION); criteriaMap.remove(KRADConstants.DOC_NUM); String refToRef = criteriaMap.get(KRADConstants.REFERENCES_TO_REFRESH); if (StringUtils.isNotBlank(refToRef) && refToRef.equalsIgnoreCase("GroupBo")) { criteriaMap.remove(KRADConstants.REFERENCES_TO_REFRESH); } boolean validPrncplFoundIfPrncplCritPresent = true; Map<String, String> attribsMap = new HashMap<String, String>(); if (!criteriaMap.isEmpty()) { List<Predicate> predicates = new ArrayList<Predicate>(); //principalId doesn't exist on 'Group'. Lets do this predicate conversion separately if (StringUtils.isNotBlank(criteriaMap.get(KimConstants.UniqueKeyConstants.PRINCIPAL_NAME))) { QueryByCriteria.Builder principalCriteria = QueryByCriteria.Builder.create(); Predicate principalPred = like("principalName", criteriaMap.get(KimConstants.UniqueKeyConstants.PRINCIPAL_NAME)); principalCriteria.setPredicates(principalPred); //String principalId = KimApiServiceLocator.getIdentityService() // .getPrincipalByPrincipalName(criteriaMap.get(KimConstants.UniqueKeyConstants.PRINCIPAL_NAME)).getPrincipalId(); PrincipalQueryResults principals = KimApiServiceLocator.getIdentityService() .findPrincipals(principalCriteria.build()); List<String> principalIds = new ArrayList<String>(); for (Principal principal : principals.getResults()) { principalIds.add(principal.getPrincipalId()); } if (CollectionUtils.isNotEmpty(principalIds)) { Timestamp currentTime = new Timestamp(Calendar.getInstance().getTimeInMillis()); predicates.add( and( in("members.memberId", principalIds.toArray( new String[principalIds.size()])), equal("members.typeCode", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode()), and( or(isNull("members.activeFromDateValue"), lessThanOrEqual("members.activeFromDateValue", currentTime)), or(isNull("members.activeToDateValue"), greaterThan("members.activeToDateValue", currentTime)) ) )); }else { validPrncplFoundIfPrncplCritPresent = false; } } criteriaMap.remove(KimConstants.UniqueKeyConstants.PRINCIPAL_NAME); Map<String, String> criteriaCopy = new HashMap<String, String>(); // copy the criteria map so we can modify it criteriaCopy.putAll(criteriaMap); // check the attribute definitions for attribute names for(String key : criteriaCopy.keySet()) { if (isParamAttribute(key)) { if (StringUtils.isNotBlank(criteriaMap.get(key))) { String attributeName = StringUtils.substringBetween(key, "attributes(", ")"); attribsMap.put(attributeName, criteriaMap.get(key)); } // valid attribute name so remove from criteria map criteriaMap.remove(key); } } predicates.add(PredicateUtils.convertMapToPredicate(criteriaMap)); criteria.setPredicates(and(predicates.toArray(new Predicate[predicates.size()]))); } List<Group> groups = new ArrayList<Group>(); if (validPrncplFoundIfPrncplCritPresent) { GroupQueryResults groupResults = KimApiServiceLocator.getGroupService().findGroups(criteria.build()); groups = groupResults.getResults(); } //have to convert back to Bos Map<String, GroupBo> groupBos = new HashMap<String, GroupBo>(groups.size()); for (Group group : groups) { // filter by any attributes if (attribsMap.isEmpty()) { if (groupBos.get(group.getId()) == null) { groupBos.put(group.getId(), GroupBo.from(group)); } } else { boolean containsAllAttribs = true; for (String attribute : attribsMap.keySet()) { containsAllAttribs &= group.getAttributes().containsKey(attribute) && group.getAttributes().get(attribute).equalsIgnoreCase(attribsMap.get(attribute)); } if (containsAllAttribs) { if (groupBos.get(group.getId()) == null) { groupBos.put(group.getId(), GroupBo.from(group)); } } } } return new ArrayList<GroupBo>(groupBos.values()); }
Example 17
Source File: SuperUserAction.java From rice with Educational Community License v2.0 | 4 votes |
public ActionForward actionRequestApprove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { LOG.info("entering actionRequestApprove() ..."); SuperUserForm superUserForm = (SuperUserForm) form; // Retrieve the relevant arguments from the "methodToCall" parameter. String methodToCallAttr = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); superUserForm.setActionTakenRecipientCode(StringUtils.substringBetween(methodToCallAttr, KRADConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL)); superUserForm.setActionTakenNetworkId(StringUtils.substringBetween(methodToCallAttr, KRADConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL)); superUserForm.setActionTakenWorkGroupId(StringUtils.substringBetween(methodToCallAttr, KRADConstants.METHOD_TO_CALL_PARM4_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM4_RIGHT_DEL)); superUserForm.setActionTakenActionRequestId(StringUtils.substringBetween(methodToCallAttr, KRADConstants.METHOD_TO_CALL_PARM5_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM5_RIGHT_DEL)); LOG.debug("Routing super user action request approve action"); boolean runPostProcessorLogic = ArrayUtils.contains(superUserForm.getActionRequestRunPostProcessorCheck(), superUserForm.getActionTakenActionRequestId()); String documentId = superUserForm.getRouteHeader().getDocumentId(); WorkflowDocumentActionsService documentActions = getWorkflowDocumentActionsService(documentId); DocumentActionParameters parameters = DocumentActionParameters.create(documentId, getUserSession(request) .getPrincipalId(), superUserForm.getAnnotation()); documentActions.superUserTakeRequestedAction(parameters, runPostProcessorLogic, superUserForm.getActionTakenActionRequestId()); String messageString; String actionReqest = StringUtils.substringBetween(methodToCallAttr, KRADConstants.METHOD_TO_CALL_PARM6_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM6_RIGHT_DEL); if (actionReqest.equalsIgnoreCase("acknowledge")) { messageString = "general.routing.superuser.actionRequestAcknowledged"; } else if (actionReqest.equalsIgnoreCase("FYI")) { messageString = "general.routing.superuser.actionRequestFYI"; } else if (actionReqest.equalsIgnoreCase("complete")) { messageString = "general.routing.superuser.actionRequestCompleted"; } else if (actionReqest.equalsIgnoreCase("approved")) { messageString = "general.routing.superuser.actionRequestApproved"; } else { messageString = "general.routing.superuser.actionRequestApproved"; } saveDocumentMessage(messageString, request, superUserForm.getDocumentId(), superUserForm.getActionTakenActionRequestId()); LOG.info("exiting actionRequestApprove() ..."); superUserForm.getActionRequests().clear(); initForm(request, form); // If the action request was also an app specific request, remove it from the app specific route recipient list. int removalIndex = findAppSpecificRecipientIndex(superUserForm, superUserForm.getActionTakenActionRequestId()); if (removalIndex >= 0) { superUserForm.getAppSpecificRouteList().remove(removalIndex); } return defaultDispatch(mapping, form, request, response); }
Example 18
Source File: KualiAction.java From rice with Educational Community License v2.0 | 4 votes |
@SuppressWarnings("unchecked") public ActionForward performInquiry(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // parse out the important strings from our methodToCall parameter String fullParameter = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); validateLookupInquiryFullParameter(request, form, fullParameter); // when javascript is disabled, the inquiry will appear in the same window as the document. when we close the inquiry, // our next request's method to call is going to be refresh KualiForm kualiForm = (KualiForm) form; kualiForm.registerEditableProperty(KRADConstants.DISPATCH_REQUEST_PARAMETER); // parse out business object class name for lookup String boClassName = StringUtils.substringBetween(fullParameter, KRADConstants.METHOD_TO_CALL_BOPARM_LEFT_DEL, KRADConstants.METHOD_TO_CALL_BOPARM_RIGHT_DEL); if (StringUtils.isBlank(boClassName)) { throw new RuntimeException("Illegal call to perform inquiry, no business object class name specified."); } // build the parameters for the inquiry url Properties parameters = new Properties(); parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, boClassName); parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation(request, mapping)); // pass values from form that should be pre-populated on inquiry String parameterFields = StringUtils.substringBetween(fullParameter, KRADConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL); if ( LOG.isDebugEnabled() ) { LOG.debug( "fullParameter: " + fullParameter ); LOG.debug( "parameterFields: " + parameterFields ); } if (StringUtils.isNotBlank(parameterFields)) { // TODO : create a method for this to be used by both lookup & inquiry ? String[] inquiryParams = parameterFields.split(KRADConstants.FIELD_CONVERSIONS_SEPARATOR); if ( LOG.isDebugEnabled() ) { LOG.debug( "inquiryParams: " + inquiryParams ); } Class<? extends BusinessObject> boClass = (Class<? extends BusinessObject>) Class.forName(boClassName); for (String inquiryParam : inquiryParams) { String[] keyValue = inquiryParam.split(KRADConstants.FIELD_CONVERSION_PAIR_SEPARATOR, 2); String inquiryParameterValue = retrieveLookupParameterValue(boClass, keyValue[1], keyValue[0], form, request); if (inquiryParameterValue == null) { parameters.put(keyValue[1], "directInquiryKeyNotSpecified"); } else { parameters.put(keyValue[1], inquiryParameterValue); } if ( LOG.isDebugEnabled() ) { LOG.debug( "keyValue[0]: " + keyValue[0] ); LOG.debug( "keyValue[1]: " + keyValue[1] ); } } } parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, "start"); parameters.put(KRADConstants.DOC_FORM_KEY, GlobalVariables.getUserSession().addObjectWithGeneratedKey(form)); String inquiryUrl = null; try { Class.forName(boClassName); inquiryUrl = getApplicationBaseUrl() + "/kr/" + KRADConstants.DIRECT_INQUIRY_ACTION; } catch ( ClassNotFoundException ex ) { // allow inquiry url to be null (and therefore no inquiry link will be displayed) but at least log a warning LOG.warn("Class name does not represent a valid class which this application understands: " + boClassName); } inquiryUrl = UrlFactory.parameterizeUrl(inquiryUrl, parameters); return new ActionForward(inquiryUrl, true); }
Example 19
Source File: Support.java From DBus with Apache License 2.0 | 4 votes |
public static void main(String[] args) { String str = "int"; String length = StringUtils.substringBetween(str, "(", ")"); String precision = StringUtils.substringBefore(length, ","); String scale = StringUtils.substringAfter(length, ","); }
Example 20
Source File: QQImpl.java From paascloud-master with Apache License 2.0 | 3 votes |
/** * Instantiates a new Qq. * * @param accessToken the access token * @param appId the app id */ public QQImpl(String accessToken, String appId) { super(accessToken, TokenStrategy.ACCESS_TOKEN_PARAMETER); this.appId = appId; String url = String.format(URL_GET_OPENID, accessToken); String result = getRestTemplate().getForObject(url, String.class); log.info("result={}", result); this.openId = StringUtils.substringBetween(result, "\"openid\":\"", "\"}"); }