Exemplo n.º 1
0
 public void createStudyDefinition(Message message) throws RemoteException {
   List<Study> objects =
       xmUtils.getDomainObjectsFromList(Study.class, xmUtils.getArguments(message));
   if (objects.size() != 1) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is exactly one study defination in the message.");
   }
   WebRequest webRequest =
       SessionAndAuditHelper.setupHibernateSessionAndAudit(
           interceptor, "C3PR Admin", "Coordinating Center", new Date(), "Coordinating Center");
   try {
     Study study = objects.get(0);
     studyFactory.buildStudy(study);
     for (StudySite studySite : study.getStudySites()) {
       studySite.setHostedMode(false);
       // TODO fix it later
       //                studySite.setSiteStudyStatus(SiteStudyStatus.PENDING);
     }
     for (StudyCoordinatingCenter studyCoordinatingCenter : study.getStudyCoordinatingCenters()) {
       studyCoordinatingCenter.setHostedMode(false);
     }
     study.setCoordinatingCenterStudyStatus(CoordinatingCenterStudyStatus.PENDING);
     studyDao.save(study);
     studyRepository.createStudy(study.getIdentifiers());
   } catch (C3PRCodedException e) {
     throw new RemoteException("error building the study", e);
   } finally {
     SessionAndAuditHelper.tearDownHibernateSession(interceptor, webRequest);
   }
 }
Exemplo n.º 2
0
  /*
   *  Return true only if the state is modified in anyway.
   */
  @Override
  public boolean onSave(
      Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
    log.debug(this.getClass().getName() + ": Entering onSave()");

    // Every new registration is handled here.
    if (entity instanceof StudySubjectStudyVersion) {
      handleNewStudySubjectSaved(
          null,
          ((StudySubjectStudyVersion) entity).getStudySubject().getRegWorkflowStatus(),
          entity);
    }
    /*		if(entity instanceof StudySubject){
    	handleNewStudySubjectSaved(null,((StudySubject)entity).getRegWorkflowStatus(), entity);
    }*/
    // Every new study...notification is onyl sent if new stuayd status is Active
    if (entity instanceof Study) {
      handleStudyStatusChange(null, ((Study) entity).getCoordinatingCenterStudyStatus(), entity);
    }
    // New Study Site .....currently not implemented
    if (entity instanceof SiteStatusHistory) {
      StudySite studySite = ((SiteStatusHistory) entity).getStudySite();
      handleStudySiteStatusChange(null, studySite.getSiteStudyStatus(), studySite);
    }

    // saving correspondence activate rules only if follow_up is needed and either person_spoken_to
    // or notified_study_personnel is present

    /*if(entity instanceof Correspondence && ((Correspondence)entity).getFollowUpNeeded() &&
    		(((Correspondence)entity).getPersonSpokenTo()!=null || ((Correspondence)entity).getNotifiedStudyPersonnel().size()>0)){
    	activateRulesForNewOrUpdatedCorrespondence((Correspondence)entity);
    }*/
    log.debug(this.getClass().getName() + ": Exiting onSave()");
    return false;
  }
Exemplo n.º 3
0
 public void activateStudySite(gov.nih.nci.cabig.ccts.domain.Message message)
     throws RemoteException {
   List arguments = xmUtils.getArguments(message);
   List<Identifier> identifiers = xmUtils.getDomainObjectsFromList(Identifier.class, arguments);
   if (identifiers.size() == 0) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is atleast one identifier in the message.");
   }
   List<StudySite> studySiteList = xmUtils.getDomainObjectsFromList(StudySite.class, arguments);
   if (studySiteList.size() != 1) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is atleast one study site defination in the message.");
   }
   WebRequest webRequest =
       SessionAndAuditHelper.setupHibernateSessionAndAudit(
           interceptor, "C3PR Admin", "Coordinating Center", new Date(), "Coordinating Center");
   try {
     StudySite studySite =
         studyRepository
             .getUniqueStudy(identifiers)
             .getStudySite(studySiteList.get(0).getHealthcareSite().getPrimaryIdentifier());
     studySite.setIrbApprovalDate(studySiteList.get(0).getIrbApprovalDate());
     // TODO fix it later
     //        	studySite.setStartDate(studySiteList.get(0).getStartDate());
     studySiteDao.save(studySite);
     // TODO fix it later
     //            studyRepository.activateStudySite(identifiers,
     // studySiteList.get(0).getHealthcareSite().getPrimaryIdentifier());
   } catch (Exception e) {
     throw new RemoteException(e.getMessage());
   } finally {
     SessionAndAuditHelper.tearDownHibernateSession(interceptor, webRequest);
   }
 }
Exemplo n.º 4
0
  /**
   * Activate rules for accruals. Called for new registrations only. Checks if accrual notifications
   * are configured. Fires rules if thresholds are met.
   *
   * @param studySubjectObj the study subject obj
   */
  private void activateRulesForAccruals(Object studySubjectObj) {
    StudySubject studySubject = null;
    StudyOrganization studyOrg = null;
    StudySite studySite = null;

    if (studySubjectObj instanceof StudySubject) {
      studySubject = (StudySubject) studySubjectObj;
    } else {
      return;
    }

    List<Object> objects = new ArrayList<Object>();
    objects.add(studySubject);
    int studyAccruals = 0;
    int threshold = 0;
    List<HealthcareSite> hcsList = getSites(studySubject);
    for (PlannedNotification pn : getPlannedNotifications(hcsList)) {
      if (pn.getEventName().equals(NotificationEventTypeEnum.STUDY_ACCRUAL_EVENT)) {
        Iterator<StudyOrganization> iter =
            studySubject.getStudySite().getStudy().getStudyOrganizations().iterator();
        while (iter.hasNext()) {
          studyOrg = iter.next();
          // ensure that the host org is in the studyOrg list for the study
          if (studyOrg
              .getHealthcareSite()
              .getPrimaryIdentifier()
              .equalsIgnoreCase(configuration.get(Configuration.LOCAL_NCI_INSTITUTE_CODE))) {
            studyAccruals = calculateStudyAccrual(studySubject);
            threshold = studySubject.getStudySite().getStudy().getTargetAccrualNumber().intValue();
            // if accruals exceed specified threshold value then send out email
            if (studyAccruals * 100 / threshold >= pn.getStudyThreshold()) {
              objects.add(pn);
              rulesDelegationService.activateRules(
                  NotificationEventTypeEnum.STUDY_ACCRUAL_EVENT, objects);
            }
          }
        }
      }
      if (pn.getEventName().equals(NotificationEventTypeEnum.STUDY_SITE_ACCRUAL_EVENT)) {
        studySite = studySubject.getStudySite();
        // ensure that the host org is in the studySite list for the study
        if (studySite
            .getHealthcareSite()
            .getPrimaryIdentifier()
            .equalsIgnoreCase(configuration.get(Configuration.LOCAL_NCI_INSTITUTE_CODE))) {
          studyAccruals = calculateStudySiteAccrual(studySubject);
          threshold = studySubject.getStudySite().getTargetAccrualNumber().intValue();
          // if accruals exceed specified threshold value then send out email
          if ((studyAccruals / threshold) * 100 >= pn.getStudySiteThreshold()) {
            objects.add(pn);
            rulesDelegationService.activateRules(
                NotificationEventTypeEnum.STUDY_SITE_ACCRUAL_EVENT, objects);
          }
        }
      }
    }
  }