diff --git a/api/src/main/java/org/openmrs/module/appointmentscheduling/AppointmentType.java b/api/src/main/java/org/openmrs/module/appointmentscheduling/AppointmentType.java index c5a8e478..a0929533 100644 --- a/api/src/main/java/org/openmrs/module/appointmentscheduling/AppointmentType.java +++ b/api/src/main/java/org/openmrs/module/appointmentscheduling/AppointmentType.java @@ -22,8 +22,10 @@ public class AppointmentType extends BaseOpenmrsMetadata { private Integer appointmentTypeId; private Integer duration; - - public AppointmentType() { + + private boolean confidential = false; + + public AppointmentType() { } @@ -72,4 +74,13 @@ public void setDuration(Integer duration) { public String getDisplayString() { return getName(); } + + public void setConfidential(boolean confidential) { + this.confidential = confidential; + } + + public boolean isConfidential() { + return confidential; + } + } diff --git a/api/src/main/java/org/openmrs/module/appointmentscheduling/api/AppointmentService.java b/api/src/main/java/org/openmrs/module/appointmentscheduling/api/AppointmentService.java index 0ec1c562..b34a6811 100644 --- a/api/src/main/java/org/openmrs/module/appointmentscheduling/api/AppointmentService.java +++ b/api/src/main/java/org/openmrs/module/appointmentscheduling/api/AppointmentService.java @@ -13,11 +13,6 @@ */ package org.openmrs.module.appointmentscheduling.api; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; - import org.openmrs.Location; import org.openmrs.Patient; import org.openmrs.Provider; @@ -35,6 +30,11 @@ import org.openmrs.module.appointmentscheduling.TimeSlot; import org.openmrs.module.appointmentscheduling.exception.TimeSlotFullException; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; + /** * This service exposes module's core functionality. It is a Spring managed bean * which is configured in moduleApplicationContext.xml. @@ -118,6 +118,7 @@ List getAppointmentTypes(String fuzzySearchPhrase, * @return the created or updated appointment type. * @should save new appointment type * @should save edited appointment type + * @should save confidential appointment type * @should throw error when name is null * @should throw error when name is empty string */ diff --git a/api/src/main/resources/AppointmentType.hbm.xml b/api/src/main/resources/AppointmentType.hbm.xml index e2615d48..cfa512f0 100644 --- a/api/src/main/resources/AppointmentType.hbm.xml +++ b/api/src/main/resources/AppointmentType.hbm.xml @@ -16,6 +16,7 @@ + diff --git a/api/src/main/resources/liquibase.xml b/api/src/main/resources/liquibase.xml index 0d309fa0..7c6cc64a 100644 --- a/api/src/main/resources/liquibase.xml +++ b/api/src/main/resources/liquibase.xml @@ -400,4 +400,16 @@ referencedTableName="provider" referencedColumnNames="provider_id"/> + + + + + Adding confidential column to appointmentscheduling_appointment_type table + + + + + + + \ No newline at end of file diff --git a/api/src/test/java/org/openmrs/module/appointmentscheduling/api/AppointmentTypeServiceTest.java b/api/src/test/java/org/openmrs/module/appointmentscheduling/api/AppointmentTypeServiceTest.java index 66816bb1..8d08721e 100644 --- a/api/src/test/java/org/openmrs/module/appointmentscheduling/api/AppointmentTypeServiceTest.java +++ b/api/src/test/java/org/openmrs/module/appointmentscheduling/api/AppointmentTypeServiceTest.java @@ -181,8 +181,18 @@ public void saveAppointmentType_shouldSaveEditedAppointmentType() throws Excepti //Should not change the number of appointment types. assertEquals(4, service.getAllAppointmentTypes().size()); } - - @Test + + @Test + @Verifies(value = "should save confidential appointment type", method = "saveAppointmentType(AppointmentType)") + public void saveAppointmentType_shouldSaveConfidentialAppointmentType() throws Exception { + AppointmentType appointmentType = new AppointmentType("HIV Followup", "Scheduled followup", 30); + appointmentType.setConfidential(true); + + appointmentType = service.saveAppointmentType(appointmentType); + assertTrue(appointmentType.isConfidential()); + } + + @Test @Verifies(value = "should retire given appointment type", method = "retireAppointmentType(AppointmentType, String)") public void retireAppointmentType_shouldRetireGivenAppointmentType() throws Exception { AppointmentType appointmentType = service.getAppointmentType(1); diff --git a/api/src/test/resources/standardAppointmentTestDataset.xml b/api/src/test/resources/standardAppointmentTestDataset.xml index 9b921558..aa878133 100644 --- a/api/src/test/resources/standardAppointmentTestDataset.xml +++ b/api/src/test/resources/standardAppointmentTestDataset.xml @@ -1,9 +1,9 @@ - - - - + + + + diff --git a/omod/src/main/java/org/openmrs/module/appointmentscheduling/rest/resource/openmrs1_9/AppointmentTypeResource1_9.java b/omod/src/main/java/org/openmrs/module/appointmentscheduling/rest/resource/openmrs1_9/AppointmentTypeResource1_9.java index 6efdb14c..5c542fe7 100644 --- a/omod/src/main/java/org/openmrs/module/appointmentscheduling/rest/resource/openmrs1_9/AppointmentTypeResource1_9.java +++ b/omod/src/main/java/org/openmrs/module/appointmentscheduling/rest/resource/openmrs1_9/AppointmentTypeResource1_9.java @@ -29,6 +29,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation description.addProperty("name"); description.addProperty("description"); description.addProperty("duration"); + description.addProperty("confidential"); description.addProperty("retired"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); @@ -40,6 +41,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation description.addProperty("name"); description.addProperty("description"); description.addProperty("duration"); + description.addProperty("confidential"); description.addProperty("retired"); description.addProperty("auditInfo", findMethod("getAuditInfo")); description.addSelfLink(); @@ -54,6 +56,7 @@ public DelegatingResourceDescription getCreatableProperties() { description.addRequiredProperty("name"); description.addRequiredProperty("description"); description.addRequiredProperty("duration"); + description.addProperty("confidential"); return description; } diff --git a/omod/src/test/java/org/openmrs/module/appointmentscheduling/rest/controller/AppointmentTypeResource1_9ControllerTest.java b/omod/src/test/java/org/openmrs/module/appointmentscheduling/rest/controller/AppointmentTypeResource1_9ControllerTest.java index 89db1579..93809860 100644 --- a/omod/src/test/java/org/openmrs/module/appointmentscheduling/rest/controller/AppointmentTypeResource1_9ControllerTest.java +++ b/omod/src/test/java/org/openmrs/module/appointmentscheduling/rest/controller/AppointmentTypeResource1_9ControllerTest.java @@ -37,6 +37,7 @@ public void shouldGetAppointmentTypeByUuid() throws Exception { Assert.assertEquals("Initial HIV Clinic Appointment", PropertyUtils.getProperty(result, "display")); Assert.assertEquals("Initial HIV Clinic Appointment Description", PropertyUtils.getProperty(result, "description")); Assert.assertEquals(45, PropertyUtils.getProperty(result, "duration")); + Assert.assertEquals(true, PropertyUtils.getProperty(result, "confidential")); Assert.assertEquals(false, PropertyUtils.getProperty(result, "retired")); } @@ -54,6 +55,7 @@ public void shouldGetFullAppointmentTypeByUuid() throws Exception { Assert.assertEquals("Initial HIV Clinic Appointment", PropertyUtils.getProperty(result, "display")); Assert.assertEquals("Initial HIV Clinic Appointment Description", PropertyUtils.getProperty(result, "description")); Assert.assertEquals(45, PropertyUtils.getProperty(result, "duration")); + Assert.assertEquals(true, PropertyUtils.getProperty(result, "confidential")); Assert.assertEquals(false, PropertyUtils.getProperty(result, "retired")); Assert.assertNotNull(PropertyUtils.getProperty(result, "auditInfo")); } diff --git a/omod/src/test/java/org/openmrs/module/appointmentscheduling/rest/resource/openmrs1_9/AppointmentTypeResource1_9Test.java b/omod/src/test/java/org/openmrs/module/appointmentscheduling/rest/resource/openmrs1_9/AppointmentTypeResource1_9Test.java index 796f4105..0428ca88 100644 --- a/omod/src/test/java/org/openmrs/module/appointmentscheduling/rest/resource/openmrs1_9/AppointmentTypeResource1_9Test.java +++ b/omod/src/test/java/org/openmrs/module/appointmentscheduling/rest/resource/openmrs1_9/AppointmentTypeResource1_9Test.java @@ -30,6 +30,7 @@ public void validateDefaultRepresentation() throws Exception { assertPropEquals("name", getObject().getName()); assertPropEquals("description", getObject().getDescription()); assertPropEquals("duration", getObject().getDuration()); + assertPropEquals("confidential", getObject().isConfidential()); assertPropEquals("retired", getObject().isRetired()); } @@ -39,6 +40,7 @@ public void validateFullRepresentation() throws Exception { assertPropEquals("name", getObject().getName()); assertPropEquals("description", getObject().getDescription()); assertPropEquals("duration", getObject().getDuration()); + assertPropEquals("confidential", getObject().isConfidential()); assertPropEquals("retired", getObject().isRetired()); assertPropPresent("auditInfo"); } diff --git a/omod/src/test/resources/standardWebAppointmentTestDataset.xml b/omod/src/test/resources/standardWebAppointmentTestDataset.xml index 7c41195c..a68495d7 100644 --- a/omod/src/test/resources/standardWebAppointmentTestDataset.xml +++ b/omod/src/test/resources/standardWebAppointmentTestDataset.xml @@ -1,9 +1,9 @@ - - - - + + + +