Example usage for org.apache.commons.lang StringUtils removeEnd

List of usage examples for org.apache.commons.lang StringUtils removeEnd

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils removeEnd.

Prototype

public static String removeEnd(String str, String remove) 

Source Link

Document

Removes a substring only if it is at the end of a source string, otherwise returns the source string.

Usage

From source file:org.kuali.rice.krad.util.KRADUtils.java

/**
 * Retrieves parameter values from the request that match the requested
 * names. In addition, based on the object class an authorization check is
 * performed to determine if the values are secure and should be decrypted.
 * If true, the value is decrypted before returning
 *
 * @param parameterNames - names of the parameters whose values should be retrieved
 * from the request//  ww w .  ja  v a 2  s . c  o  m
 * @param parentObjectClass - object class that contains the parameter names as properties
 * and should be consulted for security checks
 * @param requestParameters - all request parameters to pull from
 * @return Map<String, String> populated with parameter name/value pairs
 * pulled from the request
 */
public static Map<String, String> getParametersFromRequest(List<String> parameterNames,
        Class<?> parentObjectClass, Map<String, String> requestParameters) {
    Map<String, String> parameterValues = new HashMap<String, String>();

    for (Iterator<String> iter = parameterNames.iterator(); iter.hasNext();) {
        String keyPropertyName = iter.next();

        if (requestParameters.get(keyPropertyName) != null) {
            String keyValue = requestParameters.get(keyPropertyName);

            // Check if this element was encrypted, if it was decrypt it
            if (KRADServiceLocatorWeb.getDataObjectAuthorizationService()
                    .attributeValueNeedsToBeEncryptedOnFormsAndLinks(parentObjectClass, keyPropertyName)) {
                try {
                    keyValue = StringUtils.removeEnd(keyValue, EncryptionService.ENCRYPTION_POST_PREFIX);
                    keyValue = CoreApiServiceLocator.getEncryptionService().decrypt(keyValue);
                } catch (GeneralSecurityException e) {
                    throw new RuntimeException(e);
                }
            }

            parameterValues.put(keyPropertyName, keyValue);
        }
    }

    return parameterValues;
}

From source file:org.kuali.rice.krad.util.ObjectUtils.java

/**
 * Sets the property of an object with the given value. Converts using the given formatter, if it isn't null.
 *
 * @param formatter//from  ww  w.  ja va 2 s .c  o m
 * @param bo
 * @param propertyName
 * @param type
 * @param propertyValue
 * @throws NoSuchMethodException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 */
public static void setObjectProperty(Formatter formatter, Object bo, String propertyName, Class type,
        Object propertyValue)
        throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    // convert value using formatter for type
    if (formatter != null) {
        propertyValue = formatter.convertFromPresentationFormat(propertyValue);
    }

    // KULRICE-8412 Changes so that values passed back through via the URL such as
    // lookups are decrypted where applicable
    if (propertyValue instanceof String) {
        String propVal = (String) propertyValue;

        if (propVal.endsWith(EncryptionService.ENCRYPTION_POST_PREFIX)) {
            propVal = StringUtils.removeEnd(propVal, EncryptionService.ENCRYPTION_POST_PREFIX);
        }

        if (KNSServiceLocator.getBusinessObjectAuthorizationService()
                .attributeValueNeedsToBeEncryptedOnFormsAndLinks(bo.getClass(), propertyName)) {
            try {
                if (CoreApiServiceLocator.getEncryptionService().isEnabled()) {
                    propertyValue = CoreApiServiceLocator.getEncryptionService().decrypt(propVal);
                }
            } catch (GeneralSecurityException e) {
                throw new RuntimeException(e);
            }
        }
    }

    // set property in the object
    PropertyUtils.setNestedProperty(bo, propertyName, propertyValue);
}

