@Test public void shouldSortRnrByCategoryFirst() throws Exception { List<RnrFormItem> rnrFormItems = new ArrayList<>(); rnrFormItems.add(generateRnrFormItem("A3", false)); rnrFormItems.add(generateRnrFormItem("B3", true)); rnrFormItems.add(generateRnrFormItem("B1", false)); rnrFormItems.add(generateRnrFormItem("A2", true)); rnrFormItems.add(generateRnrFormItem("B2", false)); rnrFormItems.add(generateRnrFormItem("A1", false)); rnRForm.setStatus(RnRForm.STATUS.DRAFT); rnRForm.setRnrFormItemListWrapper(rnrFormItems); List<RnrFormItem> sortedRnrFormItems = rnRForm.getRnrFormItemListWrapper(); assertEquals("A1", sortedRnrFormItems.get(0).getProduct().getCode()); assertEquals("A3", sortedRnrFormItems.get(1).getProduct().getCode()); assertEquals("B1", sortedRnrFormItems.get(2).getProduct().getCode()); assertEquals("B2", sortedRnrFormItems.get(3).getProduct().getCode()); assertEquals("A2", sortedRnrFormItems.get(4).getProduct().getCode()); assertEquals("B3", sortedRnrFormItems.get(5).getProduct().getCode()); }
public List<RnrFormItem> getRnrFormItemListWrapper() { rnrFormItemListWrapper = ListUtil.wrapOrEmpty(rnrFormItemList, rnrFormItemListWrapper); if (isAuthorized()) { sortRnrItemsListBasedOnProductCode(rnrFormItemListWrapper); return rnrFormItemListWrapper; } else { return sortProductList(rnrFormItemListWrapper); } }
RnRForm extends BaseModel { public List<RnrFormItem> getRnrFormItemListWrapper() { rnrFormItemListWrapper = ListUtil.wrapOrEmpty(rnrFormItemList, rnrFormItemListWrapper); if (isAuthorized()) { sortRnrItemsListBasedOnProductCode(rnrFormItemListWrapper); return rnrFormItemListWrapper; } else { return sortProductList(rnrFormItemListWrapper); } } }
RnRForm extends BaseModel { public List<RnrFormItem> getRnrFormItemListWrapper() { rnrFormItemListWrapper = ListUtil.wrapOrEmpty(rnrFormItemList, rnrFormItemListWrapper); if (isAuthorized()) { sortRnrItemsListBasedOnProductCode(rnrFormItemListWrapper); return rnrFormItemListWrapper; } else { return sortProductList(rnrFormItemListWrapper); } }  }
RnRForm extends BaseModel { public List<RnrFormItem> getRnrFormItemListWrapper() { rnrFormItemListWrapper = ListUtil.wrapOrEmpty(rnrFormItemList, rnrFormItemListWrapper); if (isAuthorized()) { sortRnrItemsListBasedOnProductCode(rnrFormItemListWrapper); return rnrFormItemListWrapper; } else { return sortProductList(rnrFormItemListWrapper); } }  boolean isDraft(); boolean isMissed(); boolean isSubmitted(); boolean canRemoveAddedProducts(); boolean isAuthorized(); static RnRForm init(Program program, Date generateDate); static RnRForm init(Program program, Period period, boolean isEmergency); static long calculateTotalRegimenAmount(Collection<RegimenItem> list, MMIARegimeList.COUNTTYPE counttype); static long caculateTotalRegimenTypeAmount(Collection<RegimenItemThreeLines> list, MMIARegimeThreeLineList.COUNTTYPE counttype); List<RnrFormItem> getRnrFormItemListWrapper(); List<BaseInfoItem> getBaseInfoItemListWrapper(); List<RegimenItem> getRegimenItemListWrapper(); List<RegimenItemThreeLines> getRegimenThreeLineListWrapper(); List<RnRFormSignature> getSignaturesWrapper(); static void fillFormId(RnRForm rnRForm); List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes); List<RnrFormItem> getRnrItems(final Product.IsKit isKit); void addSignature(String signature); }
RnRForm extends BaseModel { public List<RnrFormItem> getRnrFormItemListWrapper() { rnrFormItemListWrapper = ListUtil.wrapOrEmpty(rnrFormItemList, rnrFormItemListWrapper); if (isAuthorized()) { sortRnrItemsListBasedOnProductCode(rnrFormItemListWrapper); return rnrFormItemListWrapper; } else { return sortProductList(rnrFormItemListWrapper); } }  boolean isDraft(); boolean isMissed(); boolean isSubmitted(); boolean canRemoveAddedProducts(); boolean isAuthorized(); static RnRForm init(Program program, Date generateDate); static RnRForm init(Program program, Period period, boolean isEmergency); static long calculateTotalRegimenAmount(Collection<RegimenItem> list, MMIARegimeList.COUNTTYPE counttype); static long caculateTotalRegimenTypeAmount(Collection<RegimenItemThreeLines> list, MMIARegimeThreeLineList.COUNTTYPE counttype); List<RnrFormItem> getRnrFormItemListWrapper(); List<BaseInfoItem> getBaseInfoItemListWrapper(); List<RegimenItem> getRegimenItemListWrapper(); List<RegimenItemThreeLines> getRegimenThreeLineListWrapper(); List<RnRFormSignature> getSignaturesWrapper(); static void fillFormId(RnRForm rnRForm); List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes); List<RnrFormItem> getRnrItems(final Product.IsKit isKit); void addSignature(String signature);  }