Skip to content

Commit 67b8ef7

Browse files
committed
Added the ability to scan properties of @PropertyGetter and @PropertySetter
2 parents b46363a + 5e7f50d commit 67b8ef7

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

omod-common/src/main/java/org/openmrs/module/webservices/rest/web/api/impl/SchemaIntrospectionServiceImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
import org.apache.commons.logging.Log;
2222
import org.apache.commons.logging.LogFactory;
2323
import org.openmrs.api.impl.BaseOpenmrsService;
24+
<<<<<<< HEAD
2425
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter;
2526
import org.openmrs.module.webservices.rest.web.annotation.PropertySetter;
27+
=======
28+
>>>>>>> 5e7f50da0571fa2aab7d12e68375741437297f10
2629
import org.openmrs.module.webservices.rest.web.api.SchemaIntrospectionService;
2730
import org.openmrs.module.webservices.rest.web.resource.api.Resource;
2831
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler;
@@ -141,6 +144,7 @@ public Map<String, String> discoverAvailableProperties(Class<?> delegateType) {
141144
@Override
142145
public Map<String, String> discoverResourceProperties(Resource resource) {
143146
Class<?> delegateType = getDelegateType(resource);
147+
<<<<<<< HEAD
144148
Map<String, String> properties = discoverAvailableProperties(delegateType);
145149

146150
// Also discover properties defined by PropertyGetter and PropertySetter annotations
@@ -187,6 +191,9 @@ private void discoverAnnotatedProperties(Class<?> resourceClass, Map<String, Str
187191
// Move up to the superclass
188192
currentClass = currentClass.getSuperclass();
189193
}
194+
=======
195+
return discoverAvailableProperties(delegateType);
196+
>>>>>>> 5e7f50da0571fa2aab7d12e68375741437297f10
190197
}
191198

192199
/**

omod-common/src/test/java/org/openmrs/module/webservices/rest/web/api/impl/SchemaIntrospectionServiceImplTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,26 @@
1818
import static org.hamcrest.Matchers.hasKey;
1919
import static org.hamcrest.Matchers.hasSize;
2020

21+
<<<<<<< HEAD
2122
import java.util.ArrayList;
2223
import java.util.List;
24+
=======
25+
>>>>>>> 5e7f50da0571fa2aab7d12e68375741437297f10
2326
import java.util.Map;
2427

2528
import org.junit.Before;
2629
import org.junit.Test;
2730
import org.openmrs.Patient;
31+
<<<<<<< HEAD
2832
import org.openmrs.PatientIdentifier;
2933
import org.openmrs.Person;
3034
import org.openmrs.module.webservices.rest.web.RequestContext;
3135
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter;
3236
import org.openmrs.module.webservices.rest.web.annotation.PropertySetter;
37+
=======
38+
import org.openmrs.Person;
39+
import org.openmrs.module.webservices.rest.web.RequestContext;
40+
>>>>>>> 5e7f50da0571fa2aab7d12e68375741437297f10
3341
import org.openmrs.module.webservices.rest.web.resource.api.Resource;
3442
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource;
3543
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
@@ -158,6 +166,7 @@ public void discoverResourceProperties_shouldCombineGetDelegateTypeAndDiscoverAv
158166
}
159167

160168
/**
169+
<<<<<<< HEAD
161170
* @see SchemaIntrospectionServiceImpl#discoverResourceProperties(Resource)
162171
*/
163172
@Test
@@ -181,6 +190,8 @@ public void discoverResourceProperties_shouldIncludePropertiesFromAnnotations()
181190
}
182191

183192
/**
193+
=======
194+
>>>>>>> 5e7f50da0571fa2aab7d12e68375741437297f10
184195
* Mock DelegatingCrudResource for testing
185196
*/
186197
private class TestPatientResource extends DelegatingCrudResource<Patient> {
@@ -216,6 +227,7 @@ public void delete(Patient delegate, String reason, RequestContext context) thro
216227
}
217228

218229
/**
230+
<<<<<<< HEAD
219231
* Mock DelegatingCrudResource for testing PropertyGetter and PropertySetter annotations
220232
*/
221233
private class TestPatientResourceWithAnnotations extends DelegatingCrudResource<Patient> {
@@ -268,6 +280,8 @@ public void delete(Patient delegate, String reason, RequestContext context) thro
268280
}
269281

270282
/**
283+
=======
284+
>>>>>>> 5e7f50da0571fa2aab7d12e68375741437297f10
271285
* Mock DelegatingSubResource for testing
272286
*/
273287
private class TestPatientSubResource extends DelegatingSubResource<Patient, Person, TestPersonResource> {

0 commit comments

Comments
 (0)