@Test public void shouldReturnProductGroupIfProgramProductActiveAndProductActive() throws Exception { ProductGroup productGroup = new ProductGroup(); Product product = new Product(); product.setActive(true); product.setProductGroup(productGroup); FacilityProgramProduct facilityProgramProduct = new FacilityProgramProduct(); facilityProgramProduct.setActive(true); facilityProgramProduct.setProduct(product); assertThat(facilityProgramProduct.getActiveProductGroup(), is(productGroup)); }
@JsonIgnore public ProductGroup getActiveProductGroup() { if (this.getActive() && this.getProduct().getActive()) { return this.getProduct().getProductGroup(); } return null; }
FacilityProgramProduct extends ProgramProduct { @JsonIgnore public ProductGroup getActiveProductGroup() { if (this.getActive() && this.getProduct().getActive()) { return this.getProduct().getProductGroup(); } return null; } }
FacilityProgramProduct extends ProgramProduct { @JsonIgnore public ProductGroup getActiveProductGroup() { if (this.getActive() && this.getProduct().getActive()) { return this.getProduct().getProductGroup(); } return null; } FacilityProgramProduct(ProgramProduct programProduct, Long facilityId);  FacilityProgramProduct(ProgramProduct programProduct, Long facilityId, ISA isa); }
FacilityProgramProduct extends ProgramProduct { @JsonIgnore public ProductGroup getActiveProductGroup() { if (this.getActive() && this.getProduct().getActive()) { return this.getProduct().getProductGroup(); } return null; } FacilityProgramProduct(ProgramProduct programProduct, Long facilityId);  FacilityProgramProduct(ProgramProduct programProduct, Long facilityId, ISA isa); @JsonIgnore ProductGroup getActiveProductGroup(); Integer calculateIsa(Long population, Integer numberOfMonthsInPeriod); Integer calculateIsaByPackSize(Long population, Integer numberOfMonthsInPeriod); @JsonIgnore Double getWhoRatio(); static List<FacilityProgramProduct> filterActiveProducts(List<FacilityProgramProduct> programProducts); }
FacilityProgramProduct extends ProgramProduct { @JsonIgnore public ProductGroup getActiveProductGroup() { if (this.getActive() && this.getProduct().getActive()) { return this.getProduct().getProductGroup(); } return null; } FacilityProgramProduct(ProgramProduct programProduct, Long facilityId);  FacilityProgramProduct(ProgramProduct programProduct, Long facilityId, ISA isa); @JsonIgnore ProductGroup getActiveProductGroup(); Integer calculateIsa(Long population, Integer numberOfMonthsInPeriod); Integer calculateIsaByPackSize(Long population, Integer numberOfMonthsInPeriod); @JsonIgnore Double getWhoRatio(); static List<FacilityProgramProduct> filterActiveProducts(List<FacilityProgramProduct> programProducts);  }