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:io.github.jeddict.orm.generator.compiler.ConvertSnippet.java

public ConvertSnippet(Convert convert) {
    converterClass = StringUtils.isNotBlank(convert.getConverter()) ? new ClassHelper(convert.getConverter())
            : null;/*  w  w  w.  jav  a  2  s .c om*/
    disableConversion = convert.isDisableConversion();
    attributeName = convert.getAttributeName();
}

From source file:com.googlecode.jtiger.modules.ecside.view.html.RowBuilder.java

public void rowStart() {
    html.tr(0);//ww  w.  jav  a 2s  . c  o  m
    if (StringUtils.isNotBlank(row.getId())) {
        html.append(" id=\"" + row.getId() + "\" ");
    }
    styleClass();
    style();
    onclick();
    ondblclick();
    onmouseover();
    onmouseout();

    html.append(" ").append(ECSideUtils.nullToBlank(row.getTagAttributes())).append(" ");
    html.append(row.getAttribute(TableConstants.EXTEND_ATTRIBUTES));

    String recordKey = row.getRecordKey();
    if (StringUtils.isNotBlank(recordKey)) {
        html.append(" recordKey=\"").append(recordKey).append("\" ");
    }
    html.close();
}

From source file:com.iorga.webappwatcher.util.InstanceSetParameterHandler.java

@SuppressWarnings("unchecked")
@Override//from  w ww.j a  va  2s  .  c o  m
protected Set<I> convertFromString(final String value) {
    final Set<I> instances = Sets.newHashSet();
    final String[] includes = value.split(",");
    for (final String className : includes) {
        if (StringUtils.isNotBlank(className)) {
            try {
                instances.add((I) parameterscontext.get(Class.forName(className)));
            } catch (final ClassNotFoundException e) {
                log.warn("Can't get instance of " + className, e);
            }
        }
    }
    return instances;
}

From source file:io.fabric8.jenkins.openshiftsync.BuildDecisionHandler.java

@Override
public boolean shouldSchedule(Queue.Task p, List<Action> actions) {
    if (p instanceof WorkflowJob && !isOpenShiftBuildCause(actions)) {
        WorkflowJob wj = (WorkflowJob) p;
        BuildConfigProjectProperty buildConfigProjectProperty = wj
                .getProperty(BuildConfigProjectProperty.class);
        if (buildConfigProjectProperty != null
                && StringUtils.isNotBlank(buildConfigProjectProperty.getNamespace())
                && StringUtils.isNotBlank(buildConfigProjectProperty.getName())) {

            String namespace = buildConfigProjectProperty.getNamespace();
            String jobURL = joinPaths(getJenkinsURL(getOpenShiftClient(), namespace), wj.getUrl());

            getOpenShiftClient().buildConfigs().inNamespace(namespace)
                    .withName(buildConfigProjectProperty.getName())
                    .instantiate(new BuildRequestBuilder().withNewMetadata()
                            .withName(buildConfigProjectProperty.getName()).and().addNewTriggeredBy()
                            .withMessage("Triggered by Jenkins job at " + jobURL).and().build());
            return false;
        }//www. j  a v  a2s  .c o  m
    }

    return true;
}

From source file:com.cognifide.slice.cq.taglib.CatchTag.java

/** {@inheritDoc} */
@Override//from   w  ww .j a  v a 2  s  . c o m
public int doStartTag() {
    // in case previous instance set a throwable under the same name
    if (StringUtils.isNotBlank(throwableVariableName)) {
        pageContext.removeAttribute(throwableVariableName, PageContext.PAGE_SCOPE);
    }
    return EVAL_BODY_INCLUDE;
}

From source file:com.janrain.servlet.JsonpCallbackFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {

    HttpServletRequest httpRequest = (HttpServletRequest) request;
    HttpServletResponse httpResponse = (HttpServletResponse) response;

    Map<String, String[]> parameters = httpRequest.getParameterMap();
    String callbackName = "";
    String[] values = parameters.get("callback");
    if (values != null) {
        callbackName = values[0];//from w  ww . jav a  2 s  .  co  m
    }

    if (StringUtils.isNotBlank(callbackName)) {
        // wrap the json in the callback
        OutputStream stream = httpResponse.getOutputStream();
        GenericResponseWrapper wrapper = new GenericResponseWrapper(httpResponse);

        chain.doFilter(request, wrapper);

        stream.write((callbackName + "(").getBytes());
        stream.write(wrapper.getData());
        stream.write(");".getBytes());

        wrapper.setContentType("text/javascript;charset=UTF-8");
        // always return 200 when using the callback to allow the message to
        // reach the browser based function
        wrapper.setStatus(HttpServletResponse.SC_OK);
        stream.close();

    } else {
        // pass the request/response on
        chain.doFilter(request, response);
    }

}

From source file:com.safetys.framework.jmesa.core.message.ResourceBundleMessages.java

public ResourceBundleMessages(String messagesLocation, WebContext webContext) {
    this.locale = webContext.getLocale();
    try {/*ww w . j  av  a 2 s.  co  m*/
        defaultResourceBundle = getResourceBundle(JMESA_RESOURCE_BUNDLE);
        if (StringUtils.isNotBlank(messagesLocation)) {
            customResourceBundle = getResourceBundle(messagesLocation);
        }
    } catch (MissingResourceException e) {
        if (logger.isErrorEnabled()) {
            logger.error("The resource bundle [" + messagesLocation
                    + "] was not found. Make sure the path and resource name is correct.");
        }
    }
}

From source file:de.tudarmstadt.ukp.clarin.webanno.brat.display.model.VID.java

public static VID parseOptional(String aVid) {
    if (StringUtils.isNotBlank(aVid)) {
        return parse(aVid);
    } else {/*from  w w  w . j  a va2s.  com*/
        return new VID(NONE);
    }
}

From source file:io.kahu.hawaii.domain.validation.MandatoryPropertyValidator.java

@Override
public boolean isValid(ValueHolder value, ConstraintValidatorContext context) {
    if (value == null) {
        return false;
    }/*  w  w w.ja v  a2 s  . c o m*/
    if (value instanceof ValidatableDomainObject) {
        return true;
    }
    boolean isEmpty = value.isEmpty();
    if (isEmpty) {
        context.disableDefaultConstraintViolation();
        String message = "Mandatory property '%s' is empty.";
        context.buildConstraintViolationWithTemplate(message).addConstraintViolation();
    }
    if (StringUtils.isNotBlank(key) && !value.isEmpty()) {
        if (value instanceof ValidatableDomainProperty) {
            if (!((ValidatableDomainProperty) value).validate()) {
                context.disableDefaultConstraintViolation();
                context.buildConstraintViolationWithTemplate("INVALID").addConstraintViolation();
                return false;
            }
        }
    }

    return !isEmpty;
}

From source file:com.playonlinux.apps.AppsFilter.java

@Override
public boolean test(AppEntity item) {
    if (StringUtils.isBlank(title) && category == null) {
        return false;
    }/*from w w  w  .  ja  v a  2 s.  co m*/

    if (StringUtils.isNotBlank(title)) {
        if (!item.getName().toLowerCase().contains(title.toLowerCase())) {
            return false;
        }
    } else if (category != null && !category.equals(item.getCategoryName())) {
        return false;
    }

    return !(item.isTesting() && !showTesting) && !(item.isRequiresNoCd() && !showNoCd)
            && !(item.isCommercial() && !showCommercial);

}