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:io.cloudslang.engine.queue.services.ExecutionQueueServiceImpl.java

@Override
@Transactional(readOnly = true)//  w  w w  .j a  va  2 s. c o m
public Map<Long, Payload> readPayloadByExecutionIds(Long... ids) {
    if (ArrayUtils.isEmpty(ids))
        throw new IllegalArgumentException("List of IDs is null or empty");
    return executionQueueRepository.findPayloadByExecutionIds(ids);
}

From source file:cn.loveapple.client.android.shiba.view.LoveappleWebViewClient.java

/**
 * ???????????//from  w  w w  .ja  va 2  s .com
 * @param hostWhiteList ????????
 */
public void setHostWhiteList(String[] hostWhiteList) {
    this.hostWhiteList = new HashSet<String>();
    if (ArrayUtils.isEmpty(hostWhiteList)) {
        return;
    }
    for (String host : hostWhiteList) {
        this.hostWhiteList.add(host);
    }
}

From source file:net.jforum.services.AttachmentService.java

public void editAttachments(Post post, HttpServletRequest request) {
    // Check for attachments to remove
    List<String> deleteList = new ArrayList<String>();
    String[] delete = null;/*from  w  w  w .  ja  v a2 s .c om*/
    String s = request.getParameter("delete_attach");

    if (!StringUtils.isEmpty(s)) {
        delete = s.split(",");
    }

    if (!ArrayUtils.isEmpty(delete)) {
        for (String deleteId : delete) {
            if (!StringUtils.isEmpty(deleteId)) {
                int attachmentId = Integer.parseInt(deleteId);

                Attachment attachment = this.repository.get(attachmentId);
                post.getAttachments().remove(attachment);

                this.removeAttachmentFiles(attachment);
            }
        }

        deleteList = Arrays.asList(delete);
    }

    // Update
    String[] attachIds = null;
    s = request.getParameter("edit_attach_ids");
    if (!StringUtils.isEmpty(s)) {
        attachIds = s.split(",");
    }

    if (!ArrayUtils.isEmpty(attachIds)) {
        for (String x : attachIds) {
            if (deleteList.contains(x) || StringUtils.isEmpty(x)) {
                continue;
            }

            int attachmentId = Integer.parseInt(x);

            Attachment attachment = this.repository.get(attachmentId);
            attachment.setDescription(request.getParameter("edit_description_" + attachmentId));
        }
    }
}

From source file:com.kenai.redminenb.repository.RedmineRepositoryController.java

private boolean validate() {
    if (connectError) {
        panel.connectButton.setEnabled(true);
        return false;
    }/*from  www. ja  v a2  s .co  m*/

    if (!populated) {
        return false;
    }
    errorMessage = null;

    panel.connectButton.setEnabled(false);
    panel.createNewProjectButton.setEnabled(false);

    // check url
    String url = getUrl();
    if (url.equals("")) { // NOI18N
        errorMessage = Bundle.MSG_MissingUrl();
        return false;
    }

    try {
        new URL(url); // check this first even if URL is an URI
        new URI(url);
    } catch (Exception ex) {
        errorMessage = Bundle.MSG_WrongUrl();
        Redmine.LOG.log(Level.FINE, errorMessage, ex);
        return false;
    }

    // username and password required if not access key authentication
    if (getAuthMode() == AuthMode.Credentials) {
        if (StringUtils.isBlank(getUser())) {
            errorMessage = Bundle.MSG_MissingUsername();
            return false;
        } else if (ArrayUtils.isEmpty(getPassword())) {
            errorMessage = Bundle.MSG_MissingPassword();
            return false;
        }
    } else {
        if (StringUtils.isBlank(getAccessKey())) {
            errorMessage = Bundle.MSG_MissingAccessKey();
            return false;
        }
    }

    panel.connectButton.setEnabled(true);
    panel.createNewProjectButton.setEnabled(connected);

    // check name
    String name = panel.nameTextField.getText().trim();

    if (name.equals("")) { // NOI18N
        errorMessage = Bundle.MSG_MissingName();
        return false;
    }

    // is name unique?
    //      if ((repository.isFresh() && Redmine.getInstance().isRepositoryNameExists(name))
    //               || (!repository.isFresh() && !name.equals(repository.getName())
    //               && Redmine.getInstance().isRepositoryNameExists(name))) {
    //      if (Redmine.getInstance().isRepositoryNameExists(name)) {
    //         errorMessage = Bundle.MSG_TrackerAlreadyExists();
    //         return false;
    //      }

    // is repository unique?
    //      RedmineRepository confRepository = Redmine.getInstance().repositoryExists(repository);
    //
    //      if ((repository.isFresh() && Redmine.getInstance().isRepositoryExists(repository))
    //              || (!repository.isFresh() && confRepository != null
    //              && !confRepository.getID().equals(repository.getID()))) {
    //         errorMessage = Bundle.MSG_RepositoryAlreadyExists();
    //         return false;
    //      }

    if (panel.projectComboBox.getSelectedIndex() == -1) {
        errorMessage = Bundle.MSG_MissingProject();
        return false;
    }

    return true;
}

