コード例 #1
0
 @Override
 public List<ProtocolOnlineReviewDocumentBase> getProtocolReviewDocumentsForCurrentSubmission(
     ProtocolBase protocol) {
   List<ProtocolOnlineReviewDocumentBase> onlineReviewDocuments =
       new ArrayList<ProtocolOnlineReviewDocumentBase>();
   ProtocolSubmissionBase submission = protocol.getProtocolSubmission();
   List<ProtocolOnlineReviewBase> reviews =
       findProtocolOnlineReviews(protocol.getProtocolId(), submission.getSubmissionId());
   for (ProtocolOnlineReviewBase review : reviews) {
     if (review.isActive()) {
       review.refresh();
       try {
         onlineReviewDocuments.add(
             (ProtocolOnlineReviewDocumentBase)
                 (documentService.getByDocumentHeaderId(
                     review.getProtocolOnlineReviewDocument().getDocumentNumber())));
       } catch (WorkflowException e) {
         throw new RuntimeException(
             String.format(
                 "Could not load ProtocolOnlineReviewBase docuemnt %s due to WorkflowException: %s",
                 review.getProtocolOnlineReviewDocument().getDocumentNumber(), e.getMessage()),
             e);
       }
     }
   }
   return onlineReviewDocuments;
 }
  protected void buildAndAttachProtocolCorrespondence(
      ProtocolBase protocol, byte[] data, String correspTypeCode) {

    ProtocolCorrespondence protocolCorrespondence = getNewProtocolCorrespondenceHook();
    protocolCorrespondence.setProtocol(protocol);
    protocolCorrespondence.setProtocolId(protocol.getProtocolId());
    protocolCorrespondence.setProtocolNumber(protocol.getProtocolNumber());
    protocolCorrespondence.setSequenceNumber(protocol.getSequenceNumber());
    protocolCorrespondence.setProtoCorrespTypeCode(correspTypeCode);

    ProtocolActionBase lastAction = protocol.getLastProtocolAction();
    protocolCorrespondence.setProtocolAction(lastAction);
    protocolCorrespondence.setActionIdFk(lastAction.getProtocolActionId());
    protocolCorrespondence.setCorrespondence(data);
    protocolCorrespondence.setActionId(lastAction.getActionId());

    // What is Final flag used for? ANSWER: the final flag is used by the IRB admin to denote
    // correspondences
    // that are ready to be sent/published to the PI etc.
    protocolCorrespondence.setFinalFlag(false);
    protocolCorrespondence.setCreateUser(GlobalVariables.getUserSession().getPrincipalName());
    protocolCorrespondence.setCreateTimestamp(dateTimeService.getCurrentTimestamp());

    if (lastAction.getProtocolCorrespondences() == null) {
      List<ProtocolCorrespondence> correspondences = new ArrayList<ProtocolCorrespondence>();
      correspondences.add(protocolCorrespondence);
      lastAction.setProtocolCorrespondences(correspondences);
      protocol.refreshReferenceObject("protocolSubmissions");
    } else {
      lastAction.getProtocolCorrespondences().add(protocolCorrespondence);
    }

    getBusinessObjectService().save(protocolCorrespondence);

    getBusinessObjectService().save(protocol);
  }