List of usage examples for org.apache.commons.lang BooleanUtils toStringTrueFalse
public static String toStringTrueFalse(boolean bool)
Converts a boolean to a String returning 'true'
or 'false'
.
BooleanUtils.toStringTrueFalse(true) = "true" BooleanUtils.toStringTrueFalse(false) = "false"
From source file:org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingManagementViewHelperServiceImpl.java
/** * This method loads all the course offerings for a term and subject area/code. * * @param termId term id//from ww w . ja v a 2s. c o m * @param subjectCode subject area * @param form course offering management form * @throws Exception */ public void loadCourseOfferingsByTermAndSubjectCode(String termId, String subjectCode, CourseOfferingDisplayUI form) throws Exception { SearchRequestInfo searchRequest = new SearchRequestInfo( CourseOfferingManagementSearchImpl.CO_MANAGEMENT_SEARCH.getKey()); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.SUBJECT_AREA, subjectCode); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.ATP_ID, termId); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.CROSS_LIST_SEARCH_ENABLED, BooleanUtils.toStringTrueFalse(true)); loadCourseOfferings(searchRequest, form); /* if (form.getCourseOfferingResultList().isEmpty()) { LOG.error("Error: Can't find any Course Offering for a Subject Code: " + subjectCode + " in term: " + termId); GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, CourseOfferingConstants.COURSEOFFERING_MSG_ERROR_NO_COURSE_OFFERING_IS_FOUND, "Subject Code", subjectCode, termId); }*/ }
From source file:org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingManagementViewHelperServiceImpl.java
/** * This method loads the previous and next course offerings for navigation purpose. * * @param form input form//from w ww . jav a 2 s . co m */ public void loadPreviousAndNextCourseOffering(CourseOfferingManagementForm form) { try { ContextInfo contextInfo = createContextInfo(); /** * Get all the course offerings for a term and subject area. */ SearchRequestInfo searchRequest = new SearchRequestInfo( CourseOfferingManagementSearchImpl.CO_MANAGEMENT_SEARCH.getKey()); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.SUBJECT_AREA, form.getSubjectCode()); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.ATP_ID, form.getTermInfo().getId()); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.CROSS_LIST_SEARCH_ENABLED, BooleanUtils.toStringTrueFalse(true)); SearchResultInfo searchResult = CourseOfferingManagementUtil.getSearchService().search(searchRequest, contextInfo); List<CourseOfferingWrapper> availableCOs = new ArrayList<CourseOfferingWrapper>(); for (SearchResultRowInfo row : searchResult.getRows()) { String courseOfferingCode = ""; String courseOfferingId = ""; String courseOfferingDesc = ""; boolean isCrossListed = false; List<String> alternateCodes = null; String ownerCode = ""; for (SearchResultCellInfo cellInfo : row.getCells()) { String value = StringUtils.EMPTY; if (cellInfo.getValue() != null) { value = cellInfo.getValue(); } if (CourseOfferingManagementSearchImpl.SearchResultColumns.CODE.equals(cellInfo.getKey())) { courseOfferingCode = value; } else if (CourseOfferingManagementSearchImpl.SearchResultColumns.CO_ID .equals(cellInfo.getKey())) { courseOfferingId = value; } else if (CourseOfferingManagementSearchImpl.SearchResultColumns.DESC .equals(cellInfo.getKey())) { courseOfferingDesc = value; } else if (CourseOfferingManagementSearchImpl.SearchResultColumns.IS_CROSS_LISTED .equals(cellInfo.getKey())) { isCrossListed = BooleanUtils.toBoolean(value); } else if (CourseOfferingManagementSearchImpl.SearchResultColumns.CROSS_LISTED_COURSES .equals(cellInfo.getKey())) { alternateCodes = Arrays.asList(StringUtils.split(value, ",")); } else if (CourseOfferingManagementSearchImpl.SearchResultColumns.OWNER_CODE .equals(cellInfo.getKey())) { ownerCode = value; } } CourseOfferingWrapper coWrapper = new CourseOfferingWrapper(isCrossListed, courseOfferingCode, courseOfferingDesc, alternateCodes, courseOfferingId); coWrapper.setOwnerCode(ownerCode); availableCOs.add(coWrapper); } /** * Find the current course offering index and set the previous and next course offerings if exists. */ for (CourseOfferingWrapper coWrapper : availableCOs) { if (StringUtils.equals(coWrapper.getCourseOfferingCode(), form.getCurrentCourseOfferingWrapper().getCourseOfferingCode())) { int currentIndex = availableCOs.indexOf(coWrapper); form.setInputCode(coWrapper.getCourseOfferingCode()); if (currentIndex > 0) { form.setPreviousCourseOfferingWrapper(availableCOs.get(currentIndex - 1)); } else { form.setPreviousCourseOfferingWrapper(null); } if (currentIndex < availableCOs.size() - 1) { form.setNextCourseOfferingWrapper(availableCOs.get(currentIndex + 1)); } else { form.setNextCourseOfferingWrapper(null); } break; } } } catch (Exception e) { throw new RuntimeException(e); } }
From source file:org.kuali.student.enrollment.class2.scheduleofclasses.service.impl.ScheduleOfClassesViewHelperServiceImpl.java
/** * Loads all the Course offerings from a term which matches the additional search parameters. * * @param form//from w ww . ja v a 2s. c o m * @param termId * @param searchParameters * @throws Exception */ protected void buildCOResultsDisplay(ScheduleOfClassesSearchForm form, String termId, Map<String, Object> searchParameters) throws Exception { form.getCoDisplayWrapperList().clear(); SearchRequestInfo searchRequest = new SearchRequestInfo( CourseOfferingManagementSearchImpl.CO_MANAGEMENT_SEARCH.getKey()); for (Map.Entry<String, Object> entry : searchParameters.entrySet()) { if (entry.getValue() instanceof String) { searchRequest.addParam(entry.getKey(), (String) entry.getValue()); } else if (entry.getValue() instanceof List) { searchRequest.addParam(entry.getKey(), (List) entry.getValue()); } else { throw new RuntimeException("Invalid Search Parameter type. Only String and List are allowed."); } } List<String> filterCOStates = new ArrayList<String>(1); filterCOStates.add(LuiServiceConstants.LUI_CO_STATE_OFFERED_KEY); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.FILTER_CO_STATES, filterCOStates); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.ATP_ID, termId); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.CROSS_LIST_SEARCH_ENABLED, BooleanUtils.toStringTrueFalse(true)); searchRequest.addParam(CourseOfferingManagementSearchImpl.SearchParameters.IS_EXACT_MATCH_CO_CODE_SEARCH, BooleanUtils.toStringTrueFalse(false)); searchRequest.addParam( CourseOfferingManagementSearchImpl.SearchParameters.INCLUDE_PASSFAIL_AUDIT_HONORS_RESULTS, BooleanUtils.toStringTrueFalse(true)); loadCourseOfferings(searchRequest, form); if (form.getCoDisplayWrapperList() == null || form.getCoDisplayWrapperList().isEmpty()) { LOG.error("Error: Can't find any Course Offering for the selected search"); GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_MESSAGES, RiceKeyConstants.ERROR_CUSTOM, "Can't find any Course Offering for the selected search"); return; } for (CourseOfferingDisplayWrapper coDisplayWrapper : form.getCoDisplayWrapperList()) { // Adding Information (icons) StringBuilder information = new StringBuilder(); if (coDisplayWrapper.isHonorsCourse()) { information.append( makeInfoIconWithTooltip(ScheduleOfClassesConstants.SOC_RESULT_PAGE_HONORS_COURSE_IMG, ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_HONORS_COURSE)); } if (StringUtils.equals(coDisplayWrapper.getCourseOfferingGradingOptionKey(), LrcServiceConstants.RESULT_GROUP_KEY_GRADE_SATISFACTORY)) { information.append( makeInfoIconWithTooltip(ScheduleOfClassesConstants.SOC_RESULT_PAGE_GRADING_SATISFACTORY_IMG, ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_GRADING_SATISFACTORY)); } else if (StringUtils.equals(coDisplayWrapper.getCourseOfferingGradingOptionKey(), LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PERCENTAGE)) { information.append( makeInfoIconWithTooltip(ScheduleOfClassesConstants.SOC_RESULT_PAGE_GRADING_PERCENT_IMG, ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_GRADING_PERCENT)); } if (coDisplayWrapper.isAuditCourse()) { information .append(makeInfoIconWithTooltip(ScheduleOfClassesConstants.SOC_RESULT_PAGE_STUREG_AUDIT_IMG, ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_STUREG_AUDIT)); } if (coDisplayWrapper.isStudentSelectablePassFail()) { information.append( makeInfoIconWithTooltip(ScheduleOfClassesConstants.SOC_RESULT_PAGE_STUREG_PASSFAIL_IMG, ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_STUREG_PASSFAIL)); } coDisplayWrapper.setInformation(information.toString()); } }
From source file:org.obiba.onyx.quartz.editor.variable.VariablePreview.java
public VariablePreview(String id, final IModel<Variable> model) { super(id, model); Variable variable = model.getObject(); add(new Label("name", variable.getName())); add(new Label("type", WordUtils.capitalize(variable.getValueType().getName()))); add(new Label("repeatable", WordUtils.capitalize(BooleanUtils.toStringTrueFalse(variable.isRepeatable())))); Label script = new Label("script", variable.getAttributeStringValue("script")); script.add(new SyntaxHighlighterBehavior()); add(script);/* www .j a va 2 s . c om*/ }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendPersonElements(List<Person> persons, Element rootElement) { for (int i = 0; i < persons.size(); i++) { Person person = persons.get(i);/* w ww. jav a 2 s . c om*/ Element personElement = XmlUtils.appendElement(rootElement, NS_NC_30, "Person"); String personId = "Person_" + StringUtils.leftPad(String.valueOf(i + 1), 2, '0'); XmlUtils.addAttribute(personElement, NS_STRUCTURES_30, "id", personId); appendTextElement(personElement, NS_NC_30, "PersonAgeDescriptionText", person.getPersonAge()); appendPersonBirthLocation(person, personElement); appendTextElement(personElement, NS_NC_30, "PersonCitizenshipText", person.getPersonCitizenshipCountry()); appendTextElement(personElement, NS_NC_30, "PersonEthnicityText", person.getPersonEthnicityDescription()); appendTextElement(personElement, NS_NC_30, "PersonEyeColorText", person.getPersonEyeColorDescription()); appendTextElement(personElement, NS_NC_30, "PersonHairColorText", person.getPersonHairColorDescription()); appendPersonHeightMeasure(person, personElement); appendPersonName(person, personElement); appendPersonPhysicalFeature(person, personElement); appendTextElement(personElement, NS_NC_30, "PersonRaceText", person.getPersonRaceDescription()); appendTextElement(personElement, NS_NC_30, "PersonSexText", person.getPersonSexDescription()); appendTextElement(personElement, NS_NC_30, "PersonSkinToneText", person.getPersonSkinToneDescription()); appendIdentificationWrapper(personElement, NS_NC_30, "PersonSSNIdentification", person.getSocialSecurityNumberBase()); appendIdentificationWrapper(personElement, NS_NC_30, "PersonStateIdentification", person.getPersonStateIdentification()); appendTextElement(personElement, NS_NC_30, "PersonUSCitizenIndicator", BooleanUtils.toStringTrueFalse(person.getUsCitizenshipIndicator())); appendPersonWeightMeasure(person, personElement); appendPersonAugmentation(person, personElement); appendTextElement(personElement, NS_WARRANT_MOD_REQ_EXT, "PersonCautionCodeText", person.getPersonCautionDescription()); appendIdentificationWrapper(personElement, NS_WARRANT_MOD_REQ_EXT, "PersonMiscellaneousRecordIdentification", person.getMiscellaneousIDBase()); appendTextElement(personElement, NS_WARRANT_MOD_REQ_EXT, "PersonImmigrationAlienQueryIndicator", BooleanUtils.toStringTrueFalse(person.getPersonImmigrationAlienQueryIndicator())); } }
From source file:org.ojbc.intermediaries.sn.dao.SubscriptionSearchQueryDAO.java
public int unsubscribe(String subscriptionSystemId, String topic, Map<String, String> subjectIds, String systemName, String subscriptionOwner) { int returnCount; String fullyQualifiedTopic = NotificationBrokerUtils.getFullyQualifiedTopic(topic); // If we have the subscriptionSystemId (the id PK key in the database, use that to unsubscribe). This typically comes from a subscription search if (StringUtils.isNotBlank(subscriptionSystemId)) { log.debug("unsubscribing manual subscription, subscritpion system ID: " + subscriptionSystemId); Object[] criteriaArray = new Object[] { fullyQualifiedTopic, subscriptionSystemId }; String queryString = "update subscription s set s.active=0 where s.topic=? and s.id=?"; returnCount = this.jdbcTemplate.update(queryString, criteriaArray); log.debug("fbiSubscriptionMember? " + BooleanUtils.toStringTrueFalse(fbiSubscriptionMember)); if (fbiSubscriptionMember) { unsubscribeIdentificationTransaction(Integer.valueOf(subscriptionSystemId)); }/* w ww . j ava2s . c o m*/ return returnCount; } // If we don't have the subscriptionSystemID, attempt to unsubscribe using the info available in the message. This typically comes from automated subscriptions. else { log.debug("unsubscribing auto subscription, not subscritpion system ID"); Object[] criteriaArray = new Object[] { fullyQualifiedTopic, systemName, subscriptionOwner }; criteriaArray = ArrayUtils.addAll(criteriaArray, SubscriptionSearchQueryDAO.buildCriteriaArray(subjectIds)); String queryString = "update subscription s set s.active=0 where s.topic=? and s.subscribingSystemIdentifier=? and s.subscriptionOwner = ? and" + SubscriptionSearchQueryDAO.buildCriteriaSql(subjectIds.size()); log.debug("Query String: " + queryString); log.debug("Topic: " + fullyQualifiedTopic + " System Name: " + systemName + " subscription owner: " + subscriptionOwner); returnCount = this.jdbcTemplate.update(queryString, criteriaArray); } return returnCount; }
From source file:org.sipfoundry.openfire.config.AccountsParser.java
private static void parseMongoUsers(XmppAccountInfo accountInfo) { ValidUsers validUsers = UnfortunateLackOfSpringSupportFactory.getValidUsers(); List<User> users = validUsers.getUsersWithImEnabled(); XmppUserAccount account = null;//from w w w . j av a 2s .co m for (User user : users) { account = new XmppUserAccount(); account.setPassword(user.getPintoken()); account.setUserName(user.getJid()); account.setSipUserName(user.getUserName()); account.setEmail(StringUtils.defaultIfEmpty(user.getEmailAddress(), StringUtils.EMPTY)); account.setDisplayName(StringUtils.defaultIfEmpty(user.getImDisplayName(), StringUtils.EMPTY)); account.setAdvertiseOnCallPreference(BooleanUtils.toStringTrueFalse(user.isAdvertiseOnCallStatus())); account.setOnThePhoneMessage( StringUtils.defaultIfEmpty(user.getOnthePhoneMessage(), StringUtils.EMPTY)); accountInfo.addAccount(account); } User imbotUser = validUsers.getImbotUser(); account = new XmppUserAccount(); account.setPassword(imbotUser.getPintoken()); account.setUserName(imbotUser.getUserName()); accountInfo.addAccount(account); }
From source file:org.springbyexample.enterprise.solr.CatalogItemMarshaller.java
/** * Implementation of <code>Marshaller</code>. *///from w ww .j av a2 s .c o m @SuppressWarnings("unchecked") public void marshal(Object bean, Result result) throws XmlMappingException, IOException { List<CatalogItem> lCatalogItems = (List<CatalogItem>) bean; OutputStream out = null; XMLWriter writer = null; if (result instanceof StreamResult) { try { out = ((StreamResult) result).getOutputStream(); Document document = DocumentHelper.createDocument(); Element root = document.addElement(ADD_ELEMENT_NAME); for (CatalogItem item : lCatalogItems) { Element doc = root.addElement(DOC_ELEMENT_NAME); doc.addElement(FIELD_ELEMENT_NAME).addAttribute(FIELD_ELEMENT_NAME_ATTRIBUTE, "id") .addText(item.getId()); doc.addElement(FIELD_ELEMENT_NAME).addAttribute(FIELD_ELEMENT_NAME_ATTRIBUTE, "manu") .addText(item.getManufacturer()); doc.addElement(FIELD_ELEMENT_NAME) .addAttribute(FIELD_ELEMENT_NAME_ATTRIBUTE, FIELD_ELEMENT_NAME_ATTRIBUTE) .addText(item.getName()); doc.addElement(FIELD_ELEMENT_NAME).addAttribute(FIELD_ELEMENT_NAME_ATTRIBUTE, "price") .addText(new Float(item.getPrice()).toString()); doc.addElement(FIELD_ELEMENT_NAME).addAttribute(FIELD_ELEMENT_NAME_ATTRIBUTE, "inStock") .addText(BooleanUtils.toStringTrueFalse(item.isInStock())); doc.addElement(FIELD_ELEMENT_NAME).addAttribute(FIELD_ELEMENT_NAME_ATTRIBUTE, "popularity") .addText(new Integer(item.getPopularity()).toString()); } writer = new XMLWriter(out); writer.write(document); } finally { try { writer.close(); } catch (Exception e) { } IOUtils.closeQuietly(out); } } logger.debug("Marshalled bean of size {}.", lCatalogItems.size()); }