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

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

Introduction

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

Prototype

public static String upperCase(String str) 

Source Link

Document

Converts a String to upper case as per String#toUpperCase() .

Usage

From source file:org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingEditMaintainableImpl.java

private void updateCourseOffering(CourseOfferingEditWrapper coEditWrapper) {
    try {/*www  .  j a v  a  2  s. co m*/
        // persist format offerings
        updateFormatOfferings(coEditWrapper);

        //persist unitDeploymentOrgIds
        List<String> unitDeploymentOrgIds = new ArrayList<String>();
        for (OrganizationInfoWrapper orgWrapper : coEditWrapper.getOrganizationNames()) {
            if (StringUtils.isNotBlank(orgWrapper.getId())) {
                unitDeploymentOrgIds.add(orgWrapper.getId());
            }
        }

        CourseOfferingInfo coInfo = coEditWrapper.getCourseOfferingInfo();
        coInfo.setUnitsDeploymentOrgIds(unitDeploymentOrgIds);

        ContextInfo contextInfo = createContextInfo();

        // Credit Options (also creates extra-line)
        if (coEditWrapper.getCreditOption().getTypeKey()
                .equals(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_FIXED)
                && !coEditWrapper.getCreditOption().getFixedCredit().isEmpty()) {
            ResultValuesGroupInfo rvgInfo = CourseOfferingManagementUtil.getLrcService()
                    .getCreateFixedCreditResultValuesGroup(coEditWrapper.getCreditOption().getFixedCredit(),
                            LrcServiceConstants.RESULT_SCALE_KEY_CREDIT_DEGREE, contextInfo);
            coInfo.setCreditOptionId(rvgInfo.getKey());
        } else if (coEditWrapper.getCreditOption().getTypeKey()
                .equals(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_RANGE)
                && !coEditWrapper.getCreditOption().getMinCredits().isEmpty()
                && !coEditWrapper.getCreditOption().getMaxCredits().isEmpty()) {
            ResultValuesGroupInfo rvgInfo = CourseOfferingManagementUtil.getLrcService()
                    .getCreateRangeCreditResultValuesGroup(coEditWrapper.getCreditOption().getMinCredits(),
                            coEditWrapper.getCreditOption().getMaxCredits(),
                            calculateIncrement(coEditWrapper.getCreditOption().getAllowedCredits()),
                            LrcServiceConstants.RESULT_SCALE_KEY_CREDIT_DEGREE, contextInfo);
            coInfo.setCreditOptionId(rvgInfo.getKey());
        } else if (coEditWrapper.getCreditOption().getTypeKey()
                .equals(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_MULTIPLE)
                && !coEditWrapper.getCreditOption().getCredits().isEmpty()) {
            ResultValuesGroupInfo rvgInfo = CourseOfferingManagementUtil.getLrcService()
                    .getCreateMultipleCreditResultValuesGroup(coEditWrapper.getCreditOption().getCredits(),
                            LrcServiceConstants.RESULT_SCALE_KEY_CREDIT_DEGREE, contextInfo);
            coInfo.setCreditOptionId(rvgInfo.getKey());
        }

        // CO code
        String courseOfferingCode = coEditWrapper.getCourse().getCode();
        coInfo.setCourseNumberSuffix(StringUtils.upperCase(coInfo.getCourseNumberSuffix()));
        if (!StringUtils.isEmpty(coInfo.getCourseNumberSuffix())) {
            courseOfferingCode += coInfo.getCourseNumberSuffix();
        }
        coInfo.setCourseOfferingCode(courseOfferingCode);

        // Waitlist
        if (coInfo.getHasWaitlist() && !coEditWrapper.getHasWaitlist()) {
            //activate the waitlist
            CourseOfferingManagementUtil.getCourseWaitListServiceFacade()
                    .activateActivityOfferingWaitlistsByCourseOffering(coInfo.getId(), coInfo.getTermId(),
                            contextInfo);
        } else if (!coInfo.getHasWaitlist() && coEditWrapper.getHasWaitlist()) {
            //deactivate the waitlist
            CourseOfferingManagementUtil.getCourseWaitListServiceFacade()
                    .deactivateActivityOfferingWaitlistsByCourseOffering(coInfo.getId(), contextInfo);
        }

        //TODO REMOVE THIS AFTER KRAD CHECKLISTS ARE FIXED for student registration options
        //determine if audit reg options and pass/fail reg options should be added/removed to/from coInfo
        if (coEditWrapper.getAuditStudentRegOpts() && !coInfo.getStudentRegistrationGradingOptions()
                .contains(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT)) {
            coInfo.getStudentRegistrationGradingOptions().add(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT);
        } else if (!coEditWrapper.getAuditStudentRegOpts() && coInfo.getStudentRegistrationGradingOptions()
                .contains(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT)) {
            coInfo.getStudentRegistrationGradingOptions()
                    .remove(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT);
        }

        if (coEditWrapper.getPassFailStudentRegOpts() && !coInfo.getStudentRegistrationGradingOptions()
                .contains(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL)) {
            coInfo.getStudentRegistrationGradingOptions()
                    .add(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL);
        } else if (!coEditWrapper.getPassFailStudentRegOpts() && coInfo.getStudentRegistrationGradingOptions()
                .contains(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL)) {
            coInfo.getStudentRegistrationGradingOptions()
                    .remove(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL);
        }

        updateInstructors(coEditWrapper, coInfo);

        //Save cross lists
        loadCrossListedCOs(coEditWrapper, coInfo);

        // update Final Exam Driver
        setFinalExamDriverAttr(coInfo, coEditWrapper);

        // update Use Final Exam Matrix
        setUseFinalExamMatrix(coInfo, coEditWrapper);

        CourseOfferingManagementUtil.getCourseOfferingService().updateCourseOffering(coInfo.getId(), coInfo,
                contextInfo);
        String[] parameters = { coInfo.getCourseOfferingCode() };
        KSUifUtils.getMessengerFromUserSession()
                .addSuccessMessage(CourseOfferingConstants.COURSE_OFFERING_EDIT_SUCCESS, parameters);

        // generate exam offerings if exam period exists
        if (!StringUtils.isEmpty(coEditWrapper.getExamPeriodId())) {
            ExamOfferingResult result = CourseOfferingManagementUtil.getExamOfferingServiceFacade()
                    .generateFinalExamOffering(ExamOfferingManagementUtil.createExamOfferingContext(coInfo,
                            coEditWrapper.getExamPeriodId()), new ArrayList<String>(), contextInfo);
            ExamOfferingManagementUtil.processExamOfferingResultSet(result);
        }

        // check for changes to states in CO and related FOs (may happen in the case of deleted FOs)
        //            CourseOfferingViewHelperUtil.updateCourseOfferingStateFromActivityOfferingStateChange(coInfo, contextInfo);

    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }

}

