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.kfs.module.tem.service.impl.TemProfileServiceImpl.java

/**
 * @see org.kuali.kfs.module.tem.service.TemProfileService#createTemProfileAddressFromPerson(org.kuali.rice.kim.bo.Person, java.lang.Integer, org.kuali.kfs.module.tem.businessobject.TemProfileAddress)
 *///from   w  ww .j av a2  s  .  c o  m
@Override
public TemProfileAddress createTemProfileAddressFromPerson(Person person, Integer profileId,
        TemProfileAddress defaultAddress) {
    defaultAddress.setProfileId(profileId);
    defaultAddress.setStreetAddressLine1(StringUtils.upperCase(person.getAddressLine1()));
    defaultAddress.setStreetAddressLine2(StringUtils.upperCase(person.getAddressLine2()));
    defaultAddress.setCityName(StringUtils.upperCase(person.getAddressCity()));
    defaultAddress.setStateCode(StringUtils.upperCase(person.getAddressStateProvinceCode()));
    defaultAddress.setZipCode(person.getAddressPostalCode());
    defaultAddress.setCountryCode(StringUtils.upperCase(person.getAddressCountryCode()));
    return defaultAddress;
}

From source file:org.kuali.kfs.module.tem.service.impl.TravelerServiceImpl.java

/**
 * @see org.kuali.kfs.module.tem.service.TravelerService#copyKimDataToTemProfile(org.kuali.kfs.module.tem.businessobject.TemProfile, org.kuali.rice.kim.bo.Person, org.kuali.rice.kim.bo.entity.dto.KimEntityInfo)
 *///from   ww  w .j av  a 2  s .  c o m
@Override
public void copyKimDataToTemProfile(TemProfile profile, Person principal, Entity kimEntity) {
    // copy principal data
    if (ObjectUtils.isNotNull(kimEntity)) {
        profile.setFirstName(principal.getFirstName().toUpperCase());
        profile.setMiddleName(principal.getMiddleName().toUpperCase());
        profile.setLastName(principal.getLastName().toUpperCase());
    }

    TemProfileAddress profileAddress = new TemProfileAddress();

    if (ObjectUtils.isNotNull(profile.getTemProfileAddress())) {
        profileAddress = profile.getTemProfileAddress();
    }

    profileAddress.setProfileId(profile.getProfileId());

    profileAddress.setStreetAddressLine1(StringUtils.upperCase(principal.getAddressLine1Unmasked()));
    profileAddress.setStreetAddressLine2(StringUtils.upperCase(principal.getAddressLine2Unmasked()));
    profileAddress.setCityName(StringUtils.upperCase(principal.getAddressCity()));
    profileAddress.setStateCode(StringUtils.upperCase(principal.getAddressStateProvinceCodeUnmasked()));
    profileAddress.setZipCode(principal.getAddressPostalCodeUnmasked());
    profileAddress.setCountryCode(StringUtils.upperCase(principal.getAddressCountryCodeUnmasked()));

    profile.setTemProfileAddress(profileAddress);
    profile.setEmailAddress(StringUtils.upperCase(principal.getEmailAddressUnmasked()));
    profile.setPhoneNumber(principal.getPhoneNumberUnmasked());

    String primaryDeptCode[] = principal.getPrimaryDepartmentCode().split("-");
    if (primaryDeptCode != null && primaryDeptCode.length == 2) {
        profile.setHomeDeptChartOfAccountsCode(primaryDeptCode[0]);
        profile.setHomeDeptOrgCode(primaryDeptCode[1]);
    }

    profile.refreshReferenceObject("homeDeptOrg");
    profile.setEmployeeId(principal.getEmployeeId());

    // Copy kim info to profile
    if (ObjectUtils.isNotNull(kimEntity)) {
        if (ObjectUtils.isNotNull(kimEntity.getBioDemographics())) {

            String birthDate = kimEntity.getBioDemographics().getBirthDate();
            java.util.Date parsedBirthDate = new java.util.Date();
            try {
                parsedBirthDate = new SimpleDateFormat(EntityBioDemographics.BIRTH_DATE_FORMAT)
                        .parse(birthDate);
            } catch (ParseException pe) {
                LOG.error("Error parsing EntityBioDemographics birth date: '" + birthDate + "'", pe);
            }
            Date dateOfBirth = new Date(parsedBirthDate.getTime());
            profile.setDateOfBirth(dateOfBirth);
            profile.setGender(kimEntity.getBioDemographics().getGenderCode());

        }
        List<EntityCitizenship> citizenships = kimEntity.getCitizenships();
        if (ObjectUtils.isNotNull(citizenships) && citizenships.size() > 0) {
            profile.setCitizenship(citizenships.get(0).getCountryCode());
        }
    }

}

