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

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

Introduction

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

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

Checks if a String is not empty ("") and not null.

Usage

From source file:com.enonic.cms.core.portal.instruction.CreateContentUrlInstruction.java

public void setContentKey(String contentKey) {
    if (StringUtils.isNotEmpty(contentKey)) {
        this.contentKey = contentKey;
    }
}

From source file:com.dearho.cs.subscriber.action.confirm.SubscriberConfirmGetAction.java

@Override
public String process() {
    subscriberConfirm = subscriberConfirmService.querySubscriberConfirmById(subscriberConfirm.getId());

    if (subscriberConfirm.getBusinessFlow() != null
            && StringUtils.isNotEmpty(subscriberConfirm.getBusinessFlow().getReviewerId())) {
        User user = userService.searchUserByID(subscriberConfirm.getBusinessFlow().getReviewerId());
        if (user != null) {
            subscriberConfirm.getBusinessFlow().setReviewerId(user.getName());
        }//  w  ww. j  a  v  a 2 s  .  co  m
    }

    if (subscriberConfirm.getBusinessFlow() != null
            && StringUtils.isNotEmpty(subscriberConfirm.getBusinessFlow().getResultDesc())) {
        String resultDesc = subscriberConfirm.getBusinessFlow().getResultDesc();

        resultList = Arrays.asList(resultDesc.split(","));

    }
    getRequest().setAttribute("type", getRequest().getParameter("type"));

    return SUCCESS;
}

From source file:com.hihframework.core.utils.CurrencyConverter.java

/**
 * Convert a String to a Double and a Double to a String
 *
 * @param type the class type to output/*from w  w  w  .  j  a  va  2s.c  o  m*/
 * @param value the object to convert
 * @return object the converted object (Double or String)
 */
public final Object convert(final Class<?> type, final Object value) {
    // for a null value, return null
    if (value == null) {
        return null;
    } else {
        if (value instanceof String) {
            if (log.isDebugEnabled()) {
                log.debug("value (" + value + ") instance of String");
            }

            try {
                if (StringUtils.isNotEmpty(String.valueOf(value))) {
                    return null;
                }

                if (log.isDebugEnabled()) {
                    log.debug("converting '" + value + "' to a decimal");
                }

                //formatter.setDecimalSeparatorAlwaysShown(true);
                Number num = formatter.parse(String.valueOf(value));

                return new Double(num.doubleValue());
            } catch (ParseException pe) {
                pe.printStackTrace();
            }
        } else if (value instanceof Double) {
            if (log.isDebugEnabled()) {
                log.debug("value (" + value + ") instance of Double");
                log.debug("returning double: " + formatter.format(value));
            }

            return formatter.format(value);
        }
    }

    throw new ConversionException("Could not convert " + value + " to " + type.getName() + "!");
}

From source file:gnete.card.web.infoAndBizQuery.RiskManageQueryAction.java

@Override
public String execute() throws Exception {
    this.riskLevelTypeList = RiskLevelType.getAll();
    this.formMap = this.formMap == null ? new HashMap<String, String>() : this.formMap;
    if (this.formMap.get("type") == null) {
        this.formMap.put("type", "B");
    }//w  w w. jav  a 2s. c  o m

    Assert.isTrue(isCenterOrCenterDeptRoleLogined(), "??????");

    Map<String, Object> params = new HashMap<String, Object>();
    List<String> allowedParamKeys = Arrays.asList("riskLevel", "license", "licenseEffDayCnt",
            "legalPersonIdcard", "legalPersonIdcardEffDayCnt");
    for (String key : allowedParamKeys) {
        if (StringUtils.isNotEmpty(formMap.get(key))) {
            params.put(key, formMap.get(key).trim());
        }
    }
    if ("B".equals(formMap.get("type"))) {// 
        this.page = this.branchInfoDAO.findBranch(params, this.getPageNumber(), this.getPageSize());
    } else if ("M".equals(formMap.get("type"))) {// 
        this.page = this.merchInfoDAO.find(params, this.getPageNumber(), this.getPageSize());
    }
    return LIST;
}

From source file:net.jofm.format.NumberFormat.java

