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:com.baidu.rigel.biplatform.ac.util.JsonUnSeriallizableUtils.java

/**
 * DataModeljson??DataModel???/*from  ww w  .  j a  v a2 s  .  c  om*/
 * 
 * @param dataModelJson DataModeljson
 * @return json??DataModel
 */
public static DataModel dataModelFromJson(String dataModelJson) {
    if (StringUtils.isBlank(dataModelJson)) {
        throw new IllegalArgumentException("datamodel json is empty.");
    }
    DataModel dataModel = AnswerCoreConstant.GSON.fromJson(dataModelJson, DataModel.class);
    setHeadFieldParent(dataModel.getRowHeadFields(), null, null);
    setHeadFieldParent(dataModel.getColumnHeadFields(), null, null);
    return dataModel;

}

From source file:controllers.user.UserResumeApp.java

/**
 * Tab??/*from ww  w  .  ja  va  2s. c o m*/
 *
 * @return
  */
@Transactional(readOnly = true)
public static Result userhead() {
    DynamicForm requestData = Form.form().bindFromRequest();
    Long userId = new Long(requestData.get("userId"));
    User user = User.findById(userId);
    if (StringUtils.isBlank(user.avatar)) {
        String headUrl = Assets.at(Assets.getDefaultAvatar());
        return ok(views.html.usercenter.detailUS.userhead.render(userId, headUrl));
    }
    String headUrl = Assets.at(User.getAvatarFileRelativePath(userId, 190));
    return ok(views.html.usercenter.detailUS.userhead.render(userId, headUrl));
}

From source file:io.github.jeddict.jsonb.modeler.spec.JSONBNode.java

/**
 * @return the name// w  ww.ja va 2  s  .c o m
 */
@Override
public String getName() {
    if (!StringUtils.isBlank(attribute.getJsonbProperty())) {
        return attribute.getJsonbProperty();
    }
    return attribute.getName();
}

From source file:ch.entwine.weblounge.common.url.PathUtils.java

/**
 * Concatenates the path elements with respect to leading and trailing
 * slashes. The path will always end with a trailing slash.
 * /* ww  w. jav a2s  .  c  o m*/
 * @param pathElements
 *          the path elements
 * @return the concatenated url of the two arguments
 * @throws IllegalArgumentException
 *           if less than two path elements are provided
 */
public static String concat(String... pathElements) throws IllegalArgumentException {
    if (pathElements == null || pathElements.length < 1)
        throw new IllegalArgumentException("Prefix cannot be null or empty");
    if (pathElements.length < 2)
        throw new IllegalArgumentException("Suffix cannot be null or empty");

    StringBuffer b = new StringBuffer();
    for (String s : pathElements) {
        if (StringUtils.isBlank(s))
            throw new IllegalArgumentException("Path element cannot be null");
        String element = adjustSeparator(s);
        element = removeDoubleSeparator(element);
        element = cleanSpecializedCharacter(element);

        if (b.length() == 0) {
            b.append(element);
        } else if (b.lastIndexOf(File.separator) < b.length() - 1 && !element.startsWith(File.separator)) {
            b.append(File.separator).append(element);
        } else if (b.lastIndexOf(File.separator) == b.length() - 1 && element.startsWith(File.separator)) {
            b.append(element.substring(1));
        } else {
            b.append(element);
        }
    }

    return b.toString();
}

From source file:com.leixl.easyframework.doc.dao.impl.EMovieDaoImpl.java

public Pagination getPage(String name, Boolean disabled, int pageNo, int pageSize) {
    Finder f = Finder.create("select bean from EMovie bean");

    f.append(" where 1=1");
    if (!StringUtils.isBlank(name)) {
        f.append(" and bean.name like :name");
        f.setParam("name", "%" + name + "%");
    }// w w  w .  ja  v  a 2 s.  com
    if (disabled != null) {
        f.append(" and bean.disabled=:disabled");
        f.setParam("disabled", disabled);
    }
    f.append(" order by bean.id desc");
    return find(f, pageNo, pageSize);
}

From source file:com.gantzgulch.sharing.form.FileUploadValidator.java

@Override
public void validate(Object target, Errors errors) {

    SharedFileUploadForm form = (SharedFileUploadForm) target;

    if (StringUtils.isBlank(form.getFile().getOriginalFilename())) {
        errors.rejectValue("file", "file.no_name", "File must have a name.");
    }/*from  ww w .j  a  va 2 s . co m*/

    if (form.getFile().getSize() == 0) {
        errors.rejectValue("file", "file.empty", "No empty files.");
    }

}

From source file:com.qcadoo.tenant.api.SamplesDataset.java

/**
 * Parse {@link SamplesDataset} from string
 * /*  w  w  w  . ja  va  2 s.c o m*/
 * @param string
 *            to parse
 * @return appropriate {@link SamplesDataset}
 * @throws IllegalArgumentException
 *             if there is no {@link SamplesDataset} matching to given string
 */
public static final SamplesDataset parseString(final String string) {
    if (StringUtils.isBlank(string) || "none".equalsIgnoreCase(string)) {
        return NONE;
    } else if ("minimal".equalsIgnoreCase(string)) {
        return MINIMAL;
    } else if ("test".equalsIgnoreCase(string)) {
        return TEST;
    } else if ("generated".equalsIgnoreCase(string)) {
        return GENERATED;
    }
    throw new IllegalArgumentException("Wrong samples dataset: " + string);
}

From source file:com.prowidesoftware.swift.model.field.Field11STest.java

@Test
public void testSerialization2() throws Exception {
    Field11S field11s = new Field11S();
    field11s.setComponent1("195");
    field11s.setComponent2(Calendar.getInstance());
    field11s.setComponent3(2);//w w w  .  j  a v  a  2 s  .  c  o  m
    Tag tag = field11s.asTag();
    String val = tag.getValue();
    assertFalse(StringUtils.isBlank(val));
}

From source file:com.salesmanager.core.util.CustomerUtil.java

public static String getCustomerShippingState(Customer customer, Locale locale) {

    if (!StringUtils.isBlank(customer.getCustomerState())) {
        return customer.getCustomerState();
    }/*from   w  w w. j a v  a  2s. co m*/

    Map zones = RefCache.getAllZonesmap((LanguageUtil.getLanguageNumberCode(locale.getLanguage())));
    Zone zone = (Zone) zones.get(customer.getCustomerZoneId());
    if (zone != null) {
        return zone.getZoneName();
    }
    return "";
}

From source file:com.elasticbox.jenkins.k8s.util.PluginHelper.java

public static boolean anyOfThemIsBlank(String... inputParameters) {
    for (String inputParameter : inputParameters) {
        if (StringUtils.isBlank(inputParameter)) {
            return true;
        }/*www  .  j a  va 2 s .  co m*/
    }
    return false;
}