public void migrate( ExpeditedAdverseEventReport aeReportSrc, ExpeditedAdverseEventReport aeReportDest, DomainObjectImportOutcome<ExpeditedAdverseEventReport> outcome) { List<SAEReportPriorTherapy> srcSAEReportPriorTherapys = aeReportSrc.getSaeReportPriorTherapies(); if (srcSAEReportPriorTherapys == null || srcSAEReportPriorTherapys.isEmpty()) { outcome.addWarning("WR-SPT-1", "Input doesn't contain any SAEReportPriorTherapy Values."); return; } // Copy the SAEReportPriorTherapys Information from Source to Destination. for (SAEReportPriorTherapy spt : srcSAEReportPriorTherapys) { PriorTherapy pt = findPriorTherapy(spt.getPriorTherapy(), outcome); if (outcome.hasErrors()) { return; } validateSAEREportPriorTherapyDates(spt, outcome); SAEReportPriorTherapy destSAEReportPriorTherapy = new SAEReportPriorTherapy(); destSAEReportPriorTherapy.setPriorTherapy(pt); destSAEReportPriorTherapy.setReport(aeReportDest); copyProperties(spt, destSAEReportPriorTherapy); for (PriorTherapyAgent pta : spt.getPriorTherapyAgents()) { PriorTherapyAgent priorTherapyAgent = migratePriorTherapyAgent(pta, destSAEReportPriorTherapy); destSAEReportPriorTherapy.addPriorTherapyAgent(priorTherapyAgent); } aeReportDest.addSaeReportPriorTherapies(destSAEReportPriorTherapy); } }
private void migrateCourseAgent( CourseAgent caSrc, ExpeditedAdverseEventReport aeReportDest, DomainObjectImportOutcome<ExpeditedAdverseEventReport> outcome) { Study study = aeReportDest.getStudy(); StudyAgent studyAgent = caSrc.getStudyAgent(); if (studyAgent == null || ((studyAgent.getAgent() == null || StringUtils.isEmpty(studyAgent.getAgent().getNscNumber())) && StringUtils.isEmpty(studyAgent.getOtherAgent()))) { outcome.addWarning("ER-CA-1", "Study Agent is missing in the source"); return; } StudyAgent realStudyAgent = studyAgent.getAgent() == null ? study.findStudyAgentByNscOrName(studyAgent.getOtherAgent()) : study.findStudyAgentByNscOrName(studyAgent.getAgent().getNscNumber()); if (realStudyAgent == null) { outcome.addWarning("ER-CA-2", "Given Agent is no longer associated to the study"); return; } CourseAgent caDest = new CourseAgent(); aeReportDest.getTreatmentInformation().addCourseAgent(caDest); // set the study agent caDest.setStudyAgent(realStudyAgent); caDest.setDose(caSrc.getDose()); caDest.setAdministrationDelay(caSrc.getAdministrationDelay()); caDest.setAdministrationDelayAmount(caSrc.getAdministrationDelayAmount()); caDest.setAdministrationDelayUnits(caSrc.getAdministrationDelayUnits()); caDest.setComments(caSrc.getComments()); caDest.setAgentAdjustment(caSrc.getAgentAdjustment()); caDest.setModifiedDose(caSrc.getModifiedDose()); caDest.setLastAdministeredDate(caSrc.getLastAdministeredDate()); caDest.setDurationAndSchedule(caSrc.getDurationAndSchedule()); caDest.setFirstAdministeredDate(caSrc.getFirstAdministeredDate()); caDest.setTotalDoseAdministeredThisCourse(caSrc.getTotalDoseAdministeredThisCourse()); caDest.setFormulation(caSrc.getFormulation()); caDest.setLotNumber(caSrc.getLotNumber()); }