@Override
 public boolean isAuthorized(String username, IacucProtocolTask task) {
   ProtocolBase protocol = task.getProtocol();
   return !(kraWorkflowService.isInWorkflow(protocol.getProtocolDocument())
           && kraWorkflowService.isCurrentNode(
               protocol.getProtocolDocument(), Constants.PROTOCOL_IACUCREVIEW_ROUTE_NODE_NAME)
           && canExecuteAction(protocol, IacucProtocolActionType.ASSIGNED_TO_AGENDA)
           && isAssignedToCommittee(protocol))
       && hasPermission(username, protocol, PermissionConstants.PERFORM_IACUC_ACTIONS_ON_PROTO);
 }
 protected void performDisapprove(ProtocolBase protocol) throws Exception {
   if (protocol.getProtocolDocument() != null) {
     WorkflowDocument currentWorkflowDocument =
         protocol.getProtocolDocument().getDocumentHeader().getWorkflowDocument();
     if (currentWorkflowDocument != null) {
       currentWorkflowDocument.disapprove(
           "Protocol document disapproved after committee decision");
     }
   }
   getProtocolOnlineReviewService()
       .cancelOnlineReviews(
           protocol.getProtocolSubmission(),
           "Protocol Review cancelled - protocol has been disapproved.");
 }
  protected ProtocolDocument getReturnedVersionedDocument(ProtocolBase protocol) throws Exception {
    getDocumentService()
        .cancelDocument(
            protocol.getProtocolDocument(),
            "Protocol document cancelled - protocol has been returned for revisions.");
    getProtocolOnlineReviewService()
        .finalizeOnlineReviews(
            protocol.getProtocolSubmission(),
            "Protocol Review finalized - protocol has been returned for revisions.");

    return (ProtocolDocument) getVersionedDocument(protocol);
  }
 @Override
 public boolean isProtocolInStateToBeReviewed(ProtocolBase protocol) {
   boolean isReviewable = false;
   ProtocolSubmission submission =
       (ProtocolSubmission) ((Protocol) protocol).getProtocolSubmission();
   if (submission != null) {
     try {
       isReviewable =
           StringUtils.isNotEmpty(submission.getScheduleId())
               || ProtocolReviewType.EXPEDITED_REVIEW_TYPE_CODE.equals(
                   submission.getProtocolReviewTypeCode())
               || (ProtocolReviewType.FYI_TYPE_CODE.equalsIgnoreCase(
                       submission.getProtocolReviewTypeCode())
                   && ProtocolSubmissionType.NOTIFY_IRB.equalsIgnoreCase(
                       submission.getProtocolSubmissionType().getSubmissionTypeCode()));
       isReviewable &=
           (StringUtils.equals(
                   submission.getSubmissionStatusCode(),
                   ProtocolSubmissionStatus.SUBMITTED_TO_COMMITTEE)
               || StringUtils.equals(
                   submission.getSubmissionStatusCode(), ProtocolSubmissionStatus.IN_AGENDA));
       ProtocolDocument protocolDocument =
           (ProtocolDocument)
               protocol
                   .getProtocolDocument(); // (ProtocolDocument)
                                           // documentService.getByDocumentHeaderId(protocol.getProtocolDocument().getDocumentNumber());
       isReviewable &=
           getKraWorkflowService()
               .isCurrentNode(protocolDocument, Constants.PROTOCOL_IRBREVIEW_ROUTE_NODE_NAME);
     } catch (Exception e) {
       String errorString =
           String.format(
               "WorkflowException checking route node for creating new ProtocolOnlineReviewDocument "
                   + "for protocol %s",
               submission.getProtocolNumber());
       LOG.error(errorString, e);
       throw new RuntimeException(errorString, e);
     }
   }
   return isReviewable;
 }
  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;
  }
Exemplo n.º 6
0
 /**
  * Can the user on the current thread execute the given action for the given protocol?
  *
  * @param protocol
  * @param protocolActionTypeCode
  * @return true if the action can be executed; otherwise false
  */
 protected final boolean canExecuteAction(ProtocolBase protocol, String protocolActionTypeCode) {
   return protocol.isActive()
       && !protocol.getProtocolDocument().isViewOnly()
       && protocolActionService.isActionAllowed(protocolActionTypeCode, protocol);
 }