List of usage examples for org.apache.commons.lang StringUtils removeEnd
public static String removeEnd(String str, String remove)
Removes a substring only if it is at the end of a source string, otherwise returns the source string.
From source file:org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl.java
/** * Functional requirements state that users are able to perform searches using criteria values that they are not allowed to view. * * @see LookupableHelperService#applyFieldAuthorizationsFromNestedLookups(org.kuali.rice.krad.web.ui.Field) *//* w ww . ja v a 2 s .co m*/ public void applyFieldAuthorizationsFromNestedLookups(Field field) { BusinessObjectAuthorizationService boAuthzService = this.getBusinessObjectAuthorizationService(); if (!Field.MULTI_VALUE_FIELD_TYPES.contains(field.getFieldType())) { if (field.getPropertyValue() != null && field.getPropertyValue().endsWith(EncryptionService.ENCRYPTION_POST_PREFIX)) { if (boAuthzService.attributeValueNeedsToBeEncryptedOnFormsAndLinks(businessObjectClass, field.getPropertyName())) { AttributeSecurity attributeSecurity = getDataDictionaryService() .getAttributeSecurity(businessObjectClass.getName(), field.getPropertyName()); Person user = GlobalVariables.getUserSession().getPerson(); String decryptedValue = ""; try { String cipherText = StringUtils.removeEnd(field.getPropertyValue(), EncryptionService.ENCRYPTION_POST_PREFIX); if (CoreApiServiceLocator.getEncryptionService().isEnabled()) { decryptedValue = getEncryptionService().decrypt(cipherText); } } catch (GeneralSecurityException e) { throw new RuntimeException("Error decrypting value for business object " + businessObjectClass + " attribute " + field.getPropertyName(), e); } if (attributeSecurity.isMask() && !boAuthzService.canFullyUnmaskField(user, businessObjectClass, field.getPropertyName(), null)) { MaskFormatter maskFormatter = attributeSecurity.getMaskFormatter(); field.setEncryptedValue(field.getPropertyValue()); field.setDisplayMaskValue(maskFormatter.maskValue(decryptedValue)); field.setSecure(true); } else if (attributeSecurity.isPartialMask() && !boAuthzService.canPartiallyUnmaskField(user, businessObjectClass, field.getPropertyName(), null)) { MaskFormatter maskFormatter = attributeSecurity.getPartialMaskFormatter(); field.setEncryptedValue(field.getPropertyValue()); field.setDisplayMaskValue(maskFormatter.maskValue(decryptedValue)); field.setSecure(true); } else { field.setPropertyValue(org.kuali.rice.krad.lookup.LookupUtils .forceUppercase(businessObjectClass, field.getPropertyName(), decryptedValue)); } } else { throw new RuntimeException("Field " + field.getPersonNameAttributeName() + " was encrypted on " + businessObjectClass.getName() + " lookup was encrypted when it should not have been encrypted according to the data dictionary."); } } } else { if (boAuthzService.attributeValueNeedsToBeEncryptedOnFormsAndLinks(businessObjectClass, field.getPropertyName())) { LOG.error( "Cannot handle multiple value field types that have field authorizations, please implement custom lookupable helper service"); throw new RuntimeException( "Cannot handle multiple value field types that have field authorizations."); } } }
From source file:org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl.java
/** * * This method does the actual search, with the parameters specified, and returns the result. * * NOTE that it will not do any upper-casing based on the DD forceUppercase. That is handled through an external call to * LookupUtils.forceUppercase()./*from w w w . j a va2 s .co m*/ * * @param fieldValues A Map of the fieldNames and fieldValues to be searched on. * @param unbounded Whether the results should be bounded or not to a certain max size. * @return A List of search results. * */ protected List<? extends BusinessObject> getSearchResultsHelper(Map<String, String> fieldValues, boolean unbounded) { // remove hidden fields LookupUtils.removeHiddenCriteriaFields(getBusinessObjectClass(), fieldValues); searchUsingOnlyPrimaryKeyValues = getLookupService() .allPrimaryKeyValuesPresentAndNotWildcard(getBusinessObjectClass(), fieldValues); setBackLocation(fieldValues.get(KRADConstants.BACK_LOCATION)); setDocFormKey(fieldValues.get(KRADConstants.DOC_FORM_KEY)); setReferencesToRefresh(fieldValues.get(KRADConstants.REFERENCES_TO_REFRESH)); List searchResults; Map<String, String> nonBlankFieldValues = new HashMap<String, String>(); for (String fieldName : fieldValues.keySet()) { String fieldValue = fieldValues.get(fieldName); if (StringUtils.isNotBlank(fieldValue)) { if (fieldValue.endsWith(EncryptionService.ENCRYPTION_POST_PREFIX)) { String encryptedValue = StringUtils.removeEnd(fieldValue, EncryptionService.ENCRYPTION_POST_PREFIX); try { if (CoreApiServiceLocator.getEncryptionService().isEnabled()) { fieldValue = getEncryptionService().decrypt(encryptedValue); } } catch (GeneralSecurityException e) { LOG.error("Error decrypting value for business object " + getBusinessObjectService() + " attribute " + fieldName, e); throw new RuntimeException("Error decrypting value for business object " + getBusinessObjectService() + " attribute " + fieldName, e); } } nonBlankFieldValues.put(fieldName, fieldValue); } } // If this class is an EBO, just call the module service to get the results if (ExternalizableBusinessObjectUtils.isExternalizableBusinessObject(getBusinessObjectClass())) { ModuleService eboModuleService = KRADServiceLocatorWeb.getKualiModuleService() .getResponsibleModuleService(getBusinessObjectClass()); BusinessObjectEntry ddEntry = eboModuleService .getExternalizableBusinessObjectDictionaryEntry(getBusinessObjectClass()); Map<String, String> filteredFieldValues = new HashMap<String, String>(); for (String fieldName : nonBlankFieldValues.keySet()) { if (ddEntry.getAttributeNames().contains(fieldName)) { filteredFieldValues.put(fieldName, nonBlankFieldValues.get(fieldName)); } } searchResults = eboModuleService.getExternalizableBusinessObjectsListForLookup(getBusinessObjectClass(), (Map) filteredFieldValues, unbounded); // if any of the properties refer to an embedded EBO, call the EBO lookups first and apply to the local lookup } else if (hasExternalBusinessObjectProperty(getBusinessObjectClass(), nonBlankFieldValues)) { if (LOG.isDebugEnabled()) { LOG.debug("has EBO reference: " + getBusinessObjectClass()); LOG.debug("properties: " + nonBlankFieldValues); } // remove the EBO criteria Map<String, String> nonEboFieldValues = removeExternalizableBusinessObjectFieldValues( getBusinessObjectClass(), nonBlankFieldValues); if (LOG.isDebugEnabled()) { LOG.debug("Non EBO properties removed: " + nonEboFieldValues); } // get the list of EBO properties attached to this object List<String> eboPropertyNames = getExternalizableBusinessObjectProperties(getBusinessObjectClass(), nonBlankFieldValues); if (LOG.isDebugEnabled()) { LOG.debug("EBO properties: " + eboPropertyNames); } // loop over those properties for (String eboPropertyName : eboPropertyNames) { // extract the properties as known to the EBO Map<String, String> eboFieldValues = getExternalizableBusinessObjectFieldValues(eboPropertyName, nonBlankFieldValues); if (LOG.isDebugEnabled()) { LOG.debug("EBO properties for master EBO property: " + eboPropertyName); LOG.debug("properties: " + eboFieldValues); } // run search against attached EBO's module service ModuleService eboModuleService = KRADServiceLocatorWeb.getKualiModuleService() .getResponsibleModuleService( getExternalizableBusinessObjectClass(getBusinessObjectClass(), eboPropertyName)); // KULRICE-4401 made eboResults an empty list and only filled if service is found. List eboResults = Collections.emptyList(); if (eboModuleService != null) { eboResults = eboModuleService.getExternalizableBusinessObjectsListForLookup( getExternalizableBusinessObjectClass(getBusinessObjectClass(), eboPropertyName), (Map) eboFieldValues, unbounded); } else { LOG.debug("EBO ModuleService is null: " + eboPropertyName); } // get the mapping/relationship between the EBO object and it's parent object // use that to adjust the fieldValues // get the parent property type Class eboParentClass; String eboParentPropertyName; if (ObjectUtils.isNestedAttribute(eboPropertyName)) { eboParentPropertyName = StringUtils.substringBeforeLast(eboPropertyName, "."); try { eboParentClass = PropertyUtils.getPropertyType(getBusinessObjectClass().newInstance(), eboParentPropertyName); } catch (Exception ex) { throw new RuntimeException("Unable to create an instance of the business object class: " + getBusinessObjectClass().getName(), ex); } } else { eboParentClass = getBusinessObjectClass(); eboParentPropertyName = null; } if (LOG.isDebugEnabled()) { LOG.debug("determined EBO parent class/property name: " + eboParentClass + "/" + eboParentPropertyName); } // look that up in the DD (BOMDS) // find the appropriate relationship // CHECK THIS: what if eboPropertyName is a nested attribute - need to strip off the eboParentPropertyName if not null RelationshipDefinition rd = getBusinessObjectMetaDataService() .getBusinessObjectRelationshipDefinition(eboParentClass, eboPropertyName); if (LOG.isDebugEnabled()) { LOG.debug("Obtained RelationshipDefinition for " + eboPropertyName); LOG.debug(rd); } // copy the needed properties (primary only) to the field values // KULRICE-4446 do so only if the relationship definition exists // NOTE: this will work only for single-field PK unless the ORM layer is directly involved // (can't make (field1,field2) in ( (v1,v2),(v3,v4) ) style queries in the lookup framework if (ObjectUtils.isNotNull(rd)) { if (rd.getPrimitiveAttributes().size() > 1) { throw new RuntimeException( "EBO Links don't work for relationships with multiple-field primary keys."); } String boProperty = rd.getPrimitiveAttributes().get(0).getSourceName(); String eboProperty = rd.getPrimitiveAttributes().get(0).getTargetName(); StringBuffer boPropertyValue = new StringBuffer(); // loop over the results, making a string that the lookup DAO will convert into an // SQL "IN" clause for (Object ebo : eboResults) { if (boPropertyValue.length() != 0) { boPropertyValue.append(SearchOperator.OR.op()); } try { boPropertyValue.append(PropertyUtils.getProperty(ebo, eboProperty).toString()); } catch (Exception ex) { LOG.warn("Unable to get value for " + eboProperty + " on " + ebo); } } if (eboParentPropertyName == null) { // non-nested property containing the EBO nonEboFieldValues.put(boProperty, boPropertyValue.toString()); } else { // property nested within the main searched-for BO that contains the EBO nonEboFieldValues.put(eboParentPropertyName + "." + boProperty, boPropertyValue.toString()); } } } if (LOG.isDebugEnabled()) { LOG.debug("Passing these results into the lookup service: " + nonEboFieldValues); } // add those results as criteria // run the normal search (but with the EBO critieria added) searchResults = (List) getLookupService().findCollectionBySearchHelper(getBusinessObjectClass(), nonEboFieldValues, unbounded); } else { searchResults = (List) getLookupService().findCollectionBySearchHelper(getBusinessObjectClass(), nonBlankFieldValues, unbounded); } if (searchResults == null) { searchResults = new ArrayList(); } // sort list if default sort column given List defaultSortColumns = getDefaultSortColumns(); if (defaultSortColumns.size() > 0) { Collections.sort(searchResults, new BeanPropertyComparator(defaultSortColumns, true)); } return searchResults; }
From source file:org.kuali.rice.kns.util.FieldUtils.java
/** * Uses reflection to get the property names of the business object, then checks for the property name as a key in the passed * map. If found, takes the value from the map and sets the business object property. * * @param bo//from www . j a v a2 s .co m * @param fieldValues * @param propertyNamePrefix this value will be prepended to all property names in the returned unformattable values map * @return Cached Values from any formatting failures */ public static Map populateBusinessObjectFromMap(BusinessObject bo, Map<String, ?> fieldValues, String propertyNamePrefix) { Map cachedValues = new HashMap(); MessageMap errorMap = GlobalVariables.getMessageMap(); try { for (Iterator<String> iter = fieldValues.keySet().iterator(); iter.hasNext();) { String propertyName = iter.next(); if (propertyName.endsWith(KRADConstants.CHECKBOX_PRESENT_ON_FORM_ANNOTATION)) { // since checkboxes do not post values when unchecked, this code detects whether a checkbox was unchecked, and // sets the value to false. if (StringUtils.isNotBlank((String) fieldValues.get(propertyName))) { String checkboxName = StringUtils.removeEnd(propertyName, KRADConstants.CHECKBOX_PRESENT_ON_FORM_ANNOTATION); String checkboxValue = (String) fieldValues.get(checkboxName); if (checkboxValue == null) { // didn't find a checkbox value, assume that it is unchecked if (isPropertyWritable(bo, checkboxName)) { Class type = ObjectUtils.easyGetPropertyType(bo, checkboxName); if (type == Boolean.TYPE || type == Boolean.class) { // ASSUMPTION: unchecked means false ObjectUtils.setObjectProperty(bo, checkboxName, type, "false"); } } } } // else, if not null, then it has a value, and we'll let the rest of the code handle it when the param is processed on // another iteration (may be before or after this iteration). } else if (isPropertyWritable(bo, propertyName) && fieldValues.get(propertyName) != null) { // if the field propertyName is a valid property on the bo class Class type = ObjectUtils.easyGetPropertyType(bo, propertyName); try { Object fieldValue = fieldValues.get(propertyName); ObjectUtils.setObjectProperty(bo, propertyName, type, fieldValue); } catch (FormatException e) { cachedValues.put(propertyNamePrefix + propertyName, fieldValues.get(propertyName)); errorMap.putError(propertyNamePrefix + propertyName, e.getErrorKey(), e.getErrorArgs()); } } } } catch (IllegalAccessException e) { LOG.error("unable to populate business object" + e.getMessage()); throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { LOG.error("unable to populate business object" + e.getMessage()); throw new RuntimeException(e.getMessage(), e); } catch (NoSuchMethodException e) { LOG.error("unable to populate business object" + e.getMessage()); throw new RuntimeException(e.getMessage(), e); } return cachedValues; }
From source file:org.kuali.rice.kns.web.struts.action.KualiMaintenanceDocumentAction.java
protected Map<String, String> getRequestParameters(List keyFieldNames, Maintainable maintainable, HttpServletRequest request) {/*www . j a v a 2s . c o m*/ Map<String, String> requestParameters = new HashMap<String, String>(); for (Iterator iter = keyFieldNames.iterator(); iter.hasNext();) { String keyPropertyName = (String) iter.next(); if (request.getParameter(keyPropertyName) != null) { String keyValue = request.getParameter(keyPropertyName); // Check if this element was encrypted, if it was decrypt it if (getBusinessObjectAuthorizationService().attributeValueNeedsToBeEncryptedOnFormsAndLinks( maintainable.getBoClass(), keyPropertyName)) { try { keyValue = StringUtils.removeEnd(keyValue, EncryptionService.ENCRYPTION_POST_PREFIX); if (CoreApiServiceLocator.getEncryptionService().isEnabled()) { keyValue = encryptionService.decrypt(keyValue); } } catch (GeneralSecurityException e) { throw new RuntimeException(e); } } requestParameters.put(keyPropertyName, keyValue); } } return requestParameters; }
From source file:org.kuali.rice.krad.datadictionary.MessageBeanProcessor.java
/** * Retrieves the component code associated with the bean definition * * @param beanName name of the bean to find component code for * @param beanDefinition bean definition to find component code for * @return String component code for bean or null if a component code was not found */// w ww. ja va 2 s. c o m protected String getComponentForBean(String beanName, BeanDefinition beanDefinition) { String componentCode = null; MutablePropertyValues pvs = beanDefinition.getPropertyValues(); if (pvs.contains(KRADPropertyConstants.COMPONENT_CODE)) { PropertyValue propertyValue = pvs.getPropertyValue(KRADPropertyConstants.COMPONENT_CODE); componentCode = getStringValue(propertyValue.getValue()); } if ((componentCode == null) && StringUtils.isNotBlank(beanName) && !isGeneratedBeanName(beanName)) { componentCode = beanName; } if (StringUtils.isNotBlank(componentCode)) { componentCode = StringUtils.removeEnd(componentCode, KRADConstants.DICTIONARY_BEAN_PARENT_SUFFIX); } return componentCode; }
From source file:org.kuali.rice.krad.lookup.LookupableImpl.java
/** * Filters the search criteria to be used with the lookup. * * <p>Processing entails primarily of the removal of filtered and unused/blank search criteria. Encrypted field * values are decrypted, and date range fields are combined into a single criteria entry.</p> * * <p>In special cases additional non-valid criteria may be included. E.g. with the KIM User Control as a criteria * the principal name may be passed so that it is displayed on the control. The filtering removes these values * based on the viewPostMetadata. When calling the search directly (methodToCall=search) the viewPostMetadata is * not set before filtering therefore non-valid criteria are not supported in these cases.</p> * * @param lookupForm lookup form instance containing the lookup data * @param searchCriteria map of criteria to process * @return map of processed criteria//from ww w .jav a 2 s. c o m */ protected Map<String, String> processSearchCriteria(LookupForm lookupForm, Map<String, String> searchCriteria) { Map<String, InputField> criteriaFields = new HashMap<String, InputField>(); if (lookupForm.getView() != null) { criteriaFields = getCriteriaFieldsForValidation((LookupView) lookupForm.getView(), lookupForm); } // combine date range criteria Map<String, String> filteredSearchCriteria = LookupUtils.preprocessDateFields(searchCriteria); // allow lookup inputs to filter the criteria for (String fieldName : searchCriteria.keySet()) { InputField inputField = criteriaFields.get(fieldName); if ((inputField == null) || !(inputField instanceof LookupInputField)) { continue; } LookupInputField lookupInputField = (LookupInputField) inputField; String propertyName = lookupInputField.getPropertyName(); // get the post data for the filterable controls ViewPostMetadata viewPostMetadata = lookupForm.getViewPostMetadata(); if (viewPostMetadata != null) { Object componentPostData = viewPostMetadata.getComponentPostData(lookupForm.getViewId(), UifConstants.PostMetadata.FILTERABLE_LOOKUP_CRITERIA); Map<String, FilterableLookupCriteriaControlPostData> filterableLookupCriteria = (Map<String, FilterableLookupCriteriaControlPostData>) componentPostData; // first filter the results using the filter on the control if (filterableLookupCriteria != null && filterableLookupCriteria.containsKey(propertyName)) { FilterableLookupCriteriaControlPostData postData = filterableLookupCriteria.get(propertyName); Class<? extends FilterableLookupCriteriaControl> controlClass = postData.getControlClass(); FilterableLookupCriteriaControl control = KRADUtils.createNewObjectFromClass(controlClass); filteredSearchCriteria = control.filterSearchCriteria(propertyName, filteredSearchCriteria, postData); } // second filter the results using the filter in the input field filteredSearchCriteria = lookupInputField.filterSearchCriteria(filteredSearchCriteria); // early return if we have no results if (filteredSearchCriteria == null) { return null; } } } // decryption any encrypted search values Map<String, String> processedSearchCriteria = new HashMap<String, String>(); for (String fieldName : filteredSearchCriteria.keySet()) { String fieldValue = filteredSearchCriteria.get(fieldName); // do not add hidden or blank criteria InputField inputField = criteriaFields.get(fieldName); if (((inputField != null) && (inputField.getControl() instanceof HiddenControl)) || StringUtils.isBlank(fieldValue)) { continue; } if (fieldValue.endsWith(EncryptionService.ENCRYPTION_POST_PREFIX)) { String encryptedValue = StringUtils.removeEnd(fieldValue, EncryptionService.ENCRYPTION_POST_PREFIX); try { fieldValue = getEncryptionService().decrypt(encryptedValue); } catch (GeneralSecurityException e) { throw new RuntimeException("Error decrypting value for business object class " + getDataObjectClass() + " attribute " + fieldName, e); } } processedSearchCriteria.put(fieldName, fieldValue); } return processedSearchCriteria; }
From source file:org.kuali.rice.krad.lookup.LookupableImpl.java
/** * {@inheritDoc}//from w w w . jav a 2 s . co m */ @Override public void buildMultiValueSelectField(InputField selectField, Object model) { LookupForm lookupForm = (LookupForm) model; Map<String, Object> selectFieldContext = selectField.getContext(); Object lineDataObject = selectFieldContext == null ? null : selectFieldContext.get(UifConstants.ContextVariableNames.LINE); if (lineDataObject == null) { throw new RuntimeException("Unable to get data object for line from component: " + selectField.getId()); } Control selectControl = selectField.getControl(); if ((selectControl != null) && (selectControl instanceof ValueConfiguredControl)) { // get value for each field conversion from line and add to lineIdentifier List<String> fromFieldNames = new ArrayList<String>(lookupForm.getFieldConversions().keySet()); // Per KULRICE-12125 we need to remove secure field names from this list. fromFieldNames = new ArrayList<String>( KRADUtils.getPropertyKeyValuesFromDataObject(fromFieldNames, lineDataObject).keySet()); Collections.sort(fromFieldNames); lookupForm.setMultiValueReturnFields(fromFieldNames); String lineIdentifier = ""; for (String fromFieldName : fromFieldNames) { Object fromFieldValue = ObjectPropertyUtils.getPropertyValue(lineDataObject, fromFieldName); if (fromFieldValue != null) { lineIdentifier += fromFieldValue; } lineIdentifier += ":"; } lineIdentifier = StringUtils.removeEnd(lineIdentifier, ":"); ((ValueConfiguredControl) selectControl).setValue(lineIdentifier); } }
From source file:org.kuali.rice.krad.lookup.LookupController.java
/** * Invoked from the UI to return the selected lookup results lines, parameters are collected to build a URL to * the caller and then a redirect is performed. * * @param lookupForm lookup form instance containing the selected results and lookup configuration * @param request servlet request/* www. j ava2s.c om*/ * @param redirectAttributes redirect attributes instance * @return redirect URL for the return location */ @RequestMapping(method = RequestMethod.POST, params = "methodToCall=returnSelected") public String returnSelected(@ModelAttribute(UifConstants.KUALI_FORM_ATTR) LookupForm lookupForm, HttpServletRequest request, final RedirectAttributes redirectAttributes) { LookupUtils.refreshLookupResultSelections((LookupForm) lookupForm); // build string of select line identifiers String selectedLineValues = ""; Set<String> selectedLines = lookupForm.getSelectedCollectionLines().get(UifPropertyPaths.LOOKUP_RESULTS); if (selectedLines != null) { for (String selectedLine : selectedLines) { selectedLineValues += selectedLine + ","; } selectedLineValues = StringUtils.removeEnd(selectedLineValues, ","); } Properties parameters = new Properties(); parameters.put(UifParameters.SELECTED_LINE_VALUES, selectedLineValues); parameters.putAll(lookupForm.getInitialRequestParameters()); String redirectUrl = UrlFactory.parameterizeUrl(lookupForm.getReturnLocation(), parameters); boolean lookupCameFromDifferentServer = KRADUtils.areDifferentDomains(lookupForm.getReturnLocation(), lookupForm.getRequestUrl()); if (redirectUrl.length() > RiceConstants.MAXIMUM_URL_LENGTH && !lookupCameFromDifferentServer) { redirectAttributes.addFlashAttribute(UifParameters.SELECTED_LINE_VALUES, selectedLineValues); } if (redirectUrl.length() > RiceConstants.MAXIMUM_URL_LENGTH && lookupCameFromDifferentServer) { Map<String, String[]> parms = lookupForm.getInitialRequestParameters(); parms.remove(UifParameters.RETURN_FORM_KEY); //add an error message to display to the user redirectAttributes.mergeAttributes(parms); redirectAttributes.addAttribute(UifParameters.MESSAGE_TO_DISPLAY, RiceKeyConstants.INFO_LOOKUP_RESULTS_MV_RETURN_EXCEEDS_LIMIT); String formKeyParam = request.getParameter(UifParameters.FORM_KEY); redirectAttributes.addAttribute(UifParameters.FORM_KEY, formKeyParam); return UifConstants.REDIRECT_PREFIX + lookupForm.getRequestUrl(); } if (redirectUrl.length() < RiceConstants.MAXIMUM_URL_LENGTH) { redirectAttributes.addAttribute(UifParameters.SELECTED_LINE_VALUES, selectedLineValues); } redirectAttributes.addAttribute(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.RETURN_METHOD_TO_CALL); if (StringUtils.isNotBlank(lookupForm.getReturnFormKey())) { redirectAttributes.addAttribute(UifParameters.FORM_KEY, lookupForm.getReturnFormKey()); } redirectAttributes.addAttribute(KRADConstants.REFRESH_CALLER, lookupForm.getView().getId()); redirectAttributes.addAttribute(KRADConstants.REFRESH_CALLER_TYPE, UifConstants.RefreshCallerTypes.MULTI_VALUE_LOOKUP); redirectAttributes.addAttribute(KRADConstants.REFRESH_DATA_OBJECT_CLASS, lookupForm.getDataObjectClassName()); if (StringUtils.isNotBlank(lookupForm.getQuickfinderId())) { redirectAttributes.addAttribute(UifParameters.QUICKFINDER_ID, lookupForm.getQuickfinderId()); } if (StringUtils.isNotBlank(lookupForm.getLookupCollectionName())) { redirectAttributes.addAttribute(UifParameters.LOOKUP_COLLECTION_NAME, lookupForm.getLookupCollectionName()); } if (StringUtils.isNotBlank(lookupForm.getLookupCollectionId())) { redirectAttributes.addAttribute(UifParameters.LOOKUP_COLLECTION_ID, lookupForm.getLookupCollectionId()); } if (StringUtils.isNotBlank(lookupForm.getReferencesToRefresh())) { redirectAttributes.addAttribute(KRADConstants.REFERENCES_TO_REFRESH, lookupForm.getReferencesToRefresh()); } // clear current form from session GlobalVariables.getUifFormManager().removeSessionForm(lookupForm); return UifConstants.REDIRECT_PREFIX + lookupForm.getReturnLocation(); }
From source file:org.kuali.rice.krad.lookup.LookupControllerServiceImpl.java
/** * Builds a string containing the names of the fields being returned separated by a comma. * * @param lookupForm form instance containing the lookup data * @return String names of return fields separated by a comma *//*ww w. j a v a2 s . co m*/ protected String getMultiValueReturnFields(LookupForm lookupForm) { String multiValueReturnFieldsParam = ""; List<String> multiValueReturnFields = lookupForm.getMultiValueReturnFields(); Collections.sort(multiValueReturnFields); if (multiValueReturnFields != null && !multiValueReturnFields.isEmpty()) { for (String field : multiValueReturnFields) { multiValueReturnFieldsParam += field + ","; } multiValueReturnFieldsParam = StringUtils.removeEnd(multiValueReturnFieldsParam, ","); } return multiValueReturnFieldsParam; }
From source file:org.kuali.rice.krad.lookup.LookupControllerServiceImpl.java
/** * Builds a string containing the selected line identifiers separated by a comma. * * @param lookupForm form instance containing the lookup data * @return String selected line identifiers separated by a comma *//*from w ww . j a va 2 s . c o m*/ protected String getSelectedLineValues(LookupForm lookupForm) { String selectedLineValues = ""; Set<String> selectedLines = lookupForm.getSelectedCollectionLines().get(UifPropertyPaths.LOOKUP_RESULTS); if (selectedLines != null) { for (String selectedLine : selectedLines) { selectedLineValues += selectedLine + ","; } selectedLineValues = StringUtils.removeEnd(selectedLineValues, ","); } return selectedLineValues; }