Ejemplo n.º 1
0
  private Participant copyFrom(Participant participant) {
    final Participant p = ParticipantFactory.getInstance().createObject();

    p.setId(participant.getId());
    p.setActivityStatus(participant.getActivityStatus());
    p.setBirthDate(participant.getBirthDate());
    p.setEthnicity(participant.getEthnicity());
    p.setFirstName(participant.getFirstName());
    p.setLastName(participant.getLastName());
    p.setGender(participant.getGender());
    p.setMetaPhoneCode(participant.getMetaPhoneCode());
    p.setSocialSecurityNumber(participant.getSocialSecurityNumber());
    p.setVitalStatus(participant.getVitalStatus());

    final Iterator<Race> iter = participant.getRaceCollection().iterator();
    while (iter.hasNext()) {
      final Race race = (Race) iter.next();
      final Race r = RaceFactory.getInstance().createObject();
      r.setParticipant(p);
      r.setRaceName(race.getRaceName());
      p.getRaceCollection().add(r);
    }

    final Iterator<CollectionProtocolRegistration> cprIter =
        participant.getCollectionProtocolRegistrationCollection().iterator();
    while (cprIter.hasNext()) {
      final CollectionProtocolRegistration collectionProtocolRegistration =
          (CollectionProtocolRegistration) cprIter.next();

      final CollectionProtocol collectionProtocol =
          collectionProtocolRegistration.getCollectionProtocol();
      final CollectionProtocol cp = CollectionProtocolFactory.getInstance().createObject();
      cp.setActivityStatus(collectionProtocol.getActivityStatus());
      cp.setTitle(collectionProtocol.getTitle());
      cp.setShortTitle(collectionProtocol.getShortTitle());

      final CollectionProtocolRegistration cpr =
          CollectionProtocolRegistrationFactory.getInstance().createObject();
      cpr.setParticipant(p);
      cpr.setConsentSignatureDate(collectionProtocolRegistration.getConsentSignatureDate());
      cpr.setRegistrationDate(collectionProtocolRegistration.getRegistrationDate());
      cpr.setProtocolParticipantIdentifier(
          collectionProtocolRegistration.getProtocolParticipantIdentifier());
      // setting empty consenttier status collection, as update flow will not update consent tier
      cpr.setConsentTierResponseCollection(
          (Collection<ConsentTierResponse>) new LinkedHashSet<ConsentTierResponse>());

      cpr.setCollectionProtocol(cp);
      p.getCollectionProtocolRegistrationCollection().add(cpr);
    }
    return p;
  }
Ejemplo n.º 2
0
 private String getShortTitleForParticipant(Participant participant) {
   String shortTitle = "";
   final ArrayList<CollectionProtocolRegistration> cprColl =
       new ArrayList<CollectionProtocolRegistration>(
           participant.getCollectionProtocolRegistrationCollection());
   if (!cprColl.isEmpty()) {
     // We are expecting only ONE CPR here
     final CollectionProtocolRegistration cpr = cprColl.get(0);
     final CollectionProtocol collectionProtocol = cpr.getCollectionProtocol();
     shortTitle = collectionProtocol.getShortTitle();
   }
   return shortTitle;
 }
Ejemplo n.º 3
0
  /**
   * This method is used to populate the CP-title inside Participant object for given CP-shortTitle.
   * Also it will call method to populate the default ConsentTierResponse
   *
   * @param participant
   * @return Participant with Title populated
   * @throws ApplicationException - ApplicationException
   */
  private Participant populateCP(Participant participant) throws ApplicationException {
    final ArrayList<CollectionProtocolRegistration> cprColl =
        new ArrayList<CollectionProtocolRegistration>(
            participant.getCollectionProtocolRegistrationCollection());
    if (!cprColl.isEmpty()) {
      // We are expecting only ONE CPR here
      final CollectionProtocolRegistration incomingCPR = cprColl.get(0);
      final CollectionProtocol incomingCP = incomingCPR.getCollectionProtocol();

      // get the existing CollectionProtocol for given shortTitle
      final CollectionProtocol fetchedCP =
          getExistingCollectionProtocol(incomingCP.getShortTitle());

      if (fetchedCP != null) {
        // set the fetched CP_Title into the Participant-CPR-CP-title
        incomingCP.setTitle(fetchedCP.getTitle());

        populateConsentTierResponse(incomingCPR, fetchedCP);
      }
    }
    return participant;
  }