From source file:org.kuali.rice.krad.web.controller.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
 *///  w  ww  . j a va2  s  .c  o  m
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=returnSelected")
public String returnSelected(@ModelAttribute("KualiForm") LookupForm lookupForm, BindingResult result,
        HttpServletRequest request, HttpServletResponse response, final RedirectAttributes redirectAttributes) {

    Properties parameters = new Properties();

    // 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, ",");
    }

    //check to see what the redirect URL length would be
    parameters.put(UifParameters.SELECTED_LINE_VALUES, selectedLineValues);
    parameters.putAll(lookupForm.getInitialRequestParameters());
    String redirectUrl = UrlFactory.parameterizeUrl(lookupForm.getReturnLocation(), parameters);

    boolean lookupCameFromDifferentServer = 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) {
        HashMap<String, String> parms = (HashMap<String, String>) 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.getDocNum())) {
        redirectAttributes.addAttribute(UifParameters.DOC_NUM, lookupForm.getDocNum());
    }

    if (StringUtils.isNotBlank(lookupForm.getLookupCollectionName())) {
        redirectAttributes.addAttribute(UifParameters.LOOKUP_COLLECTION_NAME,
                lookupForm.getLookupCollectionName());
    }

    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.student.common.uif.controller.KSLookupController.java

@RequestMapping(method = RequestMethod.POST, params = "methodToCall=returnSelected")
@Override/*  www .j  a v  a2 s . co  m*/
public String returnSelected(@ModelAttribute(UifConstants.KUALI_FORM_ATTR) LookupForm lookupForm,
        HttpServletRequest request, final RedirectAttributes redirectAttributes) {

    LookupUtils.refreshLookupResultSelections((LookupForm) lookupForm);

    // build string of select line fields
    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, ",");

    }

    // 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.replaceAll(",", "&#44;").replaceAll(":", "&#58;") + ",";
        }
        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 (StringUtils.isNotBlank(multiValueReturnFieldsParam)) {
        redirectAttributes.addAttribute(UifParameters.MULIT_VALUE_RETURN_FILEDS, multiValueReturnFieldsParam);
    }

    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.student.common.uif.widget.KSRichTable.java

/**
 * Builds column options for sorting//w  w  w .  j  ava  2  s .c om
 *
 * @param collectionGroup
 */
