protected ProtocolSubmission getSubmission(ProtocolBase protocol) { // There are 'findCommission' in other classes. Consider to create a utility static method for // this // need to loop thru to find the last submission. // it may have submit/Wd/notify irb/submit, and this will cause problem if don't loop thru. ProtocolSubmission protocolSubmission = null; for (ProtocolSubmissionBase submission : protocol.getProtocolSubmissions()) { if (StringUtils.equals( submission.getSubmissionStatusCode(), ProtocolSubmissionStatus.IN_AGENDA) || StringUtils.equals( submission.getSubmissionStatusCode(), ProtocolSubmissionStatus.SUBMITTED_TO_COMMITTEE)) { protocolSubmission = (ProtocolSubmission) submission; } } return protocolSubmission; }
public boolean isProtocolInStateToBeReviewed(ProtocolBase protocol) { boolean isReviewable = false; ProtocolSubmissionBase submission = (IacucProtocolSubmission) ((IacucProtocol) protocol).getProtocolSubmission(); if (submission != null) { try { isReviewable = StringUtils.isNotEmpty(submission.getScheduleId()) || StringUtils.equals( submission.getProtocolSubmissionType().getSubmissionTypeCode(), IacucProtocolSubmissionType.NOTIFY_IACUC); isReviewable &= (StringUtils.equals( submission.getSubmissionStatusCode(), IacucProtocolSubmissionStatus.SUBMITTED_TO_COMMITTEE) || StringUtils.equals( submission.getSubmissionStatusCode(), IacucProtocolSubmissionStatus.IN_AGENDA)); ProtocolDocumentBase protocolDocument = (ProtocolDocumentBase) documentService.getByDocumentHeaderId( protocol.getProtocolDocument().getDocumentNumber()); isReviewable &= kraWorkflowService.isCurrentNode( protocolDocument, Constants.IACUC_PROTOCOL_IACUCREVIEW_ROUTE_NODE_NAME); } catch (WorkflowException e) { String errorString = String.format( "WorkflowException checking route node for creating new ProtocolOnlineReviewDocumentBase " + "for protocol %s", submission.getProtocolNumber()); LOG.error(errorString, e); throw new RuntimeException(errorString, e); } } return isReviewable; }