@Test public void shouldPopulateRnrLineItemsAndRegimenLineItems() throws Exception { List<Regimen> regimens = new ArrayList<>(); Regimen regimen1 = new Regimen(); regimen1.setActive(true); Regimen regimen2 = new Regimen(); regimen2.setActive(false); regimens.add(regimen1); regimens.add(regimen2); FacilityTypeApprovedProduct facilityTypeApprovedProduct = make(a(defaultFacilityApprovedProduct)); Product product = make(a(ProductBuilder.defaultProduct)); facilityTypeApprovedProduct.getProgramProduct().setProduct(product); ProductCategory productCategory = new ProductCategory(); facilityTypeApprovedProduct.getProgramProduct().setProductCategory(productCategory); List<FacilityTypeApprovedProduct> facilityTypeApprovedProducts = new ArrayList<>(); facilityTypeApprovedProducts.add(facilityTypeApprovedProduct); Rnr requisition = new Rnr(new Facility(1L), new Program(2L), new ProcessingPeriod(3L), false, facilityTypeApprovedProducts, regimens, 4L); assertThat(requisition.getRegimenLineItems().size(), is(1)); assertThat(requisition.getFullSupplyLineItems().size(), is(1)); }
public void add(RnrLineItem rnrLineItem, Boolean fullSupply) { if (fullSupply) { fullSupplyLineItems.add(rnrLineItem); } else { nonFullSupplyLineItems.add(rnrLineItem); } }
Rnr extends BaseModel { public void add(RnrLineItem rnrLineItem, Boolean fullSupply) { if (fullSupply) { fullSupplyLineItems.add(rnrLineItem); } else { nonFullSupplyLineItems.add(rnrLineItem); } } }
Rnr extends BaseModel { public void add(RnrLineItem rnrLineItem, Boolean fullSupply) { if (fullSupply) { fullSupplyLineItems.add(rnrLineItem); } else { nonFullSupplyLineItems.add(rnrLineItem); } } Rnr(Facility facility, Program program, ProcessingPeriod period, Boolean emergency, Long modifiedBy, Long createdBy);  Rnr(Facility facility, Program program, ProcessingPeriod period, Boolean emergency, List<FacilityTypeApprovedProduct> facilityTypeApprovedProducts,
             List<Regimen> regimens, Long modifiedBy);  Rnr(Facility facility, Program program, ProcessingPeriod period);  Rnr(Long id); }
Rnr extends BaseModel { public void add(RnrLineItem rnrLineItem, Boolean fullSupply) { if (fullSupply) { fullSupplyLineItems.add(rnrLineItem); } else { nonFullSupplyLineItems.add(rnrLineItem); } } Rnr(Facility facility, Program program, ProcessingPeriod period, Boolean emergency, Long modifiedBy, Long createdBy);  Rnr(Facility facility, Program program, ProcessingPeriod period, Boolean emergency, List<FacilityTypeApprovedProduct> facilityTypeApprovedProducts,
             List<Regimen> regimens, Long modifiedBy);  Rnr(Facility facility, Program program, ProcessingPeriod period);  Rnr(Long id); void add(RnrLineItem rnrLineItem, Boolean fullSupply); void calculateForApproval(); void fillLineItems(List<FacilityTypeApprovedProduct> facilityTypeApprovedProducts); void setFieldsForApproval(); List<RnrLineItem> getAllLineItems(); void fillBasicInformation(Facility facility, Program program, ProcessingPeriod period); RnrLineItem findCorrespondingLineItem(final RnrLineItem item); RegimenLineItem findCorrespondingRegimenLineItem(final RegimenLineItem regimenLineItem); void setFieldsAccordingToTemplateFrom(Rnr previousRequisition, ProgramRnrTemplate template, RegimenTemplate regimenTemplate); void convertToOrder(Long userId); void fillFullSupplyCost(); void fillNonFullSupplyCost(); void validateForApproval(); void copyCreatorEditableFields(Rnr rnr, ProgramRnrTemplate rnrTemplate, RegimenTemplate regimenTemplate, List<ProgramProduct> programProducts); void copyApproverEditableFields(Rnr rnr, ProgramRnrTemplate template); void setAuditFieldsForRequisition(Long modifiedBy, RnrStatus status); void prepareForFinalApproval(); void approveAndAssignToNextSupervisoryNode(SupervisoryNode parent); boolean isApprovable(); boolean preAuthorize(); void addToNonFullSupplyCost(Money cost); void addToFullSupplyCost(Money cost); boolean isForVirtualFacility(); List<RnrLineItem> getNonSkippedLineItems(); void validateRegimenLineItems(RegimenTemplate regimenTemplate); @JsonIgnore boolean isBudgetingApplicable(); }
Rnr extends BaseModel { public void add(RnrLineItem rnrLineItem, Boolean fullSupply) { if (fullSupply) { fullSupplyLineItems.add(rnrLineItem); } else { nonFullSupplyLineItems.add(rnrLineItem); } } Rnr(Facility facility, Program program, ProcessingPeriod period, Boolean emergency, Long modifiedBy, Long createdBy);  Rnr(Facility facility, Program program, ProcessingPeriod period, Boolean emergency, List<FacilityTypeApprovedProduct> facilityTypeApprovedProducts,
             List<Regimen> regimens, Long modifiedBy);  Rnr(Facility facility, Program program, ProcessingPeriod period);  Rnr(Long id); void add(RnrLineItem rnrLineItem, Boolean fullSupply); void calculateForApproval(); void fillLineItems(List<FacilityTypeApprovedProduct> facilityTypeApprovedProducts); void setFieldsForApproval(); List<RnrLineItem> getAllLineItems(); void fillBasicInformation(Facility facility, Program program, ProcessingPeriod period); RnrLineItem findCorrespondingLineItem(final RnrLineItem item); RegimenLineItem findCorrespondingRegimenLineItem(final RegimenLineItem regimenLineItem); void setFieldsAccordingToTemplateFrom(Rnr previousRequisition, ProgramRnrTemplate template, RegimenTemplate regimenTemplate); void convertToOrder(Long userId); void fillFullSupplyCost(); void fillNonFullSupplyCost(); void validateForApproval(); void copyCreatorEditableFields(Rnr rnr, ProgramRnrTemplate rnrTemplate, RegimenTemplate regimenTemplate, List<ProgramProduct> programProducts); void copyApproverEditableFields(Rnr rnr, ProgramRnrTemplate template); void setAuditFieldsForRequisition(Long modifiedBy, RnrStatus status); void prepareForFinalApproval(); void approveAndAssignToNextSupervisoryNode(SupervisoryNode parent); boolean isApprovable(); boolean preAuthorize(); void addToNonFullSupplyCost(Money cost); void addToFullSupplyCost(Money cost); boolean isForVirtualFacility(); List<RnrLineItem> getNonSkippedLineItems(); void validateRegimenLineItems(RegimenTemplate regimenTemplate); @JsonIgnore boolean isBudgetingApplicable(); static final String RNR_VALIDATION_ERROR; }