Example usage for org.apache.commons.lang StringUtils isNotEmpty

List of usage examples for org.apache.commons.lang StringUtils isNotEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isNotEmpty.

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

Checks if a String is not empty ("") and not null.

Usage

From source file:com.exxonmobile.ace.hybris.storefront.util.MetaSanitizerUtil.java

/**
 * Takes a string of words, removes duplicates and returns a comma separated list of keywords as a String
 * /*from ww w  .j a  va 2s. c o m*/
 * @param keywords
 *           Keywords to be sanitized
 * @return String of comma separated keywords
 */
public static String sanitizeKeywords(final String keywords) {
    final String clean = (StringUtils.isNotEmpty(keywords) ? Jsoup.parse(keywords).text() : ""); // Clean html
    final String[] words = StringUtils.split(clean.replace("\"", "")); // Clean quotes

    // Remove duplicates
    String noDupes = "";
    for (final String word : words) {
        if (!noDupes.contains(word)) {
            noDupes += word + ',';
        }
    }
    if (!noDupes.isEmpty()) {
        noDupes = noDupes.substring(0, noDupes.length() - 1);
    }
    return noDupes;
}

From source file:com.bibisco.bean.CharacterSceneDTO.java

public String getLocation() {

    StringBuilder lStringBuilder = new StringBuilder();

    if (StringUtils.isNotEmpty(locationNation)) {
        lStringBuilder.append(locationNation);
    }/*from   w w w .j ava2s .  co m*/
    if (StringUtils.isNotEmpty(locationState)) {
        if (lStringBuilder.toString().length() > 0) {
            lStringBuilder.append(", ");
        }
        lStringBuilder.append(locationState);
    }
    if (StringUtils.isNotEmpty(locationCity)) {
        if (lStringBuilder.toString().length() > 0) {
            lStringBuilder.append(", ");
        }
        lStringBuilder.append(locationCity);
    }
    if (StringUtils.isNotEmpty(locationName)) {
        lStringBuilder.append(" ");
        lStringBuilder.append(locationName);
    }

    return lStringBuilder.toString();
}

From source file:com.jfaker.framework.security.model.Authority.java

public Page<Authority> paginate(int pageNumber, int pageSize, String name) {
    String sql = "from sec_authority";
    if (StringUtils.isNotEmpty(name)) {
        sql += " where name like '%" + name + "%' ";
    }//  w w w .  j  a  v  a2  s.c  o  m
    sql += " order by id desc";
    return paginate(pageNumber, pageSize, "select *", sql);
}

From source file:com.clican.pluto.dataprocess.spring.parser.DplExecProcessorParser.java

@SuppressWarnings("unchecked")

