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

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

Introduction

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

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

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

Usage

From source file:net.firejack.platform.core.provider.ConfirmationMessageExceptionMapper.java

@Override
public Response toResponse(ConfirmationMessageException e) {
    String msg = e.getMessage();/* www.  java  2 s  .c om*/
    if (StringUtils.isNotBlank(e.getMsgKey())) {
        msg = MessageResolver.messageFormatting(e.getMsgKey(), headers.getLanguage(), e.getMessageArguments());
    }
    ServiceResponse messageResponse = new ServiceResponse(msg, false);
    return Response.status(Response.Status.CONFLICT).entity(messageResponse).type(headers.getMediaType())
            .build();
}

From source file:net.gasbooknet.beans.WorkForm.java

public void setDateAsString(java.lang.String date) {
    this.dateIsValid = true;
    this.dateAsRawString = date;
    try {// ww  w .  j av a2s .c o  m
        if (StringUtils.isNotBlank(date)) {
            format.parse(date);
        }
    } catch (java.text.ParseException pe) {
        this.dateIsValid = false;
    }
    if (dateIsValid) {
        try {
            this.date = (org.apache.commons.lang.StringUtils.isBlank(date)) ? null : format.parse(date);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

From source file:com.tqlab.plugin.mybatis.database.DatabaseFactoryImpl.java

@Override
public Database getDatabase(final DatabaseEnum databaseEnum, final String database, final String url,
        final Properties properties, final String driver) {

    AbstractDatabase result = null;/*www.j  a v a  2s  . c o  m*/
    switch (databaseEnum) {
    case MYSQL: {
        result = new MySQLDatabase(database, url, properties);
        break;
    }
    case HSQLDB: {
        result = new HsqldbDatabase(database, url, properties);
        break;
    }
    default: {
        //
        break;
    }
    }
    if (null != result) {
        if (StringUtils.isNotBlank(driver)) {
            result.setDriverClass(driver);
        }

        return result;
    }
    throw new MybatisPluginException("database " + databaseEnum.name() + " not supported.");
}

From source file:edu.cornell.kfs.fp.businessobject.options.PaymentMethodsForDVValuesFinder.java

public List<KeyValue> getKeyValues() {
    List<KeyValue> labels = super.getKeyValues();
    if (StringUtils.isNotBlank((String) labels.get(0).getKey())) {
        labels.add(0, new ConcreteKeyValue("", ""));
    }/*w  w  w  .  j  a v  a 2s  .  co m*/
    return labels;
}

From source file:com.puyuntech.flowerToHome.plugin.unionpayPayment.SDKUtil.java

/**
 * ??//ww w  . j a v  a 2s  . c  om
 * @param contentData map
 * @param encoding ?encoding
 * @return???map
 */
@SuppressWarnings("unchecked")
public static Map<String, Object> signData(Map<String, Object> contentData, String encoding) {
    Entry<String, String> obj = null;
    Map<String, String> submitFromData = new HashMap<String, String>();
    for (Iterator<?> it = contentData.entrySet().iterator(); it.hasNext();) {
        obj = (Entry<String, String>) it.next();
        String value = obj.getValue();
        if (StringUtils.isNotBlank(value)) {
            // value???
            submitFromData.put(obj.getKey(), value.trim());
            System.out.println(obj.getKey() + "-->" + String.valueOf(value));
        }
    }

    String stringSign = SDKUtil.sign(submitFromData, encoding);

    contentData.put(SDKConstants.param_signature, stringSign);

    return contentData;
}

From source file:edu.mayo.cts2.framework.plugin.service.lexevs.service.entity.EntityUriResolver.java

public ScopedEntityName resolveUri(String entityUri) {
    String namePart = UriUtils.getLocalPart(entityUri);
    String namespacePart = UriUtils.getNamespace(entityUri);
    String namespacePartWithSeparator = namespacePart + UriUtils.getSeparator(entityUri);

    ScopedEntityName name = new ScopedEntityName();
    name.setName(namePart);//w w w . j a  va 2  s.co  m

    for (String ns : Arrays.asList(namespacePart, namespacePartWithSeparator)) {
        String namespace = this.uriResolver.idToName(ns, IdType.CODE_SYSTEM);

        if (StringUtils.isNotBlank(namespace)) {
            name.setNamespace(namespace);

            return name;
        } else {
            try {
                CodingScheme cs = this.lexBigService.resolveCodingScheme(ns, null);
                name.setNamespace(cs.getCodingSchemeName());
                return name;
            } catch (LBException e) {
                //didn't find it here...
            }
        }
    }

    return null;
}

From source file:com.ultrapower.eoms.common.plugin.ecside.preferences.TableProperties.java

public void init(WebContext context, String preferencesLocation) {
    try {/*from   w w w  . j a va 2s  .  com*/
       InputStream resourceAsStream = getInputStream(PreferencesConstants.ECSIDE_PROPERTIES, context);
       properties.load(resourceAsStream);
        if (StringUtils.isNotBlank(preferencesLocation)) {
           resourceAsStream = getInputStream(preferencesLocation, context);
            if (resourceAsStream != null) {
                properties.load(resourceAsStream);
            }
        }
    } catch (Exception e) {
           LogHandler.errorLog(logger, "Could not load the ECSide preferences.", e);
      }
}

From source file:fr.paris.lutece.plugins.document.utils.IntegerUtils.java

/**
 * Convert a given String into an integer.
 * <br />/* www.  j a va2  s  . c o  m*/
 * If the String is blank or is not numerical, then it returns nDefault
 * @param strToParse the String to parse
 * @param nDefault the default value in case the conversion fails
 * @return the numerical value of the String
 */
public static int convert(String strToParse, int nDefault) {
    if (StringUtils.isNotBlank(strToParse) && StringUtils.isNumeric(strToParse)) {
        return Integer.parseInt(strToParse);
    }

    return nDefault;
}

From source file:ar.com.zauber.commons.conversion.util.ExpressionExtractorConverter.java

/** @param expression una expresion EL {root.size} */
public ExpressionExtractorConverter(final String expression) {
    Validate.isTrue(StringUtils.isNotBlank(expression));
    this.expression = PARSER.parseExpression(expression);
}

From source file:com.enonic.cms.core.search.builder.ContentIndexDataFieldValueSetFactory.java

private static void addOrderbyValue(ContentIndexDataElement element,
        final Set<ContentIndexDataFieldAndValue> contentIndexDataFieldAndValues) {
    final String elementOrderBy = element.getOrderBy();

    if (StringUtils.isNotBlank(elementOrderBy)) {
        contentIndexDataFieldAndValues.add(new ContentIndexDataFieldAndValue(
                element.getFieldBaseName() + INDEX_FIELD_TYPE_SEPARATOR + ORDERBY_FIELDNAME_POSTFIX,
                elementOrderBy));//from w  w  w.  j  a v a 2  s  . c o m
    }
}