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:edu.bu.kuali.kra.award.sapintegration.ValidationError.java

public ValidationError(String errorKey, List<String> errorParams) {
    if (StringUtils.isBlank(errorKey)) {
        throw new IllegalArgumentException("The error key must be non-null.");
    }//from   www  .j  ava 2  s  .co m
    this.errorKey = errorKey;
    this.errorParams = new ArrayList<String>(errorParams);
    if (errorParams != null) {
        Collections.copy(this.errorParams, errorParams);
    }
}

From source file:com.haulmont.chile.core.datatypes.impl.UUIDDatatype.java

@Override
public UUID parse(String value) throws ParseException {
    if (StringUtils.isBlank(value)) {
        return null;
    } else {/*w  w w.  j a  va2s  . c  o m*/
        try {
            return UuidProvider.fromString(value.trim());
        } catch (Exception e) {
            throw new ParseException("Error parsing UUID", 0);
        }
    }
}

From source file:eionet.cr.util.FolderUtil.java

/**
 * Extract ACL path for special folders: projects and home. Until DDC not done, main project/home folder ACL is used
 *
 * @param uri uri of the folder//from  w w  w  . j a va  2s  . c o m
 * @param specialFolderName - special folder prefix in the name
 * @return String acl path of th given folder
 */
public static String extractSpecialAclPath(String uri, String specialFolderName) {
    String appHome = GeneralConfig.getProperty(GeneralConfig.APPLICATION_HOME_URL);
    String aclPath = StringUtils.substringAfter(uri, appHome);

    if (aclPath.startsWith("/" + specialFolderName)) {
        String path = extractPathInSpecialFolder(uri, specialFolderName);
        if (!StringUtils.isBlank(path)) {
            String[] tokens = path.split("/");
            if (tokens != null && tokens.length > 0) {
                aclPath = "/" + specialFolderName + "/" + tokens[0];
            }
        }
    }

    return aclPath;
}

From source file:com.jnj.b2b.storefront.forms.validation.B2BUpdatePasswordFormValidator.java

@Override
public void validate(final Object obj, final Errors errors) {
    final UpdatePasswordForm form = (UpdatePasswordForm) obj;
    if (StringUtils.isBlank(form.getCurrentPassword())) {
        errors.rejectValue("currentPassword", "profile.currentPassword.invalid");
    }//from ww  w  . j  ava  2  s  .com
    if (!matchPattern(form.getNewPassword())) {
        errors.rejectValue("newPassword", "updatePwd.pwd.invalid");
    }
    if (!matchPattern(form.getCheckNewPassword())) {
        errors.rejectValue("checkNewPassword", "updatePwd.checkPwd.invalid");
    }
    isCheckEquals(form, errors);
}

From source file:com.googlecode.jtiger.modules.ecside.core.bean.TableDefaults.java

static String getBorder(TableModel model, String border) {
    if (StringUtils.isBlank(border)) {
        return model.getPreferences().getPreference(PreferencesConstants.TABLE_BORDER);
    }/*w w w.ja  v  a 2s  .com*/

    return border;
}

From source file:com.netflix.spinnaker.halyard.config.validate.v1.ha.ClouddriverHaServiceValidator.java

@Override
public void validate(ConfigProblemSetBuilder p, ClouddriverHaService clouddriverHaService) {
    boolean redisMasterEndpointIsBlank = StringUtils.isBlank(clouddriverHaService.getRedisMasterEndpoint());
    boolean redisSlaveEndpointIsBlank = StringUtils.isBlank(clouddriverHaService.getRedisSlaveEndpoint());
    boolean redisSlaveDeckEndpointIsBlank = StringUtils
            .isBlank(clouddriverHaService.getRedisSlaveDeckEndpoint());

    if (clouddriverHaService.isDisableClouddriverRoDeck()) {
        if (redisMasterEndpointIsBlank && redisSlaveEndpointIsBlank) {
            return;
        }//  w ww. jav a 2s .c  o  m
        if (redisMasterEndpointIsBlank || redisSlaveEndpointIsBlank) {
            p.addProblem(Problem.Severity.ERROR,
                    "Please provide values for Clouddriver Redis master endpoint and Redis slave endpoint, or leave them both blank.");
        }
    } else {
        if (redisMasterEndpointIsBlank && redisSlaveEndpointIsBlank && redisSlaveDeckEndpointIsBlank) {
            return;
        }
        if (redisMasterEndpointIsBlank || redisSlaveEndpointIsBlank || redisSlaveDeckEndpointIsBlank) {
            p.addProblem(Problem.Severity.ERROR,
                    "Please provide values for Clouddriver Redis master endpoint, Redis slave endpoint, and Redis slave-deck endpoint or leave them all blank.");
        }
    }
}

From source file:edu.northwestern.bioinformatics.studycalendar.core.editors.CollectionEditor.java

@SuppressWarnings("unchecked")
public void setValue(Object value) {
    if (value == null) {
        super.setValue(null);
    } else if (value instanceof String) {
        String valueString = (String) value;
        if (StringUtils.isBlank(valueString)) {
            super.setValue(null);
        } else {//from  www .j  a  va2  s .  c  o  m
            String[] texts = EditorUtils.splitValue(valueString);
            Collection target = createCollection(this.collectionType, texts.length);
            for (String text : texts) {
                String decodedText = EditorUtils.getDecodedString(text);
                if (decodedText == null || StringUtils.isBlank(decodedText)) {
                    target.add(null);
                } else {
                    target.add(convertElement(decodedText));
                }
            }
            super.setValue(target);
        }
    }
}

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

public ClassPathResource(String classpathLocation, ResourceType type) {
    super(type);//from   ww w .  j  av a 2 s  .  c  o  m

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

From source file:net.nan21.dnet.module.md.presenter.ext.mm.service.Product_DsService.java

@Override
protected void postFind(IQueryBuilder<Product_Ds, Product_Ds, Object> builder, List<Product_Ds> result)
        throws Exception {

    String MM_PRODUCT_ICON_BASEURL = this.getSettings().getParam(SysParams_Md.MM_PRODUCT_ICON_BASEURL);

    String MM_PRODUCT_ICON_EXT = this.getSettings().getParam(SysParams_Md.MM_PRODUCT_ICON_EXT);

    String MM_PRODUCT_ICON_SUFFIX = this.getSettings().getParam(SysParams_Md.MM_PRODUCT_ICON_SUFFIX);

    for (Product_Ds ds : result) {

        if (StringUtils.isBlank(ds.getIconUrl())) {
            ds.setIconLocation(MM_PRODUCT_ICON_BASEURL + "/" + ds.getCode() + MM_PRODUCT_ICON_SUFFIX + "."
                    + MM_PRODUCT_ICON_EXT);
        } else {//from  w w  w.  j a v  a 2s  .  c  om
            if (!ds.getIconUrl().startsWith("http")) {
                ds.setIconLocation(MM_PRODUCT_ICON_BASEURL + "/" + ds.getIconUrl());
            } else {
                ds.setIconLocation(ds.getIconUrl());
            }
        }
    }

}

From source file:com.switchfly.inputvalidation.sanitizer.CleanPatternSanitizer.java

@Override
public String execute(String content) {
    if (StringUtils.isBlank(content)) {
        return content;
    }//from www. ja v a 2  s .  c  om
    Matcher matcher = _pattern.matcher(content);
    StringBuilder builder = new StringBuilder();
    while (matcher.find()) {
        builder.append(matcher.group());
    }
    return builder.toString();
}