diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/RadiologyTest.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/RadiologyTest.java index bdbb78972..fba0a3c33 100644 --- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/RadiologyTest.java +++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/RadiologyTest.java @@ -1,6 +1,9 @@ package org.bahmni.module.referencedata.labconcepts.contract; +import java.util.Arrays; +import java.util.List; + public class RadiologyTest extends Resource { - public static final String RADIOLOGY_TEST_CONCEPT_CLASS = "Radiology"; + public static final List RADIOLOGY_TEST_CONCEPT_CLASSES = Arrays.asList("Radiology", "Radiology/Imaging Procedure"); public static final String RADIOLOGY_TEST_PARENT_CONCEPT_NAME = "Radiology"; } diff --git a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEvent.java b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEvent.java index 09230a698..2f98ab820 100644 --- a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEvent.java +++ b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEvent.java @@ -2,8 +2,8 @@ import org.openmrs.Concept; -import static org.bahmni.module.referencedata.labconcepts.contract.RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASS; -import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfConceptClass; +import static org.bahmni.module.referencedata.labconcepts.contract.RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASSES; +import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfAnyConceptClass; public class RadiologyTestEvent extends ConceptOperationEvent { @@ -14,7 +14,7 @@ public RadiologyTestEvent(String url, String category, String title) { @Override public boolean isResourceConcept(Concept concept) { - return isOfConceptClass(concept, RADIOLOGY_TEST_CONCEPT_CLASS); + return isOfAnyConceptClass(concept, RADIOLOGY_TEST_CONCEPT_CLASSES); } diff --git a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SaleableTypeEvent.java b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SaleableTypeEvent.java index 0deaaef97..6f884a6cd 100644 --- a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SaleableTypeEvent.java +++ b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SaleableTypeEvent.java @@ -16,7 +16,7 @@ import static org.bahmni.module.referencedata.labconcepts.contract.Department.DEPARTMENT_CONCEPT_CLASS; import static org.bahmni.module.referencedata.labconcepts.contract.LabTest.LAB_TEST_CONCEPT_CLASSES; import static org.bahmni.module.referencedata.labconcepts.contract.Panel.LAB_SET_CONCEPT_CLASS; -import static org.bahmni.module.referencedata.labconcepts.contract.RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASS; +import static org.bahmni.module.referencedata.labconcepts.contract.RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASSES; import static org.bahmni.module.referencedata.labconcepts.contract.Sample.SAMPLE_CONCEPT_CLASS; public class SaleableTypeEvent implements ConceptServiceOperationEvent { @@ -29,8 +29,9 @@ public class SaleableTypeEvent implements ConceptServiceOperationEvent { private List supportedOperations = Arrays.asList("saveConcept", "updateConcept", "retireConcept", "purgeConcept"); private List unhandledClasses = new ArrayList(){{ - addAll(Arrays.asList(LAB_SET_CONCEPT_CLASS, SAMPLE_CONCEPT_CLASS, DEPARTMENT_CONCEPT_CLASS, RADIOLOGY_TEST_CONCEPT_CLASS)); + addAll(Arrays.asList(LAB_SET_CONCEPT_CLASS, SAMPLE_CONCEPT_CLASS, DEPARTMENT_CONCEPT_CLASS)); addAll(LAB_TEST_CONCEPT_CLASSES); + addAll(RADIOLOGY_TEST_CONCEPT_CLASSES); }}; private List unhandledConcepsByName = Arrays.asList(ALL_SAMPLES, ALL_TESTS_AND_PANELS); diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEventTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEventTest.java index c72fc7e58..5292c26af 100644 --- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEventTest.java +++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEventTest.java @@ -70,6 +70,17 @@ public void createEventForSampleEvent() throws Exception { } + @Test + public void shouldCreateEventWhenClassIsRadiologyImagingProcedure() throws Exception{ + concept = new ConceptBuilder().withClass("Radiology/Imaging Procedure").withUUID(RADIOLOGY_TEST_CONCEPT_UUID).build(); + Event event = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept}).get(0); + Event anotherEvent = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept}).get(0); + assertNotNull(event); + assertFalse(event.getUuid().equals(anotherEvent.getUuid())); + assertEquals(event.getTitle(), ConceptServiceEventFactory.RADIOLOGY); + assertEquals(event.getCategory(), ConceptServiceEventFactory.LAB); + } + @Test public void shouldNotCreateEventForRadiologyEventIfThereIsDifferentConceptClass() throws Exception { concept = new ConceptBuilder().withClass("random").withClassUUID("some").withUUID(RADIOLOGY_TEST_CONCEPT_UUID).build(); @@ -109,4 +120,4 @@ public void createEventForRadiologyTestWithParentConceptMissing() throws Excepti assertEquals(event.getCategory(), ConceptServiceEventFactory.LAB); } -} \ No newline at end of file +} diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/RadiologyTestMapperTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/RadiologyTestMapperTest.java index dd3085dc7..404fe03d0 100644 --- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/RadiologyTestMapperTest.java +++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/RadiologyTestMapperTest.java @@ -46,7 +46,7 @@ public void setUp() throws Exception { PowerMockito.mockStatic(Context.class); when(Context.getLocale()).thenReturn(defaultLocale); - radiologyConcept = new ConceptBuilder().withUUID("RadiologyUUID").withDateCreated(dateCreated).withClass(RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASS). + radiologyConcept = new ConceptBuilder().withUUID("RadiologyUUID").withDateCreated(dateCreated).withClass(RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASSES.get(0)). withDateChanged(dateChanged).withShortName("clavicle - right, 2 views (x-ray)").withName("Clavicle - Right, 2 views (X-ray)").build(); when(Context.getConceptService()).thenReturn(conceptService); @@ -62,4 +62,4 @@ public void mapNameOfRadiologyTestFromConcept() throws Exception { } -} \ No newline at end of file +}