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

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

Introduction

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

Prototype

public static boolean isNotEmpty(final CharSequence cs) 

Source Link

Document

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

 StringUtils.isNotEmpty(null)      = false StringUtils.isNotEmpty("")        = false StringUtils.isNotEmpty(" ")       = true StringUtils.isNotEmpty("bob")     = true StringUtils.isNotEmpty("  bob  ") = true 

Usage

From source file:com.glaf.oa.travelfee.web.springmvc.TravelfeeController.java

@ResponseBody
@RequestMapping("/delete")
public void delete(HttpServletRequest request, ModelMap modelMap) {

    Long feeid = RequestUtils.getLong(request, "feeid");
    String feeids = request.getParameter("feeids");
    if (StringUtils.isNotEmpty(feeids)) {
        StringTokenizer token = new StringTokenizer(feeids, ",");
        while (token.hasMoreTokens()) {
            String x = token.nextToken();
            if (StringUtils.isNotEmpty(x)) {
                Travelfee travelfee = travelfeeService.getTravelfee(Long.valueOf(x));
                /**//from w  w w  .ja v  a  2s.  c  o  m
                 * 
                 */
                if (travelfee != null) {
                    // travelfee.setDeleteFlag(1);
                    travelfeeService.deleteById(Long.valueOf(x));
                }
            }
        }
    } else if (feeid != null) {
        Travelfee travelfee = travelfeeService.getTravelfee(Long.valueOf(feeid));
        /**
         * 
         */
        if (travelfee != null) {
            // travelfee.setDeleteFlag(1);
            travelfeeService.deleteById(feeid);
        }
    }
}

From source file:com.inkubator.hrm.web.appraisal.PerformanceIndicatorJabatanFormController.java

@PostConstruct
@Override/*www.j  a v a 2 s.  c o  m*/
public void initialization() {
    super.initialization();
    try {
        isUpdate = Boolean.FALSE;

        String id = FacesUtil.getRequestParameter("execution");
        if (StringUtils.isNotEmpty(id)) {
            jabatan = jabatanService.getJabatanByIdWithDetail(Long.parseLong(id.substring(1)));
            listPerformanceGroup = appraisalPerformanceGroupService
                    .getAllDataFetchPerformanceIndicatorAndScoringIndex();

            List<AppraisalPerformanceIndicatorJabatan> listPerformanceIndicator = appraisalPerformanceIndicatorJabatanService
                    .getAllDataByJabatanIdFetchScoringIndex(jabatan.getId());
            if (listPerformanceIndicator.size() > 0) {
                isUpdate = Boolean.TRUE;
                for (AppraisalPerformanceIndicatorJabatan appraisalPerformanceIndicatorJabatan : listPerformanceIndicator) {
                    mapIndicatorScoreIndex.put(
                            appraisalPerformanceIndicatorJabatan.getPerformanceIndicator().getId(),
                            appraisalPerformanceIndicatorJabatan.getSystemScoringIndex().getId());
                }
            }
        }

    } catch (Exception e) {
        LOGGER.error("error", e);
    }
}

From source file:com.nortal.petit.orm.relation.RelationMapper.java

public RelationMapper(Class<T> target, Class<R> relation, String targetProperty, String relationProperty,
        String targetMapping, WherePart where) {
    Assert.notNull(target, "RelationMapper.construct: target is mandatory");
    Assert.notNull(relation, "RelationMapper.construct: relation is mandatory");
    Assert.isTrue(StringUtils.isNotEmpty(targetProperty) || StringUtils.isNotEmpty(relationProperty),
            "RelationMapper.construct: targetProperty or relationProperty is mandatory");

    this.relationClass = relation;

    this.targetMapper = BeanMappings.get(target);
    this.relationMapper = BeanMappings.get(relation);

    // Init target mapping property
    if (StringUtils.isEmpty(targetProperty)) {
        this.targetProperty = targetMapper.id();
    } else {//  ww  w.j  av a  2  s. c o  m
        this.targetProperty = targetMapper.props().get(targetProperty);
    }
    Assert.notNull(this.targetProperty, "RelationMapper.construct: targetProperty is mandatory");

    targetId = new PropertyFunction<T, Object>(this.targetProperty);

    // Init target mapping property
    if (StringUtils.isEmpty(relationProperty)) {
        this.relationProperty = relationMapper.id();
    } else {
        this.relationProperty = relationMapper.props().get(relationProperty);
    }
    Assert.notNull(this.relationProperty, "RelationMapper.construct: relationProperty is mandatory");

    relationId = new PropertyFunction<R, Object>(this.relationProperty);

    if (StringUtils.isNotEmpty(targetMapping)) {
        PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(target, targetMapping);
        this.associateMethod = pd.getWriteMethod();
    }

    // Mapping conditions
    this.where = where;
}

From source file:fr.landel.utils.assertor.utils.AssertorEnum.java

private static <T extends Enum<T>> StepAssertor<T> hasName(final StepAssertor<T> step, final CharSequence name,
        final CharSequence key, final BiPredicate<T, Boolean> checker, final MessageAssertor message) {

    final Predicate<T> preChecker = (object) -> object != null && StringUtils.isNotEmpty(name);

    return new StepAssertor<>(step, preChecker, checker, false, message, key, false,
            new ParameterAssertor<>(name, EnumType.CHAR_SEQUENCE));
}

From source file:com.inkubator.hrm.web.appraisal.AppraisalProgramFormController.java