From source file:org.kuali.kpme.tklm.time.docsearch.WorkAreaSearchableAttribute.java

@Override
public List extractDocumentAttributes(ExtensionDefinition extensionDefinition,
        DocumentWithContent documentWithContent) {
    List<SearchableAttributeValue> searchableAttributeValues = new ArrayList<SearchableAttributeValue>();

    String documentId = StringUtils.substringBetween(documentWithContent.getDocumentContent().toString(),
            "<string>", "</string>");
    TimesheetDocument timesheetDocument = TkServiceLocator.getTimesheetService()
            .getTimesheetDocument(documentId);
    List<Long> workAreasIncluded = new ArrayList<Long>();
    for (Assignment assign : timesheetDocument.getAllAssignments()) {
        if (!workAreasIncluded.contains(assign.getWorkArea())) {
            SearchableAttributeValue attValue = new SearchableAttributeLongValue();
            attValue.setSearchableAttributeKey(WORK_AREA);
            attValue.setupAttributeValue(StringUtils.upperCase(assign.getWorkArea().toString()));
            searchableAttributeValues.add(attValue);
            workAreasIncluded.add(assign.getWorkArea());
        }/*from   www . ja v  a2  s  . co m*/
    }
    return searchableAttributeValues;
}

From source file:org.kuali.student.enrollment.class1.krms.service.impl.FERuleViewHelperServiceImpl.java

public List<BuildingInfo> retrieveBuildingInfo(String buildingCode, boolean strictMatch) throws Exception {

    QueryByCriteria.Builder qbcBuilder = QueryByCriteria.Builder.create();
    if (!strictMatch) {
        buildingCode = StringUtils.upperCase(buildingCode) + "%";
    }//  ww w  . j  a  va 2  s .c  om
    qbcBuilder.setPredicates(PredicateFactory.like("buildingCode", buildingCode));

    QueryByCriteria criteria = qbcBuilder.build();

    List<BuildingInfo> b = getRoomService().searchForBuildings(criteria, createContextInfo());
    return b;
}

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

public void setCourseOfferingCode(String courseOfferingCode) {
    this.courseOfferingCode = StringUtils.upperCase(courseOfferingCode);
}

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

public void setActivityOfferingCode(String activityOfferingCode) {
    this.activityOfferingCode = StringUtils.upperCase(activityOfferingCode);
}

From source file:org.kuali.student.enrollment.class2.courseoffering.helper.impl.ActivityOfferingScheduleHelperImpl.java

