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:com.dlshouwen.core.system.model.UserVO.java

public UserVO(User user, Expreview expreview) {
    this.user = user;
    this.expreview = expreview;
    if (this.user != null && this.user.getWork_date() != null) {
        this.workYears = DateUtils.getYearMonthDayToNow(this.user.getWork_date());
    }/*from   w w w.  j a v  a2  s. co  m*/
    if (StringUtils.isEmpty(this.workYears)) {
        this.workYears = "";
    }
}

From source file:converters.StringToDistributorConverter.java

@Override
public Distributor convert(String text) {
    Distributor result;//from w w w . j  a v a 2 s .  c  o  m
    int id;

    try {
        if (StringUtils.isEmpty(text))
            result = null;
        else {
            id = Integer.valueOf(text);
            result = distributorRepository.findOne(id);
        }
    } catch (Throwable oops) {
        throw new IllegalArgumentException(oops);
    }

    return result;
}

From source file:converters.StringToInscriptionConverter.java

@Override
public Inscription convert(String text) {
    Inscription result;// w  ww.j av  a2  s  . co m
    int id;

    try {
        if (StringUtils.isEmpty(text))
            result = null;
        else {
            id = Integer.valueOf(text);
            result = inscriptionRepository.findOne(id);
        }
    } catch (Throwable oops) {
        throw new IllegalArgumentException(oops);
    }

    return result;
}

From source file:com.amalto.core.util.EntityNotFoundException.java

@Override
public String getMessage() {
    if (itemPK != null) {
        if (StringUtils.isEmpty(itemPK.getDataClusterPOJOPK().getUniqueId())) {
            return "No container specified in id '" + itemPK.getUniqueID() + "'.";
        }// w w w . j a  v  a2s . c om
        if (StringUtils.isEmpty(itemPK.getConceptName())) {
            return "No data model specified in '" + itemPK.getUniqueID() + "'.";
        } else {
            return "Could not find item '" + itemPK.getUniqueID() + "'.";
        }
    } else {
        return "Could not find item."; // Generic error message.
    }
}

From source file:com.doculibre.constellio.utils.connector.ConnectorPropertyInheritanceResolver.java

@SuppressWarnings("unchecked")
public static <T extends Object> T newInheritedClassPropertyInstance(ConnectorInstance connectorInstance,
        String propertyName, Class[] paramTypes, Object[] args) {
    T inheritedClassPropertyInstance;/* w  w  w  . ja  v  a2  s  .c om*/
    String propertyValue = getStringPropertyValue(connectorInstance, propertyName);
    if (StringUtils.isEmpty(propertyValue)) {
        propertyValue = getStringPropertyValue(connectorInstance.getConnectorType(), propertyName);
    }
    if (StringUtils.isNotEmpty(propertyValue)) {
        PluginAwareClassLoader pluginAwareClassLoader = new PluginAwareClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(pluginAwareClassLoader);
            Class<T> propertyValueClass = (Class<T>) Class.forName(propertyValue);
            Constructor<T> constructor = propertyValueClass.getConstructor(paramTypes);
            inheritedClassPropertyInstance = constructor.newInstance(args);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (SecurityException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } finally {
            Thread.currentThread().setContextClassLoader(pluginAwareClassLoader.getDefaultClassLoader());
        }
    } else {
        inheritedClassPropertyInstance = null;
    }
    return inheritedClassPropertyInstance;
}

From source file:converters.StringToNutritionistConverter.java

@Override
public Nutritionist convert(String text) {
    Nutritionist result;/* www. j a v  a  2s .  c o m*/
    int id;

    try {
        if (StringUtils.isEmpty(text))
            result = null;
        else {
            id = Integer.valueOf(text);
            result = nutritionistRepository.findOne(id);
        }
    } catch (Throwable oops) {
        throw new IllegalArgumentException(oops);
    }

    return result;
}

From source file:au.com.gaiaresources.bdrs.service.managedFile.ManagedFileService.java

public ManagedFile saveManagedFile(String uuid, String description, String credit, String license,
        MultipartFile file) throws IOException {
    ManagedFile mf = (StringUtils.isEmpty(uuid)) ? new ManagedFile() : managedFileDAO.getManagedFile(uuid);
    return saveManagedFile(mf, description, credit, license, file);
}

From source file:net.shopxx.dao.impl.ProductNotifyDaoImpl.java

public boolean exists(Product product, String email) {
    if (product == null || StringUtils.isEmpty(email)) {
        return false;
    }/*from  w w  w.  j ava  2 s .com*/
    String jpql = "select count(*) from ProductNotify productNotify where productNotify.product = :product and lower(productNotify.email) = lower(:email) and productNotify.hasSent = false";
    Long count = entityManager.createQuery(jpql, Long.class).setParameter("product", product)
            .setParameter("email", email).getSingleResult();
    return count > 0;
}

From source file:converters.StringToNotificationConverter.java

@Override
public Notification convert(String text) {
    Notification result;/*from   ww  w.j a  v  a2s . com*/
    int id;

    try {
        if (StringUtils.isEmpty(text))
            result = null;
        else {
            id = Integer.valueOf(text);
            result = notificationRepository.findOne(id);
        }
    } catch (Throwable oops) {
        throw new IllegalArgumentException(oops);
    }

    return result;
}

From source file:converters.StringToSubjectClassConverter.java

@Override
public SubjectClass convert(String text) {
    SubjectClass result;/*  w w  w . j  a v  a2 s.  co  m*/
    int id;

    try {
        if (StringUtils.isEmpty(text))
            result = null;
        else {
            id = Integer.valueOf(text);
            result = subjectClassRepository.findOne(id);
        }
    } catch (Throwable oops) {
        throw new IllegalArgumentException(oops);
    }

    return result;
}