List of usage examples for org.apache.commons.collections4 CollectionUtils isEmpty
public static boolean isEmpty(final Collection<?> coll)
From source file:org.kuali.kra.coi.disclosure.AddDisclosureReporterUnitRule.java
@Override public boolean processRules(AddDisclosureReporterUnitEvent event) { boolean isValid = true; // String errorPathKey = event.getPropertyName() + ".newDisclosurePersonUnit"; GlobalVariables.getMessageMap().addToErrorPath(event.getPropertyName()); if (StringUtils.isBlank(event.getDisclosureReporterUnit().getUnitNumber())) { GlobalVariables.getMessageMap().putError("unitNumber", KeyConstants.ERROR_UNIT_NUMBER_REQUIRED); } else {// w w w . j a v a 2 s . co m if (!CollectionUtils.isEmpty(event.getDisclosureReporterUnits())) { boolean duplicateUnitNumber = false; for (DisclosureReporterUnit unit : event.getDisclosureReporterUnits()) { if (StringUtils.equals(unit.getUnitNumber(), event.getDisclosureReporterUnit().getUnitNumber())) { duplicateUnitNumber = true; break; } } if (duplicateUnitNumber) { GlobalVariables.getMessageMap().putError("unitNumber", KeyConstants.ERROR_PROTOCOL_UNIT_DUPLICATE); } } if (event.getDisclosureReporterUnit().getUnit() == null) { GlobalVariables.getMessageMap().putError("unitNumber", KeyConstants.ERROR_INVALID_UNIT, event.getDisclosureReporterUnit().getUnitNumber()); } } isValid &= GlobalVariables.getMessageMap().hasNoErrors(); GlobalVariables.getMessageMap().removeFromErrorPath(event.getPropertyName()); return isValid; }
From source file:org.kuali.kra.coi.disclosure.CoiDisclosureServiceImpl.java
private boolean isProtocolFundedByActiveSponsor(Protocol protocol) { boolean isActive = false; for (ProtocolFundingSourceBase fundingSource : protocol.getProtocolFundingSources()) { if (fundingSource.isSponsorFunding() && isSponsorForDisclosure(ProtocolDocument.class, fundingSource.getFundingSourceNumber(), SPONSORS_FOR_PROTOCOL_DISCLOSE, ALL_SPONSORS_FOR_PROTOCOL_DISCLOSE)) { isActive = true;// w w w .ja v a2 s .c o m break; } } // it is ok if there is no sponsor set up for protocol if (CollectionUtils.isEmpty(protocol.getProtocolFundingSources())) { isActive = isAllSponsorActiveForDisclose(ProtocolDocument.class, ALL_SPONSORS_FOR_PROTOCOL_DISCLOSE); } return isActive; }
From source file:org.kuali.kra.coi.disclosure.CoiDisclosureServiceImpl.java
private boolean isProtocolFundedByActiveSponsor(IacucProtocol protocol) { boolean isActive = false; for (org.kuali.kra.protocol.protocol.funding.ProtocolFundingSourceBase fundingSource : protocol .getProtocolFundingSources()) { if (fundingSource.isSponsorFunding() && isSponsorForDisclosure(ProtocolDocument.class, fundingSource.getFundingSourceNumber(), SPONSORS_FOR_PROTOCOL_DISCLOSE, ALL_SPONSORS_FOR_PROTOCOL_DISCLOSE)) { isActive = true;/* ww w . j av a 2 s. c om*/ break; } } // it is ok if there is no sponsor set up for protocol if (CollectionUtils.isEmpty(protocol.getProtocolFundingSources())) { isActive = isAllSponsorActiveForDisclose(ProtocolDocument.class, ALL_SPONSORS_FOR_IACUC_PROTOCOL_DISCLOSE); } return isActive; }
From source file:org.kuali.kra.coi.disclosure.CoiDisclosureServiceImpl.java
protected CoiDiscDetail getCurrentProjectDetail(CoiDisclosure coiDisclosure) { if (CollectionUtils.isEmpty(coiDisclosure.getCoiDisclProjects())) { coiDisclosure.refreshReferenceObject("coiDisclProjects"); }/* ww w . j av a 2s . c o m*/ for (CoiDisclProject coiDisclProject : coiDisclosure.getCoiDisclProjects()) { // after normalization coidisclosureid in detail is not setting ? for (CoiDiscDetail coiDiscDetail : coiDisclProject.getCoiDiscDetails()) { if (coiDiscDetail.getOriginalCoiDisclosure() == null || coiDisclProject.getCoiDisclosureId() .equals(coiDiscDetail.getOriginalCoiDisclosureId())) { return coiDiscDetail; } } } return null; }
From source file:org.kuali.kra.coi.disclosure.CoiDisclosureServiceImpl.java
public CoiDisclosure getCurrentDisclosure() { Map fieldValues = new HashMap(); fieldValues.put("personId", GlobalVariables.getUserSession().getPrincipalId()); fieldValues.put("currentDisclosure", "Y"); List<CoiDisclosure> disclosures = (List<CoiDisclosure>) businessObjectService .findMatching(CoiDisclosure.class, fieldValues); if (CollectionUtils.isEmpty(disclosures)) { return null; } else {// ww w . j a va 2 s . c o m return disclosures.get(0); } }
From source file:org.kuali.kra.coi.disclosure.CoiDisclosureServiceImpl.java
/** * Called during a "Report Coi" instance for System Events. This method assumes a 1:1 disclosure to project relationship * @see org.kuali.kra.coi.disclosure.CoiDisclosureService#initializeDisclosureProject(org.kuali.kra.coi.CoiDisclosure, java.lang.String) *//* w ww . j ava 2 s.c o m*/ public void initializeDisclosureProject(CoiDisclosure coiDisclosure, String projectId) { List<CoiDisclProject> coiDisclProjects = coiDisclosure.getCoiDisclProjects(); if (CollectionUtils.isEmpty(coiDisclProjects)) { coiDisclProjects = new ArrayList<CoiDisclProject>(); } coiDisclosure.setEventBo(getEventBo(coiDisclosure, projectId)); String moduleItemKey = getModuleItemKey(coiDisclosure, coiDisclosure.getEventBo()); String projectIdFk = getProjectIdFk(coiDisclosure, coiDisclosure.getEventBo()); String projectTitle = getProjectTitle(coiDisclosure, coiDisclosure.getEventBo()); CoiDisclProject newProject = new CoiDisclProject(); newProject.setCoiDisclosureId(coiDisclosure.getCoiDisclosureId()); newProject.setDisclosureEventType(coiDisclosure.getEventTypeCode()); newProject.refreshReferenceObject("coiDisclosureEventType"); newProject.setCoiDisclosure(coiDisclosure); newProject.setCoiDisclosureNumber(coiDisclosure.getCoiDisclosureNumber()); newProject.setSequenceNumber(coiDisclosure.getSequenceNumber()); newProject.setCoiProjectId(projectIdFk); newProject.setModuleItemKey(moduleItemKey); newProject.setCoiProjectTitle(projectTitle); newProject.setDisclosureDispositionCode(CoiDispositionStatus.IN_PROGRESS); newProject.refreshReferenceObject("coiDispositionStatus"); newProject.setDisclosureStatusCode(CoiDisclosureStatus.IN_PROGRESS); this.initializeDisclosureDetails(newProject); coiDisclProjects.add(newProject); coiDisclosure.setCoiDisclProjects(coiDisclProjects); }
From source file:org.kuali.kra.coi.disclosure.DisclosureHelper.java
public void setNewDisclosurePersonUnit(DisclosurePersonUnit newDisclosurePersonUnit) { this.newDisclosurePersonUnit = newDisclosurePersonUnit; DisclosurePerson disclosurePerson = null; if (CollectionUtils.isEmpty( ((CoiDisclosureDocument) this.form.getDocument()).getCoiDisclosure().getDisclosurePersons())) { disclosurePerson = ((CoiDisclosureDocument) this.form.getDocument()).getCoiDisclosure() .getDisclosureReporter(); } else {//w w w .j a va 2 s . com disclosurePerson = ((CoiDisclosureDocument) this.form.getDocument()).getCoiDisclosure() .getDisclosurePersons().get(0); } this.newDisclosurePersonUnit.setDisclosurePersonId(disclosurePerson.getDisclosurePersonId()); this.newDisclosurePersonUnit.setDisclosurePerson(disclosurePerson); this.newDisclosurePersonUnit.setPersonId(disclosurePerson.getPersonId()); }
From source file:org.kuali.kra.iacuc.actions.notifyiacuc.IacucProtocolNotifyIacucServiceImpl.java
/** * @throws WorkflowException /*from www. ja v a2 s. c om*/ * @see org.kuali.kra.irb.actions.notifyirb.ProtocolNotifyIrbService#submitIrbNotification(org.kuali.kra.irb.Protocol, org.kuali.kra.irb.actions.notifyirb.ProtocolNotifyIrbBean) */ public void submitIacucNotification(IacucProtocol protocol, IacucProtocolNotifyIacucBean notifyIacucBean) throws WorkflowException { /* * The submission is created first so that its new primary key can be added * to the protocol action entry. */ IacucProtocolSubmission submission = createProtocolSubmission(protocol, notifyIacucBean); IacucProtocolAction protocolAction = new IacucProtocolAction(protocol, submission, IacucProtocolActionType.NOTIFY_IACUC); protocolAction.setComments(notifyIacucBean.getComment()); protocol.getProtocolActions().add(protocolAction); protocolActionService.updateProtocolStatus(protocolAction, protocol); if (!CollectionUtils.isEmpty(notifyIacucBean.getAnswerHeaders())) { saveQuestionnaire(notifyIacucBean, submission.getSubmissionNumber()); notifyIacucBean.setAnswerHeaders(new ArrayList<AnswerHeader>()); } cleanUnreferencedQuestionnaire(protocol.getProtocolNumber()); documentService.saveDocument(protocol.getProtocolDocument()); protocol.refreshReferenceObject("protocolSubmissions"); }
From source file:org.kuali.kra.iacuc.actions.request.IacucProtocolRequestServiceImpl.java
/** * @throws WorkflowException /* w ww. j av a2s . 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(IacucProtocol protocol, IacucProtocolRequestBean 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. */ String prevSubmissionStatusCode = protocol.getProtocolSubmission().getSubmissionStatusCode(); IacucProtocolSubmission submission = createProtocolSubmission(protocol, requestBean); String submissionTypeCode = submission.getSubmissionTypeCode(); protocol.setProtocolSubmission(submission); IacucProtocolAction protocolAction = new IacucProtocolAction(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); protocolAction.setCreatedSubmission(true); protocol.getProtocolActions().add(protocolAction); protocolActionService.updateProtocolStatus(protocolAction, protocol); if (!CollectionUtils.isEmpty(requestBean.getAnswerHeaders())) { saveQuestionnaire(requestBean, submission.getSubmissionNumber()); requestBean.setAnswerHeaders(new ArrayList<AnswerHeader>()); } cleanUnreferencedQuestionnaire(protocol.getProtocolNumber()); documentService.saveDocument(protocol.getProtocolDocument()); }
From source file:org.kuali.kra.iacuc.actions.submit.IacucProtocolSubmissionBuilder.java
private Integer getNextSubmissionNumber(IacucProtocol protocol) { Integer nextSubmissionNumber; if (protocol.isAmendment() || protocol.isRenewal()) { String origProtocolNumber = protocol.getProtocolNumber(); String protocolNumber = origProtocolNumber.substring(0, 10); IacucProtocol origProtocol = (IacucProtocol) getProtocolFinderDao() .findCurrentProtocolByNumber(protocolNumber); nextSubmissionNumber = origProtocol.getNextValue(NEXT_SUBMISSION_NUMBER_KEY); getBusinessObjectService().save(origProtocol.getProtocolDocument().getDocumentNextvalues()); } else {//from w ww. ja v a 2 s. c o m nextSubmissionNumber = protocol.getNextValue(NEXT_SUBMISSION_NUMBER_KEY); } LOG.info("nextsubmissionnumber " + protocol.getProtocolId() + " " + (CollectionUtils.isEmpty(protocol.getProtocolSubmissions()) ? 0 : protocol.getProtocolSubmissions().size()) + "-" + nextSubmissionNumber); return nextSubmissionNumber; }