protected boolean validateNewScheduleRequest(ScheduleWrapper scheduleWrapper) {

    // validate the weekdays
    if (StringUtils.isNotEmpty(scheduleWrapper.getDays())) {
        String scheduleDays = StringUtils.upperCase(scheduleWrapper.getDays());
        List<Integer> parsedWeekdays = SchedulingServiceUtil.weekdaysString2WeekdaysList(scheduleDays);
        if (parsedWeekdays.isEmpty() || scheduleDays.trim().length() > parsedWeekdays.size()) {
            addErrorMessage(ScheduleInput.WEEKDAYS, "Day characters are invalid, duplicates not allowed.");
        }//w  ww.j a v a 2 s .  c  o  m
    }

    // if a room or a building were entered, ensure the building and room code are valid
    try {

        ContextInfo contextInfo = createContextInfo();
        int firstInfo = 0;

        // if a building code exists, validate the building code and populate the building info
        if (StringUtils.isNotBlank(scheduleWrapper.getBuildingCode())) {
            List<BuildingInfo> buildings = retrieveBuildingInfoByCode(scheduleWrapper.getBuildingCode(), true);
            if (buildings.isEmpty()) {
                addErrorMessage(ScheduleInput.BUILDING, "Facility code was invalid.");
            } else {
                scheduleWrapper.setBuilding(buildings.get(firstInfo));
            }

            // if a building code exists and a room code exists, validate the room code and populate the room info
            if (!buildings.isEmpty() && StringUtils.isNotEmpty(scheduleWrapper.getRoomCode())) {
                List<RoomInfo> rooms = CourseOfferingManagementUtil.getRoomService()
                        .getRoomsByBuildingAndRoomCode(scheduleWrapper.getBuildingCode(),
                                scheduleWrapper.getRoomCode(), contextInfo);
                if (rooms.isEmpty()) {
                    addErrorMessage(ScheduleInput.ROOM, "Room code was invalid.");
                } else {
                    RoomInfo room = rooms.get(firstInfo);
                    if (room.getRoomUsages() != null && !room.getRoomUsages().isEmpty()) {
                        scheduleWrapper.setRoomCapacity(room.getRoomUsages().get(0).getHardCapacity());
                    }
                    scheduleWrapper.setRoom(room);
                }
            }
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    return !GlobalVariables.getMessageMap().hasErrors();
}

From source file:org.kuali.student.enrollment.class2.courseoffering.helper.impl.ActivityOfferingScheduleHelperImpl.java

/**
 * Searches for buildings given a building code.
 * @param buildingCode A building code.// ww w  . ja  v  a2  s .  c  o m
 * @param strictMatch If false do a wildcard search matching at the beginning of the field. Otherwise, match exactly.
 * @return A List of BuildingInfos
 * @throws Exception
 */
public List<BuildingInfo> retrieveBuildingInfoByCode(String buildingCode, boolean strictMatch)
        throws Exception {
    QueryByCriteria.Builder qbcBuilder = QueryByCriteria.Builder.create();

    if (!strictMatch) {
        buildingCode = StringUtils.upperCase(buildingCode) + "%";
    }
    qbcBuilder.setPredicates(PredicateFactory.like("buildingCode", buildingCode));

    QueryByCriteria criteria = qbcBuilder.build();

    List<BuildingInfo> b = CourseOfferingManagementUtil.getRoomService().searchForBuildings(criteria,
            createContextInfo());
    return b;
}

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

@Override
public List<?> performSearch(LookupForm lookupForm, Map<String, String> searchCriteria, boolean bounded) {
    boolean isValidCriteria = validateSearchParameters(lookupForm, searchCriteria);
    if (!isValidCriteria) {
        return new ArrayList<Object>();
    }//from   w ww  .  j  a v  a2 s  . com

    List<ActivityOfferingWrapper> activityOfferingWrappers = new ArrayList<ActivityOfferingWrapper>();

    String termId = searchCriteria.get("termId");
    String courseOfferingCode = searchCriteria.get("courseOfferingCode");

    /**
     * Edit AO maintenace document uses this AO search to allow user to add colocated AOs.
     */
    if (StringUtils.isNotBlank(termId) && StringUtils.isNotBlank(courseOfferingCode)) {

        SearchRequestInfo searchRequest = new SearchRequestInfo(
                CourseOfferingManagementSearchImpl.CO_MANAGEMENT_SEARCH.getKey());
        searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.COURSE_CODE,
                StringUtils.upperCase(courseOfferingCode));
        searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.ATP_ID, termId);
        searchRequest.addParam(
                CourseOfferingManagementSearchImpl.SearchParameters.IS_EXACT_MATCH_CO_CODE_SEARCH,
                BooleanUtils.toStringTrueFalse(true));

        try {
            String coId = "";
            SearchResultInfo searchResult = CourseOfferingManagementUtil.getSearchService()
                    .search(searchRequest, ContextUtils.createDefaultContextInfo());

            if (searchResult.getRows().isEmpty()) {
                GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,
                        RiceKeyConstants.ERROR_CUSTOM, "Invalid CourseOfferingCode " + courseOfferingCode);
            } else if (searchResult.getRows().size() > 1) {
                GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,
                        RiceKeyConstants.ERROR_CUSTOM,
                        "Multiple CourseOfferings entries found for " + courseOfferingCode);
            } else {
                for (SearchResultCellInfo cellInfo : searchResult.getRows().get(0).getCells()) {

                    if (CourseOfferingManagementSearchImpl.SearchResultColumns.CO_ID
                            .equals(cellInfo.getKey())) {
                        coId = cellInfo.getValue();
                        break;
                    }

                }
            }

            if (StringUtils.isNotBlank(coId)) {
                List<ActivityOfferingInfo> aos = CourseOfferingManagementUtil.getCourseOfferingService()
                        .getActivityOfferingsByCourseOffering(coId, ContextUtils.createDefaultContextInfo());
                for (ActivityOfferingInfo activityOffering : aos) {
                    CO_AO_RG_ViewHelperServiceImpl helper = new CO_AO_RG_ViewHelperServiceImpl();
                    ActivityOfferingWrapper wrapper = helper.convertAOInfoToWrapper(activityOffering);
                    wrapper.setCourseOfferingId(coId);
                    activityOfferingWrappers.add(wrapper);
                }
            }

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

    }

    return activityOfferingWrappers;
}

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

