From 9995e4d5a71e7ccbc70debcc36c976c22c9ca658 Mon Sep 17 00:00:00 2001 From: Saikumar Date: Tue, 17 Apr 2018 11:19:50 +0530 Subject: [PATCH 1/6] Saikumar , Maharjun | Add OT required privileges as part of OT merging --- .../src/main/resources/liquibase.xml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/bahmnicore-omod/src/main/resources/liquibase.xml b/bahmnicore-omod/src/main/resources/liquibase.xml index c697a8d9a0..be46369d52 100644 --- a/bahmnicore-omod/src/main/resources/liquibase.xml +++ b/bahmnicore-omod/src/main/resources/liquibase.xml @@ -4254,4 +4254,80 @@ INSERT INTO role_role(child_role, parent_role) VALUES ('Appointments:FullAccess', 'Appointments:ManageAppointments'); + + + + SELECT count(*) FROM role where role = "OT: FullAccess"; + + + Creating a role for OT: FullAccess + + INSERT INTO role(role, description, uuid) VALUES ("OT: FullAccess", "Ability to access and modify OT schedules", uuid()); + + + + + + SELECT count(*) FROM role where role = "OT: ReadOnly"; + + + Creating a role for OT- ReadOnly + + INSERT INTO role(role, description, uuid) VALUES ("OT: ReadOnly", "Ability to access and modify OT schedules", uuid()); + + + + + + SELECT count(*) FROM privilege where privilege = "app:ot"; + + + Creating a privilege for viewing the OT module + + INSERT INTO privilege(privilege, description, uuid) VALUES ("app:ot", "Ability to view OT module", uuid()); + + + + + + SELECT count(*) FROM privilege where privilege = "app:ot:write"; + + + Creating a privilege for viewing the OT module + + INSERT INTO privilege(privilege, description, uuid) VALUES ("app:ot:write", "Ability to view new surgical block and other buttons to edit on OT module", uuid()); + + + + + + SELECT count(*) FROM privilege WHERE privilege = "Manage OT Schedules"; + + + SELECT count(*) FROM role_privilege WHERE role = "OT: FullAccess" AND privilege = "Manage OT Schedules"; + + + Adding Manage OT Schedules privilege to OT: FullAccess role + + INSERT INTO role_privilege(role, privilege) VALUES ("OT: FullAccess", "Manage OT Schedules"); + INSERT INTO role_privilege(role, privilege) VALUES ("OT: FullAccess", "View OT Schedules"); + INSERT INTO role_privilege(role, privilege) VALUES ("OT: FullAccess", "app:ot"); + INSERT INTO role_privilege(role, privilege) VALUES ("OT: FullAccess", "app:ot:write"); + + + + + + SELECT count(*) FROM privilege WHERE privilege = "View OT Schedules"; + + + SELECT count(*) FROM role_privilege WHERE role = "OT: ReadOnly" AND privilege = "View OT Schedules"; + + + Adding view OT Schedules privilege to OT: ReadOnly role + + INSERT INTO role_privilege(role, privilege) VALUES ("OT: ReadOnly", "View OT Schedules"); + INSERT INTO role_privilege(role, privilege) VALUES ("OT: ReadOnly", "app:ot"); + + From 92a24827184a3a50e0316e42d863bc42f100c531 Mon Sep 17 00:00:00 2001 From: mks-d Date: Fri, 11 May 2018 15:12:16 +0200 Subject: [PATCH 2/6] Travis CI to build IT modified: .travis.yml --- .travis.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1dfb8e5bd0..7257f2c797 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,4 @@ language: java jdk: - oraclejdk8 -script: mvn clean install -branches: - only: - - master -notifications: - email: false -sudo: false +script: mvn clean install -P IT \ No newline at end of file From 729d4755d263ad32cb3f8375798bef0902397b85 Mon Sep 17 00:00:00 2001 From: Mritunjay Dubey Date: Fri, 11 May 2018 19:00:36 +0530 Subject: [PATCH 3/6] BAH-403 | Concepts will be created with the given UUID in the CSV upload. (#25) --- .../csv/persister/ConceptPersisterIT.java | 39 ++++++++++++++++--- .../csv/persister/ConceptSetPersisterIT.java | 26 +++++++++++++ .../mapper/ConceptCommonMapper.java | 2 + .../impl/ReferenceDataConceptServiceImpl.java | 2 +- 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/admin/src/test/java/org/bahmni/module/admin/csv/persister/ConceptPersisterIT.java b/admin/src/test/java/org/bahmni/module/admin/csv/persister/ConceptPersisterIT.java index 7fc4571c2e..f99e6f956e 100644 --- a/admin/src/test/java/org/bahmni/module/admin/csv/persister/ConceptPersisterIT.java +++ b/admin/src/test/java/org/bahmni/module/admin/csv/persister/ConceptPersisterIT.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.UUID; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -28,9 +29,9 @@ import static org.junit.Assert.assertTrue; public class ConceptPersisterIT extends BaseIntegrationTest { - + public static final String SAME_AS = "SAME-AS"; - + @Autowired private ConceptPersister conceptPersister; @@ -167,7 +168,7 @@ public void shouldSetConceptReferenceTerms() throws Exception { conceptRow.conceptClass = "New Class"; conceptRow.dataType = "Coded"; conceptRow.shortName = "NConcept"; - ConceptReferenceTermRow conceptReferenceTermRow = new ConceptReferenceTermRow( "org.openmrs.module.emrapi","New Code", SAME_AS); + ConceptReferenceTermRow conceptReferenceTermRow = new ConceptReferenceTermRow("org.openmrs.module.emrapi", "New Code", SAME_AS); List conceptReferenceTermsList = new ArrayList<>(Arrays.asList(conceptReferenceTermRow)); conceptRow.referenceTerms = conceptReferenceTermsList; @@ -247,7 +248,7 @@ public void shouldCreateNewMappingForExistingConcept() throws Exception { conceptRow.name = "Existing Concept"; conceptRow.conceptClass = "New Class"; conceptRow.description = "Some Description"; - ConceptReferenceTermRow conceptReferenceTermRow = new ConceptReferenceTermRow( "org.openmrs.module.emrapi","New Code", SAME_AS); + ConceptReferenceTermRow conceptReferenceTermRow = new ConceptReferenceTermRow("org.openmrs.module.emrapi", "New Code", SAME_AS); List conceptReferenceTermsList = new ArrayList<>(Arrays.asList(conceptReferenceTermRow)); conceptRow.referenceTerms = conceptReferenceTermsList; @@ -288,7 +289,7 @@ public void shouldCreateNewMappingsForExistingConcept() throws Exception { conceptRow.name = "Existing Concept"; conceptRow.conceptClass = "New Class"; conceptRow.description = "Some Description"; - ConceptReferenceTermRow conceptReferenceTermRow = new ConceptReferenceTermRow( "org.openmrs.module.emrapi","New Code", SAME_AS); + ConceptReferenceTermRow conceptReferenceTermRow = new ConceptReferenceTermRow("org.openmrs.module.emrapi", "New Code", SAME_AS); List conceptReferenceTermsList = new ArrayList<>(Arrays.asList(conceptReferenceTermRow)); conceptRow.referenceTerms = conceptReferenceTermsList; @@ -328,7 +329,7 @@ public void createNewConceptOfTypeNumericWithUnitsAndHinormalLownormal() throws conceptRow.name = "New Concept"; conceptRow.conceptClass = "New Class"; conceptRow.description = "Some Description"; - ConceptReferenceTermRow conceptReferenceTermRow = new ConceptReferenceTermRow( "org.openmrs.module.emrapi","New Code", SAME_AS); + ConceptReferenceTermRow conceptReferenceTermRow = new ConceptReferenceTermRow("org.openmrs.module.emrapi", "New Code", SAME_AS); List conceptReferenceTermsList = new ArrayList<>(Arrays.asList(conceptReferenceTermRow)); conceptRow.referenceTerms = conceptReferenceTermsList; conceptRow.dataType = "Numeric"; @@ -369,4 +370,30 @@ public void createNewConceptOfTypeNumericWithUnitsAndHinormalLownormal() throws Context.flushSession(); Context.closeSession(); } + + @Test + public void shouldCreateNewConceptWithGivenUUID() throws Exception { + String uuid = UUID.randomUUID().toString(); + ConceptRow conceptRow = new ConceptRow(); + conceptRow.name = "New concept"; + conceptRow.conceptClass = "New Class"; + conceptRow.description = "New concept description"; + conceptRow.uuid = uuid; + + Messages errorMessages = conceptPersister.persist(conceptRow); + + assertTrue(errorMessages.isEmpty()); + Context.openSession(); + Context.authenticate("admin", "test"); + Concept persistedConcept = conceptService.getConceptByName(conceptRow.name); + assertNotNull(persistedConcept); + assertEquals(uuid, persistedConcept.getUuid()); + assertEquals(conceptRow.name, persistedConcept.getName(Context.getLocale()).getName()); + assertEquals(conceptRow.conceptClass, persistedConcept.getConceptClass().getName()); + assertEquals("New concept description", persistedConcept.getDescription().getDescription()); + assertEquals(0, persistedConcept.getSynonyms().size()); + Context.flushSession(); + Context.closeSession(); + + } } diff --git a/admin/src/test/java/org/bahmni/module/admin/csv/persister/ConceptSetPersisterIT.java b/admin/src/test/java/org/bahmni/module/admin/csv/persister/ConceptSetPersisterIT.java index 629aa5cf79..4332f837dc 100644 --- a/admin/src/test/java/org/bahmni/module/admin/csv/persister/ConceptSetPersisterIT.java +++ b/admin/src/test/java/org/bahmni/module/admin/csv/persister/ConceptSetPersisterIT.java @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.UUID; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -157,4 +158,29 @@ public void should_fail_to_persist_if_conceptSetRow_introduces_cycle() throws Ex Context.closeSession(); } + @Test + public void shouldCreateNewConceptSetWithGivenUUID() throws Exception { + String uuid = UUID.randomUUID().toString(); + ConceptSetRow conceptRow = new ConceptSetRow(); + conceptRow.name = "New concept"; + conceptRow.conceptClass = "New Class"; + conceptRow.description = "some description"; + conceptRow.uuid = uuid; + + Messages persistErrorMessages = conceptSetPersister.persist(conceptRow); + + assertTrue(persistErrorMessages.isEmpty()); + Context.openSession(); + Context.authenticate("admin", "test"); + Concept persistedConcept = conceptService.getConceptByName(conceptRow.name); + assertNotNull(persistedConcept); + assertEquals(conceptRow.name, persistedConcept.getName(Context.getLocale()).getName()); + assertEquals(uuid, persistedConcept.getUuid()); + Context.flushSession(); + Context.closeSession(); + } + + + + } diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/ConceptCommonMapper.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/ConceptCommonMapper.java index 931a88c1bb..0d2fe8ae61 100644 --- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/ConceptCommonMapper.java +++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/ConceptCommonMapper.java @@ -19,6 +19,8 @@ public org.openmrs.Concept map(ConceptCommon conceptCommon, ConceptMetaData conc org.openmrs.Concept openmrsConcept = new org.openmrs.Concept(); if (conceptMetaData.getExistingConcept() != null) { openmrsConcept = conceptMetaData.getExistingConcept(); + } else if (StringUtils.isNotBlank(conceptCommon.getUuid())){ + openmrsConcept.setUuid(conceptCommon.getUuid()); } String displayName = conceptCommon.getDisplayName(); openmrsConcept = addConceptName(openmrsConcept, getConceptName(conceptCommon.getUniqueName(), ConceptNameType.FULLY_SPECIFIED, conceptMetaData.getLocale())); diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/service/impl/ReferenceDataConceptServiceImpl.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/service/impl/ReferenceDataConceptServiceImpl.java index 1e5c9b866c..2f47da198b 100644 --- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/service/impl/ReferenceDataConceptServiceImpl.java +++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/service/impl/ReferenceDataConceptServiceImpl.java @@ -77,7 +77,7 @@ private org.openmrs.Concept getConceptSet(ConceptSet conceptSet, ConceptMetaData return mappedConceptSet; } - private org.openmrs.Concept getConcept(Concept conceptData, ConceptMetaData conceptMetaData) { + private org.openmrs.Concept getConcept(Concept conceptData, ConceptMetaData conceptMetaData) { List conceptAnswers = getConceptAnswers(conceptData.getAnswers()); conceptValidator.validate(conceptData, conceptMetaData.getConceptClass(), conceptMetaData.getConceptDatatype(), notFound); org.openmrs.Concept mappedConcept = conceptMapper.map(conceptData, conceptMetaData, conceptAnswers); From 1312b7f2cecc5afe48be12e0481ce7c73323761a Mon Sep 17 00:00:00 2001 From: mks-d Date: Fri, 11 May 2018 20:10:33 +0200 Subject: [PATCH 4/6] Travis to run only feasible IT. modified: .travis.yml --- .travis.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7257f2c797..f053ecc481 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,9 @@ language: java jdk: - - oraclejdk8 -script: mvn clean install -P IT \ No newline at end of file + - oraclejdk8 +install: + - mvn install -Dmaven.javadoc.skip=true -V -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn +script: + - mvn verify -P IT -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -pl bahmni-emr-api/ + - mvn verify -P IT -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -pl bahmnicore-api/ + - mvn verify -P IT -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -pl bahmnicore-omod/ \ No newline at end of file From 013298190fed102cd330da1e4aa28ef49d2b23b8 Mon Sep 17 00:00:00 2001 From: Suman Maity Date: Tue, 15 May 2018 03:00:52 +0530 Subject: [PATCH 5/6] Suman | BAH-519 | Change Bahmni Initial Diagnosis, Bahmni Diagnosis Status, Bahmni Diagnosis Revised concepts to non-set concepts * Suman | BAH-519 | Chnage Bahmni Initial Diagnosis, Bahmni Diagnosis Status, Bahmni Diagnosis Revised concepts to non-set concepts * Suman | BAH-519 | Add precodndition to check 'Bahmni Diagnosis Revised', 'Bahmni Diagnosis Status' and 'Bahmni Initial Diagnosis' is empty set concepts --- .../src/main/resources/liquibase.xml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/bahmnicore-omod/src/main/resources/liquibase.xml b/bahmnicore-omod/src/main/resources/liquibase.xml index be46369d52..8688dbf554 100644 --- a/bahmnicore-omod/src/main/resources/liquibase.xml +++ b/bahmnicore-omod/src/main/resources/liquibase.xml @@ -4330,4 +4330,67 @@ INSERT INTO role_privilege(role, privilege) VALUES ("OT: ReadOnly", "app:ot"); + + + + SELECT count(*) FROM concept_view WHERE concept_full_name = 'Bahmni Initial Diagnosis'; + + + SELECT count(*) FROM concept WHERE is_set= TRUE AND concept_id = (SELECT concept_id FROM concept_view + WHERE concept_full_name = 'Bahmni Initial Diagnosis'); + + + SELECT count(*) FROM concept_set WHERE concept_set = (SELECT concept_id FROM concept_view + WHERE concept_full_name = 'Bahmni Initial Diagnosis'); + + + Updating 'Bahmni Initial Diagnosis' concept to non-set concept + + SET @concept_id=0; + SELECT concept_id FROM concept_view WHERE concept_full_name = 'Bahmni Initial Diagnosis' INTO @concept_id; + UPDATE concept SET is_set = FALSE WHERE concept_id = @concept_id; + + + + + + SELECT count(*) FROM concept_view WHERE concept_full_name = 'Bahmni Diagnosis Status'; + + + SELECT count(*) FROM concept WHERE is_set= TRUE AND concept_id = (SELECT concept_id FROM concept_view + WHERE concept_full_name = 'Bahmni Diagnosis Status'); + + + SELECT count(*) FROM concept_set WHERE concept_set = (SELECT concept_id FROM concept_view + WHERE concept_full_name = 'Bahmni Diagnosis Status'); + + + Updating 'Bahmni Diagnosis Status' concept to non-set concept + + SET @concept_id=0; + SELECT concept_id FROM concept_view WHERE concept_full_name = 'Bahmni Diagnosis Status' INTO @concept_id; + UPDATE concept SET is_set = FALSE WHERE concept_id = @concept_id; + + + + + + SELECT count(*) FROM concept_view WHERE concept_full_name = 'Bahmni Diagnosis Revised'; + + + SELECT count(*) FROM concept WHERE is_set= TRUE AND concept_id = (SELECT concept_id FROM concept_view + WHERE concept_full_name = 'Bahmni Diagnosis Revised'); + + + SELECT count(*) FROM concept_set WHERE concept_set = (SELECT concept_id FROM concept_view + WHERE concept_full_name = 'Bahmni Diagnosis Revised'); + + + Updating 'Bahmni Diagnosis Revised' concept to non-set concept + + SET @concept_id=0; + SELECT concept_id FROM concept_view WHERE concept_full_name = 'Bahmni Diagnosis Revised' INTO @concept_id; + UPDATE concept SET is_set = FALSE WHERE concept_id = @concept_id; + + From 4b82757328b83add989a1d0d914c0830e67cc401 Mon Sep 17 00:00:00 2001 From: mks-d Date: Tue, 15 May 2018 19:53:52 +0200 Subject: [PATCH 6/6] Adding travis_wait. modified: .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f053ecc481..a1ac8d9893 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: java jdk: - oraclejdk8 install: - - mvn install -Dmaven.javadoc.skip=true -V -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + - travis_wait mvn install -Dmaven.javadoc.skip=true -V -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn script: - mvn verify -P IT -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -pl bahmni-emr-api/ - mvn verify -P IT -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -pl bahmnicore-api/