From source file:org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingEditMaintainableImpl.java

protected CourseOfferingInfo createCourseOfferingInfo(CourseOfferingEditWrapper coCreateWrapper) {

    try {// w ww.  j av a2  s. c  o  m
        //persist unitDeploymentOrgIds
        List<String> unitDeploymentOrgIds = new ArrayList<String>();
        for (OrganizationInfoWrapper orgWrapper : coCreateWrapper.getOrganizationNames()) {
            unitDeploymentOrgIds.add(orgWrapper.getId());
        }

        CourseOfferingInfo coInfo = coCreateWrapper.getCourseOfferingInfo();
        coInfo.setUnitsDeploymentOrgIds(unitDeploymentOrgIds);

        ContextInfo contextInfo = createContextInfo();

        // Credit Options (also creates extra-line)
        if (coCreateWrapper.getCreditOption().getTypeKey()
                .equals(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_FIXED)
                && !coCreateWrapper.getCreditOption().getFixedCredit().isEmpty()) {
            ResultValuesGroupInfo rvgInfo = CourseOfferingManagementUtil.getLrcService()
                    .getCreateFixedCreditResultValuesGroup(coCreateWrapper.getCreditOption().getFixedCredit(),
                            LrcServiceConstants.RESULT_SCALE_KEY_CREDIT_DEGREE, contextInfo);
            coInfo.setCreditOptionId(rvgInfo.getKey());
        } else if (coCreateWrapper.getCreditOption().getTypeKey()
                .equals(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_RANGE)
                && !coCreateWrapper.getCreditOption().getMinCredits().isEmpty()
                && !coCreateWrapper.getCreditOption().getMaxCredits().isEmpty()) {
            ResultValuesGroupInfo rvgInfo = CourseOfferingManagementUtil.getLrcService()
                    .getCreateRangeCreditResultValuesGroup(coCreateWrapper.getCreditOption().getMinCredits(),
                            coCreateWrapper.getCreditOption().getMaxCredits(),
                            calculateIncrement(coCreateWrapper.getCreditOption().getAllowedCredits()),
                            LrcServiceConstants.RESULT_SCALE_KEY_CREDIT_DEGREE, contextInfo);
            coInfo.setCreditOptionId(rvgInfo.getKey());
        } else if (coCreateWrapper.getCreditOption().getTypeKey()
                .equals(LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_MULTIPLE)
                && !coCreateWrapper.getCreditOption().getCredits().isEmpty()) {
            ResultValuesGroupInfo rvgInfo = CourseOfferingManagementUtil.getLrcService()
                    .getCreateMultipleCreditResultValuesGroup(coCreateWrapper.getCreditOption().getCredits(),
                            LrcServiceConstants.RESULT_SCALE_KEY_CREDIT_DEGREE, contextInfo);
            coInfo.setCreditOptionId(rvgInfo.getKey());
        }

        // CO code
        List<String> optionKeys = CourseOfferingManagementUtil.getDefaultOptionKeysService()
                .getDefaultOptionKeysForCreateCourseOfferingFromCanonical();
        String courseOfferingCode = coCreateWrapper.getCourse().getCode();
        coInfo.setCourseNumberSuffix(StringUtils.upperCase(coInfo.getCourseNumberSuffix()));
        if (!StringUtils.isEmpty(coInfo.getCourseNumberSuffix())) {
            courseOfferingCode += coInfo.getCourseNumberSuffix();
            optionKeys.add(CourseOfferingServiceConstants.APPEND_COURSE_OFFERING_CODE_SUFFIX_OPTION_KEY);
        }
        coInfo.setCourseOfferingCode(courseOfferingCode);

        // Waitlist
        if (!coInfo.getHasWaitlist()) {
            coInfo.setWaitlistTypeKey(null);
            coInfo.setWaitlistLevelTypeKey(null);
        }

        //TODO REMOVE THIS AFTER KRAD CHECKLISTS ARE FIXED for student registration options
        //determine if audit reg options and pass/fail reg options should be added/removed to/from coInfo
        if (coCreateWrapper.getAuditStudentRegOpts() && !coInfo.getStudentRegistrationGradingOptions()
                .contains(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT)) {
            coInfo.getStudentRegistrationGradingOptions().add(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT);
        } else if (!coCreateWrapper.getAuditStudentRegOpts() && coInfo.getStudentRegistrationGradingOptions()
                .contains(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT)) {
            coInfo.getStudentRegistrationGradingOptions()
                    .remove(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT);
        }

        if (coCreateWrapper.getPassFailStudentRegOpts() && !coInfo.getStudentRegistrationGradingOptions()
                .contains(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL)) {
            coInfo.getStudentRegistrationGradingOptions()
                    .add(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL);
        } else if (!coCreateWrapper.getPassFailStudentRegOpts() && coInfo.getStudentRegistrationGradingOptions()
                .contains(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL)) {
            coInfo.getStudentRegistrationGradingOptions()
                    .remove(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL);
        }

        updateInstructors(coCreateWrapper, coInfo);

        //Save cross lists
        loadCrossListedCOs(coCreateWrapper, coInfo);

        // set Final Exam Driver
        setFinalExamDriverAttr(coInfo, coCreateWrapper);

        //set Use Final Exam Matrix
        setUseFinalExamMatrix(coInfo, coCreateWrapper);

        CourseOfferingInfo info = CourseOfferingManagementUtil.getCourseOfferingService().createCourseOffering(
                coInfo.getCourseId(), coInfo.getTermId(), LuiServiceConstants.COURSE_OFFERING_TYPE_KEY, coInfo,
                optionKeys, contextInfo);
        String[] parameters = { coInfo.getCourseOfferingCode() };
        KSUifUtils.getMessengerFromUserSession()
                .addSuccessMessage(CourseOfferingConstants.COURSE_OFFERING_CREATE_SUCCESS, parameters);

        coCreateWrapper.setCourseOfferingInfo(info);

        this.updateFormatOfferings(coCreateWrapper);
        // generate exam offerings if exam period exists
        if (!StringUtils.isEmpty(coCreateWrapper.getExamPeriodId())) {
            ExamOfferingResult result = CourseOfferingManagementUtil.getExamOfferingServiceFacade()
                    .generateFinalExamOffering(ExamOfferingManagementUtil.createExamOfferingContext(info,
                            coCreateWrapper.getExamPeriodId()), new ArrayList<String>(), contextInfo);
            ExamOfferingManagementUtil.processExamOfferingResultSet(result);
        }

        return info;

    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}

From source file:org.kuali.student.enrollment.class2.scheduleofclasses.controller.ScheduleOfClassesSearchController.java

private void configureDefaultAoDisplayFormat(ScheduleOfClassesSearchForm form) {
    String aoDisplayFormat = ConfigContext.getCurrentContextConfig()
            .getProperty(ScheduleOfClassesConstants.ConfigProperties.AO_DISPLAY_FORMAT);
    if (StringUtils.isNotBlank(aoDisplayFormat)) {
        ScheduleOfClassesSearchForm.AoDisplayFormat format = ScheduleOfClassesSearchForm.AoDisplayFormat
                .valueOf(StringUtils.upperCase(aoDisplayFormat));
        form.setAoDisplayFormat(format);
    }// w  w  w .  j  a  v a2s.  co m
}

From source file:org.kuali.student.enrollment.class2.scheduleofclasses.controller.ScheduleOfClassesSearchController.java

/**
 * Method used to// w w  w  .j av a2  s.  c o m
 * Search for course offerings based on search parameters: term and courseCode/Title&Desc/Instructor/Department
 */
@RequestMapping(params = "methodToCall=show")
public ModelAndView show(@ModelAttribute(MODEL_ATTRIBUTE_FORM) ScheduleOfClassesSearchForm theForm)
        throws Exception, DoesNotExistException, PermissionDeniedException, OperationFailedException {

    theForm.getCoDisplayWrapperList().clear();

    //First, find termName based on termCode
    String termCode = theForm.getTermCode();
    if (StringUtils.isNotBlank(termCode)) {
        String termName = ScheduleOfClassesUtil.getAcademicCalendarService()
                .getTerm(termCode, ContextUtils.createDefaultContextInfo()).getName();
        theForm.setTermName(termName);
    } else {
        LOG.error("Error: term can't be empty");
        GlobalVariables.getMessageMap().putError("termCode",
                ScheduleOfClassesConstants.SOC_MSG_ERROR_TERM_IS_EMPTY);
        return getUIFModelAndView(theForm);
    }

    // Second, handle searchType
    if (theForm.getSearchType().equals(SEARCH_TYPE_COURSE)) {
        String course = StringUtils.upperCase(theForm.getCourse());
        if (StringUtils.isNotBlank(course)) {
            ScheduleOfClassesUtil.getViewHelperService(theForm).loadCourseOfferingsByTermAndCourseCode(termCode,
                    course, theForm);
            theForm.setSearchParameter("Course: " + course);
        } else {
            LOG.error(ERROR_SEARCH_FIELD_CANNOT_BE_EMPTY);
            GlobalVariables.getMessageMap().putError(SEARCH_FIELD,
                    ScheduleOfClassesConstants.SOC_MSG_ERROR_COURSE_IS_EMPTY);
            return getUIFModelAndView(theForm);
        }
    } else if (theForm.getSearchType().equals("instructor")) {
        String instructorId = theForm.getInstructor();
        String instructorName = theForm.getInstructorName();
        if ((StringUtils.isNotBlank(instructorId)) || (StringUtils.isNotBlank(instructorName))) {
            ScheduleOfClassesUtil.getViewHelperService(theForm).loadCourseOfferingsByTermAndInstructor(termCode,
                    instructorId, instructorName, theForm);
            theForm.setSearchParameter("Instructor: " + instructorName);
        } else {
            LOG.error(ERROR_SEARCH_FIELD_CANNOT_BE_EMPTY);
            GlobalVariables.getMessageMap().putError(SEARCH_FIELD,
                    ScheduleOfClassesConstants.SOC_MSG_ERROR_COURSE_IS_EMPTY);
            return getUIFModelAndView(theForm);
        }
    } else if (theForm.getSearchType().equals("department")) {
        String departmentId = theForm.getDepartment();
        String departmentName = theForm.getDepartmentName();
        if ((StringUtils.isNotBlank(departmentId)) || (StringUtils.isNotBlank(departmentName))) {
            ScheduleOfClassesUtil.getViewHelperService(theForm).loadCourseOfferingsByTermAndDepartment(termCode,
                    departmentId, departmentName, theForm);
            theForm.setSearchParameter("Department: " + departmentName);
        } else {
            LOG.error(ERROR_SEARCH_FIELD_CANNOT_BE_EMPTY);
            GlobalVariables.getMessageMap().putError(SEARCH_FIELD,
                    ScheduleOfClassesConstants.SOC_MSG_ERROR_COURSE_IS_EMPTY);
            return getUIFModelAndView(theForm);
        }
    } else if (theForm.getSearchType().equals("titleDesc")) {
        String titleDesc = theForm.getTitleDesc();
        if (StringUtils.isNotBlank(titleDesc)) {
            ScheduleOfClassesUtil.getViewHelperService(theForm)
                    .loadCourseOfferingsByTitleAndDescription(termCode, titleDesc, theForm);
            theForm.setSearchParameter("Title & Description: " + titleDesc);
        } else {
            LOG.error(ERROR_SEARCH_FIELD_CANNOT_BE_EMPTY);
            GlobalVariables.getMessageMap().putError(SEARCH_FIELD,
                    ScheduleOfClassesConstants.SOC_MSG_ERROR_COURSE_IS_EMPTY);
            return getUIFModelAndView(theForm);
        }
    }

    return getUIFModelAndView(theForm, ScheduleOfClassesConstants.SOC_RESULT_PAGE);
}

From source file:org.kuali.student.r2.core.scheduling.util.SchedulingServiceUtil.java

public static boolean isValidDays(String days) {
    if (StringUtils.isNotBlank(days)) {
        days = StringUtils.upperCase(days);
        String validDays = "MTWHFSU";
        return StringUtils.containsOnly(days, validDays);
    }// www. j  ava 2 s .  com
    return false;
}

From source file:org.mule.module.pubsubhubbub.HubMode.java

public static HubMode parse(final String s) {
    try {/*from   w w  w .  j  av a2 s  .co m*/
        return valueOf(StringUtils.upperCase(s));
    } catch (final IllegalArgumentException iae) {
        // rethrow with a less technical message, as it is routed back to the caller
        throw new IllegalArgumentException("Unsupported hub mode: " + s, iae);
    }
}

From source file:org.mule.module.pubsubhubbub.VerificationType.java

public static VerificationType parse(final String s) {
    try {//from w  w  w .j  ava2s.co  m
        return valueOf(StringUtils.upperCase(s));
    } catch (final IllegalArgumentException iae) {
        // rethrow with a less technical message, as it is routed back to the caller
        throw new IllegalArgumentException("Unsupported verification mode: " + s, iae);
    }
}

From source file:org.mule.transport.legstar.gen.Samples.java

/**
 * @param serviceName the service name//from www  .ja  v a2  s. c o m
 * @param operationPackageName the operation classes package name
 * @return an operation corresponding to a Web Service operation.
 */
private static CixsOperation getMultiStructOperation(final String serviceName,
        final String operationPackageName) {
    CixsOperation cixsOperation = new CixsOperation();
    cixsOperation.setName(serviceName);
    cixsOperation.setCicsProgramName(StringUtils.upperCase(StringUtils.substring(serviceName, 0, 8)));
    cixsOperation.setPackageName(operationPackageName);

    CixsStructure recor1Struc = new CixsStructure();
    recor1Struc.setJaxbType("Record1");
    recor1Struc.setJaxbPackageName("org.mule.transport.legstar.test.jaxb");
    recor1Struc.setCoxbPackageName("org.mule.transport.legstar.test.coxb");
    CixsStructure record2Struc = new CixsStructure();
    record2Struc.setJaxbType("Record2");
    record2Struc.setJaxbPackageName("org.mule.transport.legstar.test.jaxb");
    record2Struc.setCoxbPackageName("org.mule.transport.legstar.test.coxb");

    cixsOperation.addInput(recor1Struc);
    cixsOperation.addInput(record2Struc);
    cixsOperation.addOutput(recor1Struc);
    cixsOperation.addOutput(record2Struc);

    return cixsOperation;
}

From source file:org.ncbo.stanford.util.helper.BeanHelper.java

/**
 * Create SubscriptionsBean object and populates from Request object.
 * /*from   w  ww.  jav a2 s.c o m*/
 * @param request
 * @return
 */
public static SubscriptionsBean populateSubscriptionsBeanFromRequest(Request request) {
    HttpServletRequest httpServletRequest = RequestUtils.getHttpServletRequest(request);

    String userId = RequestUtils.getAttributeOrRequestParam(MessageUtils.getMessage("form.user.userId"),
            request);

    String notificationType = httpServletRequest
            .getParameter(MessageUtils.getMessage("form.user.notificationType"));
    // Taking the OntologyIds in the List
    List<String> ontologyId = getOntologyIds(request);
    SubscriptionsBean subscriptionsBean = new SubscriptionsBean();
    subscriptionsBean.setUserId(RequestUtils.parseIntegerParam(userId));
    subscriptionsBean.setOntologyIds(ontologyId);
    subscriptionsBean
            .setNotificationType(NotificationTypeEnum.valueOf(StringUtils.upperCase(notificationType)));
    // subscriptionsBean.setOntologyIds(ontologyIds);

    return subscriptionsBean;
}

From source file:org.nekorp.workflow.backend.controller.imp.AutoControllerImp.java

/**
 * cambios que se aplican a los datos del auto independientemente de lo que envien los sistemas.
 * @param auto el auto a modificar.//from w w  w .ja va  2 s .  c om
 */
private void preprocesaAuto(final Auto auto) {
    //ajusta el numero de serie
    auto.setNumeroSerie(this.stringStandarizer.standarize(auto.getNumeroSerie()));
    auto.setVin(auto.getNumeroSerie());
    //pasa las placas a mayusculas
    auto.setPlacas(StringUtils.upperCase(auto.getPlacas()));
}