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.cnd.greencube.web.base.template.method.MessageMethod.java

@SuppressWarnings("rawtypes")
public Object exec(List arguments) throws TemplateModelException {
    if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null
            && StringUtils.isNotEmpty(arguments.get(0).toString())) {
        String message = null;/* w w w.j  a  v  a 2 s.c o m*/
        String code = arguments.get(0).toString();
        if (arguments.size() > 1) {
            Object[] args = arguments.subList(1, arguments.size()).toArray();
            message = SpringUtils.getMessage(code, args);
        } else {
            message = SpringUtils.getMessage(code);
        }
        return new SimpleScalar(message);
    }
    return null;
}

From source file:fr.hoteia.qalingo.web.mvc.viewbean.AbstractViewBean.java

/**
 * /*from   ww  w.ja v  a2 s. co  m*/
 */
protected String removeHtml(String value) {
    if (StringUtils.isNotEmpty(value)) {
        value = value.replaceAll("<[^>]*>", "");
        value = value.replaceAll("  ", " ");
        value = value.trim();
    }
    return value;
}

From source file:com.swcguild.dummy.CaptchaTag.java

@Override
public void doTag() throws JspException, IOException {
    ReCaptcha captcha = ReCaptchaFactory.newReCaptcha(publickey, privatekey, false);
    Properties properties = new Properties();

    if (StringUtils.isNotEmpty(themeName)) {
        properties.put("theme", themeName);
    }/*from www.j a  v  a 2s. c  o m*/

    String captchaHtml = captcha.createRecaptchaHtml(null, properties);
    getJspContext().getOut().write(captchaHtml);
}

From source file:com.fengduo.bee.commons.filter.xss.XssClean.java

public static String clean(String value) {
    if (StringUtils.isNotEmpty(value)) {
        AntiSamy antiSamy = new AntiSamy();
        try {/*from www  .  ja  v  a  2s .  co  m*/
            final CleanResults cr = antiSamy.scan(value, getPolicy());
            // HTML
            value = cr.getCleanHTML();
        } catch (ScanException e) {
            logger.error("XSS");
        } catch (PolicyException e) {
            logger.error("XSS: " + e.getMessage());
        } catch (ServiceException e) {
            logger.error("antisamy?!");
        }
    }
    return value;
}

From source file:com.bstek.dorado.web.loader.RunModeConsoleStartedMessageOutputter.java

@Override
public void output(Writer writer) throws Exception {
    String runMode = Configure.getString("core.runMode");
    if (StringUtils.isNotEmpty(runMode) && !"production".equalsIgnoreCase(runMode)) {
        writer.append("WARN:\n").append("Dorado is currently running in " + runMode
                + " mode, you may need to change the setting for \"core.runMode\".");
    }//from   w w  w .j a  v a  2  s.  c  om
}

From source file:com.janrain.backplane2.server.MessageRequest.java

public MessageRequest(String callback, String since, String block) {

    if (StringUtils.isNotEmpty(callback)) {
        if (!callback.matches("[\\._a-zA-Z0-9]*")) {
            throw new InvalidRequestException("invalid_request", "Callback parameter value is malformed");
        }// w ww  .ja  v a2 s  . co  m
    }

    this.since = StringUtils.isBlank(since) ? "" : since;

    try {
        Integer blockSeconds = Integer.valueOf(block);
        if (blockSeconds < 0 || blockSeconds > MAX_BLOCK_SECONDS) {
            throw new InvalidRequestException("Invalid value for block parameter (" + block
                    + "), must be between 0 and " + MAX_BLOCK_SECONDS);
        }
        this.returnBefore = new Date(System.currentTimeMillis() + blockSeconds.longValue() * 1000);
    } catch (NumberFormatException e) {
        throw new InvalidRequestException(
                "Invalid value for block parameter (" + block + "): " + e.getMessage());
    }

}

From source file:com.nec.harvest.provider.OriginalGroupProvider.java

/**
 * Get original group menu from the request
 * /*from   w  w w.j  ava2 s .c o m*/
 * @return ProGNo
 */
public String getOrigGroup() {
    final String processingGroupNumber = (String) getRequest().getAttribute(Constants.SESS_ORIGINAL_GROUP);
    if (StringUtils.isNotEmpty(processingGroupNumber)) {
        return processingGroupNumber;
    }
    return null;
}

From source file:gov.nih.nci.cabig.caaers.service.migrator.StudyMigrator.java

@Override
/**//w  ww .ja v a2  s. co m
 * Will copy the basic properties of the source Study to destination Study.
 */
public void preMigrate(Study src, Study dest, DomainObjectImportOutcome<Study> outcome) {
    dest.setShortTitle(StringUtils.isNotEmpty(src.getShortTitle()) ? src.getShortTitle() : "NA");
    dest.setPhaseCode(src.getPhaseCode());
    dest.setAeReportingLevel(src.getAeReportingLevel());
    if (src.getAeTermUnique() != null) {
        dest.setAeTermUnique(src.getAeTermUnique());
    }
    if (src.getVerbatimFirst() != null) {
        dest.setVerbatimFirst(src.getVerbatimFirst());
    }

    dest.setStudyPurpose(src.getStudyPurpose());
    dest.setParticipationType(src.getParticipationType());
    dest.setLastSynchedDate(new Date());
}

From source file:com.enonic.cms.business.resolver.locale.LocaleXsltScriptResolver.java

protected ScriptResolverResult populateScriptResolverResult(String resolvedValue) {
    ScriptResolverResult result = new ScriptResolverResult();

    if (StringUtils.isNotEmpty(resolvedValue)) {
        Locale locale = null;/*  w w w .  j a va2  s. co  m*/
        try {
            locale = LocaleParser.parseLocale(resolvedValue);
        } catch (Exception e) {
            LOG.warn("Could not parse script-result: '" + resolvedValue + "' to a valid locale");
        }

        result.getResolverReturnValues().put(LOCALE_RETURN_VALUE_KEY, locale);
    }

    return result;
}

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

@SuppressWarnings("unchecked")
@Override/*w w  w . j  av a2 s . co m*/
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 DefaultStateImpl.class;
    }
}