@Override
protected void buildTableOptions(CollectionGroup collectionGroup) {
    LayoutManager layoutManager = collectionGroup.getLayoutManager();
    final boolean isUseServerPaging = collectionGroup.isUseServerPaging();

    // if sub collection exists, don't allow the table sortable
    if (!collectionGroup.getSubCollections().isEmpty()) {
        setDisableTableSort(true);
    }

    if (!isDisableTableSort()) {
        // if rendering add line, skip that row from col sorting
        if (collectionGroup.isRenderAddLine() && !collectionGroup.isReadOnly()
                && !((layoutManager instanceof TableLayoutManager)
                        && ((TableLayoutManager) layoutManager).isSeparateAddLine())) {
            Map<String, String> oTemplateOptions = this.getTemplateOptions();

            if (oTemplateOptions == null) {
                setTemplateOptions(oTemplateOptions = new HashMap<String, String>());
            }

            oTemplateOptions.put(UifConstants.TableToolsKeys.SORT_SKIP_ROWS,
                    "[" + UifConstants.TableToolsValues.ADD_ROW_DEFAULT_INDEX + "]");
        }

        StringBuilder tableToolsColumnOptions = new StringBuilder("[");

        int columnIndex = 0;
        int actionIndex = UifConstants.TableLayoutValues.ACTIONS_COLUMN_RIGHT_INDEX;
        boolean actionFieldVisible = collectionGroup.isRenderLineActions() && !collectionGroup.isReadOnly();

        if (layoutManager instanceof TableLayoutManager) {
            actionIndex = ((TableLayoutManager) layoutManager).getActionColumnIndex();
        }

        if (actionIndex == UifConstants.TableLayoutValues.ACTIONS_COLUMN_LEFT_INDEX && actionFieldVisible) {
            String actionColOptions = constructTableColumnOptions(columnIndex, false, isUseServerPaging, null,
                    null);
            tableToolsColumnOptions.append(actionColOptions + " , ");
            columnIndex++;
        }

        if (layoutManager instanceof TableLayoutManager
                && ((TableLayoutManager) layoutManager).isRenderSequenceField()) {

            //add mData handling if using a json data source
            String mDataOption = "";
            if (collectionGroup.isUseServerPaging() || isForceLocalJsonData()) {
                mDataOption = "\"" + UifConstants.TableToolsKeys.MDATA
                        + "\" : function(row,type,newVal){ return _handleColData(row,type,'c" + columnIndex
                        + "',newVal);}, ";
            }

            tableToolsColumnOptions.append("{\"" + UifConstants.TableToolsKeys.SORTABLE + "\" : " + false
            // auto sequence column is never sortable
                    + ", \"" + UifConstants.TableToolsKeys.SORT_TYPE + "\" : \""
                    + UifConstants.TableToolsValues.NUMERIC + "\", " + mDataOption + "\""
                    + UifConstants.TableToolsKeys.TARGETS + "\": [" + columnIndex + "]}, ");
            columnIndex++;
            if (actionIndex == 2 && actionFieldVisible) {
                String actionColOptions = constructTableColumnOptions(columnIndex, false, isUseServerPaging,
                        null, null);
                tableToolsColumnOptions.append(actionColOptions + " , ");
                columnIndex++;
            }
        }

        // skip select field if enabled
        if (collectionGroup.isIncludeLineSelectionField()) {
            String colOptions = constructTableColumnOptions(columnIndex, false, isUseServerPaging, null, null);
            tableToolsColumnOptions.append(colOptions + " , ");
            columnIndex++;
        }

        // if data dictionary defines aoColumns, copy here and skip default sorting/visibility behaviour
        if (!StringUtils.isEmpty(getTemplateOptions().get(UifConstants.TableToolsKeys.AO_COLUMNS))) {
            // get the contents of the JS array string
            String jsArray = getTemplateOptions().get(UifConstants.TableToolsKeys.AO_COLUMNS);
            int startBrace = StringUtils.indexOf(jsArray, "[");
            int endBrace = StringUtils.lastIndexOf(jsArray, "]");
            tableToolsColumnOptions.append(StringUtils.substring(jsArray, startBrace + 1, endBrace) + ", ");

            if (actionFieldVisible && (actionIndex == -1 || actionIndex >= columnIndex)) {
                String actionColOptions = constructTableColumnOptions(columnIndex, false, isUseServerPaging,
                        null, null);
                tableToolsColumnOptions.append(actionColOptions);
            } else {
                tableToolsColumnOptions = new StringBuilder(
                        StringUtils.removeEnd(tableToolsColumnOptions.toString(), ", "));
            }

            tableToolsColumnOptions.append("]");
            getTemplateOptions().put(UifConstants.TableToolsKeys.AO_COLUMNS,
                    tableToolsColumnOptions.toString());
        } else if (!StringUtils.isEmpty(getTemplateOptions().get(UifConstants.TableToolsKeys.AO_COLUMN_DEFS))
                && isForceAoColumnDefsOverride()) {
            String jsArray = getTemplateOptions().get(UifConstants.TableToolsKeys.AO_COLUMN_DEFS);
            int startBrace = StringUtils.indexOf(jsArray, "[");
            int endBrace = StringUtils.lastIndexOf(jsArray, "]");
            tableToolsColumnOptions.append(StringUtils.substring(jsArray, startBrace + 1, endBrace) + ", ");

            if (actionFieldVisible && (actionIndex == -1 || actionIndex >= columnIndex)) {
                String actionColOptions = constructTableColumnOptions(columnIndex, false, isUseServerPaging,
                        null, null);
                tableToolsColumnOptions.append(actionColOptions);
            } else {
                tableToolsColumnOptions = new StringBuilder(
                        StringUtils.removeEnd(tableToolsColumnOptions.toString(), ", "));
            }

            tableToolsColumnOptions.append("]");
            getTemplateOptions().put(UifConstants.TableToolsKeys.AO_COLUMN_DEFS,
                    tableToolsColumnOptions.toString());
        } else if (layoutManager instanceof TableLayoutManager) {
            List<Field> rowFields = ((TableLayoutManager) layoutManager).getFirstRowFields();

            // build column defs from the the first row of the table
            for (Component component : rowFields) {
                if (actionFieldVisible && columnIndex + 1 == actionIndex) {
                    String actionColOptions = constructTableColumnOptions(columnIndex, false, isUseServerPaging,
                            null, null);
                    tableToolsColumnOptions.append(actionColOptions + " , ");
                    columnIndex++;
                }

                //add mData handling if using a json data source
                String mDataOption = "";
                if (collectionGroup.isUseServerPaging() || isForceLocalJsonData()) {
                    mDataOption = "\"" + UifConstants.TableToolsKeys.MDATA
                            + "\" : function(row,type,newVal){ return _handleColData(row,type,'c" + columnIndex
                            + "',newVal);}, ";
                }

                // for FieldGroup, get the first field from that group
                if (component instanceof FieldGroup) {
                    component = ((FieldGroup) component).getItems().get(0);
                }

                Map<String, String> componentDataAttributes;
                if (component instanceof DataField) {
                    DataField field = (DataField) component;

                    // if a field is marked as invisible in hiddenColumns, append options and skip sorting
                    if (getHiddenColumns() != null && getHiddenColumns().contains(field.getPropertyName())) {
                        tableToolsColumnOptions.append("{" + UifConstants.TableToolsKeys.VISIBLE + ": "
                                + UifConstants.TableToolsValues.FALSE + ", " + mDataOption + "\""
                                + UifConstants.TableToolsKeys.TARGETS + "\": [" + columnIndex + "]" + "}, ");
                        // if sortableColumns is present and a field is marked as sortable or unspecified
                    } else if (getSortableColumns() != null && !getSortableColumns().isEmpty()) {
                        if (getSortableColumns().contains(field.getPropertyName())) {
                            tableToolsColumnOptions.append(
                                    getDataFieldColumnOptions(columnIndex, collectionGroup, field) + ", ");
                        } else {
                            tableToolsColumnOptions.append("{'" + UifConstants.TableToolsKeys.SORTABLE + "': "
                                    + UifConstants.TableToolsValues.FALSE + ", " + mDataOption + "\""
                                    + UifConstants.TableToolsKeys.TARGETS + "\": [" + columnIndex + "]"
                                    + "}, ");
                        }
                    } else {// sortable columns not defined
                        String colOptions = getDataFieldColumnOptions(columnIndex, collectionGroup, field);
                        tableToolsColumnOptions.append(colOptions + " , ");
                    }
                    columnIndex++;
                } else if ((component instanceof MessageField)
                        && (componentDataAttributes = component.getDataAttributes()) != null
                        && UifConstants.RoleTypes.ROW_GROUPING
                                .equals(componentDataAttributes.get(UifConstants.DataAttributes.ROLE))) {
                    //Grouping column is never shown, so skip
                    tableToolsColumnOptions.append("{" + UifConstants.TableToolsKeys.VISIBLE + ": "
                            + UifConstants.TableToolsValues.FALSE + ", " + mDataOption + "\""
                            + UifConstants.TableToolsKeys.TARGETS + "\": [" + columnIndex + "]" + "}, ");
                    columnIndex++;
                    // start KS customization (to allow message field sorting) - KSENROLL-4999
                } else if (component instanceof MessageField) {
                    componentDataAttributes = component.getDataAttributes();
                    //For message field, sort as a regular String
                    String sortType = "";
                    if (componentDataAttributes != null) {
                        sortType = componentDataAttributes.get("sortType");
                    }
                    if (StringUtils.isBlank(sortType)) {
                        sortType = UifConstants.TableToolsValues.DOM_TEXT;
                    }
                    String colOptions = constructTableColumnOptions(columnIndex, true, isUseServerPaging,
                            String.class, sortType);
                    tableToolsColumnOptions.append(colOptions + " , ");
                    columnIndex++;
                    // end KS customization (to allow message field sorting) - KSENROLL-4999
                } else if (component instanceof LinkField) {
                    String colOptions = constructTableColumnOptions(columnIndex, true, isUseServerPaging,
                            String.class, UifConstants.TableToolsValues.DOM_TEXT);
                    tableToolsColumnOptions.append(colOptions + " , ");
                    columnIndex++;
                } else {
                    String colOptions = constructTableColumnOptions(columnIndex, false, isUseServerPaging, null,
                            null);
                    tableToolsColumnOptions.append(colOptions + " , ");
                    columnIndex++;
                }

            }

            if (actionFieldVisible && (actionIndex == -1 || actionIndex >= columnIndex)) {
                String actionColOptions = constructTableColumnOptions(columnIndex, false, isUseServerPaging,
                        null, null);
                tableToolsColumnOptions.append(actionColOptions);
            } else {
                tableToolsColumnOptions = new StringBuilder(
                        StringUtils.removeEnd(tableToolsColumnOptions.toString(), ", "));
            }
            //merge the aoColumnDefs passed in
            if (!StringUtils.isEmpty(getTemplateOptions().get(UifConstants.TableToolsKeys.AO_COLUMN_DEFS))) {
                String origAoOptions = getTemplateOptions().get(UifConstants.TableToolsKeys.AO_COLUMN_DEFS)
                        .trim();
                origAoOptions = StringUtils.removeStart(origAoOptions, "[");
                origAoOptions = StringUtils.removeEnd(origAoOptions, "]");
                tableToolsColumnOptions.append("," + origAoOptions);
            }

            tableToolsColumnOptions.append("]");
            getTemplateOptions().put(UifConstants.TableToolsKeys.AO_COLUMN_DEFS,
                    tableToolsColumnOptions.toString());
        }
    }
}

