private FileData<PatientVisitDTO> doPut(FileData<PatientVisitDTO> entity) throws RestLoaderException { Response response = hbRestClient.doPut(entity.getEntity()); try { switch (response.getStatus()) { case 200: PayloadStatus result = response.readEntity(PayloadStatus.class); String id = HBUtil.getIdFromURI(result.getIdentifier()); entity.setSuccess(true); entity.setResult(DataLoaderConstants.SUCCESS_MSG + id); break; case 400: RestApiError badRequestError = response.readEntity(RestApiError.class); entity.setSuccess(false); entity.setResult(DataLoaderConstants.ERROR_MSG + badRequestError.toString()); break; case 404: RestApiError notFoundError = response.readEntity(RestApiError.class); entity.setSuccess(false); entity.setResult(DataLoaderConstants.ERROR_MSG + notFoundError.toString()); break; default: } } catch (MessageBodyProviderNotFoundException e) { log.warning(e.getMessage()); entity.setSuccess(false); entity.setResult(DataLoaderConstants.UNKNOWN_ERROR_MSG); } return entity; }
private static PatientVisitDTO extractPatientVisitDTO(FileData<PatientVisitDTO> entity) { return entity.getEntity(); }