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.student.enrollment.class2.courseoffering.dto.CourseOfferingListSectionWrapper.java
/** * This method returns a coocated official course code for a course. This will * be displayed as the tooltip (if colocated co exists) at Manage CO screen. * * @return/*w w w .j av a2s. co m*/ */ @SuppressWarnings("unused") public String getColocatedInfoUI() { //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder StringBuilder sb = new StringBuilder(); sb.append("One or more activities in this course is colocated with activities in:<br>"); sb.append(colocatedCoCode + "<br>"); return StringUtils.removeEnd(sb.toString(), "<br>"); }
From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingWrapper.java
/** * This method returns a list of crosslisted/official course code for a course as comma seperated * string//from w w w . j a v a 2 s .co m * * @see #getAlternateCOCodesUITooltip() * @return */ @SuppressWarnings("unused") public String getAlternateCOCodesUIList() { //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder StringBuilder sb = new StringBuilder(); for (String code : alternateCOCodes) { sb.append(code + ", "); } return StringUtils.removeEnd(sb.toString(), ", "); }
From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingWrapper.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. * * @see #getAlternateCOCodesUIList()/*ww w . j a v a 2s . co m*/ * @return */ @SuppressWarnings("unused") public String getAlternateCOCodesUITooltip() { //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder StringBuilder sb = new StringBuilder(); for (String code : alternateCOCodes) { sb.append(code + "<br>"); } return StringUtils.removeEnd(sb.toString(), "<br>"); }
From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingWrapper.java
public String getOwnerAliasesUIList() { //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder StringBuilder sb = new StringBuilder(); if (ownerAliases != null) { for (String code : ownerAliases) { sb.append(code + ", "); }//from w w w . j a va 2s. c o m } return StringUtils.removeEnd(sb.toString(), ", "); }
From source file:org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingWrapper.java
/** * This method returns a list of comma seperated alternate course codes. * This is used in create and edit course offerings screen. * @return//from ww w .jav a 2 s . co m */ @SuppressWarnings("unused") public String getCrossListedCourseCodes() { StringBuilder builder = new StringBuilder(); if (course != null) { for (CourseCrossListing crossListing : course.getCrossListings()) { builder.append(crossListing.getCode() + ", "); } } return StringUtils.removeEnd(builder.toString(), ", "); }
From source file:org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingCreateMaintainableImpl.java
/** * Helper method to display a list of Activity type names at the UI * * @param formatInfo format// w w w . j a v a2s . c o m * @return activity type names */ private String getActivityTypeNames(FormatInfo formatInfo) { ContextInfo contextInfo = ContextUtils.createDefaultContextInfo(); //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder StringBuilder activities = new StringBuilder(); try { List<ActivityInfo> activityInfos = formatInfo.getActivities(); for (ActivityInfo activityInfo : activityInfos) { TypeInfo activityType = CourseOfferingManagementUtil.getTypeService() .getType(activityInfo.getTypeKey(), contextInfo); activities.append(activityType.getName() + "/"); } } catch (Exception e) { throw new RuntimeException(e); } return StringUtils.removeEnd(activities.toString(), "/"); }
From source file:org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingMaintainableImpl.java
/** * Returns the format long name short name as a string array by concatenation all the shortened activity names with / seperated * * @param foWrapper/*w w w. ja v a2 s .c om*/ * @param course * @return String[] */ public String[] getFormatShortAndLongNames(FormatOfferingWrapper foWrapper, CourseInfo course) { String[] formatNames = new String[2]; for (FormatInfo format : course.getFormats()) { if (StringUtils.equals(format.getId(), foWrapper.getFormatId())) { StringBuilder longName = new StringBuilder(); StringBuilder shortName = new StringBuilder(); for (ActivityInfo activityInfo : format.getActivities()) { TypeInfo activityType = null; try { activityType = CourseOfferingManagementUtil.getTypeService() .getType(activityInfo.getTypeKey(), ContextUtils.createDefaultContextInfo()); } catch (Exception e) { throw new RuntimeException(e); } longName.append(activityType.getName() + "/"); shortName.append(activityType.getName().toUpperCase().substring(0, 3) + "/"); } if (format.getActivities().size() == 1) { formatNames[0] = StringUtils.removeEnd(longName.toString(), "/") + " Only"; } else { formatNames[0] = StringUtils.removeEnd(longName.toString(), "/"); } formatNames[1] = StringUtils.removeEnd(shortName.toString(), "/"); return formatNames; } } formatNames[0] = StringUtils.EMPTY; formatNames[1] = StringUtils.EMPTY; return formatNames; }
From source file:org.kuali.student.enrollment.class2.scheduleofclasses.dto.ActivityOfferingDisplayWrapper.java
/** * This method return a colocated AO code for current course. This will * be displayed as the tooltip (if colocated AO exists) at manage and delete AO screen. * * @return//from w ww . jav a2 s .c om */ @SuppressWarnings("unused") public String getColocatedAoInfoUI() { return StringUtils.removeEnd("This activity is colocated with:" + BR + colocatedAoInfo, BR); }
From source file:org.lexevs.dao.database.utility.DaoUtility.java
private static String removeTrailingList(String string) { if (StringUtils.isBlank(string)) { return null; }/*from w w w. jav a 2 s.c o m*/ if (string.endsWith("List")) { string = StringUtils.removeEnd(string, "List"); } return string; }
From source file:org.opentox.jaqpot3.qsar.util.WekaInstancesProcess.java
public static String getCSVOutput(Model model, AuthenticationToken token, Instances inst, VRI datasetURI, String VRIprefix, String ownerName) { String res, name;//w w w . j av a 2 s . com Map<String, String> UUIDMap; int noAttributes = inst.numAttributes(); int noInstances = inst.numInstances(); // make a list for predicted features List<String> predictedFeaturesUris = new ArrayList<String>(); List<Feature> predictedFeatureList = model.getPredictedFeatures(); for (Feature temp : predictedFeatureList) { predictedFeaturesUris.add(temp.getUri().getUri()); } //get the json object of the dataset to retrieve info for the properties VRI input = new VRI(datasetURI); DatasetJsonDownloader jsn = new DatasetJsonDownloader(input); JSONObject obj = jsn.getJSON(token); //create the header of the csv res = getCSVHeader(inst, jsn, obj, predictedFeaturesUris); //get a map for binding the substance uris to their names UUIDMap = jsn.bindUUIDsToNames(obj, VRIprefix); //get the names of the substances and their values in the properties for (int i = 0; i < noInstances; ++i) { if (StringUtils.isNotEmpty(UUIDMap.get(inst.attribute(0).value(i)))) { name = ownerName + UUIDMap.get(inst.attribute(0).value(i)); res += name; for (int k = 1; k < noAttributes; ++k) { res += "," + inst.instance(i).value(k); } res += "\n"; } } //if not trimmed then new empty substance will be created res = StringUtils.removeEnd(res, "\n"); return res; }