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

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

Introduction

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

Prototype

public static String defaultString(final String str) 

Source Link

Document

Returns either the passed in String, or if the String is null , an empty String ("").

 StringUtils.defaultString(null)  = "" StringUtils.defaultString("")    = "" StringUtils.defaultString("bat") = "bat" 

Usage

From source file:de.micromata.genome.gwiki.page.impl.GWikiEditorArtefaktBase.java

public String getTabTitle() {
    return StringUtils.defaultString(partName);
}

From source file:net.andydvorak.intellij.lessc.ui.notifier.NotificationListenerImpl.java

private static boolean isViewFileEvent(@NotNull HyperlinkEvent event) {
    final String description = StringUtils.defaultString(event.getDescription());
    return "file".equals(description) || description.endsWith(".less") || description.endsWith(".css");
}

From source file:ca.uhn.fhir.rest.client.interceptor.BasicAuthInterceptor.java

@Override
public void interceptRequest(IHttpRequest theRequest) {
    String authorizationUnescaped = StringUtils.defaultString(myUsername) + ":"
            + StringUtils.defaultString(myPassword);
    String encoded;/*  w w w .  jav  a  2 s  . c o  m*/
    try {
        encoded = Base64.encodeBase64String(authorizationUnescaped.getBytes("ISO-8859-1"));
    } catch (UnsupportedEncodingException e) {
        throw new InternalErrorException("Could not find US-ASCII encoding. This shouldn't happen!");
    }
    theRequest.addHeader(Constants.HEADER_AUTHORIZATION, ("Basic " + encoded));
}

From source file:de.micromata.genome.gwiki.page.impl.wiki.parser.WeditWikiUtils.java

public static String wikiToWedit(String text) {
    String ret = StringUtils.defaultString(text);
    ret = StringEscapeUtils.escapeXml(ret);

    //    ret = StringUtils.replace(ret, "\n", "<br/>\n");
    //    ret = "<p>" + ret + "</p>";
    return ret;/*w  w w . ja v a  2s .co m*/
}

From source file:com.cognifide.aet.job.common.comparators.permormance.clientside.parser.ClientSidePerformanceParser.java

private ComparatorStepResult.Status getResultStatus(String overallScore) {
    switch (StringUtils.defaultString(overallScore)) {
    case "A":
        return ComparatorStepResult.Status.PASSED;
    case "F":
        return ComparatorStepResult.Status.FAILED;
    default://from w  w  w  .j  a va2  s.co  m
        return ComparatorStepResult.Status.WARNING;
    }
}

From source file:com.cognifide.qa.bb.aem.dialog.classic.field.tags.NamespaceAndPathBuilder.java

/**
 * @return Hacked NamespaceAndPath instance. See class description for explanation.
 *//*from  w  w  w .  j a va 2s . co  m*/
NamespaceAndPath build() {
    namespace = StringUtils.defaultString(namespace);
    path = StringUtils.defaultString(path);

    if ("".equals(namespace) && !path.startsWith(DEFAULT_PARENT_FOR_NO_NAMESPACE_ITEMS)) {
        path = DEFAULT_PARENT_FOR_NO_NAMESPACE_ITEMS + path;
    }
    return new NamespaceAndPath(namespace, path);
}

From source file:com.netsteadfast.greenstep.base.filter.WebLoginCheckFilter.java

private boolean isLogin(HttpServletRequest httpRequest, AccountObj accountObj) {
    Map<String, String> dataMap = UserCurrentCookie.getCurrentData(httpRequest);
    String account = StringUtils.defaultString(dataMap.get("account"));
    String currentId = StringUtils.defaultString(dataMap.get("currentId"));
    if (StringUtils.isBlank(account)) {
        return false;
    }// w w w .ja va 2s . c  o  m
    if (!accountObj.getAccount().equals(account)) {
        return false;
    }
    try {
        if (this.uSessLogHelper.countByCurrent(account, currentId) > 0) {
            return true;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}

From source file:io.wcm.handler.link.testcontext.DummyAppTemplate.java

private DummyAppTemplate(String templatePath) {
    this.templatePath = templatePath;

    // build resource type from template path
    String resourceTypeFromTemplatePath = null;
    final Pattern TEMPLATE_PATH_PATTERN = Pattern.compile("^/apps/([^/]+)/templates(/.*)?/([^/]+)$");
    Matcher templateParts = TEMPLATE_PATH_PATTERN.matcher(templatePath);
    if (templateParts.matches()) {
        resourceTypeFromTemplatePath = "/apps/" + templateParts.group(1) + "/components"
                + StringUtils.defaultString(templateParts.group(2)) + "/page/" + templateParts.group(3);
    }/*from  w  w  w. j  a v a  2s.com*/

    this.resourceType = resourceTypeFromTemplatePath;
}

From source file:com.netsteadfast.greenstep.base.chain.SimpleChain.java

private ChainResultObj getResult(Context context) throws Exception {
    ChainResultObj resultObj = new ChainResultObj();
    resultObj.setValue(context.get(ChainConstants.CHAIN_RESULT));
    resultObj.setMessage(StringUtils.defaultString((String) context.get(ChainConstants.CHAIN_MESSAGE)));
    return resultObj;
}

From source file:de.micromata.genome.gwiki.pagelifecycle_1_0.debug.PlcTenantsActionBean.java

public void init() {
    GWikiMptIdSelector idsel = getTenantSelector();
    if (idsel == null) {
        currentTenant = null;/*from ww  w.  j  av  a  2 s .  c om*/
        return;
    }
    currentTenant = StringUtils
            .defaultString(idsel.getTenantId(GWikiServlet.INSTANCE, wikiContext.getRequest()));
    if (StringUtils.isEmpty(currentTenant) == true) {
        currentTenant = null;
    }
}