/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getUpdatableProperties() */ @Override public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); }
@Override public Model getUPDATEModel(Representation rep) { return getCREATEModel(rep); }
/** * @see DelegatingCrudResource#getRepresentationDescription(Representation) */ @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = super.getRepresentationDescription(rep); description.addProperty("attributes", Representation.REF); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = super.getRepresentationDescription(rep); description.addProperty("attributes", Representation.DEFAULT); return description; } return null; }
private Location getLocation(String locationUniqueId) { Location location = ((LocationResource1_8) Context.getService(RestService.class).getResourceByName( RestConstants.VERSION_1 + "/location")).getByUniqueId(locationUniqueId); if (location == null) throw new ObjectNotFoundException(); return location; } }
@Test public void convert_shouldConvertASimpleObjectThatIncludesAUuid() { final String uuid = "91f6c840-da25-11e8-ae91-0242ac110002"; SimpleObject so = new SimpleObject(); so.add("uuid", uuid); so.add("name", "Location name"); so.add("description", "Location description"); DelegatingCrudResource<Location> resource = new LocationResource1_8(); Location location = resource.convert(so); Assert.assertEquals(uuid, location.getUuid()); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ @Override public DelegatingResourceDescription getCreatableProperties() { DelegatingResourceDescription description = super.getCreatableProperties(); description.addProperty("attributes"); return description; }