Ejemplo n.º 1
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (!super.equals(obj)) return false;
   if (getClass() != obj.getClass()) return false;
   final SystemAssignedIdentifier other = (SystemAssignedIdentifier) obj;
   if (systemName == null) {
     if (other.systemName != null) return false;
   } else if (!systemName.equalsIgnoreCase(other.systemName)) return false;
   if (!this.getValue().equals(other.getValue())) return false;
   return true;
 }
Ejemplo n.º 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 "";
  }