List of usage examples for org.apache.commons.lang BooleanUtils isTrue
public static boolean isTrue(Boolean bool)
Checks if a Boolean
value is true
, handling null
by returning false
.
BooleanUtils.isTrue(Boolean.TRUE) = true BooleanUtils.isTrue(Boolean.FALSE) = false BooleanUtils.isTrue(null) = false
From source file:org.kuali.rice.krad.lookup.LookupableImpl.java
/** * Indicator if wildcards and operators are disabled on this search criteria. * * @param lookupCriteria the viewPostMetadata with the attributes of the search criteria field * @return true if wildcards and operators are disabled, false otherwise *///from w w w .j ava 2 s.c om protected boolean isCriteriaWildcardDisabled(Map lookupCriteria) { return BooleanUtils.isTrue((Boolean) lookupCriteria .get(UifConstants.LookupCriteriaPostMetadata.DISABLE_WILDCARDS_AND_OPERATORS)); }
From source file:org.kuali.rice.krad.lookup.LookupableImpl.java
/** * Indicator if the search criteria is required. * * @param lookupCriteria the viewPostMetadata with the attributes of the search criteria field * @return true if the search criteria is required, false otherwise *///from www .j a v a2 s . c o m protected boolean isCriteriaRequired(Map lookupCriteria) { return BooleanUtils.isTrue((Boolean) lookupCriteria.get(UifConstants.LookupCriteriaPostMetadata.REQUIRED)); }
From source file:org.kuali.rice.krad.lookup.LookupableImpl.java
/** * Indicator if the search criteria is on a secure field. * * @param lookupCriteria the viewPostMetadata with the attributes of the search criteria field * @return true if the search criteria is a secure field, false otherwise *//*w w w . j av a 2s. com*/ protected boolean isCriteriaSecure(Map lookupCriteria) { return BooleanUtils .isTrue((Boolean) lookupCriteria.get(UifConstants.LookupCriteriaPostMetadata.SECURE_VALUE)); }
From source file:org.lexgrid.valuesets.impl.LexEVSPickListDefinitionServicesImpl.java
private ResolvedPickListEntryList internalResolvePickListForTerm(String valueSetDefURI, boolean sortByText, AbsoluteCodingSchemeVersionReferenceList csVersionList, String versionTag) throws LBException { ResolvedPickListEntryList plList = new ResolvedPickListEntryList(); LexEVSValueSetDefinitionServices vds = new LexEVSValueSetDefinitionServicesImpl(); ResolvedValueSetDefinition rvdDef;/*from w w w .j ava 2 s. c o m*/ SortOptionList sortCriteria = null; if (BooleanUtils.isTrue(sortByText)) sortCriteria = Constructors.createSortOptionList(new String[] { "entityDescription" }); try { rvdDef = vds.resolveValueSetDefinition(new URI(valueSetDefURI), null, csVersionList, versionTag, sortCriteria); } catch (URISyntaxException e) { throw new LBException("Problem with ValueSet URI", e); } ResolvedConceptReferencesIterator rcrItr = rvdDef.getResolvedConceptReferenceIterator(); while (rcrItr.hasNext()) { ResolvedConceptReference rcr = rcrItr.next(); ResolvedPickListEntry rpl = new ResolvedPickListEntry(); rpl.setEntityCode(rcr.getCode()); rpl.setEntityCodeNamespace(rcr.getCodeNamespace()); Entity entity = rcr.getEntity(); if (entity != null) { Presentation[] presentations = entity.getPresentation(); for (Presentation pres : presentations) { if (BooleanUtils.toBoolean(pres.isIsPreferred())) { rpl.setPickText(pres.getValue().getContent()); rpl.setPropertyId(pres.getPropertyId()); plList.addResolvedPickListEntry(rpl); } } } } return plList; }
From source file:org.medici.bia.controller.docbase.EditExtractOrSynopsisDocumentController.java
/** * //from www .jav a 2 s .c om * @param command * @return */ @RequestMapping(method = RequestMethod.GET) public ModelAndView setupForm(@ModelAttribute("command") EditExtractOrSynopsisDocumentCommand command) { Map<String, Object> model = new HashMap<String, Object>(0); if ((command != null) && (command.getEntryId() > 0)) { SynExtract synExtract = new SynExtract(); try { synExtract = getDocBaseService().findSynExtractDocument(command.getEntryId()); if (synExtract != null) { command.setSynExtrId(synExtract.getSynExtrId()); command.setDocExtract(synExtract.getDocExtract()); command.setDocumentBibliography(synExtract.getDocumentBibliography()); command.setSynopsis(synExtract.getSynopsis()); } else { command.setSynExtrId(0); command.setDocExtract(null); command.setDocumentBibliography(null); command.setSynopsis(null); } command.setDocument(getDocBaseService().findDocument(command.getEntryId())); } catch (ApplicationThrowable ath) { return new ModelAndView("error/EditDetailsDocument", model); } } else { // On Document creation, the research is always the current user. command.setSynExtrId(0); command.setDocExtract(null); command.setSynopsis(null); command.setDocumentBibliography(null); } if (BooleanUtils.isTrue(command.getModalWindow())) { return new ModelAndView("docbase/EditExtractOrSynopsisDocumentModalWindow", model); } else { return new ModelAndView("docbase/EditExtractOrSynopsisDocument", model); } }
From source file:org.medici.bia.controller.docbase.ShowExplorerDocumentController.java
/** * // www . ja v a 2 s . c o m * @param command * @param result * @return */ @RequestMapping(method = RequestMethod.POST) public ModelAndView searchCarta(@Valid @ModelAttribute("command") ShowExplorerDocumentCommand command, BindingResult result) { if (command.getInsertNum() != null || command.getInsertLet() != null || command.getImageProgTypeNum() != null || command.getMissedNumbering() != null) { // validation should be launched only when insert and folio details have a value (at least one of them) getValidator().validate(command, result); } if (result.hasErrors()) { // in case of errors we need to remove imageType and imageProgTypeNum, so we return imageOrder which is previous image. command.setImageType(null); // command.setImageProgTypeNum(null); return setupForm(command, result); } else { Map<String, Object> model = new HashMap<String, Object>(0); try { // Document document = new Document(); // if(command.getEntryId() != null){ // document = getDocBaseService().findDocument(command.getEntryId()); // } Boolean hasInserts = getVolBaseService().hasInserts(command.getVolNum(), command.getVolLetExt()); model.put("hasInsert", hasInserts); DocumentExplorer documentExplorer = new DocumentExplorer(command.getEntryId(), command.getVolNum(), StringUtils.nullTrim(command.getVolLetExt())); // // we set informations from the document // documentExplorer.setFolioNum(document.getFolioNum()); // documentExplorer.setFolioMod(document.getFolioMod()); documentExplorer.setImage(new Image()); if (!StringUtils.isNullableString(command.getInsertNum())) { documentExplorer.getImage().setInsertNum(StringUtils.nullTrim(command.getInsertNum())); documentExplorer.getImage().setInsertLet(StringUtils.nullTrim(command.getInsertLet())); } documentExplorer.getImage().setImageProgTypeNum(command.getImageProgTypeNum()); documentExplorer.getImage().setMissedNumbering(StringUtils.nullTrim(command.getMissedNumbering())); documentExplorer.getImage() .setImageRectoVerso(StringUtils.isNullableString(command.getImageRectoVerso()) ? null : Image.ImageRectoVerso .convertFromString(StringUtils.nullTrim(command.getImageRectoVerso()))); documentExplorer.getImage().setImageOrder(command.getImageOrder()); documentExplorer.getImage().setImageType(command.getImageType()); documentExplorer.setTotal(command.getTotal()); documentExplorer.setTotalRubricario(command.getTotalRubricario()); documentExplorer.setTotalCarta(command.getTotalCarta()); documentExplorer.setTotalAppendix(command.getTotalAppendix()); documentExplorer.setTotalOther(command.getTotalOther()); documentExplorer.setTotalGuardia(command.getTotalGuardia()); documentExplorer = getManuscriptViewerService().getDocumentExplorer(documentExplorer); model.put("documentExplorer", documentExplorer); } catch (ApplicationThrowable applicationThrowable) { model.put("applicationThrowable", applicationThrowable); return new ModelAndView("error/ShowExplorerDocument", model); } if (BooleanUtils.isTrue(command.getModalWindow())) { return new ModelAndView("docbase/ShowExplorerDocumentModalWindow", model); } else { return new ModelAndView("docbase/ShowExplorerDocument", model); } } }
From source file:org.medici.bia.controller.docbase.ShowExplorerDocumentController.java
/** * /*w w w . j a v a 2s . c om*/ * @param volumeId * @return */ @RequestMapping(method = RequestMethod.GET) public ModelAndView setupForm(@ModelAttribute("command") ShowExplorerDocumentCommand command, BindingResult result) { Map<String, Object> model = new HashMap<String, Object>(0); DocumentExplorer documentExplorer = new DocumentExplorer(command.getEntryId(), command.getVolNum(), StringUtils.nullTrim(command.getVolLetExt())); documentExplorer.setImage(new Image()); documentExplorer.getImage().setImageProgTypeNum(command.getImageProgTypeNum()); documentExplorer.getImage().setMissedNumbering(StringUtils.nullTrim(command.getMissedNumbering())); documentExplorer.getImage().setImageRectoVerso(StringUtils.isNullableString(command.getImageRectoVerso()) ? null : Image.ImageRectoVerso.convertFromString(StringUtils.nullTrim(command.getImageRectoVerso()))); documentExplorer.getImage().setImageOrder(command.getImageOrder()); documentExplorer.getImage().setImageType(command.getImageType()); documentExplorer.getImage().setInsertNum(StringUtils.nullTrim(command.getInsertNum())); documentExplorer.getImage() .setInsertLet(StringUtils.isNullableString(command.getInsertNum()) ? null : command.getInsertLet()); documentExplorer.setTotal(command.getTotal()); documentExplorer.setTotalRubricario(command.getTotalRubricario()); documentExplorer.setTotalCarta(command.getTotalCarta()); documentExplorer.setTotalAppendix(command.getTotalAppendix()); documentExplorer.setTotalOther(command.getTotalOther()); documentExplorer.setTotalGuardia(command.getTotalGuardia()); try { documentExplorer = getManuscriptViewerService().getDocumentExplorer(documentExplorer); model.put("documentExplorer", documentExplorer); Boolean hasInserts = getVolBaseService().hasInserts(command.getVolNum(), command.getVolLetExt()); model.put("hasInsert", hasInserts); } catch (ApplicationThrowable applicationThrowable) { model.put("applicationThrowable", applicationThrowable); } if (BooleanUtils.isTrue(command.getModalWindow())) { return new ModelAndView("docbase/ShowExplorerDocumentModalWindow", model); } else { return new ModelAndView("docbase/ShowExplorerDocument", model); } }
From source file:org.medici.bia.controller.volbase.ShowExplorerVolumeController.java
/** * // w ww . j a va 2 s . com * @param command * @param result * @return */ @RequestMapping(method = RequestMethod.POST) public ModelAndView searchCarta(@Valid @ModelAttribute("command") ShowExplorerVolumeCommand command, BindingResult result) { if (command.getInsertNum() != null || command.getInsertLet() != null || command.getImageProgTypeNum() != null || command.getMissedNumbering() != null) { // validation should be launched only when insert and folio details have a value (at least one of them) getValidator().validate(command, result); } if (result.hasErrors()) { // in case of errors we need to remove imageType and imageProgTypeNum, so we return imageOrder which is previous image. command.setImageType(null); //command.setImageProgTypeNum(null); return setupForm(command, result); } else { Map<String, Object> model = new HashMap<String, Object>(0); VolumeExplorer volumeExplorer = new VolumeExplorer(command.getSummaryId(), command.getVolNum(), command.getVolLetExt()); volumeExplorer.setImage(new Image()); if (!StringUtils.isNullableString(command.getInsertNum())) { volumeExplorer.getImage().setInsertNum(StringUtils.nullTrim(command.getInsertNum())); volumeExplorer.getImage().setInsertLet(StringUtils.nullTrim(command.getInsertLet())); } volumeExplorer.getImage().setImageProgTypeNum(command.getImageProgTypeNum()); volumeExplorer.getImage().setMissedNumbering(StringUtils.nullTrim(command.getMissedNumbering())); volumeExplorer.getImage().setImageRectoVerso( Image.ImageRectoVerso.convertFromString(StringUtils.nullTrim(command.getImageRectoVerso()))); volumeExplorer.getImage().setImageOrder(command.getImageOrder()); volumeExplorer.getImage().setImageType(command.getImageType()); volumeExplorer.setTotal(command.getTotal()); volumeExplorer.setTotalRubricario(command.getTotalRubricario()); volumeExplorer.setTotalCarta(command.getTotalCarta()); volumeExplorer.setTotalAppendix(command.getTotalAppendix()); volumeExplorer.setTotalOther(command.getTotalOther()); volumeExplorer.setTotalGuardia(command.getTotalGuardia()); try { Boolean hasInserts = getVolBaseService().hasInserts(command.getVolNum(), command.getVolLetExt()); model.put("hasInsert", hasInserts); volumeExplorer = getVolBaseService().getVolumeExplorer(volumeExplorer); model.put("volumeExplorer", volumeExplorer); } catch (ApplicationThrowable applicationThrowable) { model.put("applicationThrowable", applicationThrowable); return new ModelAndView("error/ShowExplorerVolume", model); } if (BooleanUtils.isTrue(command.getModalWindow())) { return new ModelAndView("volbase/ShowExplorerVolumeModalWindow", model); } else { return new ModelAndView("volbase/ShowExplorerVolume", model); } } }
From source file:org.medici.bia.controller.volbase.ShowExplorerVolumeController.java
/** * //from w w w. ja v a 2 s. c o m * @param volumeId * @return */ @RequestMapping(method = RequestMethod.GET) public ModelAndView setupForm(@ModelAttribute("command") ShowExplorerVolumeCommand command, BindingResult result) { Map<String, Object> model = new HashMap<String, Object>(0); VolumeExplorer volumeExplorer = new VolumeExplorer(command.getSummaryId(), command.getVolNum(), command.getVolLetExt()); volumeExplorer.setImage(new Image()); volumeExplorer.getImage().setImageProgTypeNum(command.getImageProgTypeNum()); volumeExplorer.getImage().setMissedNumbering(StringUtils.nullTrim(command.getMissedNumbering())); volumeExplorer.getImage().setImageRectoVerso( Image.ImageRectoVerso.convertFromString(StringUtils.nullTrim(command.getImageRectoVerso()))); volumeExplorer.getImage().setImageOrder(command.getImageOrder()); volumeExplorer.getImage().setImageType(command.getImageType()); volumeExplorer.getImage().setInsertNum(StringUtils.nullTrim(command.getInsertNum())); volumeExplorer.getImage() .setInsertLet(StringUtils.isNullableString(command.getInsertNum()) ? null : command.getInsertLet()); volumeExplorer.setTotal(command.getTotal()); volumeExplorer.setTotalRubricario(command.getTotalRubricario()); volumeExplorer.setTotalCarta(command.getTotalCarta()); volumeExplorer.setTotalAppendix(command.getTotalAppendix()); volumeExplorer.setTotalOther(command.getTotalOther()); volumeExplorer.setTotalGuardia(command.getTotalGuardia()); try { volumeExplorer = getVolBaseService().getVolumeExplorer(volumeExplorer); model.put("volumeExplorer", volumeExplorer); Boolean hasInserts = getVolBaseService().hasInserts(command.getVolNum(), command.getVolLetExt()); model.put("hasInsert", hasInserts); } catch (ApplicationThrowable ath) { } if (BooleanUtils.isTrue(command.getModalWindow())) { return new ModelAndView("volbase/ShowExplorerVolumeModalWindow", model); } else { return new ModelAndView("volbase/ShowExplorerVolume", model); } }
From source file:org.ngrinder.perftest.service.PerfTestService.java
/** * Create {@link GrinderProperties} based on the passed {@link PerfTest}. * * @param perfTest base data/*ww w. jav a 2 s.c o m*/ * @param scriptHandler scriptHandler * @return created {@link GrinderProperties} instance */ public GrinderProperties getGrinderProperties(PerfTest perfTest, ScriptHandler scriptHandler) { try { // Use default properties first GrinderProperties grinderProperties = new GrinderProperties( config.getHome().getDefaultGrinderProperties()); User user = perfTest.getCreatedUser(); // Get all files in the script path String scriptName = perfTest.getScriptName(); FileEntry userDefinedGrinderProperties = fileEntryService.getOne(user, FilenameUtils.concat(FilenameUtils.getPath(scriptName), DEFAULT_GRINDER_PROPERTIES), -1L); if (!config.isSecurityEnabled() && userDefinedGrinderProperties != null) { // Make the property overridden by user property. GrinderProperties userProperties = new GrinderProperties(); userProperties.load(new StringReader(userDefinedGrinderProperties.getContent())); grinderProperties.putAll(userProperties); } grinderProperties.setAssociatedFile(new File(DEFAULT_GRINDER_PROPERTIES)); grinderProperties.setProperty(GRINDER_PROP_SCRIPT, scriptHandler.getScriptExecutePath(scriptName)); grinderProperties.setProperty(GRINDER_PROP_TEST_ID, "test_" + perfTest.getId()); grinderProperties.setInt(GRINDER_PROP_AGENTS, getSafe(perfTest.getAgentCount())); grinderProperties.setInt(GRINDER_PROP_PROCESSES, getSafe(perfTest.getProcesses())); grinderProperties.setInt(GRINDER_PROP_THREAD, getSafe(perfTest.getThreads())); if (perfTest.isThresholdDuration()) { grinderProperties.setLong(GRINDER_PROP_DURATION, getSafe(perfTest.getDuration())); grinderProperties.setInt(GRINDER_PROP_RUNS, 0); } else { grinderProperties.setInt(GRINDER_PROP_RUNS, getSafe(perfTest.getRunCount())); if (grinderProperties.containsKey(GRINDER_PROP_DURATION)) { grinderProperties.remove(GRINDER_PROP_DURATION); } } grinderProperties.setProperty(GRINDER_PROP_ETC_HOSTS, StringUtils.defaultIfBlank(perfTest.getTargetHosts(), "")); grinderProperties.setBoolean(GRINDER_PROP_USE_CONSOLE, true); if (BooleanUtils.isTrue(perfTest.getUseRampUp())) { grinderProperties.setBoolean(GRINDER_PROP_THREAD_RAMPUP, perfTest.getRampUpType() == RampUp.THREAD); grinderProperties.setInt(GRINDER_PROP_PROCESS_INCREMENT, getSafe(perfTest.getRampUpStep())); grinderProperties.setInt(GRINDER_PROP_PROCESS_INCREMENT_INTERVAL, getSafe(perfTest.getRampUpIncrementInterval())); if (perfTest.getRampUpType() == RampUp.PROCESS) { grinderProperties.setInt(GRINDER_PROP_INITIAL_SLEEP_TIME, getSafe(perfTest.getRampUpInitSleepTime())); } else { grinderProperties.setInt(GRINDER_PROP_INITIAL_THREAD_SLEEP_TIME, getSafe(perfTest.getRampUpInitSleepTime())); } grinderProperties.setInt(GRINDER_PROP_INITIAL_PROCESS, getSafe(perfTest.getRampUpInitCount())); } else { grinderProperties.setInt(GRINDER_PROP_PROCESS_INCREMENT, 0); } grinderProperties.setInt(GRINDER_PROP_REPORT_TO_CONSOLE, 500); grinderProperties.setProperty(GRINDER_PROP_USER, perfTest.getCreatedUser().getUserId()); grinderProperties.setProperty(GRINDER_PROP_JVM_CLASSPATH, getCustomClassPath(perfTest)); grinderProperties.setInt(GRINDER_PROP_IGNORE_SAMPLE_COUNT, getSafe(perfTest.getIgnoreSampleCount())); grinderProperties.setBoolean(GRINDER_PROP_SECURITY, config.isSecurityEnabled()); // For backward agent compatibility. // If the security is not enabled, pass it as jvm argument. // If enabled, pass it to grinder.param. In this case, I drop the // compatibility. if (StringUtils.isNotBlank(perfTest.getParam())) { String param = perfTest.getParam().replace("'", "\\'").replace(" ", ""); if (config.isSecurityEnabled()) { grinderProperties.setProperty(GRINDER_PROP_PARAM, StringUtils.trimToEmpty(param)); } else { String property = grinderProperties.getProperty(GRINDER_PROP_JVM_ARGUMENTS, ""); property = property + " -Dparam=" + param + " "; grinderProperties.setProperty(GRINDER_PROP_JVM_ARGUMENTS, property); } } LOGGER.info("Grinder Properties : {} ", grinderProperties); return grinderProperties; } catch (Exception e) { throw processException("error while prepare grinder property for " + perfTest.getTestName(), e); } }