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:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.PaymentDetailsValidator.java

@Override
public void validate(final Object object, final Errors errors) {
    final PaymentDetailsForm form = (PaymentDetailsForm) object;

    final Calendar start = CalendarHelper.parseDate(form.getStartMonth(), form.getStartYear());
    final Calendar expiration = CalendarHelper.parseDate(form.getExpiryMonth(), form.getExpiryYear());

    if (start != null && expiration != null && start.after(expiration)) {
        errors.rejectValue("startMonth", "payment.startDate.invalid");
    }//from w  w w . ja  v  a 2  s  . co m

    final boolean editMode = StringUtils.isNotBlank(form.getPaymentId());
    if (editMode || Boolean.TRUE.equals(form.getNewBillingAddress())) {
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.titleCode", "address.title.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.firstName",
                "address.firstName.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.lastName",
                "address.lastName.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.line1", "address.line1.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.townCity",
                "address.townCity.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.postcode",
                "address.postcode.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.countryIso",
                "address.country.invalid");
        // ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.line2", "address.line2.invalid"); // for some addresses this field is required by cybersource
    }
}

From source file:com.mobile.blue.util.payyl.SDKUtil.java

/**
 * ??/*  w ww.  j  ava  2  s. c  om*/
 * 
 * @param contentData
 *            map
 * @param encoding
 *            ?encoding
 * @return ???map
 */
@SuppressWarnings("unchecked")
public static Map<String, String> signData(Map<String, ?> contentData, String encoding) {
    Entry<String, String> obj = null;
    Map<String, String> submitFromData = new HashMap<String, String>();
    for (Iterator<?> it = contentData.entrySet().iterator(); it.hasNext();) {
        obj = (Entry<String, String>) it.next();
        String value = obj.getValue();
        if (StringUtils.isNotBlank(value)) {
            // value???
            submitFromData.put(obj.getKey(), value.trim());
        }
    }

    SDKUtil.sign(submitFromData, encoding);
    return submitFromData;
}

From source file:com.taobao.adfs.database.tdhsocket.client.easy.impl.WhereImpl.java

public Where fields(String... field) {
    StringBuilder sb = new StringBuilder("|");
    for (String f : field) {
        if (StringUtils.isNotBlank((f))) {
            sb.append(f);// w w  w  .  j av a 2  s.  c  o  m
            sb.append('|');
        }
    }
    get.getTableInfo().setIndex(sb.toString());
    return this;
}

From source file:com.sfs.whichdoctor.search.http.RotationBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request// w  w w. ja va 2s.c  o  m
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = rotationSqlHandler.initiate(user);

    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    RotationBean searchCriteria = (RotationBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}

From source file:de.tsystems.mms.apm.performancesignature.dynatrace.PerfSigEnvContributor.java

@Override
public void buildEnvironmentFor(@Nonnull final Run r, @Nonnull final EnvVars envs,
        @Nonnull final TaskListener listener) throws IOException, InterruptedException {

    List<PerfSigEnvInvisAction> envActions = r.getActions(PerfSigEnvInvisAction.class);
    if (envActions.isEmpty()) {
        return;//from  w  ww  . j ava 2  s . com
    }

    envs.put(SESSIONCOUNT, String.valueOf(envActions.size()));
    int i = 1;
    for (PerfSigEnvInvisAction action : envActions) {
        if (StringUtils.isNotBlank(action.getTestRunID())) {
            envs.put(TESTRUN_ID_KEY + i++, action.getTestRunID());
        }
    }
}

From source file:bazaar4idea.command.BzrPushCommand.java

public BzrStandardResult execute() {
    List<String> arguments = new LinkedList<String>();
    if (StringUtils.isNotBlank(revision)) {
        arguments.add("-r");
        arguments.add(revision);/* w  w  w .j a  va 2 s  .  c om*/
    }
    arguments.add(destination);
    BzrStandardResult result = ShellCommandService.getInstance(project).execute2(repo, "push", arguments);
    if (BzrErrorUtil.isAbort(result) && BzrErrorUtil.isAuthorizationRequiredAbort(result)) {
        try {
            BzrUrl hgUrl = new BzrUrl(destination);
            if (hgUrl.supportsAuthentication()) {
                BzrUsernamePasswordDialog dialog = new BzrUsernamePasswordDialog(project);
                dialog.setUsername(hgUrl.getUsername());
                dialog.show();
                if (dialog.isOK()) {
                    hgUrl.setUsername(dialog.getUsername());
                    hgUrl.setPassword(String.valueOf(dialog.getPassword()));
                    arguments.set(arguments.size() - 1, hgUrl.asString());
                    result = ShellCommandService.getInstance(project).execute2(repo, "push", arguments);
                }
            }
        } catch (URISyntaxException e) {
            VcsImplUtil.showErrorMessage(project, "Invalid destination: " + destination, "Error");
        }
    }

    project.getMessageBus().syncPublisher(BzrVcs.OUTGOING_TOPIC).update(project);

    return result;
}

From source file:com.watchrabbit.scanner.attacker.verify.BasicXSSVerificationStrategy.java

@Override
public Vulnerability verify(RemoteWebDriver driver, long loadMilisec) {
    WebDriverWait wait = new WebDriverWait(driver, 1);
    try {//from w w w .jav  a2  s .c  o m
        wait.until((WebDriver predicatedDriver) -> false);
    } catch (TimeoutException ex) {
        LOGGER.info("Timed out on {}", driver.getCurrentUrl());
    }
    String result = (String) driver.executeScript("return window.w$");

    LOGGER.debug("XSS Attack result is {}", result);
    if (StringUtils.isNotBlank(result)) {
        return Vulnerability.EXISTS;
    } else {
        return Vulnerability.NONE;
    }
}

From source file:com.digitalpebble.stormcrawler.protocol.selenium.NavigationFilters.java

/**
 * Loads and configure the NavigationFilters based on the storm config if
 * there is one otherwise returns an emptyNavigationFilters.
 **//* w  w  w  .j a  v a2  s . c o m*/
@SuppressWarnings("rawtypes")
public static NavigationFilters fromConf(Map stormConf) {
    String configfile = ConfUtils.getString(stormConf, "navigationfilters.config.file");
    if (StringUtils.isNotBlank(configfile)) {
        try {
            return new NavigationFilters(stormConf, configfile);
        } catch (IOException e) {
            String message = "Exception caught while loading the NavigationFilters from " + configfile;
            LOG.error(message);
            throw new RuntimeException(message, e);
        }
    }

    return NavigationFilters.emptyNavigationFilters;
}

From source file:ddf.catalog.test.SecurityPolicyConfigurator.java

public static String createWhitelist(String whitelist) {
    return DEFAULT_WHITELIST + (StringUtils.isNotBlank(whitelist) ? "," + whitelist : "");
}

From source file:hudson.plugins.ec2.util.DeviceMappingParser.java

private static EbsBlockDevice parseEbs(String blockDevice) {

    String[] parts = blockDevice.split(":");

    EbsBlockDevice ebs = new EbsBlockDevice();
    if (StringUtils.isNotBlank(getOrEmpty(parts, 0))) {
        ebs.setSnapshotId(parts[0]);/*from   w ww  .  java2  s .c  om*/
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 1))) {
        ebs.setVolumeSize(Integer.valueOf(parts[1]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 2))) {
        ebs.setDeleteOnTermination(Boolean.valueOf(parts[2]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 3))) {
        ebs.setVolumeType(parts[3]);
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 4))) {
        ebs.setIops(Integer.valueOf(parts[4]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 5))) {
        ebs.setEncrypted(parts[5].equals("encrypted"));
    }

    return ebs;
}