@Override
protected Object doParse(String value, Class<?> destinationClazz) {
    Number result;/*from   w w  w .ja  v a2  s.c o m*/
    try {
        if (StringUtils.isNotEmpty(format)) {
            DecimalFormat formatter = new DecimalFormat(format);
            result = formatter.parse(value);
        } else {
            result = Double.valueOf(value);
        }
    } catch (Exception pe) {
        throw new FixedMappingException(
                "Unable to parse the value '" + value + "' to number with format '" + format + "'");
    }

    return convert(result, destinationClazz);
}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.GroupTableLoader.java

@Override
public void loadComponent() {
    super.loadComponent();

    String fixedGroupingString = element.attributeValue("fixedGrouping");
    if (StringUtils.isNotEmpty(fixedGroupingString)) {
        resultComponent.setFixedGrouping(Boolean.parseBoolean(fixedGroupingString));
    }//from   w  w  w  . j a  v  a2 s . com
}

From source file:com.evolveum.midpoint.repo.sql.util.ContainerOidGenerator.java

private String generate(Object object) {
    Container container = (Container) object;
    if (StringUtils.isNotEmpty(container.getOwnerOid())) {
        return container.getOwnerOid();
    }//from  ww  w.  j  a  v a  2 s. c o  m

    throw new RuntimeException("Unknown oid, should not happen.");
}

From source file:info.magnolia.module.workflow.commands.simple.MessageCommand.java

/**
 * @see info.magnolia.commands.MgnlCommand#execute(info.magnolia.context.Context)
 *///from   w ww  .  ja  v a  2  s .co  m
public boolean execute(Context context) throws Exception {
    String msg = this.getMessage(context);
    if (StringUtils.isNotEmpty(msg)) {
        Messages msgs = MessagesUtil.chainWithDefault(this.getI18nBasename());
        AlertUtil.setMessage(msgs.getWithDefault(msg, msg));
    }
    return false;
}

From source file:com.thoughtworks.inproctester.htmlunit.UrlEncodedContent.java

public String generateFormDataAsString() {
    StringBuilder s = new StringBuilder();

    for (NameValuePair requestParameter : requestParameters) {

        String key = requestParameter.getName();

        if (s.length() > 0) {
            s.append('&');
        }//from ww w .  j  a v  a 2s.  c o m
        s.append(UrlHelper.urlEncode(key)).append("=");
        String value = requestParameter.getValue();

        if (StringUtils.isNotEmpty(value)) {
            s.append(UrlHelper.urlEncode(value));
        }

    }

    return s.toString();
}

From source file:ddf.security.sts.claimsHandler.BindMethodChooser.java

public static BindRequest selectBindMethod(String bindMethod, String bindUserDN, String bindUserCredentials,
        String realm, String kdcAddress) {
    BindRequest request;/*  w w  w.j a v a2 s. co m*/
    switch (bindMethod) {
    case "Simple":
        request = Requests.newSimpleBindRequest(bindUserDN, bindUserCredentials.toCharArray());
        break;
    case "SASL":
        request = Requests.newPlainSASLBindRequest(bindUserDN, bindUserCredentials.toCharArray());
        break;
    case "GSSAPI SASL":
        request = Requests.newGSSAPISASLBindRequest(bindUserDN, bindUserCredentials.toCharArray());
        ((GSSAPISASLBindRequest) request).setRealm(realm);
        ((GSSAPISASLBindRequest) request).setKDCAddress(kdcAddress);
        break;
    case "Digest MD5 SASL":
        request = Requests.newDigestMD5SASLBindRequest(bindUserDN, bindUserCredentials.toCharArray());
        ((DigestMD5SASLBindRequest) request).setCipher(DigestMD5SASLBindRequest.CIPHER_HIGH);
        ((DigestMD5SASLBindRequest) request).getQOPs().clear();
        ((DigestMD5SASLBindRequest) request).getQOPs().add(DigestMD5SASLBindRequest.QOP_AUTH_CONF);
        ((DigestMD5SASLBindRequest) request).getQOPs().add(DigestMD5SASLBindRequest.QOP_AUTH_INT);
        ((DigestMD5SASLBindRequest) request).getQOPs().add(DigestMD5SASLBindRequest.QOP_AUTH);
        if (StringUtils.isNotEmpty(realm)) {
            ((DigestMD5SASLBindRequest) request).setRealm(realm);
        }
        break;
    default:
        request = Requests.newSimpleBindRequest(bindUserDN, bindUserCredentials.toCharArray());
        break;
    }

    return request;
}