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.dianping.wed.cache.redis.biz.WeddingRedisServiceImpl.java

@Override
public long lPush(WeddingRedisKeyDTO redisKey, final String... value) {
    if (ArrayUtils.isEmpty(value)) {
        return 0;
    }/*from  w ww  . j a  va 2s . co m*/
    final String finalKey = wcsWeddingRedisKeyCfgService.generateKey(redisKey);
    return JedisHelper.doJedisOperation(new JedisCallback<Long>() {
        @Override
        public Long doWithJedis(Jedis jedis) {
            return jedis.lpush(finalKey, value);
        }
    }, finalKey, RedisActionType.WRITE);
}

From source file:hudson.plugins.clearcase.history.AbstractHistoryAction.java

private boolean needsLsHistoryForGetChanges(String viewTag, String[] loadRules)
        throws IOException, InterruptedException {
    return !ChangeSetLevel.NONE.equals(changeset) && cleartool.doesViewExist(viewTag)
            && !ArrayUtils.isEmpty(loadRules);
}

From source file:com.adaptris.mail.MailSenderImp.java

/**
 * Build the content of the MimeMessage from the constituent parts.
 *//*  w  w  w .  j a v  a2s .  c om*/
protected void buildContent() throws MailException {
    checkSession();
    try {
        if (ArrayUtils.isEmpty(message.getFrom())) {
            message.setFrom();
        }
        if (ArrayUtils.isEmpty(message.getAllRecipients())) {
            throw new MailException("Mail message has no recipients");
        }
        message.setSentDate(new Date());
        MimeMultipart body = new MimeMultipart();
        addAttachmentsToMessage(body);
        addEmailBody(body);
        message.setContent(body);
        message.saveChanges();
    } catch (MessagingException e) {
        throw new MailException(e);
    }
}

From source file:com.fiveamsolutions.nci.commons.search.SearchCallback.java

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void callback(Method m, Object result, String objAlias) throws Exception {
    this.objectAlias = objAlias;
    String fieldName = StringUtils.uncapitalize(m.getName().substring("get".length()));
    String paramName = objectAlias + "_" + fieldName;
    if (result == null) {
        return;/*from w w  w  .  j a v  a2 s.  com*/
    }
    SearchOptions searchOptions = new SearchOptions(m);
    validateSettings(searchOptions, result);

    if (result instanceof Collection<?>) {
        processCollectionField((Collection<?>) result, fieldName, this.objectAlias, searchOptions);
    } else if (!ArrayUtils.isEmpty(searchOptions.getFields())) {
        processFieldWithSubProp(result, fieldName, paramName, searchOptions, false);
    } else if (searchOptions.isNested()) {
        processNestedField(result, fieldName, paramName, searchOptions);
    } else {
        processSimpleField(result, fieldName, paramName, searchOptions);
    }
}

From source file:com.etcc.csc.datatype.PaymentDetailUtil.java

public static OLC_VPS_INV_PMT_REC[] invoicesToOLC_VPS_INV_PMT_RECs(Invoice[] invoices, boolean veaAccepted)
        throws Exception {
    if (ArrayUtils.isEmpty(invoices)) {
        return null;
    }/*from  w  w w .  ja v a 2s .co  m*/
    OLC_VPS_INV_PMT_REC[] OLC_VPS_INV_PMT_RECs = new OLC_VPS_INV_PMT_REC[invoices.length];
    for (int i = 0; i < invoices.length; i++) {
        OLC_VPS_INV_PMT_REC rec = invoiceToOLC_VPS_INV_PMT_REC(invoices[i], veaAccepted);
        rec.setARR_INDEX(new BigDecimal(i + 1));
        OLC_VPS_INV_PMT_RECs[i] = rec;
    }
    return OLC_VPS_INV_PMT_RECs;
}

From source file:com.nec.harvest.service.impl.HelpServiceImpl.java

