/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String) */ @Override public ConceptMap getByUniqueId(String uniqueId) { return Context.getService(RestHelperService.class).getObjectByUuid(ConceptMap.class, uniqueId); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getUpdatableProperties() */ @Override public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { OrderResource1_10 orderResource = (OrderResource1_10) Context.getService(RestService.class) .getResourceBySupportedClass(Order.class); //this actually throws a ResourceDoesNotSupportOperationException return orderResource.getUpdatableProperties(); }
private Patient getPatient(String patientUniqueId) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceByName( RestConstants.VERSION_1 + "/patient")).getByUniqueId(patientUniqueId); if (patient == null) throw new ObjectNotFoundException(); return patient; }
/** * @see RestService#getRepresentation(String) * @verifies get ref representation when specified */ @Test public void getRepresentation_shouldGetRefRepresentationWhenSpecified() throws Exception { Assert.assertEquals(Representation.REF, service.getRepresentation(RestConstants.REPRESENTATION_REF)); }
/** * @verifies return null if search handlers have not been initialized * @see RestServiceImpl#getAllSearchHandlers() */ @Test public void getAllSearchHandlers_shouldReturnNullIfSearchHandlersHaveNotBeenInitialized() throws Exception { assertThat(restService.getAllSearchHandlers(), is(nullValue())); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getUpdatableProperties() */ @Override public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { OrderResource1_10 orderResource = (OrderResource1_10) Context.getService(RestService.class) .getResourceBySupportedClass(Order.class); //this actually throws a ResourceDoesNotSupportOperationException return orderResource.getUpdatableProperties(); }
/** * Fetches a conceptReferenceTerm by uuid * * @see DelegatingCrudResource#getByUniqueId(java.lang.String) */ @Override public ConceptReferenceTermMap getByUniqueId(String uuid) { return Context.getService(RestHelperService.class).getObjectByUuid(ConceptReferenceTermMap.class, uuid); }
/** * @see org.openmrs.module.webservices.rest.web.resource.api.Converter#asRepresentation(T, * org.openmrs.module.webservices.rest.web.representation.Representation) */ @Override public SimpleObject asRepresentation(User instance, Representation rep) throws ConversionException { UserAndPassword1_8 userPass = new UserAndPassword1_8(instance); UserResource1_8 userResource = (UserResource1_8) Context.getService(RestService.class).getResourceByName( RestConstants.VERSION_1 + "/user"); return userResource.asRepresentation(userPass, rep); }
/** * @see RestService#getRepresentation(String) * @verifies get default representation when specified */ @Test public void getRepresentation_shouldGetDefaultRepresentationWhenSpecified() throws Exception { Assert.assertEquals(Representation.DEFAULT, service.getRepresentation(RestConstants.REPRESENTATION_DEFAULT)); }
@Override public Model getUPDATEModel(Representation rep) { OrderResource1_10 orderResource = (OrderResource1_10) Context.getService(RestService.class) .getResourceBySupportedClass(Order.class); return orderResource.getUPDATEModel(rep); }
@Override public EncounterProvider getByUniqueId(String uniqueId) { return Context.getService(RestHelperService.class).getObjectByUuid(EncounterProvider.class, uniqueId); }
/** * @verifies fail if resource for given name cannot be found * @see RestServiceImpl#getResourceByName(String) */ @Test public void getResourceByName_shouldFailIfResourceForGivenNameCannotBeFound() throws Exception { expectedException.expect(UnknownResourceException.class); expectedException.expectMessage("Unknown resource: UNKNOWNRESOURCENAME"); restService.getResourceByName("UNKNOWNRESOURCENAME"); }
/** * @see RestService#getRepresentation(String) * @verifies get full representation when specified */ @Test public void getRepresentation_shouldGetFullRepresentationWhenSpecified() throws Exception { Assert.assertEquals(Representation.FULL, service.getRepresentation(RestConstants.REPRESENTATION_FULL)); }
/** * @return the resource this handler works with */ @SuppressWarnings("unchecked") public DelegatingCrudResource<Superclass> getResource() { // get the service-managed singleton version of the resource Resource resource = Context.getService(RestService.class).getResourceBySupportedClass(getSuperclass()); return (DelegatingCrudResource<Superclass>) resource; };
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest#newObject() */ @Override public ConceptMap newObject() { return Context.getService(RestHelperService.class).getObjectByUuid(ConceptMap.class, getUuidProperty()); }
@Before public void setUp() { ServerLogResource1_8 serverLogResource1_8 = (ServerLogResource1_8) restService .getResourceBySupportedClass(ServerLogActionWrapper.class); serverLogResource1_8.setServerLogActionWrapper(mockServerLogActionWrapper); }
@Override public ConceptReferenceTermMap newObject() { return Context.getService(RestHelperService.class).getObjectByUuid(ConceptReferenceTermMap.class, getUuidProperty()); }
@Before public void beforeEachTests() throws Exception { resource = (UserResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( UserAndPassword1_8.class); }
@Before public void beforeEachTests() throws Exception { resource = (PatientIdentifierResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( PatientIdentifier.class); }
@Before public void beforeEachTests() throws Exception { resource = (PatientResource1_9) Context.getService(RestService.class).getResourceBySupportedClass(Patient.class); }