From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingEditWrapper.java

/**
 * This method returns a list of crosslisted course codes for a course as comma seperated
 * string -- intended as a UI-helper method particularly since after CO-edit the save operation is
 * currently asynchronous so the UI doesn't see the updated data at any of the other CO-layers; since
 * the edits are happening directly in this object then the UI code will see the change and be able to
 * display appropriately; the drawback is that it's false since if persistence fails down below this
 * data will still appear as if everything was updated correctly.
 * <p/>/*from   ww w.j  a  v  a 2  s. co  m*/
 * Essentially, this is a patch for KSENROLL-5398 until KSENROLL-5346 is completed to make the edit
 * synchronous.
 *
 * @return
 * @see # getAlternateCOCodesUITooltip()
 */
@SuppressWarnings("unused")
public String getAlternateCOCodesUIList() {
    //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder
    StringBuilder sb = new StringBuilder();

    if (alternateCourseCodesSuffixStripped == null) {
        alternateCourseCodesSuffixStripped = new ArrayList<String>();
    }

    for (String crosslistingCode : alternateCourseCodesSuffixStripped) {
        sb.append(crosslistingCode + ", ");
    }

    return StringUtils.removeEnd(sb.toString(), ", ");
}

From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingEditWrapper.java

/**
 * This method returns a list of crosslisted/official course code for a course. This will
 * be displayed as the tooltip (if crosslisted cos exists) at Copy CO Screen.
 *
 * @return//from ww  w .j  a v a2 s . c o  m
 */
