コード例 #1
0
ファイル: HealthcareSite.java プロジェクト: NCIP/c3pr
 /**
  * Sets the nci code.
  *
  * @param nciCode the nci code
  * @param primaryIndicator the primary indicator
  */
 public void setNCICode(String nciCode, boolean primaryIndicator) {
   if (!StringUtils.isEmpty(nciCode)) {
     OrganizationAssignedIdentifier identifier = null;
     for (OrganizationAssignedIdentifier tempIdentifier : getOrganizationAssignedIdentifiers()) {
       if (tempIdentifier.getType() == OrganizationIdentifierTypeEnum.NCI) {
         identifier = (OrganizationAssignedIdentifier) tempIdentifier;
         break;
       }
     }
     if (identifier == null) {
       identifier = new OrganizationAssignedIdentifier();
       identifier.setType(OrganizationIdentifierTypeEnum.NCI);
       identifier.setPrimaryIndicator(primaryIndicator);
       getIdentifiersAssignedToOrganization().add(identifier);
     }
     identifier.setValue(nciCode);
   }
 }
コード例 #2
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 "";
  }