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

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

Introduction

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

Prototype

public static boolean isEmpty(boolean[] array) 

Source Link

Document

Checks if an array of primitive booleans is empty or null.

Usage

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public List<Invoice> getAuthorizedLegalInvs() {
    List<Invoice> list = new ArrayList<Invoice>();
    if (!ArrayUtils.isEmpty(legalInvs)) {
        for (int i = 0; i < legalInvs.length; i++) {
            if (legalInvs[i].isAuthorized()) {
                list.add(legalInvs[i]);//from www . j  a  v a 2s.  c  o m
            }
        }
    }
    return list;
}

From source file:com.baidu.rigel.biplatform.tesseract.util.FileUtils.java

/**
 * ?dir?/* ww w  . j  a v a2  s  . co m*/
 * @param dir
 * @return boolean
 */
public static boolean isEmptyDir(File dir) {
    boolean result = false;
    if (dir == null || !dir.exists() || !dir.isDirectory() || ArrayUtils.isEmpty(dir.listFiles())) {
        result = true;
    }
    return result;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public boolean getOpenLegalInvExists() {
    if (!ArrayUtils.isEmpty(legalInvs)) {
        for (int i = 0; i < legalInvs.length; i++) {
            if ("N".equals(legalInvs[i].getPaidIndicator())) {
                return true;
            }/*from  ww w.j a  v a2 s  . com*/
        }
    }
    return false;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getLegalInvTotalUnPaidAmount() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(legalInvs)) {
        for (int i = 0; i < legalInvs.length; i++) {
            if ("N".equals(legalInvs[i].getPaidIndicator())) {
                amount = amount.add(legalInvs[i].getAmount());
            }//from  w  w w. ja va2  s .com
        }
    }
    return amount;
}

From source file:com.baidu.rigel.biplatform.tesseract.util.FileUtils.java

/**
 * ???//from   ww  w  . j  av  a2 s.  c o  m
 * @param dir 
 * @param fileSuffix ?
 * @return boolean
 */
public static boolean isExistGivingFileSuffix(File dir, String fileSuffix) {
    boolean result = false;
    if (!isEmptyDir(dir) && !StringUtils.isEmpty(fileSuffix)) {
        File[] files = dir.listFiles(new LocalImageFilenameFilter(fileSuffix));
        if (!ArrayUtils.isEmpty(files)) {
            result = true;
        }
    }

    return result;
}

From source file:gov.nih.nci.cabig.caaers.grid.CaaersStudyConsumer.java

/**
 * Will populate the investigator//from www . j a v  a  2s .  co m
 * 
 * @param studyOrganization
 * @param invTypes
 */