@PostConstruct
@Override/*w  w  w.  j  a  va2s . c o  m*/
public void initialization() {
    super.initialization();
    try {
        model = new AppraisalProgramModel();
        isUpdate = Boolean.FALSE;

        String id = FacesUtil.getRequestParameter("execution");
        if (StringUtils.isNotEmpty(id)) {
            AppraisalProgram appraisalProgram = appraisalProgramService
                    .getEntityByIdWithDetail(Long.parseLong(id.substring(1)));
            if (appraisalProgram != null) {
                isUpdate = Boolean.TRUE;
                model = getModelFromEntity(appraisalProgram);
            }
        }

        this.onChangeIsIndiscipline();
        this.onChangeIsAchievement();
        model.setListPerformanceGroup(appraisalPerformanceGroupService.getAllData());

    } catch (Exception e) {
        LOGGER.error("error", e);
    }
}

From source file:eu.openanalytics.rsb.security.IdentifiedUserDetailsService.java

@PostConstruct
public void initializeGrantedAuthorities() {
    grantedAuthorities = new HashSet<GrantedAuthority>();

    if (StringUtils.isBlank(configuredAuthorities)) {
        return;//from   w  w  w  .j  a  v  a  2 s  .  co m
    }

    for (final String configuredAuthority : StringUtils.split(configuredAuthorities, ", ")) {
        final String strippedAuthority = StringUtils.stripToEmpty(configuredAuthority);
        if (StringUtils.isNotEmpty(strippedAuthority)) {
            grantedAuthorities.add(new SimpleGrantedAuthority(strippedAuthority));
        }
    }
}

From source file:br.ufac.sion.dao.CidadeFacade.java

private Criteria criarCriteriaParaFiltro(FiltroCidades filtro) {

    Session session = em.unwrap(Session.class);
    Criteria criteria = session.createCriteria(Cidade.class);

    if (StringUtils.isNotEmpty(filtro.getNome())) {
        criteria.add(Restrictions.ilike("nome", filtro.getNome(), MatchMode.ANYWHERE));
    }/*ww  w.  j  a  v  a 2  s.  c o m*/
    if (filtro.getEstado() != null && filtro.getEstado().getId() != null) {
        criteria.add(Restrictions.eq("estado", filtro.getEstado()));
    }

    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return criteria;
}

From source file:com.glaf.core.tree.helper.DTreeHelper.java

/**
 * dtree//from   w  w  w .jav  a 2 s .co  m
 * 
 * @param components
 * @return
 */
public String buildTreeScript(List<TreeModel> treeModels, String iTree, boolean showLink) {
    Collections.sort(treeModels);
    TreeRepositoryBuilder builder = new TreeRepositoryBuilder();
    TreeRepository repository = builder.build(treeModels);
    StringBuffer buffer = new StringBuffer();
    List<?> topComponents = repository.getTopTrees();
    for (int i = 0, len = topComponents.size(); i < len; i++) {
        TreeComponent component = (TreeComponent) topComponents.get(i);
        buffer.append(newline);
        buffer.append("       ").append(iTree).append(".add('").append(component.getId()).append("', '-1',  '")
                .append(component.getTitle()).append("'");
        if (showLink) {
            if (StringUtils.isNotEmpty(component.getLocation())) {
                buffer.append(", \"javascript:gotoLink('").append(component.getId()).append("','")
                        .append(component.getTitle()).append("','").append(component.getLocation())
                        .append("');\"");
            } else {
                buffer.append(", '").append("'");
            }
            if (StringUtils.isNotEmpty(component.getTarget())) {
                buffer.append(", '").append(component.getTarget()).append("'");
            }
        } else {
            buffer.append(",'',''");
        }
        buffer.append(");");
        buffer.append(newline);
        buffer.append(buildTreeModel(component, iTree, showLink));
        buffer.append(newline);

    }
    buffer.append(newline);
    return buffer.toString();
}

From source file:com.baifendian.swordfish.execserver.parameter.SystemParamManager.java

/**
 * ?//from  w  w w  .ja  va2 s .c  o  m
 *
 * @param execType ?, , ?, 
 * @param time , ?, , , ?, ?
 * @param execId  id
 * @param jobId  id
 */
public static Map<String, String> buildSystemParam(ExecType execType, Date time, Integer execId, String jobId) {
    Date bizDate;

    switch (execType) {
    case COMPLEMENT_DATA:
        bizDate = time; // ?
        break;
    case DIRECT:
    case SCHEDULER:
    default:
        bizDate = addDays(time, -1); // ??
    }

    Date bizCurDate = addDays(bizDate, 1); // bizDate + 1 

    Map<String, String> valueMap = new HashMap<>();

    valueMap.put(BIZ_DATE, formatDate(bizDate));
    valueMap.put(BIZ_CUR_DATE, formatDate(bizCurDate));
    valueMap.put(CYC_TIME, formatTime(bizCurDate));

    if (execId != null) {
        valueMap.put(EXEC_ID, Long.toString(execId));
    }

    if (StringUtils.isNotEmpty(jobId)) {
        valueMap.put(JOB_ID, jobId);
    }

    return valueMap;
}

From source file:com.glaf.dts.web.rest.MxTransformTaskResource.java

@POST
@Path("/delete/{queryId}")
public void delete(@PathParam("queryId") String queryId, @Context UriInfo uriInfo) {
    if (StringUtils.isNotEmpty(queryId)) {
        transformTaskService.deleteByQueryId(queryId);
    }// w  w w.  ja  v  a2  s .  c o  m
}