From source file:hudson.plugins.clearcase.action.AbstractCheckoutAction.java

protected AbstractCheckoutAction.LoadRulesDelta getLoadRulesDelta(Set<String> configSpecLoadRules,
        Launcher launcher) {/* w  w w.j  av  a2  s. c om*/
    Set<String> removedLoadRules = new LinkedHashSet<String>(configSpecLoadRules);
    Set<String> addedLoadRules = new LinkedHashSet<String>();
    if (!ArrayUtils.isEmpty(loadRules)) {
        for (String loadRule : loadRules) {
            addedLoadRules.add(ConfigSpec.cleanLoadRule(loadRule, launcher.isUnix()));
        }
        removedLoadRules.removeAll(addedLoadRules);
        addedLoadRules.removeAll(configSpecLoadRules);
        PrintStream logger = launcher.getListener().getLogger();
        for (String removedLoadRule : removedLoadRules) {
            logger.println("Removed load rule : " + removedLoadRule);
        }
        for (String addedLoadRule : addedLoadRules) {
            logger.println("Added load rule : " + addedLoadRule);
        }
    }
    return new AbstractCheckoutAction.LoadRulesDelta(removedLoadRules, addedLoadRules);
}

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

public BigDecimal getViolationAmount() {
    BigDecimal total = new BigDecimal(0.0);
    if (!ArrayUtils.isEmpty(violations)) {
        for (int i = 0; i < violations.length; i++) {
            total = total.add(violations[i].getCashAmount());
        }/*from w w  w .  j ava 2 s  . c o  m*/
    }
    return total;
}

From source file:com.adobe.acs.commons.exporters.impl.users.UsersExportServlet.java

/**
 * Determines if the user should be included based on the specified group filter type, and requested groups.
 *
 * @param groups      the groups/*from w w  w  .j a v a 2  s .  c o  m*/
 * @param groupFilter the groupFilter
 * @param csvUser     the user
 * @return true if the user should be included.
 */
protected boolean checkGroups(String[] groups, String groupFilter, CsvUser csvUser) throws RepositoryException {
    log.debug("Group Filter: {}", groupFilter);
    if (!ArrayUtils.isEmpty(groups)) {
        if (GROUP_FILTER_DIRECT.equals(groupFilter) && csvUser.isInDirectGroup(groups)) {
            log.debug("Adding [ {} ] via [ Direct ] membership", csvUser.getID());
            return true;
        } else if (GROUP_FILTER_INDIRECT.equals(groupFilter) && csvUser.isInIndirectGroup(groups)) {
            log.debug("Adding [ {} ] via [ Indirect ] membership", csvUser.getID());
            return true;
        } else if (GROUP_FILTER_BOTH.equals(groupFilter)
                && (csvUser.isInDirectGroup(groups) || csvUser.isInIndirectGroup(groups))) {
            log.debug("Adding [ {} ] via [ Direct OR Indirect ] membership", csvUser.getID());
            return true;
        }

        return false;
    }

    log.debug("Adding [ {} ] as no groups were specified to specify membership filtering.", csvUser.getID());
    return true;
}

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

public BigDecimal getInvoiceFeeAmount() {
    BigDecimal total = new BigDecimal(0.0);
    if (!ArrayUtils.isEmpty(invoices)) {
        for (int i = 0; i < invoices.length; i++) {
            total = total.add(BigDecimalUtil.nullSafe(invoices[i].getOnlineFee()));
        }//w w w  .  j  a  va 2s.  co  m
    }
    return total;
}

From source file:cn.loveapple.client.android.shiba.view.LoveappleWebViewClient.java

/**
 * ????????????//  w w w .j av  a  2 s.  c o m
 * @param schemaWhiteList ?????????
 */
public void setSchemaWhiteList(String[] schemaWhiteList) {
    this.schemaWhiteList = new HashSet<String>();
    if (ArrayUtils.isEmpty(schemaWhiteList)) {
        return;
    }
    for (String schema : schemaWhiteList) {
        this.schemaWhiteList.add(schema);
    }
}

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

public static OLC_UNINVOICED_VIOLS_REC[] convertToOLC_UNINVOICED_VIOLS_RECs(Violation[] violations)
        throws Exception {
    if (ArrayUtils.isEmpty(violations)) {
        return null;
    }//from   w ww .j  a  va 2s  . c o m
    OLC_UNINVOICED_VIOLS_REC[] recs = new OLC_UNINVOICED_VIOLS_REC[violations.length];
    for (int i = 0; i < violations.length; i++) {
        recs[i] = convertToOLC_UNINVOICED_VIOLS_REC(violations[i]);
    }
    return recs;
}