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

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

Introduction

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

Prototype

public static boolean isNotBlank(final CharSequence cs) 

Source Link

Document

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

 StringUtils.isNotBlank(null)      = false StringUtils.isNotBlank("")        = false StringUtils.isNotBlank(" ")       = false StringUtils.isNotBlank("bob")     = true StringUtils.isNotBlank("  bob  ") = true 

Usage

From source file:com.thinkbiganalytics.security.core.encrypt.EncryptionService.java

public String encrypt(String str) {
    String encrypted = null;/*from w w  w.  j  a v a2  s .  c  om*/
    if (StringUtils.isNotBlank(str) && !isEncrypted(str)) {
        encrypted = encryptor.encrypt(str);
        if (!StringUtils.startsWith(encrypted, CIPHER_PREFIX)) {
            encrypted = CIPHER_PREFIX + encrypted;
        }
    } else {
        encrypted = str;
    }
    return encrypted;
}

From source file:com.msopentech.odatajclient.engine.data.ODataLinkType.java

/**
 * Gets//w w w  .  j av  a  2  s. c  o  m
 * <code>ODataLinkType</code> instance from the given rel and type.
 *
 * @param client OData client.
 * @param rel rel.
 * @param type type.
 * @return <code>ODataLinkType</code> object.
 */
public static ODataLinkType fromString(final ODataClient client, final String rel, final String type) {
    if (StringUtils.isNotBlank(rel) && rel
            .startsWith(client.getWorkingVersion().getNamespaceMap().get(ODataVersion.MEDIA_EDIT_LINK_REL))) {

        return MEDIA_EDIT.setType(StringUtils.isBlank(type) ? "*/*" : type);
    }

    if (ODataLinkType.ENTITY_NAVIGATION.type.equals(type)) {
        return ENTITY_NAVIGATION;
    }

    if (ODataLinkType.ENTITY_SET_NAVIGATION.type.equals(type)) {
        return ENTITY_SET_NAVIGATION;
    }

    if (ODataLinkType.ASSOCIATION.type.equals(type)) {
        return ASSOCIATION;
    }

    throw new IllegalArgumentException("Invalid link type: " + type);
}

From source file:com.thinkbiganalytics.nifi.provenance.model.util.ProvenanceEventDtoUtil.java

public static boolean isFlowFileQueueEmptied(ProvenanceEventRecordDTO event) {
    return (isEndingFlowFileEvent(event) && StringUtils.isNotBlank(event.getDetails())
            && event.getDetails().toLowerCase().startsWith(FLOWFILE_QUEUE_EMPTIED));
}

From source file:com.citytechinc.cq.clientlibs.api.util.ComponentUtils.java

public static Set<String> getNestedComponentTypes(Resource root, boolean inclusive) {

    Set<Resource> flattenedResourceTree = flattenResourceTree(root, inclusive);

    Set<String> resourceTypeSet = Sets.newHashSet();

    for (Resource currentResource : flattenedResourceTree) {
        if (currentResource.getResourceType() != null
                && StringUtils.isNotBlank(currentResource.getResourceType())) {
            resourceTypeSet.add(currentResource.getResourceType());
        }/* ww  w  . ja va2 s.  c o m*/
    }

    return resourceTypeSet;

}

From source file:de.blizzy.documentr.markdown.macro.impl.AbstractMarkdownMacroRunnable.java

@Override
public final String getHtml(IMacroContext macroContext) {
    String markdown = getMarkdown(macroContext);
    if (StringUtils.isNotBlank(markdown)) {
        HtmlSerializerContext context = macroContext.getHtmlSerializerContext();
        return context.markdownToHtml(markdown);
    }/*from w w  w .  j a  v a  2  s .  c om*/
    return null;
}

From source file:com.gdo.stencils.cond.PathCondition.java

public PathCondition(C stclContext, String pathCondition, S stcl) {
    if (StringUtils.isNotBlank(pathCondition) && pathCondition.startsWith("({")) {
        String path = pathCondition.substring(2, pathCondition.length() - 2);
        _pathCondition = "(" + stcl.getString(stclContext, path, "") + ")";
    } else {/*from ww w .  j  a  v  a 2 s .c  o  m*/
        _pathCondition = pathCondition;
    }
}

