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

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

Introduction

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

Prototype

public static boolean isEmpty(String str) 

Source Link

Document

Checks if a String is empty ("") or null.

Usage

From source file:de.hybris.platform.chinesetaxinvoiceaddon.forms.validation.TaxInvoiceValidator.java

protected static void validateNotNullField(final String invoiceField, final InvoiceField fieldType,
        final Errors errors) {
    if (invoiceField == null || StringUtils.isEmpty(invoiceField)) {
        errors.rejectValue(fieldType.getFieldKey(), fieldType.getErrorKey());
    }//from   w ww.jav a2s. c o m
}

From source file:com.pureinfo.tgirls.servlet.CookieTestServlet.java

@Override
protected void doPost(HttpServletRequest _req, HttpServletResponse _resp) throws ServletException, IOException {
    try {//ww w. j  a v  a2  s.  c  o  m
        String userId = _req.getParameter("id");
        if (StringUtils.isEmpty(userId)) {
            userId = "1";
        }

        IUserMgr mgr = (IUserMgr) ArkContentHelper.getContentMgrOf(User.class);
        User u = mgr.getUserByTaobaoId(userId);

        _req.getSession().setAttribute(ArkHelper.ATTR_LOGIN_USER, u);
        Cookie c = new Cookie("", "");

        //            _req.getCookies()[0].
    } catch (PureException e) {
        // TODO Auto-generated catch block
        e.printStackTrace(System.err);
    }
}

From source file:com.elasticgrid.model.internal.jibx.Conversion.java

public static DateTime deserializeDateTime(String when) {
    if (StringUtils.isEmpty(when))
        return null;
    return DATE_FORMATTER.parseDateTime(when);
}

From source file:com.intel.cosbench.config.Auth.java

public void setType(String type) {
    if (StringUtils.isEmpty(type))
        throw new ConfigException("auth type cannot be empty");
    this.type = type;
}

From source file:com.bstek.dorado.common.event.ClientEventRegistry.java

/**
 * //from  ww w.j  a  va 2  s. c o m
 * 
 * @param clientEventRegisterInfo
 *            ?
 */
public static void registerClientEvent(ClientEventRegisterInfo clientEventRegisterInfo) {
    Class<?> type = clientEventRegisterInfo.getType();
    if (type == null) {
        throw new NullPointerException("[type] should not be null.");
    }

    Map<String, ClientEventRegisterInfo> eventMap = typeMap.get(type);
    if (eventMap == null) {
        eventMap = new HashMap<String, ClientEventRegisterInfo>();
        typeMap.put(type, eventMap);
    }

    String eventName = clientEventRegisterInfo.getName();
    if (StringUtils.isEmpty(eventName)) {
        throw new IllegalArgumentException("[eventName] should not be empty.");
    }

    if (eventMap.containsKey(eventName)) {
        throw new IllegalArgumentException(
                "Client event [" + type.getName() + "," + eventName + "] is already registered.");
    }

    eventMap.put(eventName, clientEventRegisterInfo);
}

From source file:com.intel.cosbench.driver.iterator.NumericNameIterator.java

@Override
public String next(String curr) {
    int value;//w  w  w .  j a  v a 2  s . c  o  m
    if (StringUtils.isEmpty(curr)) {
        if ((value = iterator.next(0)) <= 0)
            return null;
        return StringUtils.join(new Object[] { prefix, value, suffix });
    }
    curr = StringUtils.removeStart(curr, prefix);
    curr = StringUtils.removeEnd(curr, suffix);
    if ((value = iterator.next(Integer.parseInt(curr))) <= 0)
        return null;
    return StringUtils.join(new Object[] { prefix, value, suffix });
}

From source file:com.sangupta.pep.macros.QRMacro.java

@Override
public ContentAndClasses process(String content, File parentDir) {
    final ContentAndClasses cc = new ContentAndClasses(content);

    if (StringUtils.isEmpty(content)) {
        return cc;
    }//from   w ww . j av  a2 s  .  c  o m

    Matcher matcher = PATTERN.matcher(content);
    if (matcher.matches()) {
        StringBuilder builder = new StringBuilder();
        builder.append(matcher.group(1));
        builder.append("<p class=\"qr\"><img src=\"http://chart.apis.google.com/chart?chs=");
        builder.append(matcher.group(2));
        builder.append("x");
        builder.append(matcher.group(2));
        builder.append("&cht=qr&chl=");
        builder.append(matcher.group(3));
        builder.append("&chf=bg,s,00000000&choe=UTF-8\" alt=\"QR Code\" /></p>");
        builder.append(matcher.group(4));

        String newContent = builder.toString();
        if (!content.equals(newContent)) {
            cc.setContent(newContent);
            cc.addClass("has_qr");
        } else {
            cc.setContent(content);
        }
    }

    return cc;
}

From source file:net.sourceforge.fenixedu.domain.contacts.Phone.java

public static Phone createPhone(Party party, String number, PartyContactType type, Boolean isDefault,
        Boolean visibleToPublic, Boolean visibleToStudents, Boolean visibleToTeachers,
        Boolean visibleToEmployees, Boolean visibleToAlumni) {
    Phone result = null;/*from   w w w .  jav  a2s  .c  om*/
    if (!StringUtils.isEmpty(number)) {
        result = new Phone(party, type, visibleToPublic, visibleToStudents, visibleToTeachers,
                visibleToEmployees, visibleToAlumni, isDefault, number);
    }
    return result;
}

From source file:be.fedict.eid.pkira.blm.model.usermgmt.validation.UniqueUserNationalRegisterNumberValidator.java

@Override
public boolean isValid(Object value) {
    if (StringUtils.isEmpty((String) value)) {
        return true;
    }//from  w  w w.  j  a  v a2 s  .c om
    UserHome userHome = (UserHome) Component.getInstance(UserHome.NAME);
    User user = userHome.findByNationalRegisterNumber((String) value);
    if (user == null || user.equals(userHome.getInstance())) {
        return true;
    }
    return false;
}

From source file:com.abiquo.server.core.infrastructure.RackDAO.java

private static Criterion equalName(final String name) {
    assert !StringUtils.isEmpty(name);

    return Restrictions.eq(Rack.NAME_PROPERTY, name);
}