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

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

Introduction

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

Prototype

public static boolean isBlank(String str) 

Source Link

Document

Checks if a String is whitespace, empty ("") or null.

Usage

From source file:de.codesourcery.jasm16.compiler.io.StringResource.java

public StringResource(String identifier, String data, ResourceType type) {
    super(type);/*from  w ww.  j  a  v  a2  s.c  om*/

    if (StringUtils.isBlank(identifier)) {
        throw new IllegalArgumentException("identifier must not be NULL/blank");
    }
    if (data == null) {
        throw new IllegalArgumentException("data must not be NULL.");
    }
    this.identifier = identifier;
    this.data = data;
}

From source file:de.hybris.platform.acceleratorservices.dataimport.batch.stock.StockTranslator.java

@Override
public void init(final SpecialColumnDescriptor columnDescriptor) {
    String beanName = columnDescriptor.getDescriptorData().getModifier(MODIFIER_NAME_ADAPTER);
    if (StringUtils.isBlank(beanName)) {
        beanName = DEFAULT_IMPORT_ADAPTER_NAME;
    }//from   w  w w . ja v  a 2  s.c o m
    stockImportAdapter = (StockImportAdapter) Registry.getApplicationContext().getBean(beanName);
}

From source file:com.smartitengineering.util.bean.FileSystemResource.java

public FileSystemResource(final String filePath) {
    if (StringUtils.isBlank(filePath)) {
        throw new IllegalArgumentException("File path must not be blank");
    }//from w w w .  j  a  v  a2  s  .  com
    this.filePath = filePath;
    file = new File(filePath);
}

From source file:com.surfs.storage.web.controller.storage.GlobleController.java

@RequestMapping(value = "/globleProperties.do")
public ModelAndView globleProperties(HttpSession session) {
    String dataCenterName = WebUtils.getCrrentDataCenterName(session);
    String dataCenterKey = WebUtils.getCrrentDataCenterKey(session);
    if (StringUtils.isBlank(dataCenterName)) {
        Map<String, String> dataCenterMap = getDataCenterMap();
        for (Entry<String, String> dataCenterObj : dataCenterMap.entrySet()) {
            dataCenterName = dataCenterObj.getValue();
            dataCenterKey = dataCenterObj.getKey();
            // set default dataCenterName
            session.setAttribute("dataCenterKey", dataCenterKey);
            session.setAttribute("dataCenterName", dataCenterName);
            // remove default dataCenterName
            dataCenterMap.remove(dataCenterKey);
            break;
        }/*w  w w .  java  2  s  .c o m*/
        if (dataCenterMap.size() > 0)
            session.setAttribute("dataCenterMap", dataCenterMap);
    }

    try {
        GlobleProperties globleProperties = new Setup(dataCenterKey).getDataSource().getResourcesAccessor()
                .getGlobleProperties();

        return new ModelAndView("globle", "globleProperties", globleProperties);
    } catch (Exception e) {
        session.setAttribute("error", e.getMessage());
        return new ModelAndView("redirect:/login.jsp");
    }
}

From source file:ee.ria.xroad.common.conf.globalconf.AbstractConfigurationPart.java

static final void verifyFieldExists(Map<String, String> headers, String fieldName, String expectedValue) {
    String value = headers.get(fieldName);
    if (StringUtils.isBlank(value)) {
        throw new CodedException(X_INTERNAL_ERROR, "Missing field " + fieldName);
    }//from  www  .ja  va2  s  .c  o m

    if (expectedValue != null && !expectedValue.equals(value)) {
        throw new CodedException(X_INTERNAL_ERROR, "Field " + fieldName + " must have value " + expectedValue);
    }
}

From source file:com.leixl.easyframework.doc.entity.EMovie.java

/**
 * URL?/* w w w  .j  a  v a  2  s .  c  o m*/
 * 
 * @return
 */
public String getUrl() {
    if (!StringUtils.isBlank(getLink())) {
        return getLink();
    }
    return getUrlStatic();
}

From source file:eionet.cr.web.action.admin.harvestscripts.HarvestScriptParser.java

/**
 *
 * @param script//www  . j  ava 2 s .  c o m
 * @param harvestedSource
 * @param associatedType
 * @return
 */
public static String parseForExecution(String script, String harvestedSource, String associatedType) {

    if (StringUtils.isBlank(script)) {
        return script;
    }

    if (!StringUtils.isBlank(harvestedSource)) {
        script = StringUtils.replace(script, "?" + HARVESTED_SOURCE_VARIABLE, "<" + harvestedSource + ">");
    }

    if (!StringUtils.isBlank(associatedType)) {
        script = StringUtils.replace(script, "?" + ASSOCIATED_TYPE_VARIABLE, "<" + associatedType + ">");
    }

    return script;
}

From source file:io.kodokojo.config.module.EmailSenderModule.java

@Singleton
@Provides//w  ww . ja va2  s.com
EmailSender provideEmailSender(EmailConfig emailConfig) {
    if (StringUtils.isBlank(emailConfig.smtpHost())) {
        return new NoopEmailSender();
    } else {
        return new SmtpEmailSender(emailConfig.smtpHost(), emailConfig.smtpPort(), emailConfig.smtpUsername(),
                emailConfig.smtpPassword(), emailConfig.smtpFrom());
    }
}

From source file:com.smartitengineering.event.hub.core.ContentHelper.java

private void convert() {
    if (content != null && StringUtils.isBlank(contentAsString)) {
        try {//from  www  . j a v  a 2  s . c  o  m
            contentAsString = IOUtils.toString(content.getContent());
        } catch (Exception ex) {
        }
    }
}

From source file:com.sillelien.dollar.test.CircleCiParallelRule.java

@Override
public Statement apply(Statement statement, @NotNull Description description) {

    boolean runTest = true;

    final String tName = description.getClassName() + "#" + description.getMethodName();

    final String numNodes = System.getenv("CIRCLE_NODE_TOTAL");
    final String curNode = System.getenv("CIRCLE_NODE_INDEX");

    if (StringUtils.isBlank(numNodes) || StringUtils.isBlank(curNode)) {
        System.out.println("Running locally, so skipping");
    } else {/*from w  w  w . j  a v a2 s  .  co  m*/
        final int hashCode = Math.abs(tName.hashCode());

        int nodeToRunOn = hashCode % Integer.parseInt(numNodes);
        final int curNodeInt = Integer.parseInt(curNode);

        runTest = nodeToRunOn == curNodeInt;

        System.out.println(
                "currentNode: " + curNodeInt + ", targetNode: " + nodeToRunOn + ", runTest: " + runTest);

        if (!runTest) {
            return new Statement() {
                @Override
                public void evaluate() {
                    Assume.assumeTrue("Skipping test, currentNode: " + curNode + ", targetNode: " + nodeToRunOn,
                            false);
                }
            };
        }
    }

    return statement;
}