@Test public void shouldRetrievePeriodStartDateForARequisitionIfExists() { Rnr rnr = new Rnr(); Date date = DateUtil.parseDate("2011-11-11 11:11:11"); rnr.setFacility(make(a(FacilityBuilder.defaultFacility))); rnr.setProgram(make(a(ProgramBuilder.defaultProgram))); rnr.setClientSubmittedTime(date); ProcessingPeriod period = make(a(ProcessingPeriodBuilder.defaultProcessingPeriod)); rnr.setPeriod(period); Report report = Report.prepareForREST(rnr); assertThat(report.getPeriodStartDate(), is(period.getStartDate())); }
public static Report prepareForREST(final Rnr rnr) { Report report = new Report(); report.setAgentCode(rnr.getFacility().getCode()); report.setProgramCode(rnr.getProgram().getCode()); ArrayList<RnrLineItem> nonFullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getNonFullSupplyLineItems()); }}; report.setNonFullSupplyProducts(nonFullSupplyProducts); ArrayList<RnrLineItem> fullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getFullSupplyLineItems()); }}; report.setProducts(fullSupplyProducts); ArrayList<RegimenLineItem> regimenLineItems = new ArrayList<RegimenLineItem>() {{ addAll(rnr.getRegimenLineItems()); }}; report.setRegimens(regimenLineItems); ArrayList<PatientQuantificationLineItem> patientQuantificationLineItems = new ArrayList<PatientQuantificationLineItem>() {{ addAll(rnr.getPatientQuantifications()); }}; report.setPatientQuantifications(patientQuantificationLineItems); report.setEmergency(rnr.isEmergency()); if (rnr.getClientSubmittedTime() != null) { report.setClientSubmittedTime(DateUtil.formatDate(rnr.getClientSubmittedTime())); } report.setClientSubmittedNotes(rnr.getClientSubmittedNotes()); report.setPeriodStartDate(rnr.getPeriod().getStartDate()); report.setRnrSignatures(rnr.getRnrSignatures()); return report; }
Report { public static Report prepareForREST(final Rnr rnr) { Report report = new Report(); report.setAgentCode(rnr.getFacility().getCode()); report.setProgramCode(rnr.getProgram().getCode()); ArrayList<RnrLineItem> nonFullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getNonFullSupplyLineItems()); }}; report.setNonFullSupplyProducts(nonFullSupplyProducts); ArrayList<RnrLineItem> fullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getFullSupplyLineItems()); }}; report.setProducts(fullSupplyProducts); ArrayList<RegimenLineItem> regimenLineItems = new ArrayList<RegimenLineItem>() {{ addAll(rnr.getRegimenLineItems()); }}; report.setRegimens(regimenLineItems); ArrayList<PatientQuantificationLineItem> patientQuantificationLineItems = new ArrayList<PatientQuantificationLineItem>() {{ addAll(rnr.getPatientQuantifications()); }}; report.setPatientQuantifications(patientQuantificationLineItems); report.setEmergency(rnr.isEmergency()); if (rnr.getClientSubmittedTime() != null) { report.setClientSubmittedTime(DateUtil.formatDate(rnr.getClientSubmittedTime())); } report.setClientSubmittedNotes(rnr.getClientSubmittedNotes()); report.setPeriodStartDate(rnr.getPeriod().getStartDate()); report.setRnrSignatures(rnr.getRnrSignatures()); return report; } }
Report { public static Report prepareForREST(final Rnr rnr) { Report report = new Report(); report.setAgentCode(rnr.getFacility().getCode()); report.setProgramCode(rnr.getProgram().getCode()); ArrayList<RnrLineItem> nonFullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getNonFullSupplyLineItems()); }}; report.setNonFullSupplyProducts(nonFullSupplyProducts); ArrayList<RnrLineItem> fullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getFullSupplyLineItems()); }}; report.setProducts(fullSupplyProducts); ArrayList<RegimenLineItem> regimenLineItems = new ArrayList<RegimenLineItem>() {{ addAll(rnr.getRegimenLineItems()); }}; report.setRegimens(regimenLineItems); ArrayList<PatientQuantificationLineItem> patientQuantificationLineItems = new ArrayList<PatientQuantificationLineItem>() {{ addAll(rnr.getPatientQuantifications()); }}; report.setPatientQuantifications(patientQuantificationLineItems); report.setEmergency(rnr.isEmergency()); if (rnr.getClientSubmittedTime() != null) { report.setClientSubmittedTime(DateUtil.formatDate(rnr.getClientSubmittedTime())); } report.setClientSubmittedNotes(rnr.getClientSubmittedNotes()); report.setPeriodStartDate(rnr.getPeriod().getStartDate()); report.setRnrSignatures(rnr.getRnrSignatures()); return report; }  }
Report { public static Report prepareForREST(final Rnr rnr) { Report report = new Report(); report.setAgentCode(rnr.getFacility().getCode()); report.setProgramCode(rnr.getProgram().getCode()); ArrayList<RnrLineItem> nonFullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getNonFullSupplyLineItems()); }}; report.setNonFullSupplyProducts(nonFullSupplyProducts); ArrayList<RnrLineItem> fullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getFullSupplyLineItems()); }}; report.setProducts(fullSupplyProducts); ArrayList<RegimenLineItem> regimenLineItems = new ArrayList<RegimenLineItem>() {{ addAll(rnr.getRegimenLineItems()); }}; report.setRegimens(regimenLineItems); ArrayList<PatientQuantificationLineItem> patientQuantificationLineItems = new ArrayList<PatientQuantificationLineItem>() {{ addAll(rnr.getPatientQuantifications()); }}; report.setPatientQuantifications(patientQuantificationLineItems); report.setEmergency(rnr.isEmergency()); if (rnr.getClientSubmittedTime() != null) { report.setClientSubmittedTime(DateUtil.formatDate(rnr.getClientSubmittedTime())); } report.setClientSubmittedNotes(rnr.getClientSubmittedNotes()); report.setPeriodStartDate(rnr.getPeriod().getStartDate()); report.setRnrSignatures(rnr.getRnrSignatures()); return report; }  void validate(); Date getClientSubmittedTime(); @JsonIgnore Rnr getRequisition(Long requisitionId, Long modifiedBy); void validateForApproval(); static Report prepareForREST(final Rnr rnr); }
Report { public static Report prepareForREST(final Rnr rnr) { Report report = new Report(); report.setAgentCode(rnr.getFacility().getCode()); report.setProgramCode(rnr.getProgram().getCode()); ArrayList<RnrLineItem> nonFullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getNonFullSupplyLineItems()); }}; report.setNonFullSupplyProducts(nonFullSupplyProducts); ArrayList<RnrLineItem> fullSupplyProducts = new ArrayList<RnrLineItem>() {{ addAll(rnr.getFullSupplyLineItems()); }}; report.setProducts(fullSupplyProducts); ArrayList<RegimenLineItem> regimenLineItems = new ArrayList<RegimenLineItem>() {{ addAll(rnr.getRegimenLineItems()); }}; report.setRegimens(regimenLineItems); ArrayList<PatientQuantificationLineItem> patientQuantificationLineItems = new ArrayList<PatientQuantificationLineItem>() {{ addAll(rnr.getPatientQuantifications()); }}; report.setPatientQuantifications(patientQuantificationLineItems); report.setEmergency(rnr.isEmergency()); if (rnr.getClientSubmittedTime() != null) { report.setClientSubmittedTime(DateUtil.formatDate(rnr.getClientSubmittedTime())); } report.setClientSubmittedNotes(rnr.getClientSubmittedNotes()); report.setPeriodStartDate(rnr.getPeriod().getStartDate()); report.setRnrSignatures(rnr.getRnrSignatures()); return report; }  void validate(); Date getClientSubmittedTime(); @JsonIgnore Rnr getRequisition(Long requisitionId, Long modifiedBy); void validateForApproval(); static Report prepareForREST(final Rnr rnr);  }