List of usage examples for org.apache.commons.lang StringUtils trimToEmpty
public static String trimToEmpty(String str)
Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null
.
From source file:com.haulmont.cuba.gui.app.security.role.edit.tabs.EntityNameFilter.java
@Override public boolean test(@Nullable T target) { if (target != null) { if (Boolean.TRUE.equals(assignedOnlyCheckBox.getValue()) && !target.isAssigned()) { return false; }/* w w w .ja va2 s. co m*/ if (Boolean.FALSE.equals(systemLevelCheckBox.getValue()) && (target instanceof EntityPermissionTarget) && !target.isAssigned()) { Class entityClass = ((EntityPermissionTarget) target).getEntityClass(); MetaClass metaClass = metadata.getSession().getClassNN(entityClass); if (metadata.getTools().isSystemLevel(metaClass)) { return false; } } String filterValue = StringUtils.trimToEmpty(entityFilter.<String>getValue()); return StringUtils.isBlank(filterValue) || StringUtils.containsIgnoreCase(target.getCaption(), filterValue); } return false; }
From source file:com.edgenius.core.Installation.java
public static Installation refreshInstallation() { Installation install = new Installation(); try {/*from w w w . j a v a 2 s .c o m*/ File installFile = FileUtil.getFile(DataRoot.getDataRoot() + installResource); if (installFile.exists()) { XStream xs = new XStream(); xs.processAnnotations(Installation.class); install = (Installation) xs.fromXML(new FileInputStream(installFile)); if (Installation.STATUS_COMPLETED.equalsIgnoreCase(install.getStatus())) { Installation.DONE = true; } Installation.INSTANCE_ID = StringUtils.trimToEmpty(install.getInstanceID()); Installation.INSTANCE_TYPE = install.getInstanceType(); } } catch (Exception e) { log.error("Unable load installation.xml, treat as system not install"); } return install; }
From source file:com.cloudbees.plugins.deployer.sources.FixedDirectoryDeploySource.java
/** * Constructor used by stapler./*from w ww .j av a 2 s . c o m*/ * * @param directoryPath the file path. */ @DataBoundConstructor public FixedDirectoryDeploySource(@CheckForNull String directoryPath) { this.directoryPath = StringUtils.trimToEmpty(directoryPath); }
From source file:com.wim.reportviewer.web.report.list.ListReportsControllerImpl.java
private Collection<ReportInfo> loadReports(String filter) throws IOException { final List<ReportInfo> reports = new java.util.ArrayList<ReportInfo>(); final Map<String, JasperDesign> lstReports = ReportUtil.getReports(); filter = ReportUtil.removeAccents(StringUtils.trimToEmpty(filter)).toLowerCase(); final Iterator<String> it = lstReports.keySet().iterator(); while (it.hasNext()) { final String currentReportFileName = (String) it.next(); JasperDesign report = (JasperDesign) lstReports.get(currentReportFileName); ReportInfo ir = new ReportInfo(); ir.setFileName(currentReportFileName); ir.setName(report.getName());//from www.java 2 s .co m if (StringUtils.isBlank(filter)) { reports.add(ir); } else { if (ReportUtil.removeAccents(ir.getName()).toLowerCase().contains(filter)) { reports.add(ir); } } } Collections.sort(reports, new Comparator<ReportInfo>() { @Override public int compare(ReportInfo ri1, ReportInfo ri2) { return ri1.getName().compareToIgnoreCase(ri2.getName()); } }); return reports; }
From source file:de.unioninvestment.eai.portal.portlet.crud.domain.model.FormFields.java
/** * /* w ww . j av a 2s .c om*/ * * @return Ob es min. ein Defaultwert gesetzt ist. */ public boolean hasDefaultValue() { for (FormField formField : fields.values()) { if (StringUtils.isNotEmpty(StringUtils.trimToEmpty(formField.getDefault()))) { return true; } } return false; }
From source file:com.cloudbees.plugins.deployer.sources.StaticSelectionDeploySource.java
/** * Constructor used by stapler.// www . ja v a2 s . c o m * * @param filePath the file path. */ @DataBoundConstructor public StaticSelectionDeploySource(@CheckForNull String filePath) { this.filePath = StringUtils.trimToEmpty(filePath); }
From source file:de.xirp.profile.CommunicationInterface.java
/** * Returns the main class name of the communication interface * plugin./* w ww . ja va 2 s . c o m*/ * * @return Returns the class name. */ @XmlTransient public String getClassName() { return StringUtils.trimToEmpty(clazz); }
From source file:com.collegesource.interfaces.student.BannerStudentFinder.java
/** * Find a student in Banner by stuno.// w w w . j ava 2 s . com * * @param instidq * @param instid * @param stuno */ @Override public StuMaster findStudentByStuno(String instidq, String instid, String stuno) { //Trim Values instidq = StringUtils.trimToEmpty(instidq); instid = StringUtils.trimToEmpty(instid); stuno = StringUtils.trimToEmpty(stuno); logger.debug(MessageFormat.format("Searching for student by stuno[{0}]", stuno)); StuMaster sm = new StuMaster(); List<Map<String, Object>> results = bannerDao.searchForStudentByStuno(stuno, logger); if (!CollectionUtils.isEmpty(results)) { sm = createStudent(results.get(0)); if (!findStudentInStuMaster(instidq, instid, stuno)) { createStuMasterAndStuDemoRecord(sm); } else if (!validateStuDemo(sm)) { updateStuDemoRecord(sm); } } return sm; }
From source file:mitm.common.cifs.SMBURLBuilder.java
private String normalizeShareAndDir(String input) { input = StringUtils.trimToEmpty(input); if (StringUtils.isNotEmpty(input)) { input = removeStartingSlash(input); input = addTrailingSlash(input); }/*from w ww. j a va 2s . c o m*/ return input; }
From source file:com.bluexml.xforms.actions.AbstractWriteAction.java
/** * Builds a redirection URL, adding or not the parameters to the given URL. Adding the * parameters is the default behavior./*from www. j a v a 2 s . c om*/ * * @param pSubmitURL * @param currentPage * @return the URL, with or without parameters appended */ protected String buildRedirectionUrlWithParams(String pSubmitURL, Page currentPage) { Map<String, String> initParams = currentPage.getInitParams(); String submitURL = pSubmitURL; boolean foundInParams = initParams.containsKey(MsgId.PARAM_SKIP_ADDITIONAL_INFO.getText()); boolean skipInfo = false; if (foundInParams) { skipInfo = (StringUtils.equals(initParams.get(MsgId.PARAM_SKIP_ADDITIONAL_INFO.getText()), "true")); } else { // #1656 // there may be something specified in the Xtension property of this form skipInfo = controller.getXtensionSkipAdditionalInfo(currentPage.getFormName(), currentPage.getFormType()); } if (skipInfo == false) { String separator = (submitURL.indexOf('?') == -1 ? "?" : "&"); String idStr = StringUtils.trimToEmpty(currentPage.getDataId()); submitURL += separator + "id=" + idStr; submitURL += "&" + MsgId.PARAM_LEAVING_FORM + "=" + currentPage.getFormName(); } return submitURL; }