void populateInvestigators(StudyOrganization studyOrganization, StudyInvestigatorType[] invTypes)
        throws StudyCreationException {
    if (ArrayUtils.isEmpty(invTypes)) {
        logger.error("No investigators are available in the input message");
        return;
    }

    SiteInvestigator siteInvestigator = null;
    InvestigatorQuery query = null;
    Investigator dbInvestigator = null;
    StudyInvestigator studyInvestigator = null;

    for (StudyInvestigatorType invType : invTypes) {
        //Extract NCI IDENTIFIER of Investigator 
        String invNCICode = invType.getHealthcareSiteInvestigator().getInvestigator(0).getNciIdentifier();
        if (StringUtils.isEmpty(invNCICode)) {
            logger.error("Investigator details are missing!");
            StudyCreationException exp = new StudyCreationException();
            exp.setFaultReason(
                    "Missing investigator details in input : InvestigatorType.healthcareSiteInvesitagor.investigatorType[0].nciIdentifier");
            exp.setFaultString("Invalid input, missing investigator information");
            throw exp;
        }
        query = new InvestigatorQuery();
        query.filterByNciIdentifierExactMatch(invNCICode);
        List<Investigator> investigators = investigatorRepository.searchInvestigator(query);
        if (investigators != null && investigators.size() > 0) {
            dbInvestigator = investigators.get(0);
        }
        //Create or Update the Investigator as needed.
        dbInvestigator = createOrUpdateInvestigator(dbInvestigator, studyOrganization.getOrganization(),
                invType.getHealthcareSiteInvestigator().getInvestigator(0));

        //Extract the SiteInvestigator from the Investigator 
        siteInvestigator = dbInvestigator.findSiteInvestigator(studyOrganization.getOrganization());
        //Associate SiteInvestigator to Study.
        studyInvestigator = new StudyInvestigator();
        studyInvestigator.setStudyOrganization(studyOrganization);
        String roleCode = null;
        PersonRole[] caaersRoles = new PersonRole[] { PersonRole.SITE_INVESTIGATOR,
                PersonRole.SITE_PRINCIPAL_INVESTIGATOR, PersonRole.PRINCIPAL_INVESTIGATOR };
        if (invType.getRoleCode() == null) {
            StudyCreationException exp = new StudyCreationException();
            exp.setFaultReason("Investigator role is NULL in Study message");
            throw exp;
        }
        for (PersonRole caaersRole : caaersRoles) {
            if (caaersRole.getDisplayName().equals(invType.getRoleCode())) {
                roleCode = caaersRole.getRoleCode();
                break;
            }
        }

        if (roleCode == null) {
            StudyCreationException exp = new StudyCreationException();
            exp.setFaultReason("Supplied Investigator role " + invType.getRoleCode()
                    + " does not map with roles in caAERS");
            throw exp;
        }

        studyInvestigator.setRoleCode(roleCode);
        studyInvestigator.setStartDate(siteInvestigator.getStartDate());
        studyInvestigator.setSiteInvestigator(siteInvestigator);
        studyOrganization.addStudyInvestigators(studyInvestigator);
    }
}

From source file:com.dianping.wed.cache.redis.biz.WeddingRedisServiceImpl.java

@Override
public long hDel(WeddingRedisKeyDTO redisKey, final String... fields) {
    if (ArrayUtils.isEmpty(fields)) {
        return 0;
    }/*from   w  w  w . ja  v  a 2s .c  o m*/
    final String finalKey = wcsWeddingRedisKeyCfgService.generateKey(redisKey);
    return JedisHelper.doJedisOperation(new JedisCallback<Long>() {
        @Override
        public Long doWithJedis(Jedis jedis) {
            return jedis.hdel(finalKey, fields);
        }
    }, finalKey, RedisActionType.WRITE);
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getLegalInvTotalTollDue() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(legalInvs)) {
        for (int i = 0; i < legalInvs.length; i++) {
            if ("N".equals(legalInvs[i].getPaidIndicator())) {
                amount = amount.add(legalInvs[i].getAmount()).subtract(legalInvs[i].getInvoiceAdminFee())
                        .subtract(legalInvs[i].getAdjustedTxnFees())
                        .subtract(legalInvs[i].getInvSecondNoticeAdminFee());
                ;/*from  ww  w. j  ava2  s  .  c  o  m*/
            }
        }
    }
    return amount;
}

From source file:de.codesourcery.eve.skills.ui.components.impl.AssetListComponent.java

private void updateSelectedVolume() {
    final int[] viewRows = table.getSelectedRows();
    if (ArrayUtils.isEmpty(viewRows)) {
        selectedVolume.setItems(NO_ASSETS);
        return;//  ww w  .  j  a  v  a2s  . c o m
    }

    final List<Asset> selected = new ArrayList<Asset>();

    for (int viewRow : viewRows) {
        final int modelRow = table.convertRowIndexToModel(viewRow);
        selected.add(model.getRow(modelRow));
    }
    selectedVolume.setItems(selected);
}

From source file:de.codesourcery.eve.skills.ui.components.impl.AssetListComponent.java

private List<Asset> getSelectedAssets() {
    final int[] selection = table.getSelectedRows();
    if (ArrayUtils.isEmpty(selection)) {
        return null;
    }/*from   w  w w.j  a v  a2 s. com*/

    final List<Asset> assets = new ArrayList<Asset>();
    for (int viewRow : selection) {
        final int modelRow = model.convertViewRowToModel(viewRow);
        assets.add(model.getRow(modelRow));
    }
    return assets;
}