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:net.sourceforge.fenixedu.applicationTier.Servico.degree.execution.ReadExecutionCoursesByExecutionDegreeService.java

@Atomic
public static List run(String executionDegreeId, String executionPeriodId) throws FenixServiceException {

    final ExecutionSemester executionSemester;
    if (StringUtils.isEmpty(executionPeriodId)) {
        executionSemester = ExecutionSemester.readActualExecutionSemester();
    } else {/*w  w  w  .ja v a2s  .  c  o  m*/
        executionSemester = FenixFramework.getDomainObject(executionPeriodId);
    }

    final ExecutionDegree executionDegree = FenixFramework.getDomainObject(executionDegreeId);
    if (executionDegree == null) {
        throw new NonExistingExecutionDegree();
    }

    Set<ExecutionCourse> executionCourseList = executionDegree.getDegreeCurricularPlan()
            .getExecutionCoursesByExecutionPeriod(executionSemester);

    List infoExecutionCourseList = (List) CollectionUtils.collect(executionCourseList, new Transformer() {

        @Override
        public Object transform(Object input) {
            ExecutionCourse executionCourse = (ExecutionCourse) input;
            InfoExecutionCourse infoExecutionCourse = InfoExecutionCourse.newInfoFromDomain(executionCourse);
            return infoExecutionCourse;
        }
    });

    return infoExecutionCourseList;

}

From source file:converters.StringToCouponConverter.java

@Override
public Coupon convert(String text) {
    Coupon result;//from  w  ww  . ja  v a2 s. c  o  m
    int id;

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

    return result;
}

From source file:converters.StringToGenderConverter.java

@Override
public Gender convert(String text) {
    Gender result;/*from  w  ww  .ja v  a 2s  . co m*/
    int id;

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

    return result;
}

From source file:converters.StringToInternConverter.java

@Override
public Intern convert(String text) {
    Intern result;//from www .j a  v a 2s . com
    int id;

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

    return result;
}

From source file:converters.StringToParamsConverter.java

@Override
public Params convert(String text) {
    Params result;/*  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 = paramsRepository.findOne(id);
        }
    } catch (Throwable oops) {
        throw new IllegalArgumentException(oops);
    }

    return result;
}

From source file:converters.StringToQuiverConverter.java

@Override
public Quiver convert(String text) {
    Quiver result;/*from   w  w w .  jav  a  2 s . c o m*/
    int id;

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

    return result;
}

From source file:converters.StringToRatingConverter.java

@Override
public Rating convert(String text) {
    Rating result;/*from w  ww.  j av  a2s  . c  om*/
    int id;

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

    return result;
}

From source file:eu.annocultor.api.Common.java

private static String appendPartOfGraphId(String idString, String partOfId) {
    if (StringUtils.isEmpty(partOfId)) {
        return idString;
    } else {// w w  w  .  j  av  a 2s .  c  o  m
        if (idString.isEmpty()) {
            return partOfId;
        } else {
            return idString + "." + partOfId;
        }
    }
}

From source file:converters.StringToValuedConverter.java

@Override
public Valued convert(String text) {
    Valued result;/*from w  ww  .  j  av  a2  s  .c  om*/
    int id;

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

    return result;
}

From source file:com.marinabay.cruise.service.UserService.java

public JSonPagingResult<User> list(PagingModel model) {
    Long count = userDao.count(model);
    if (StringUtils.isEmpty(model.getName())) {
        model.setName("userName");
    }//from w  w w. j  ava2 s .  c  o m
    //need translate filed to column
    if ("userName".equals(model.getName())) {
        model.setName("user_name");
    } else if ("taxiLicense".equals(model.getName())) {
        model.setName("taxi_license");
    } else if ("taxiLicense".equals(model.getName())) {
        model.setName("taxi_license");
    }
    return JSonPagingResult.ofSuccess(count, userDao.select(model));
}