@SuppressWarnings("unused")
public String getCrossListedCodesUI() {

    StringBuilder sb = new StringBuilder();
    sb.append("This course is crosslisted with:<br>");
    for (String code : alternateCOCodes) {
        sb.append(code + ",");
    }

    return StringUtils.removeEnd(sb.toString(), ",");
}

From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingEditWrapper.java

public String getCrosslistedCodes() {
    StringBuilder sb = new StringBuilder();
    for (String code : alternateCOCodes) {
        sb.append(code + ",");
    }/*w w w.  jav  a  2s.c  o  m*/

    return StringUtils.removeEnd(sb.toString(), ",");
}

From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingListSectionWrapper.java

/**
 * This method returns a list of crosslisted/official course code for a course. This will
 * be displayed as the tooltip (if crosslisted cos exists) at Manage CO screen.
 *
 * @return//from w  ww.  java 2  s .c o m
 */
@SuppressWarnings("unused")
public String getCrossListedCodesUI() {

    //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder
    StringBuilder sb = new StringBuilder();
    sb.append("This course is crosslisted with:<br>");
    for (String code : alternateCOCodes) {
        sb.append(code + ",");
    }
    return StringUtils.removeEnd(sb.toString(), ",");
}

From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingListSectionWrapper.java

/**
 * This method returns a list of crosslisted/official course code for a course. This will
 * be displayed as the tooltip (if crosslisted cos exists) at Manage CO screen.
 *
 * @return//from w  w w  .j a va2  s  .  c o m
 */
@SuppressWarnings("unused")
public String getJointDefinedCodesUI() {

    //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder
    StringBuilder sb = new StringBuilder();
    sb.append("This course is joint defined with:<br>");
    sb.append(jointDefinedCoCode + "<br>");

    return StringUtils.removeEnd(sb.toString(), "<br>");
}