Example usage for org.apache.commons.collections4 CollectionUtils isEmpty

List of usage examples for org.apache.commons.collections4 CollectionUtils isEmpty

Introduction

In this page you can find the example usage for org.apache.commons.collections4 CollectionUtils isEmpty.

Prototype

public static boolean isEmpty(final Collection<?> coll) 

Source Link

Document

Null-safe check if the specified collection is empty.

Usage

From source file:org.kuali.kra.iacuc.IacucProtocol.java

public boolean isContinuationWithoutAmendment() {
    return isContinuation() && CollectionUtils.isEmpty(this.getProtocolAmendRenewal().getModules());
}

From source file:org.kuali.kra.institutionalproposal.home.InstitutionalProposal.java

public ProposalIpReviewJoin getProposalIpReviewJoin() {
    if (!CollectionUtils.isEmpty(this.proposalIpReviewJoins)) {
        return this.proposalIpReviewJoins.get(0);
    }/*  www  . ja  v a 2s. co  m*/
    return null;
}

From source file:org.kuali.kra.irb.actions.notifyirb.ProtocolNotifyIrbServiceImpl.java

/**
 * @throws WorkflowException /*from   w w  w. j a  va 2  s  .  co m*/
 * @see org.kuali.kra.irb.actions.notifyirb.ProtocolNotifyIrbService#submitIrbNotification(org.kuali.kra.irb.Protocol, org.kuali.kra.irb.actions.notifyirb.ProtocolNotifyIrbBean)
 */
public void submitIrbNotification(Protocol protocol, ProtocolNotifyIrbBean notifyIrbBean)
        throws WorkflowException {
    /*
     * The submission is created first so that its new primary key can be added
     * to the protocol action entry.
     */
    ProtocolSubmission submission = createProtocolSubmission(protocol, notifyIrbBean);
    ProtocolAction protocolAction = new ProtocolAction(protocol, submission, ProtocolActionType.NOTIFY_IRB);
    protocolAction.setComments(notifyIrbBean.getComment());
    protocol.getProtocolActions().add(protocolAction);
    protocolActionService.updateProtocolStatus(protocolAction, protocol);
    if (!CollectionUtils.isEmpty(notifyIrbBean.getQuestionnaireHelper().getAnswerHeaders())) {
        saveQuestionnaire(notifyIrbBean, submission.getSubmissionNumber());
        notifyIrbBean.getQuestionnaireHelper().setAnswerHeaders(new ArrayList<AnswerHeader>());
    }
    cleanUnreferencedQuestionnaire(protocol.getProtocolNumber());
    documentService.saveDocument(protocol.getProtocolDocument());
    protocol.refreshReferenceObject("protocolSubmissions");
}

From source file:org.kuali.kra.irb.actions.ProtocolSubmissionBuilder.java

private Integer getNextSubmissionNumber(Protocol protocol) {
    Integer nextSubmissionNumber;
    if (protocol.isAmendment() || protocol.isRenewal()) {
        String origProtocolNumber = protocol.getProtocolNumber();
        String protocolNumber = origProtocolNumber.substring(0, 10);
        Protocol origProtocol = (Protocol) getProtocolFinderDao().findCurrentProtocolByNumber(protocolNumber);
        nextSubmissionNumber = origProtocol.getNextValue(NEXT_SUBMISSION_NUMBER_KEY);
        getBusinessObjectService().save(origProtocol.getProtocolDocument().getDocumentNextvalues());

    } else {/*ww w .  j a v a2  s  .co m*/
        nextSubmissionNumber = protocol.getNextValue(NEXT_SUBMISSION_NUMBER_KEY);
    }
    LOG.info("nextsubmissionnumber " + protocol.getProtocolId() + " "
            + (CollectionUtils.isEmpty(protocol.getProtocolSubmissions()) ? 0
                    : protocol.getProtocolSubmissions().size())
            + "-" + nextSubmissionNumber);
    return nextSubmissionNumber;
}

