示例#1
0
  @Override
  protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder)
      throws Exception {
    binder.setAutoGrowNestedPaths(Boolean.FALSE);
    super.initBinder(request, binder);
    binder.registerCustomEditor(Date.class, ControllerTools.getDateEditor(false));
    binder.registerCustomEditor(
        healthcareSiteDao.domainClass(), new CustomDaoEditor(healthcareSiteDao));
    binder.registerCustomEditor(
        healthcareSiteInvestigatorDao.domainClass(),
        new NullIdDaoBasedEditor(healthcareSiteInvestigatorDao));
    binder.registerCustomEditor(
        personUserDao.domainClass(), new NullIdDaoBasedEditor(personUserDao));
    binder.registerCustomEditor(studyDao.domainClass(), new CustomDaoEditor(studyDao));

    binder.registerCustomEditor(Integer.class, new CustomNumberEditor(Integer.class, true));
    binder.registerCustomEditor(String.class, "file", new StringMultipartFileEditor());
    binder.registerCustomEditor(
        byte[].class, "study.criteriaFile", new ByteArrayMultipartFileEditor());

    binder.registerCustomEditor(StudyPart.class, new EnumByNameEditor(StudyPart.class));
    binder.registerCustomEditor(ConsentRequired.class, new EnumByNameEditor(ConsentRequired.class));
    binder.registerCustomEditor(
        OrganizationIdentifierTypeEnum.class,
        new EnumByNameEditor(OrganizationIdentifierTypeEnum.class));
    binder.registerCustomEditor(
        RandomizationType.class, new EnumByNameEditor(RandomizationType.class));
    binder.registerCustomEditor(
        CoordinatingCenterStudyStatus.class,
        new EnumByNameEditor(CoordinatingCenterStudyStatus.class));
    binder.registerCustomEditor(
        InvestigatorStatusCodeEnum.class, new EnumByNameEditor(InvestigatorStatusCodeEnum.class));
    binder.registerCustomEditor(SiteStudyStatus.class, new EnumByNameEditor(SiteStudyStatus.class));
    binder.registerCustomEditor(EpochType.class, new EnumByNameEditor(EpochType.class));
    binder.registerCustomEditor(
        ConsentingMethod.class, new EnumByNameEditor(ConsentingMethod.class));
    binder.registerCustomEditor(
        StudySponsorType.class, new EnumByNameEditor(StudySponsorType.class));
    binder.registerCustomEditor(StudyCategory.class, new EnumByNameEditor(StudyCategory.class));
    binder.registerCustomEditor(
        NCIRecognizedProgramName.class, new EnumByNameEditor(NCIRecognizedProgramName.class));
  }
示例#2
0
  /**
   * Gets the sites. Returns the list of sites associated with the
   * study/studySite/studySubject(depending on the event).
   *
   * @param entity the entity
   * @return the sites
   */
  private List<HealthcareSite> getSites(Object entity) {

    List<HealthcareSite> hcsList = new ArrayList<HealthcareSite>();
    if (entity instanceof StudySubject) {
      //			Original code, commented out for the time-being.
      /*if(((StudySubject)entity).getStudySite() != null){
      	hcsList.add(((StudySubject)entity).getStudySite().getHealthcareSite());
      	hcsList.add(((StudySubject)entity).getStudySite().getStudy().getStudyCoordinatingCenter().getHealthcareSite());

      }*/

      // Try this if the above doesn't work
      StudySubject studySubject = (StudySubject) entity;
      if (studySubject.getStudySubjectStudyVersion() != null
          && studySubject.getStudySubjectStudyVersion().getStudySiteStudyVersion() != null) {
        hcsList.add(
            studySubject
                .getStudySubjectStudyVersion()
                .getStudySiteStudyVersion()
                .getStudySite()
                .getHealthcareSite());
        hcsList.add(
            studySubject
                .getStudySiteVersion()
                .getStudyVersion()
                .getStudy()
                .getStudyCoordinatingCenter()
                .getHealthcareSite());
      }
    }
    if (entity instanceof StudySubjectStudyVersion) {
      StudySubjectStudyVersion studySubjectStudyVersion = (StudySubjectStudyVersion) entity;
      hcsList.add(
          studySubjectStudyVersion.getStudySiteStudyVersion().getStudySite().getHealthcareSite());
      hcsList.add(
          studySubjectStudyVersion
              .getStudySiteStudyVersion()
              .getStudySite()
              .getStudy()
              .getStudyCoordinatingCenter()
              .getHealthcareSite());
    }

    if (entity instanceof SiteStatusHistory) {
      hcsList.add(((SiteStatusHistory) entity).getStudySite().getHealthcareSite());
      hcsList.add(
          ((SiteStatusHistory) entity)
              .getStudySite()
              .getStudy()
              .getStudyCoordinatingCenter()
              .getHealthcareSite());
    }
    if (entity instanceof StudySite) {
      hcsList.add(((StudySite) entity).getHealthcareSite());
      hcsList.add(((StudySite) entity).getStudy().getStudyCoordinatingCenter().getHealthcareSite());
    }
    if (entity instanceof Study) {
      for (StudyOrganization so : ((Study) entity).getStudyOrganizations()) {
        hcsList.add(so.getHealthcareSite());
      }
    }
    // defaulting to the hosting site if nothing is found
    if (hcsList.size() == 0) {
      String localNciCode = this.configuration.get(Configuration.LOCAL_NCI_INSTITUTE_CODE);
      hcsList.add(healthcareSiteDao.getByPrimaryIdentifierFromLocal(localNciCode));
    }
    removeDuplicates(hcsList);
    return hcsList;
  }