Exemple #1
0
  public void createAndOpenStudy(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);

      // handle book randomization
      if (study.getRandomizedIndicator()
          && study.getRandomizationType() == RandomizationType.BOOK) {
        handleBookRandomization(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);
      //            study=studyRepository.createStudy(study);
      //            studyRepository.openStudy(study.getIdentifiers());
      studyDao.save(study);
      studyRepository.createAndOpenStudy(study);
    } catch (C3PRCodedException e) {
      throw new RemoteException("error building the study", e);
    } finally {
      SessionAndAuditHelper.tearDownHibernateSession(interceptor, webRequest);
    }
  }