From source file:org.kuali.kra.irb.actions.request.ProtocolRequestServiceImpl.java

/**
 * @throws WorkflowException //from  w ww  .j a  v a 2 s .c  om
 * @see org.kuali.kra.irb.actions.request.ProtocolRequestService#submitRequest(org.kuali.kra.irb.Protocol, org.kuali.kra.irb.actions.request.ProtocolRequestBean)
 */
public void submitRequest(Protocol protocol, ProtocolRequestBean requestBean) throws WorkflowException {
    LOG.info("submitRequest " + requestBean.getProtocolActionTypeCode() + " "
            + protocol.getProtocolDocument().getDocumentNumber());
    /*
     * The submission is created first so that its new primary key can be added
     * to the protocol action entry.
     */
    // if doing request following 'Approve' immediately, it may get OLE issue, which is caused by saving documentheader
    // refresh ProtodolDocument to keep it uptodate
    //        protocol.refreshReferenceObject("protocolDocument");
    String prevSubmissionStatusCode = protocol.getProtocolSubmission().getSubmissionStatusCode();

    ProtocolSubmission submission = createProtocolSubmission(protocol, requestBean);
    String submissionTypeCode = submission.getSubmissionTypeCode();
    protocol.setProtocolSubmission(submission);

    ProtocolAction protocolAction = new ProtocolAction(protocol, submission,
            requestBean.getProtocolActionTypeCode());
    protocolAction.setComments(requestBean.getReason());
    protocolAction.setProtocol(protocol);

    //Creating an audit trail
    protocolAction.setPrevProtocolStatusCode(protocol.getProtocolStatusCode());
    protocolAction.setPrevSubmissionStatusCode(prevSubmissionStatusCode);
    protocolAction.setSubmissionTypeCode(submissionTypeCode);

    protocol.getProtocolActions().add(protocolAction);

    protocolActionService.updateProtocolStatus(protocolAction, protocol);
    if (!CollectionUtils.isEmpty(requestBean.getQuestionnaireHelper().getAnswerHeaders())) {
        saveQuestionnaire(requestBean, submission.getSubmissionNumber());
        requestBean.getQuestionnaireHelper().setAnswerHeaders(new ArrayList<AnswerHeader>());
    }
    cleanUnreferencedQuestionnaire(protocol.getProtocolNumber());
    documentService.saveDocument(protocol.getProtocolDocument());
}

From source file:org.kuali.kra.protocol.actions.decision.CommitteeDecisionRuleBase.java

private boolean processMotion(CD committeeDecision) {
    boolean retVal = true;

    if (StringUtils.isBlank(committeeDecision.getMotionTypeCode())) {
        reportError(Constants.PROTOCOL_COMMITTEE_DECISION_ACTION_PROPERTY_KEY + DOT + MOTION_FIELD,
                KeyConstants.ERROR_PROTOCOL_RECORD_COMMITEE_NO_MOTION);
        retVal = false;//from  w ww  .  j a v a  2 s.c o  m
    } else {
        String motionTypeCode = committeeDecision.getMotionTypeCode();
        ReviewCommentsBeanBase reviewerCommentsBean = committeeDecision.getReviewCommentsBean();
        List<CommitteeScheduleMinuteBase> reviewComments = reviewerCommentsBean.getReviewComments();
        ProtocolBase protocol = committeeDecision.getProtocol();
        if ((CommitteeDecisionMotionType.SPECIFIC_MINOR_REVISIONS.equals(motionTypeCode)
                || CommitteeDecisionMotionType.SUBSTANTIVE_REVISIONS_REQUIRED.equals(motionTypeCode)
                || CommitteeDecisionMotionType.DISAPPROVE.equals(motionTypeCode))
                && CollectionUtils.isEmpty(filterReviewComments(reviewComments, protocol))) {
            reportError(Constants.PROTOCOL_COMMITTEE_DECISION_ACTION_PROPERTY_KEY + DOT + MOTION_FIELD,
                    getNoCommentsForRevisionsErrorMessageHook());
            retVal = false;
        }
    }

    return retVal;
}

