@Test public void shouldNotGetInvisibleColumnsAsPrintableColumnsForNonFullSupply() throws Exception { boolean visible = true; boolean inVisible = false; boolean fullSupply = false; ProgramRnrTemplate programRnrTemplate = new ProgramRnrTemplate(1L, asList( rnrColumn(PRODUCT, visible), rnrColumn(QUANTITY_APPROVED, inVisible), rnrColumn(QUANTITY_DISPENSED, visible) )); List<? extends Column> printableColumns = programRnrTemplate.getPrintableColumns(fullSupply); assertThat(printableColumns.size(), is(1)); assertThat(printableColumns.get(0).getName(), is(PRODUCT)); }
public List<? extends Column> getPrintableColumns(Boolean fullSupply) { List<RnrColumn> printableRnrColumns = new ArrayList<>(); for (Column rnrColumn : columns) { if (rnrColumn.getVisible()) { if (fullSupply && !nonPrintableFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } else if (!fullSupply && printableNonFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } } } return printableRnrColumns; }
ProgramRnrTemplate extends Template { public List<? extends Column> getPrintableColumns(Boolean fullSupply) { List<RnrColumn> printableRnrColumns = new ArrayList<>(); for (Column rnrColumn : columns) { if (rnrColumn.getVisible()) { if (fullSupply && !nonPrintableFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } else if (!fullSupply && printableNonFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } } } return printableRnrColumns; } }
ProgramRnrTemplate extends Template { public List<? extends Column> getPrintableColumns(Boolean fullSupply) { List<RnrColumn> printableRnrColumns = new ArrayList<>(); for (Column rnrColumn : columns) { if (rnrColumn.getVisible()) { if (fullSupply && !nonPrintableFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } else if (!fullSupply && printableNonFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } } } return printableRnrColumns; } ProgramRnrTemplate(Long programId, List<? extends Column> rnrColumns);  ProgramRnrTemplate(List<? extends Column> programRnrColumns); }
ProgramRnrTemplate extends Template { public List<? extends Column> getPrintableColumns(Boolean fullSupply) { List<RnrColumn> printableRnrColumns = new ArrayList<>(); for (Column rnrColumn : columns) { if (rnrColumn.getVisible()) { if (fullSupply && !nonPrintableFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } else if (!fullSupply && printableNonFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } } } return printableRnrColumns; } ProgramRnrTemplate(Long programId, List<? extends Column> rnrColumns);  ProgramRnrTemplate(List<? extends Column> programRnrColumns); boolean columnsVisible(String... rnrColumnNames); boolean columnsCalculated(String... rnrColumnNames); boolean columnsUserInput(String... rnrColumnNames); String getRnrColumnLabelFor(String columnName); Map<String, OpenLmisMessage> validateToSave(); List<? extends Column> getPrintableColumns(Boolean fullSupply); }
ProgramRnrTemplate extends Template { public List<? extends Column> getPrintableColumns(Boolean fullSupply) { List<RnrColumn> printableRnrColumns = new ArrayList<>(); for (Column rnrColumn : columns) { if (rnrColumn.getVisible()) { if (fullSupply && !nonPrintableFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } else if (!fullSupply && printableNonFullSupplyColumnNames.contains(rnrColumn.getName())) { printableRnrColumns.add((RnrColumn) rnrColumn); } } } return printableRnrColumns; } ProgramRnrTemplate(Long programId, List<? extends Column> rnrColumns);  ProgramRnrTemplate(List<? extends Column> programRnrColumns); boolean columnsVisible(String... rnrColumnNames); boolean columnsCalculated(String... rnrColumnNames); boolean columnsUserInput(String... rnrColumnNames); String getRnrColumnLabelFor(String columnName); Map<String, OpenLmisMessage> validateToSave(); List<? extends Column> getPrintableColumns(Boolean fullSupply); static final String STOCK_IN_HAND; static final String REMARKS; static final String QUANTITY_DISPENSED; static final String BEGINNING_BALANCE; static final String QUANTITY_RECEIVED; static final String QUANTITY_APPROVED; static final String LOSSES_AND_ADJUSTMENTS; static final String STOCK_OUT_DAYS; static final String NORMALIZED_CONSUMPTION; static final String QUANTITY_REQUESTED; static final String REASON_FOR_REQUESTED_QUANTITY; static final String NEW_PATIENT_COUNT; static final String COST; static final String PRICE; static final String TOTAL; static final String PRODUCT; static final String DISPENSING_UNIT; static final String PRODUCT_CODE; static final String PACKS_TO_SHIP; static final String SKIPPED; static final String CALCULATED_ORDER_QUANTITY; static final String USER_NEEDS_TO_ENTER_DEPENDENT_FIELD; static final String INTERDEPENDENT_FIELDS_CAN_NOT_BE_CALCULATED; static final String COLUMN_SHOULD_BE_VISIBLE_IF_USER_INPUT; static final String USER_NEED_TO_ENTER_REQUESTED_QUANTITY_REASON; }