public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) {
    this.setBeanDefinitionStringProperty("resultName", beanDef, element);

    String dplStatement = element.getAttribute("dplStatement");
    if (StringUtils.isEmpty(dplStatement)) {
        dplStatement = "dplStatement";
    }/*from  ww  w.java 2 s. c o  m*/
    String clazz = element.getAttribute("clazz");
    if (StringUtils.isNotEmpty(clazz)) {
        try {
            Class c = Class.forName(clazz);
            beanDef.getPropertyValues().addPropertyValue("clazz", c);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    String singleRow = element.getAttribute("singleRow");
    if (StringUtils.isNotEmpty(singleRow)) {
        beanDef.getPropertyValues().addPropertyValue("singleRow", Boolean.parseBoolean(singleRow));
    }
    String traces = element.getAttribute("traces");
    if (StringUtils.isNotEmpty(traces)) {
        List<String> traceList = new ArrayList<String>();
        for (String trace : traces.split(",")) {
            traceList.add(trace.trim());
        }
        beanDef.getPropertyValues().addPropertyValue("traces", traceList);
    }
    beanDef.getPropertyValues().addPropertyValue("dplStatement", new RuntimeBeanReference(dplStatement));
    beanDef.getPropertyValues().addPropertyValue("dpl", element.getTextContent().trim());
}

From source file:com.clican.pluto.fsm.spring.parser.TaskStateParser.java

@SuppressWarnings("unchecked")
@Override/*  www . j  a va  2  s  .com*/
public Class<? extends IState> getStateClass(Element element) {
    String clazz = element.getAttribute("clazz");
    if (StringUtils.isNotEmpty(clazz)) {
        try {
            return (Class<? extends IState>) Class.forName(clazz);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    } else {
        return TaskStateImpl.class;
    }
}

From source file:gov.nih.nci.cabig.caaers2adeers.MessageAdapter.java

@Override
public Object getBody() {
    if (StringUtils.isNotEmpty(body))
        return body;
    return new PayloadGenerator().getRequest(EntityOperation.PRIOR_THERAPY);
}

From source file:cn.vlabs.umt.ui.tags.RegisterLinkTag.java

public int doStartTag() throws JspException {
    try {/*from  w  ww.  j  a v  a  2 s. c o  m*/

        String contextPath = ((HttpServletRequest) pageContext.getRequest()).getContextPath();
        String link = "/regist.jsp";
        if (StringUtils.isNotEmpty(contextPath)) {
            link = contextPath + link;
        }
        Map<String, String> params = SessionUtils.getSiteInfo((HttpServletRequest) (pageContext.getRequest()));
        if (params != null) {
            String otherAppRegisterLink = params.get(Attributes.APP_REGISTER_URL_KEY);
            link = otherAppRegisterLink != null ? otherAppRegisterLink : link;
        }
        pageContext.getOut().print("<a href=" + link + ">");

    } catch (IOException e) {
    }
    return EVAL_BODY_INCLUDE;
}

From source file:au.org.ala.delta.translation.delta.OverlayFontWriter.java

public void writeFont(FontInfo fontInfo, OverlayFontType fontType) {
    int indent = 2;

    writeId(fontType);//from www .  j  a v a 2  s.c o  m

    String comment = fontInfo.comment;
    if (StringUtils.isNotEmpty(comment)) {
        writeComment(indent, comment);
        indent = 10;
    }
    if (StringUtils.isNotEmpty(fontInfo.name)) {

        writeFontInfo(fontInfo, indent);
    }

}

From source file:com.clican.pluto.dataprocess.spring.parser.CollectionIteratorProcessorParser.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) {
    this.setBeanDefinitionStringProperty("elementName", beanDef, element);
    this.setBeanDefinitionStringProperty("collectionName", beanDef, element);
    String commit = element.getAttribute("stepCommit");
    if (StringUtils.isNotEmpty(commit)) {
        beanDef.getPropertyValues().addPropertyValue("stepCommit", Boolean.parseBoolean(commit));
    }/*from   w  w  w . j  a v a 2  s. c  om*/
    String iteratorProcessors = element.getAttribute("iteratorProcessors");
    List iteratorProcessorList = new ManagedList();
    for (String nextDataProcess : iteratorProcessors.split(",")) {
        nextDataProcess = nextDataProcess.trim();
        iteratorProcessorList.add(new RuntimeBeanReference(nextDataProcess));
    }
    beanDef.getPropertyValues().addPropertyValue("iteratorProcessors", iteratorProcessorList);
}

From source file:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.UpdatePasswordFormValidator.java

@Override
public void validate(Object object, Errors errors) {
    final UpdatePwdForm updatePasswordForm = (UpdatePwdForm) object;
    final String newPassword = updatePasswordForm.getPwd();
    final String checkPassword = updatePasswordForm.getCheckPwd();

    if (StringUtils.isNotEmpty(newPassword) && StringUtils.isNotEmpty(checkPassword)
            && !StringUtils.equals(newPassword, checkPassword)) {
        errors.rejectValue("checkPwd", "validation.checkPwd.equals");
    } else if (StringUtils.isEmpty(checkPassword)) {
        errors.rejectValue("checkPwd", "updatePwd.checkPwd.invalid");
    }//from w w  w .ja  v  a  2 s .com
}