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.ottogroup.bi.streaming.operator.json.JsonProcessingUtils.java

/**
 * Splits the given dot-separated value string into an array where each artifact
 * separated by a dot is one element inside the array
 * @param str/*  w  ww .ja  va  2 s  .c om*/
 * @return
 */
public static String[] toPathArray(final String str) {
    if (StringUtils.isNotBlank(str))
        return str.split("\\.");
    return new String[0];
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.DefaultViewField.java

@Override
protected Component initContent() {
    final Label label = new Label();
    label.setWidth("100%");
    label.setContentMode(contentMode);/*from w  w w.  j ava 2 s  .c  o m*/

    if (StringUtils.isNotBlank(value)) {
        label.setValue(value);
    } else {
        label.setValue("");
    }

    return label;
}

From source file:com.tg.webservice.controller.UsuarioController.java

private int registerUser(String name, String uname) {
    System.out.println("Inside checkCredentials");
    int result = 3;
    if (StringUtils.isNotBlank(uname)) {
        try {// www.  j a  v  a  2s .  c  o m
            if (!checkCredentials(uname))
                if (UsuarioDao.insertUser(name, uname)) {
                    System.out.println("RegisterUSer if");
                    result = 0;
                }
        } catch (SQLException sqle) {
            System.out.println("RegisterUSer catch sqle");
            if (sqle.getErrorCode() == 1062) {
                result = 1;
            } else if (sqle.getErrorCode() == 1064) {
                System.out.println(sqle.getErrorCode());
                result = 2;
            }
        } catch (Exception e) {
            System.out.println("Inside checkCredentials catch e ");
            result = 3;
        }
    } else {
        System.out.println("Inside checkCredentials else");
        result = 3;
    }

    return result;
}

From source file:models.service.LoginUserCache.java

public static void refreshBySession(Session session) {
    String uid = UserAuthService.getLoginUid(session);
    if (StringUtils.isNotBlank(uid)) {
        removeUser(uid);//from w ww.j  av  a2s.  c o m
    }
}

From source file:ca.simplegames.micro.controllers.ScriptController.java

/**
 * Construct a new ScriptController for a given script.
 *
 * @param site   The SiteContext/*  w w w.j  ava 2  s  . c  om*/
 * @param script The file representing the script
 */
public ScriptController(SiteContext site, String controllerName, String script) {

    if (StringUtils.isNotBlank(controllerName) && StringUtils.isNotBlank(script)) {
        this.script = script;
        try {
            language = BSFManager.getLangFromFilename(controllerName);
        } catch (BSFException e) {
            e.printStackTrace();
        }
        this.controllerName = controllerName;
    }
}

From source file:com.afeng.common.utils.web.SelectType.java

/**
 * //from  ww w  . jav a  2s  .  co  m
 * @param selectType
 * @return
 */
public static Combobox combobox(String selectType) {
    Combobox selectCombobox = null;
    //combobox  "------"?"------"
    if (StringUtils.isNotBlank(selectType)) {
        SelectType s = SelectType.getSelectTypeValue(selectType);
        String title = selectType;
        if (s != null) {
            title = s.getDescription();
        }
        selectCombobox = new Combobox("", title);
    }
    return selectCombobox;
}

From source file:com.xpn.xwiki.web.LoginSubmitAction.java

@Override
public String render(XWikiContext context) throws XWikiException {
    String msg = (String) context.get("message");
    if (StringUtils.isNotBlank(msg)) {
        context.getResponse().setStatus(HttpServletResponse.SC_FORBIDDEN);
    }/*from w  w w.  j  av  a 2s  .  c  o  m*/
    return "login";
}

From source file:com.thoughtworks.go.config.IdFileService.java

public boolean dataPresent() {
    try {/*w  w w . j  av  a2 s . c om*/
        return StringUtils.isNotBlank(load());
    } catch (Exception ioe) {
        return false;
    }
}

From source file:io.federecio.dropwizard.swagger.ApiListingResource.java

@GET
@Produces({ MediaType.APPLICATION_JSON, "application/yaml" })
@ApiOperation(value = "The swagger definition in either JSON or YAML", hidden = true)
public Response getListing(@Context Application app, @Context ServletConfig sc, @Context HttpHeaders headers,
        @Context UriInfo uriInfo, @PathParam("type") String type) {
    Swagger swagger = process(app, context, sc, headers, uriInfo);

    if (swagger == null)
        return Response.status(404).build();

    String contentType = StringUtils.isNotBlank(type) && type.trim().equalsIgnoreCase("yaml")
            ? "application/yaml"
            : MediaType.APPLICATION_JSON;
    return Response.ok().entity(swagger).type(contentType).build();
}

From source file:com.thoughtworks.go.plugin.configrepo.contract.CRConfigurationProperty.java

public boolean hasEncryptedValue() {
    return StringUtils.isNotBlank(encryptedValue);
}