From source file:org.kuali.kra.protocol.actions.print.ProtocolQuestionnairePrintingServiceImplBase.java

private boolean isCurrentRegularQn(AnswerHeader answerHeader) {
    boolean isCurrentQn = false;
    if ((getProtocol().isAmendment() || getProtocol().isRenewal())
            && !answerHeader.getModuleItemKey().equals(getProtocol().getProtocolNumber())) {
        Map keyValues = new HashMap();
        keyValues.put("protocolNumber", answerHeader.getModuleItemKey());
        ProtocolBase prevProtocol = null;
        // if this is an A/R protocol, then need to find the original protocol that the A/R first merged into.            
        for (ProtocolBase protocol : ((List<ProtocolBase>) getBusinessObjectService()
                .findMatchingOrderBy(getProtocolBOClassHook(), keyValues, "sequenceNumber", true))) {
            isCurrentQn = answerHeader.getModuleSubItemKey().equals(protocol.getSequenceNumber().toString())
                    && !CollectionUtils.isEmpty(getProtocol().getProtocolSubmissions())
                    && isMergedToProtocol(protocol, getProtocol());
            if (isCurrentQn) {
                if (prevProtocol == null || !isMergedToProtocol(prevProtocol, getProtocol())) {
                    // this is the protocol this A/R merged into. so, use this questionnaire.
                    break;
                } else {
                    // prevProtocol is the initial ProtocolBase that this A/R merged into.
                    isCurrentQn = false;
                }/*  ww w. ja v  a2s. c om*/

            }
            prevProtocol = protocol;
        }
    } else {
        // if this is a regular protocol, then check if sequencenumber & modulesubitemkey match
        isCurrentQn = answerHeader.getModuleSubItemKey().equals(getProtocol().getSequenceNumber().toString());
    }
    return isCurrentQn;
}

From source file:org.kuali.kra.protocol.actions.print.ProtocolQuestionnairePrintingServiceImplBase.java

private boolean isCurrentAorRQn(AnswerHeader answerHeader) {
    boolean isCurrentQn = false;
    if (getProtocol().isAmendment() || getProtocol().isRenewal()) {
        // if this is A/R, then just match sequencenumber and modulesubitemkey
        isCurrentQn = answerHeader.getModuleSubItemKey().equals(getProtocol().getSequenceNumber().toString());
    } else {/*from w  ww  .  ja va 2  s .  c om*/
        // if this is a regular protocol, then get this A/R associated this this Qn and see if
        // A/R has been merged to this version of protocol
        Map keyValues = new HashMap();
        keyValues.put("protocolNumber", answerHeader.getModuleItemKey());

        ProtocolBase protocol = ((List<ProtocolBase>) getBusinessObjectService()
                .findMatchingOrderBy(getProtocolBOClassHook(), keyValues, "sequenceNumber", false)).get(0);

        isCurrentQn = answerHeader.getModuleSubItemKey().equals(protocol.getSequenceNumber().toString())
                && !CollectionUtils.isEmpty(protocol.getProtocolSubmissions())
                && isMergedToProtocol(getProtocol(), protocol);
    }
    return isCurrentQn;
}

From source file:org.kuali.kra.protocol.actions.reviewcomments.ReviewCommentsServiceImplBase.java

private boolean isAdmin(String principalId) {
    return !CollectionUtils.isEmpty(getAdminIds()) && getAdminIds().contains(principalId);
}

From source file:org.kuali.kra.protocol.actions.reviewcomments.ReviewCommentsServiceImplBase.java

private Set<String> getProtocolAggregators() {
    if (CollectionUtils.isEmpty(aggregatorIds)) {
        aggregatorIds = (Set<String>) roleService.getRoleMemberPrincipalIds(getNamespaceHook(),
                getAggregatorRoleNameHook(), null);

    }/* ww w. j a v a2 s.  c o  m*/
    return aggregatorIds;

}