示例#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);
   }
 }
示例#2
0
 protected Study createDefaultStudyWithDesign() {
   Study study = new LocalStudy();
   if (companionIndicator != null) {
     study.setCompanionIndicator(companionIndicator);
     if (!companionIndicator) {
       study.setStandaloneIndicator(true);
     } else {
       study.setStandaloneIndicator(false);
     }
   }
   return study;
 }
示例#3
0
 @Override
 protected C save(C command, Errors errors) {
   StudyWrapper wrapper = (StudyWrapper) command;
   Study study = null;
   if (wrapper.getStudy().getId() == null) {
     studyDao.save(wrapper.getStudy());
     study = studyDao.getByIdentifiers(wrapper.getStudy().getIdentifiers()).get(0);
   } else {
     study = studyDao.merge(wrapper.getStudy());
   }
   studyDao.initialize(study);
   study.getParentStudyAssociations().size();
   wrapper.setStudy(study);
   return (C) wrapper;
 }
示例#4
0
 private void handleBookRandomization(Study study) {
   for (Epoch epoch : study.getEpochs()) {
     if (epoch.getRandomizedIndicator() && !epoch.hasBookRandomizationEntry()) {
       BookRandomizationEntry bookRandomizationEntry =
           ((BookRandomization) epoch.getRandomization()).getBookRandomizationEntry().get(0);
       bookRandomizationEntry.setArm(epoch.getArms().get(0));
       bookRandomizationEntry.setPosition(0);
     }
   }
 }
示例#5
0
  public String getTable(
      Map<String, List> parameterMap, String[] params, HttpServletRequest request) {

    List<StudySubject> studySubjectResults;
    Participant participant;
    SystemAssignedIdentifier id;

    Study study = new LocalStudy(true);
    if (!StringUtils.isEmpty(params[0].toString())) {
      study.setShortTitleText(params[0].toString());
    }
    if (!StringUtils.isEmpty(params[1].toString())) {
      id = new SystemAssignedIdentifier();
      id.setValue(params[1].toString());
      study.addIdentifier(id);
    }

    List<Study> studyList = new ArrayList<Study>();

    // this if -else ensures that participant is null if no data relevant to
    // participant is
    // entered and the studyDao is called.
    if (StringUtils.isEmpty(params[2].toString())
        && StringUtils.isEmpty(params[3].toString())
        && StringUtils.isEmpty(params[4].toString())) {
      participant = null;
      // call the studyDao if participant is null.
      studyList = studyDao.searchByExample(study, true, 0);
    } else {
      participant = new Participant();
      id = new SystemAssignedIdentifier();
      if (!StringUtils.isEmpty(params[2].toString())) {
        id.setValue(params[2].toString());
        participant.addIdentifier(id);
      }

      if (!StringUtils.isEmpty(params[3].toString())) {
        participant.setFirstName(params[3].toString());
      }
      if (!StringUtils.isEmpty(params[4].toString())) {
        participant.setLastName(params[4].toString());
      }

      StudySite studySite = new StudySite();
      study.addStudySite(studySite);

      StudySubject studySubject = new StudySubject();
      studySubject.setStudySite(studySite);
      studySubject.setParticipant(participant);

      // else call the studySubjectDao
      studySubjectResults = studySubjectDao.advancedStudySearch(studySubject);
      Iterator iter = studySubjectResults.iterator();
      while (iter.hasNext()) {
        studyList.add(((StudySubject) iter.next()).getStudySite().getStudy());
      }
    }

    Context context = new HttpServletRequestContext(request, parameterMap);

    TableModel model = new TableModelImpl(context);
    try {
      return build(model, studyList).toString();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "";
  }