From source file:fi.foyt.fni.utils.licenses.CreativeCommonsLicense.java

public String getIconUrl(boolean compact) {
    StringBuilder urlBuilder = new StringBuilder();

    if (secure) {
        urlBuilder.append("https:");
    } else {//from   ww  w . j  a  v a 2 s. c  om
        urlBuilder.append("http:");
    }

    urlBuilder.append(ICON_PREFIX);
    urlBuilder.append(StringUtils.join(properties, '-'));
    urlBuilder.append('/');

    if (StringUtils.isNotBlank(version)) {
        urlBuilder.append(version);
    } else {
        urlBuilder.append(DEFAULT_VERSION);
    }

    if (StringUtils.isNotBlank(jurisdiction)) {
        urlBuilder.append('/');
        urlBuilder.append(jurisdiction);
    }

    urlBuilder.append('/');

    if (compact) {
        urlBuilder.append(COMPACT_ICON);
    } else {
        urlBuilder.append(NORMAL_ICON);
    }

    return urlBuilder.toString();
}

From source file:com.ihandy.quote_core.serverpage.picc.IsXuBaoPage.java

@Override
public Response getResponse(String html, Request request) {
    Response response = new Response();
    if (StringUtils.isNotBlank(html)) {//?
        Map<String, Object> returnMap = new HashMap<>();
        JSONObject obj = JSONObject.parseObject(html);
        String proposalNo = obj.getJSONArray("data").getJSONObject(0).getString("proposalNo");
        returnMap.put("proposalNo", proposalNo);//???
        response.setResponseMap(returnMap);
        response.setReturnCode(SysConfigInfo.SUCCESS200);
        response.setErrMsg(SysConfigInfo.SUCCESS200MSG);
    } else {//from   www  . j  a va 2  s  .  co  m
        response.setResponseMap(null);
        response.setReturnCode(SysConfigInfo.ERROR404);
        response.setErrMsg(SysConfigInfo.ERROR404MSG);
    }
    return response;
}

From source file:br.ufac.sion.dao.CargoFacade.java

@Override
public List<Cargo> findByDescricaoAndNivel(Cargo filtro) {
    Session session = em.unwrap(Session.class);
    Criteria criteria = session.createCriteria(Cargo.class);

    if (StringUtils.isNotBlank(filtro.getDescricao())) {
        criteria.add(Restrictions.ilike("descricao", filtro.getDescricao(), MatchMode.ANYWHERE));
    }//  w  w w . j  av a  2s.c  o  m

    if (filtro.getNivel() != null) {
        criteria.add(Restrictions.eq("nivel", filtro.getNivel()));
    }

    return criteria.addOrder(Order.asc("descricao")).list();
}

From source file:io.github.robwin.swagger2markup.utils.PropertyUtils.java

public static String getType(Property property, MarkupLanguage markupLanguage) {
    Validate.notNull(property, "property must not be null!");
    String type;//from   w  w  w . j  a va 2s .  c om
    if (property instanceof RefProperty) {
        RefProperty refProperty = (RefProperty) property;
        switch (markupLanguage) {
        case ASCIIDOC:
            return "<<" + refProperty.getSimpleRef() + ">>";
        default:
            return refProperty.getSimpleRef();
        }
    } else if (property instanceof ArrayProperty) {
        ArrayProperty arrayProperty = (ArrayProperty) property;
        Property items = arrayProperty.getItems();
        type = getType(items, markupLanguage) + " " + arrayProperty.getType();
    } else if (property instanceof StringProperty) {
        StringProperty stringProperty = (StringProperty) property;
        List<String> enums = stringProperty.getEnum();
        if (CollectionUtils.isNotEmpty(enums)) {
            type = "enum" + " (" + StringUtils.join(enums, ", ") + ")";
        } else {
            type = property.getType();
        }
    } else {
        if (StringUtils.isNotBlank(property.getFormat())) {
            type = StringUtils.defaultString(property.getType()) + " (" + property.getFormat() + ")";
        } else {
            type = property.getType();
        }
    }
    return StringUtils.defaultString(type);
}