List of usage examples for org.apache.commons.lang3 StringUtils isNotEmpty
public static boolean isNotEmpty(final CharSequence cs)
Checks if a CharSequence is not empty ("") and not null.
StringUtils.isNotEmpty(null) = false StringUtils.isNotEmpty("") = false StringUtils.isNotEmpty(" ") = true StringUtils.isNotEmpty("bob") = true StringUtils.isNotEmpty(" bob ") = true
From source file:com.nridge.core.base.std.Platform.java
/** * Determines if the current platform that the JVM is executing within is * a Mac-based operating system./* w ww .ja v a 2 s.com*/ * @return <i>true</i> if it is or <i>false</i> otherwise. */ public static boolean isMac() { String osName; Properties osProperties; osProperties = System.getProperties(); osName = (String) osProperties.get("os.name"); return StringUtils.isNotEmpty(osName) && osName.startsWith(PLATFORM_MACOS); }
From source file:com.inkubator.hrm.web.employee.EmpPtkpFormController.java
@PostConstruct @Override/*from w w w. j av a 2 s.co m*/ public void initialization() { super.initialization(); try { isDisabledPtkpNumber = Boolean.FALSE; String empDataId = FacesUtil.getRequestParameter("empDataId"); empDataModel = new EmpDataModel(); if (StringUtils.isNotEmpty(empDataId)) { EmpData empData = empDataService.getEmpDataWithBiodata(Long.parseLong(empDataId)); if (empDataId != null) { empDataModel = getModelFromEntity(empData); } } } catch (Exception e) { LOGGER.error("Error", e); } }
From source file:com.qcadoo.mes.deviationCausesReporting.domain.DeviationWithOccurrencesCount.java
public DeviationWithOccurrencesCount(final String deviationCause, final Long totalNumberOfOccurrences) { Preconditions.checkArgument(StringUtils.isNotEmpty(deviationCause), "Deviation cause (deviation type) cannot be empty!"); this.deviationCause = deviationCause; this.totalNumberOfOccurrences = (Long) ObjectUtils.defaultIfNull(totalNumberOfOccurrences, 0L); }
From source file:com.inkubator.hrm.web.organisation.OrgTypeOfSpecFormController.java
@PostConstruct @Override//from w ww .j ava2s .c om public void initialization() { super.initialization(); try { String orgTypeOfSpecId = FacesUtil.getRequestParameter("orgTypeOfSpecId"); model = new OrgTypeOfSpecModel(); isUpdate = Boolean.FALSE; if (StringUtils.isNotEmpty(orgTypeOfSpecId)) { OrgTypeOfSpec orgTypeOfSpec = service.getEntiyByPK(Long.parseLong(orgTypeOfSpecId)); if (orgTypeOfSpecId != null) { model = getModelFromEntity(orgTypeOfSpec); isUpdate = Boolean.TRUE; } } } catch (Exception e) { LOGGER.error("Error", e); } }
From source file:com.cognifide.aet.executor.xmlparser.xml.utils.EscapeUtils.java
public static void validateAttr(String attribute) { String description = attribute.substring(13, attribute.length() - 1); if (StringUtils.isNotEmpty(description) && description.length() > DESCRIPTION_MAX_LENGTH) { throw new IllegalArgumentException( String.format("URL attribute description is longer than max %d chars: %s", DESCRIPTION_MAX_LENGTH, description)); }/* w ww . jav a2 s .com*/ if (StringUtils.isNotEmpty(description) && !description.matches(DESCRIPTION_PATTERN)) { throw new IllegalArgumentException(String.format("Invalid URL description provided: %s", description)); } }
From source file:com.nridge.ds.neo4j.ds_neo4j.Neo4jGDB.java
public static GraphDatabaseService getInstance(final AppMgr anAppMgr, DataBag aSchemaBag) throws DSException { if (mGraphDBService == null) { Label graphDBLabel = null; if (aSchemaBag != null) { String labelName = aSchemaBag.getFeature("labelName"); if (StringUtils.isNotEmpty(labelName)) graphDBLabel = Label.label(labelName); }// www . j a va 2 s. co m String graphDBPathName = anAppMgr.getString(anAppMgr.APP_PROPERTY_GDB_PATH); String graphDBSchemaPathFileName = String.format("%s%cschema", graphDBPathName, File.separatorChar); File graphDBSchemaFile = new File(graphDBSchemaPathFileName); boolean gdbSchemaExists = graphDBSchemaFile.exists(); // Ensure we have a graph database folder for data storage. File graphDBPathFile = new File(graphDBPathName); if (!graphDBPathFile.exists()) graphDBPathFile.mkdir(); if (!graphDBPathFile.exists()) { String msgStr = String.format("%s: Does not exist.", graphDBPathName); throw new DSException(msgStr); } // Prevent a large number of log messages from being generated. LogProvider logProvider = new Slf4jLogProvider(); // Enter the critical section to create the service handle. synchronized (Neo4jGDB.class) { if (mGraphDBService == null) { mGraphDBService = new GraphDatabaseFactory().setUserLogProvider(logProvider) .newEmbeddedDatabaseBuilder(new File(graphDBPathName)).newGraphDatabase(); if ((aSchemaBag != null) && (!gdbSchemaExists)) { DataField pkField = aSchemaBag.getPrimaryKeyField(); if (pkField != null) { Schema gdbSchema; IndexDefinition indexDefinition = null; try (Transaction gdbTransaction = mGraphDBService.beginTx()) { gdbSchema = mGraphDBService.schema(); for (DataField dataField : aSchemaBag.getFields()) { if (dataField != pkField) { if (dataField.isFeatureTrue("isIndexed")) gdbSchema.indexFor(graphDBLabel).on(dataField.getName()).create(); } } indexDefinition = gdbSchema.indexFor(graphDBLabel).on(pkField.getName()).create(); gdbTransaction.success(); } if (indexDefinition != null) { try (Transaction gdbTransaction = mGraphDBService.beginTx()) { gdbSchema.awaitIndexOnline(indexDefinition, 10, TimeUnit.SECONDS); gdbTransaction.success(); } } } } } } } return mGraphDBService; }
From source file:com.thruzero.common.web.model.container.HtmlPanel.java
public String getSafeContent() { String result = content;/*from ww w . java 2 s.c o m*/ if (StringUtils.isNotEmpty(result)) { result = Jsoup.clean(result, Whitelist.relaxed()); } return result; }
From source file:io.wcm.handler.media.spi.helpers.AbstractMediaSource.java
@Override public boolean accepts(MediaRequest mediaRequest) { // if an explicit media request is set check this first if (StringUtils.isNotEmpty(mediaRequest.getMediaRef())) { return accepts(mediaRequest.getMediaRef()); }//from w ww. j ava2s .c o m // otherwise check resource which contains media request properties ValueMap props = mediaRequest.getResourceProperties(); // check for matching media source ID in link resource String mediaSourceId = props.get(MediaNameConstants.PN_MEDIA_SOURCE, String.class); if (StringUtils.isNotEmpty(mediaSourceId)) { return StringUtils.equals(mediaSourceId, getId()); } // if not link type is set at all check if link ref attribute contains a valid link else { String refProperty = StringUtils.defaultString(mediaRequest.getRefProperty(), getPrimaryMediaRefProperty()); String mediaRef = props.get(refProperty, String.class); return accepts(mediaRef); } }
From source file:com.adeptj.modules.commons.crypto.SaltHashPair.java
public SaltHashPair(String salt, String hash) { Validate.isTrue(StringUtils.isNotEmpty(hash), "hash can't be blank!!"); Validate.isTrue(StringUtils.isNotEmpty(salt), "salt can't be blank!!"); this.salt = salt; this.hash = hash; }
From source file:com.glaf.base.modules.sys.springmvc.MainController.java
@RequestMapping(params = "method=footer") public ModelAndView footer(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); if (StringUtils.isNotEmpty(request.getParameter("systemName"))) { Environment.setCurrentSystemName(request.getParameter("systemName")); } else {//w ww . j av a 2s .co m Environment.setCurrentSystemName(Environment.DEFAULT_SYSTEM_NAME); } return new ModelAndView("/main/footer", modelMap); }