private CollectionProtocol getExistingCollectionProtocol(String shortTitle) throws ApplicationException { CollectionProtocol cp = new CollectionProtocol(); cp.setShortTitle(shortTitle); cp = caTissueAPIClient.searchById(CollectionProtocol.class, cp); return cp; }
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; }