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:de.hybris.platform.commercewebservicescommons.errors.converters.WebserviceExceptionConverter.java

@Override
public void populate(final Object o, final List<ErrorWsDTO> webserviceErrorList) {
    final WebserviceException ex = (WebserviceException) o;
    final ErrorWsDTO error = createTargetElement();

    if (StringUtils.isNotEmpty(ex.getSubject())) {
        error.setSubject(ex.getSubject());
        if (StringUtils.isNotEmpty(ex.getSubjectType())) {
            error.setSubjectType(ex.getSubjectType());
        }//from w w w. ja  v a 2 s  . com
    }
    if (StringUtils.isNotEmpty(ex.getReason())) {
        error.setReason(ex.getReason());
    }
    if (StringUtils.isNotBlank(ex.getType())) {
        error.setType(ex.getType());
    }
    error.setMessage(ex.getMessage());
    webserviceErrorList.add(error);
}

From source file:net.jforum.core.tags.URLTag.java

/**
 * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag()
 *//* w  w w.j a v  a  2  s. co m*/
@Override
public void doTag() throws JspException, IOException {

    StringBuilder urlBuilder = new StringBuilder(128).append(this.request().getContextPath());

    if (!encode) {
        urlBuilder.append(this.address);
    } else {
        if (this.address == null) {
            this.address = "";
        }

        String[] addresses = this.address.split("/");

        for (String _address : addresses) {
            if (StringUtils.isNotEmpty(_address)) {
                urlBuilder.append("/").append(URLEncoder.encode(_address, URL_ENCODE));
            }
        }
    }

    this.write(this.response().encodeURL(urlBuilder.toString()));
}

From source file:au.org.ala.delta.model.NumericCharacter.java

/**
 * 
 * @return true if units have been specified for this character.
 */
public boolean hasUnits() {
    return StringUtils.isNotEmpty(getUnits());
}

From source file:com.bstek.bdf2.core.orm.jdbc.dialect.AbstractDialect.java

/**
 * ???//from ww w.  ja va 2  s.c om
 * @param connection ?
 * @param dbProductName ???
 * @param dbMajorVersion ??
 * @return ?????
 */
public boolean support(Connection connection, String dbProductName, String dbMajorVersion) {
    try {
        DatabaseMetaData databaseMetaData = connection.getMetaData();
        String databaseProductName = databaseMetaData.getDatabaseProductName();
        int databaseMajorVersion = databaseMetaData.getDatabaseMajorVersion();
        boolean containsMysql = StringUtils.containsIgnoreCase(databaseProductName, dbProductName);
        if (StringUtils.isNotEmpty(dbMajorVersion)) {
            return containsMysql && Integer.valueOf(dbMajorVersion) == databaseMajorVersion;
        }
        return containsMysql;
    } catch (SQLException e) {
        return false;
    }
}

From source file:com.pedra.storefront.forms.validation.GuestRegisterValidator.java

@Override
public void validate(final Object object, final Errors errors) {
    final GuestRegisterForm guestRegisterForm = (GuestRegisterForm) object;
    final String newPasswd = guestRegisterForm.getPwd();
    final String checkPasswd = guestRegisterForm.getCheckPwd();

    if (StringUtils.isNotEmpty(newPasswd) && StringUtils.isNotEmpty(checkPasswd)
            && !StringUtils.equals(newPasswd, checkPasswd)) {
        errors.rejectValue("checkPwd", "validation.checkPwd.equals");
    } else {//from   w ww.  j a v  a 2s  .  c o m
        if (StringUtils.isEmpty(newPasswd)) {
            errors.rejectValue("pwd", "register.pwd.invalid");
        } else if (StringUtils.length(newPasswd) < 6 || StringUtils.length(newPasswd) > 255) {
            errors.rejectValue("pwd", "register.pwd.invalid");
        }

        if (StringUtils.isEmpty(checkPasswd)) {
            errors.rejectValue("checkPwd", "register.checkPwd.invalid");
        } else if (StringUtils.length(checkPasswd) < 6 || StringUtils.length(checkPasswd) > 255) {
            errors.rejectValue("checkPwd", "register.checkPwd.invalid");
        }
    }
}

From source file:de.u808.simpleinquest.web.usermanagement.UserEditController.java

@Override
protected Object formBackingObject(HttpServletRequest request) throws Exception {
    if (StringUtils.isNotEmpty(request.getParameter("id"))) {
        return userManager.fetchUser(Long.valueOf(request.getParameter("id")));
    } else//from w w  w  . j  av  a2  s.  c  o m
        return super.formBackingObject(request);
}

From source file:com.jfaker.framework.security.model.Resource.java

public Page<Resource> paginate(int pageNumber, int pageSize, String name) {
    String sql = "from sec_resource r left join sec_menu m on r.menu=m.id";
    if (StringUtils.isNotEmpty(name)) {
        sql += " where r.name like '%" + name + "%' ";
    }//from ww  w. ja  va 2  s .c  om
    sql += " order by id desc";
    return paginate(pageNumber, pageSize, "select r.*,m.name as menuName", sql);
}

From source file:com.qcloud.project.macaovehicle.service.impl.CarOwnerEnterprisersServiceImpl.java

@Override
public boolean add(CarOwnerEnterprisers carOwnerEnterprisers) {

    long id = autoIdGenerator.get(ID_KEY);
    carOwnerEnterprisers.setId(id);/*from  ww w  .  j ava2 s .  com*/
    if (StringUtils.isNotEmpty(carOwnerEnterprisers.getLicense())) {
        carOwnerEnterprisers.setLicense(fileSDKClient.uidToUrl(carOwnerEnterprisers.getLicense()));
    }
    if (StringUtils.isNotEmpty(carOwnerEnterprisers.getPaymentUrl())) {
        carOwnerEnterprisers.setPaymentUrl(fileSDKClient.uidToUrl(carOwnerEnterprisers.getPaymentUrl()));
    }
    if (StringUtils.isNotEmpty(carOwnerEnterprisers.getCommitmentUrl())) {
        carOwnerEnterprisers.setCommitmentUrl(fileSDKClient.uidToUrl(carOwnerEnterprisers.getCommitmentUrl()));
    }
    if (StringUtils.isNotEmpty(carOwnerEnterprisers.getOppositeUrl())) {
        carOwnerEnterprisers.setOppositeUrl(fileSDKClient.uidToUrl(carOwnerEnterprisers.getOppositeUrl()));
    }
    if (StringUtils.isNotEmpty(carOwnerEnterprisers.getPositiveUrl())) {
        carOwnerEnterprisers.setPositiveUrl(fileSDKClient.uidToUrl(carOwnerEnterprisers.getPositiveUrl()));
    }
    return carOwnerEnterprisersDao.add(carOwnerEnterprisers);
}

From source file:com.openshift.internal.restclient.authorization.AuthorizationContext.java

@Override
public boolean isAuthorized() {
    return StringUtils.isNotEmpty(token);
}

From source file:com.netflix.spinnaker.halyard.deploy.spinnaker.v1.profile.X509Config.java

public X509Config(Security security) {
    if (!security.getAuthn().getX509().isEnabled()) {
        return;/*ww w . j av a  2  s. co m*/
    }

    X509 x509 = security.getAuthn().getX509();

    this.enabled = x509.isEnabled();
    if (StringUtils.isNotEmpty(x509.getRoleOid())) {
        this.roleOid = x509.getRoleOid();
    }
    if (StringUtils.isNotEmpty(x509.getNodeName())) {
        this.subjectPrincipalRegex = x509.getSubjectPrincipalRegex();
    }
}