@Test public void updateRequest() throws Exception { Patient patient = new Patient(); patient.setUuid(TEST_PATIENT_UUID); SimpleObject simpleObject = getSimpleObject(patient); String json = (new SimpleObjectMessageConverter()).convertToJson(simpleObject); ClientHttpEntity expected = new ClientHttpEntity<String>(json, HttpMethod.POST, URI.create(TEST_URI + "/" + TEST_PATIENT_UUID)); assertEquals(expected, restClientHelper.updateRequest(TEST_URI, simpleObject)); }
@Override public ClientHttpEntity updateRequest(String url, Object object) throws URISyntaxException { if (object instanceof AuditMessage) { url += "/" + ((AuditMessage) object).getUuid(); return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); } else { getRestResourceConverter().convertObject(url, object); url += "/" + ((SimpleObject) object).get("uuid"); } return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); }
RESTClientHelper implements ClientHelper { @Override public ClientHttpEntity updateRequest(String url, Object object) throws URISyntaxException { if (object instanceof AuditMessage) { url += "/" + ((AuditMessage) object).getUuid(); return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); } else { getRestResourceConverter().convertObject(url, object); url += "/" + ((SimpleObject) object).get("uuid"); } return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); } }
RESTClientHelper implements ClientHelper { @Override public ClientHttpEntity updateRequest(String url, Object object) throws URISyntaxException { if (object instanceof AuditMessage) { url += "/" + ((AuditMessage) object).getUuid(); return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); } else { getRestResourceConverter().convertObject(url, object); url += "/" + ((SimpleObject) object).get("uuid"); } return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); }  }
RESTClientHelper implements ClientHelper { @Override public ClientHttpEntity updateRequest(String url, Object object) throws URISyntaxException { if (object instanceof AuditMessage) { url += "/" + ((AuditMessage) object).getUuid(); return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); } else { getRestResourceConverter().convertObject(url, object); url += "/" + ((SimpleObject) object).get("uuid"); } return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); }  @Override ClientHttpEntity retrieveRequest(String url); @Override ClientHttpEntity createRequest(String url, Object object); @Override ClientHttpEntity deleteRequest(String url, String uuid); @Override ClientHttpEntity updateRequest(String url, Object object); @Override Class resolveClassByCategory(String category); @Override List<ClientHttpRequestInterceptor> getCustomInterceptors(String username, String password); @Override List<HttpMessageConverter<?>> getCustomMessageConverter(); @Override boolean compareResourceObjects(String category, Object from, Object dest); @Override Object convertToObject(String formattedData, Class<?> clazz); @Override String convertToFormattedData(Object object); @Override Object convertToOpenMrsObject(Object o, String category); }
RESTClientHelper implements ClientHelper { @Override public ClientHttpEntity updateRequest(String url, Object object) throws URISyntaxException { if (object instanceof AuditMessage) { url += "/" + ((AuditMessage) object).getUuid(); return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); } else { getRestResourceConverter().convertObject(url, object); url += "/" + ((SimpleObject) object).get("uuid"); } return new ClientHttpEntity<String>(convertToFormattedData(object), HttpMethod.POST, new URI(url)); }  @Override ClientHttpEntity retrieveRequest(String url); @Override ClientHttpEntity createRequest(String url, Object object); @Override ClientHttpEntity deleteRequest(String url, String uuid); @Override ClientHttpEntity updateRequest(String url, Object object); @Override Class resolveClassByCategory(String category); @Override List<ClientHttpRequestInterceptor> getCustomInterceptors(String username, String password); @Override List<HttpMessageConverter<?>> getCustomMessageConverter(); @Override boolean compareResourceObjects(String category, Object from, Object dest); @Override Object convertToObject(String formattedData, Class<?> clazz); @Override String convertToFormattedData(Object object); @Override Object convertToOpenMrsObject(Object o, String category);  }