/** {@inheritDoc} */
@Override//from  w w w.  jav a 2s  .co m
public boolean deleteByIDs(String... Ids) throws ServiceException {
    if (ArrayUtils.isEmpty(Ids)) {
        throw new IllegalArgumentException("Array help must not be null or empty");
    }

    final Session session = HibernateSessionManager.getSession();
    Transaction tx = null;

    boolean isDeleted = Boolean.FALSE;
    try {
        tx = session.beginTransaction();
        String sql = " DELETE FROM  Help a WHERE a.delKbn = :delKbn AND a.recID IN (:recIDs) ";
        Query query = repository.getQuery(session, sql).setParameterList("recIDs", Ids).setParameter("delKbn",
                Constants.STATUS_ACTIVE);

        int result = query.executeUpdate();
        isDeleted = (result > 0);
        tx.commit();
    } catch (HibernateException ex) {
        if (tx != null) {
            tx.rollback();
        }
        throw new ServiceException("An error occurred while delete help list");
    } finally {
        HibernateSessionManager.closeSession(session);
    }
    return isDeleted;
}

From source file:hudson.plugins.clearcase.history.AbstractHistoryAction.java

private boolean needsLsHistoryForHasChanges(String viewTag, String[] loadRules)
        throws IOException, InterruptedException {
    return cleartool.doesViewExist(viewTag) && !ArrayUtils.isEmpty(loadRules);
}

From source file:com.hs.mail.imap.message.response.FetchResponseBuilder.java

private byte[] bodyFetch(FetchData fd, BodyFetchItem item) throws IOException, MimeException {
    int[] path = item.getPath();
    try {/*from  ww w .j av  a 2 s .c  o  m*/
        if (ArrayUtils.isEmpty(path)) {
            return bodyContent(fd, item);
        } else {
            return bodyContent(fd, item, path, false);
        }
    } catch (PartContentBuilder.PartNotFoundException e) {
        // Missing parts should return zero sized content
        return PartContentBuilder.EMPTY;
    }
}

From source file:com.photon.phresco.framework.actions.applications.CI.java

public String configure() {
    S_LOGGER.debug("Entering Method  CI.configure()");
    try {/*from w  ww  .  j a  va2s.c o m*/
        String[] selectedJobsName = getHttpRequest().getParameterValues(REQ_SELECTED_JOBS_LIST);
        String jobName = "";
        if (!ArrayUtils.isEmpty(selectedJobsName)) {
            jobName = selectedJobsName[0];
        }
        S_LOGGER.debug("selectedJobs for configuration " + jobName);

        ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
        Project project = administrator.getProject(projectCode);
        // Get environment info
        List<Environment> environments = administrator.getEnvironments(project);
        getHttpRequest().setAttribute(REQ_ENVIRONMENTS, environments);
        getHttpRequest().setAttribute(REQ_PROJECT, project);
        // Get xcode targets
        String technology = project.getProjectInfo().getTechnology().getId();
        if (TechnologyTypes.IPHONES.contains(technology)) {
            List<PBXNativeTarget> xcodeConfigs = ApplicationsUtil.getXcodeConfiguration(projectCode);
            getHttpRequest().setAttribute(REQ_XCODE_CONFIGS, xcodeConfigs);
            // get list of sdks
            List<String> iphoneSdks = IosSdkUtil.getMacSdks(MacSdkType.iphoneos);
            iphoneSdks.addAll(IosSdkUtil.getMacSdks(MacSdkType.iphonesimulator));
            iphoneSdks.addAll(IosSdkUtil.getMacSdks(MacSdkType.macosx));
            getHttpRequest().setAttribute(REQ_IPHONE_SDKS, iphoneSdks);
        }
        CIJob existJob = administrator.getJob(project, jobName);
        getHttpRequest().setAttribute(REQ_EXISTING_JOB, existJob);
        getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
        getHttpRequest().setAttribute(REQ_PROJECT_CODE, projectCode);
    } catch (Exception e) {
        S_LOGGER.error("Entered into catch block of CI.configure()" + FrameworkUtil.getStackTraceAsString(e));
        new LogErrorReport(e, "CI configuration clicked");
    }
    return APP_CI_CONFIGURE;
}

From source file:de.alpharogroup.crypto.core.AbstractCryptor.java

/**
 * Factory method for creating a new salt that will be used with the cipher object.
 *
 * @return the salt byte array//from   www.ja  va  2s . co  m
 */
protected byte[] newSalt() {
    if (ArrayUtils.isEmpty(getModel().getSalt())) {
        return CryptConst.SALT;
    }
    return getModel().getSalt();
}