/**
 *
 * This method creates the CourseOffering for a course and for a specific term. This is being called
 * for the regular CO as well as for the Joint offerings
 *
 * @param termId courseing offering created for this term
 * @param courseInfo this is the course info for which this mehtod is going to create course offering
 * @param courseOfferingSuffix the suffix entered by the user
 * @return created course offering//  w ww . j  av  a 2  s  .co  m
 * @throws Exception throws any of the services exception from the service call
 */
protected CourseOfferingInfo createCourseOfferingInfo(String termId, CourseInfo courseInfo,
        String courseOfferingSuffix, CourseOfferingInfo courseOffering) throws Exception {

    ContextInfo context = createContextInfo();
    List<String> optionKeys = CourseOfferingManagementUtil.getDefaultOptionKeysService()
            .getDefaultOptionKeysForCreateCourseOfferingFromCanonical();

    courseOffering.setTermId(termId);
    courseOffering.setCourseOfferingTitle(courseInfo.getCourseTitle());
    //                  courseOffering.setCreditOptionId();

    // if the course offering wrapper suffix is set, set the value in the CourseOfferingInfo
    if (!StringUtils.isEmpty(courseOfferingSuffix)) {
        courseOffering.setCourseOfferingCode(StringUtils.upperCase(courseOfferingSuffix));
        courseOffering.setCourseNumberSuffix(StringUtils.upperCase(courseOfferingSuffix));
        optionKeys.add(CourseOfferingServiceConstants.APPEND_COURSE_OFFERING_CODE_SUFFIX_OPTION_KEY);
    }
    courseOffering.setCourseId(courseInfo.getId());
    courseOffering.setCourseCode(courseInfo.getCode());
    courseOffering.setTypeKey(LuiServiceConstants.COURSE_OFFERING_TYPE_KEY);
    courseOffering.setStateKey(LuiServiceConstants.LUI_CO_STATE_DRAFT_KEY);

    //Copy grading and credit options
    if (!courseInfo.getCreditOptions().isEmpty()) {
        courseOffering.setCreditOptionId(courseInfo.getCreditOptions().get(0).getKey());
    }
    //Remove these two special student registration options and set them on the CO
    List<String> courseGradingOptions = new ArrayList<String>(courseInfo.getGradingOptions());
    if (courseGradingOptions.remove(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL)) {
        courseOffering.getStudentRegistrationGradingOptions()
                .add(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL);
    }
    if (courseGradingOptions.remove(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT)) {
        courseOffering.getStudentRegistrationGradingOptions()
                .add(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT);
    }
    //set the first remaining grading option on the CO
    if (!courseGradingOptions.isEmpty()) {
        int firstGradingOption = 0;
        courseOffering.setGradingOptionId(courseGradingOptions.get(firstGradingOption));
    }

    // make sure we set attribute information from the course
    if (!courseInfo.getAttributes().isEmpty()) {
        for (AttributeInfo info : courseInfo.getAttributes()) {
            // Default the CourseOffering Final Exam Type to the Final Exam type in the Course
            if (info.getKey().equals("finalExamStatus")) {
                courseOffering.setFinalExamType(
                        convertCourseFinalExamTypeToCourseOfferingFinalExamType(info.getValue()));
            }
        }
    }

    CourseOfferingInfo info = CourseOfferingManagementUtil.getCourseOfferingService().createCourseOffering(
            courseInfo.getId(), termId, LuiServiceConstants.COURSE_OFFERING_TYPE_KEY, courseOffering,
            optionKeys, context);
    String[] parameters = { info.getCourseOfferingCode() + info.getCourseNumberSuffix() };
    KSUifUtils.getMessengerFromUserSession()
            .addSuccessMessage(CourseOfferingConstants.COURSE_OFFERING_CREATE_SUCCESS, parameters);

    ExamOfferingResult result = CourseOfferingManagementUtil.getExamOfferingServiceFacade()
            .generateFinalExamOffering(ExamOfferingManagementUtil.createExamOfferingContext(info),
                    new ArrayList<String>(), context);
    ExamOfferingManagementUtil.processExamOfferingResultSet(result);

    return info;
}