List of usage examples for org.apache.commons.lang StringUtils isNotEmpty
public static boolean isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
From source file:gov.nih.nci.protexpress.util.SearchCriteriaHelper.java
/** * Given a Date object, returns a Calendar. * * @param crit the Criteria// www.ja v a2 s. c om * @param params the search parameters * @param onlyCount parameter for getting the count only * @param sortProperty the sort property * @param sortDir the sort order * @return the Criteria */ public static Criteria getCriteria(Criteria crit, SearchParameters params, boolean onlyCount, String sortProperty, SortOrderEnum sortDir) { if (onlyCount) { crit.setProjection(Projections.rowCount()); } if (!onlyCount && sortDir != null && StringUtils.isNotBlank(sortProperty)) { if (SortOrderEnum.ASCENDING.equals(sortDir)) { crit.addOrder(Order.asc(sortProperty)); } else { crit.addOrder(Order.desc(sortProperty)); } } if ((params != null) && (StringUtils.isNotEmpty(params.getName()))) { crit.add(Restrictions.like("name", "%" + params.getName() + "%").ignoreCase()); } // crit.createAlias("auditInfo", "audit"); if ((params != null) && !params.getSearchAllUsers()) { crit.add(Restrictions.eq("auditInfo.creator", UserHolder.getUsername())); } if ((params != null) && (params.getFromDate() != null)) { crit.add(Restrictions.ge("auditInfo.lastModifiedDate", DateHelper.getDate(params.getFromDate()))); } if ((params != null) && (params.getToDate() != null)) { crit.add(Restrictions.le("auditInfo.lastModifiedDate", DateHelper.getDate(params.getToDate()))); } return crit; }
From source file:com.nec.harvest.jasperreport.resolver.JasperReportResolver.java
/** * Get report path * * @return */ public String getReportPath() { return StringUtils.isNotEmpty(reportPath) ? reportPath : getDefaultPath(); }
From source file:info.magnolia.cms.util.AlertUtil.java
/** * Checks if there is a message set//w w w. j a v a 2 s. c om * @param request * @return true if set */ public static boolean isMessageSet() { return StringUtils.isNotEmpty((String) MgnlContext.getAttribute(Context.ATTRIBUTE_MESSAGE)); }
From source file:com.cyclopsgroup.waterview.jelly.JellyPageRenderer.java
private static String getScriptPath(String packageName, String module) { StringBuffer scriptPath = new StringBuffer(); if (StringUtils.isNotEmpty(packageName)) { scriptPath.append(packageName.replace('.', '/')); scriptPath.append('/'); }/*from w ww .j a va2 s . c o m*/ scriptPath.append(module).append(".jelly"); return scriptPath.toString(); }
From source file:com.cyclopsgroup.waterview.velocity.VelocityPageRenderer.java
private static String getTemplatePath(String packageName, String module) { StringBuffer templatePath = new StringBuffer(); if (StringUtils.isNotEmpty(packageName)) { templatePath.append(packageName.replace('.', '/')); templatePath.append("/"); }//from ww w .ja va2 s . c om templatePath.append(module).append(".vm"); return templatePath.toString(); }
From source file:com.assemblade.opendj.acis.CompositeSubject.java
public static Subject parse(Subject left, String text) { Matcher compositeMatcher = compositePattern.matcher(text); if (compositeMatcher.find()) { String operand = compositeMatcher.group(1).trim(); String right = compositeMatcher.group(2); if (StringUtils.isNotEmpty(operand) && (operand.equalsIgnoreCase("AND") || operand.equalsIgnoreCase("OR"))) { return new CompositeSubject(left, Subject.parse(right), operand); }/*from w ww . j a v a 2s . c om*/ } return null; }
From source file:azkaban.webapp.servlet.ExternalAnalyzerUtils.java
/** * Gets an external analyzer URL if configured in 'azkaban.properties'. * //from w w w .j av a2 s.c om * @param props The props to be set to get the external analyzer URL. * * @param req The <code>HttpServletRequest</code> requesting the page. * * @return Returns an external analyzer URL. */ public static String getExternalAnalyzer(Props props, HttpServletRequest req) { String url = props.getString(EXECUTION_EXTERNAL_LINK_URL, ""); int index = url.indexOf('%'); if (StringUtils.isNotEmpty(url) && index != -1) { String pattern = url.substring(url.indexOf('%'), url.length()); switch (pattern) { case "%url": return buildExternalAnalyzerURL(req, url, pattern); default: LOGGER.error("Pattern configured is not supported. " + "Please check the comments section in 'azkaban.properties' " + "for supported patterns."); return ""; } } LOGGER.debug("An optional external analyzer is not configured."); return ""; }
From source file:com.evolveum.midpoint.schema.PagingTypeFactory.java
public static PagingType createPaging(int offset, int maxSize, OrderDirectionType order, String orderBy) { PagingType paging = new PagingType(); paging.setOffset(offset);// w ww .ja v a 2 s. c o m paging.setMaxSize(maxSize); if (order != null && StringUtils.isNotEmpty(orderBy)) { paging.setOrderBy(fillPropertyReference(orderBy)); paging.setOrderDirection(order); } return paging; }
From source file:com.enonic.cms.core.content.imports.ImportValueFormater.java
public static ContentKey getContentKey(final AbstractSourceValue value) { final String contentKeyAsString = getStringValue(value); if (StringUtils.isNotEmpty(contentKeyAsString)) { return new ContentKey(contentKeyAsString); }/*from w w w. jav a 2 s . c o m*/ return null; }
From source file:net.shopxx.util.CookieUtils.java
/** * cookie//from ww w . j ava 2s.co m * * @param request * HttpServletRequest * @param response * HttpServletResponse * @param name * cookie?? * @param value * cookie * @param path * * @param maxAge * (??: ) * @param domain * * @param secure * ?? */ public static void addCookie(HttpServletRequest request, HttpServletResponse response, String name, String value, String path, Integer maxAge, String domain, Boolean secure) { Assert.notNull(request); Assert.notNull(response); Assert.hasText(name); try { value = URLEncoder.encode(value, "UTF-8"); Cookie cookie = new Cookie(name, value); if (StringUtils.isNotEmpty(path)) { cookie.setPath(path); } if (maxAge != null) { cookie.setMaxAge(maxAge); } if (StringUtils.isNotEmpty(domain)) { cookie.setDomain(domain); } if (secure != null) { cookie.setSecure(secure); } response.addCookie(cookie); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }