@Test public void formatRegimenShort_shouldFormatRegimen() throws Exception { RegimenOrder empty = new RegimenOrder(new HashSet<DrugOrder>()); Assert.assertThat(kenyaUi.formatRegimenShort(empty, ui), is("Empty")); Assert.assertThat(kenyaUi.formatRegimenShort(regimen, ui), is("DAPSONE, STAVUDINE")); }
public String formatRegimenShort(RegimenOrder regimen, UiUtils ui) { if (CollectionUtils.isEmpty(regimen.getDrugOrders())) { return "Empty"; } List<String> components = new ArrayList<String>(); for (DrugOrder o : regimen.getDrugOrders()) { ConceptName cn = o.getConcept().getPreferredName(CoreConstants.LOCALE); if (cn == null) { cn = o.getConcept().getName(CoreConstants.LOCALE); } components.add(cn.getName()); } return OpenmrsUtil.join(components, ", "); }
EmrUiUtils { public String formatRegimenShort(RegimenOrder regimen, UiUtils ui) { if (CollectionUtils.isEmpty(regimen.getDrugOrders())) { return "Empty"; } List<String> components = new ArrayList<String>(); for (DrugOrder o : regimen.getDrugOrders()) { ConceptName cn = o.getConcept().getPreferredName(CoreConstants.LOCALE); if (cn == null) { cn = o.getConcept().getName(CoreConstants.LOCALE); } components.add(cn.getName()); } return OpenmrsUtil.join(components, ", "); } }
EmrUiUtils { public String formatRegimenShort(RegimenOrder regimen, UiUtils ui) { if (CollectionUtils.isEmpty(regimen.getDrugOrders())) { return "Empty"; } List<String> components = new ArrayList<String>(); for (DrugOrder o : regimen.getDrugOrders()) { ConceptName cn = o.getConcept().getPreferredName(CoreConstants.LOCALE); if (cn == null) { cn = o.getConcept().getName(CoreConstants.LOCALE); } components.add(cn.getName()); } return OpenmrsUtil.join(components, ", "); }  }
EmrUiUtils { public String formatRegimenShort(RegimenOrder regimen, UiUtils ui) { if (CollectionUtils.isEmpty(regimen.getDrugOrders())) { return "Empty"; } List<String> components = new ArrayList<String>(); for (DrugOrder o : regimen.getDrugOrders()) { ConceptName cn = o.getConcept().getPreferredName(CoreConstants.LOCALE); if (cn == null) { cn = o.getConcept().getName(CoreConstants.LOCALE); } components.add(cn.getName()); } return OpenmrsUtil.join(components, ", "); }  String formatDrug(DrugReference drugRef, UiUtils ui); String formatRegimenShort(RegimenOrder regimen, UiUtils ui); String formatRegimenLong(RegimenOrder regimen, UiUtils ui); SimpleObject simpleRegimen(RegimenOrder regimen, UiUtils ui); List<SimpleObject> simpleRegimenHistory(RegimenChangeHistory history, UiUtils ui); List<SimpleObject> simpleRegimenDefinitions(Collection<RegimenDefinition> definitions, UiUtils ui); }
EmrUiUtils { public String formatRegimenShort(RegimenOrder regimen, UiUtils ui) { if (CollectionUtils.isEmpty(regimen.getDrugOrders())) { return "Empty"; } List<String> components = new ArrayList<String>(); for (DrugOrder o : regimen.getDrugOrders()) { ConceptName cn = o.getConcept().getPreferredName(CoreConstants.LOCALE); if (cn == null) { cn = o.getConcept().getName(CoreConstants.LOCALE); } components.add(cn.getName()); } return OpenmrsUtil.join(components, ", "); }  String formatDrug(DrugReference drugRef, UiUtils ui); String formatRegimenShort(RegimenOrder regimen, UiUtils ui); String formatRegimenLong(RegimenOrder regimen, UiUtils ui); SimpleObject simpleRegimen(RegimenOrder regimen, UiUtils ui); List<SimpleObject> simpleRegimenHistory(RegimenChangeHistory history, UiUtils ui); List<SimpleObject> simpleRegimenDefinitions(Collection<RegimenDefinition> definitions, UiUtils ui);  }