private String getSubjectReference(Resource resource, Function<Resource, Reference> f) { Reference reference = f.apply(resource); if (reference == null) { throw FhirUtils.unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.UNKNOWN_PATIENT_ID.getOpcode(), null, "Empty Patient reference in resource %s", resource ); } // Could be contained resources if (reference.getResource() != null) { Patient patient = (Patient) reference.getResource(); return patient.getIdentifier().get(0).getValue(); } return reference.getReference(); }
private String getSubjectReference(Resource resource, Function<Resource, Reference> f) { Reference reference = f.apply(resource); if (reference == null) { throw FhirUtils.unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.UNKNOWN_PATIENT_ID.getOpcode(), null, "Empty Patient reference in resource %s", resource ); } // Could be contained resources if (reference.getResource() != null) { Patient patient = (Patient) reference.getResource(); return patient.getIdentifier().get(0).getValue(); } return reference.getReference(); }
private String getSubjectReference(Resource resource, Function<Resource, Reference> f) { Reference reference = f.apply(resource); if (reference == null) { throw FhirUtils.unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.UNKNOWN_PATIENT_ID.getOpcode(), null, "Empty Patient reference in resource %s", resource ); } // Could be contained resources if (reference.getResource() != null) { Patient patient = (Patient) reference.getResource(); return patient.getIdentifier().get(0).getValue(); } return reference.getReference(); }
private String getSubjectReference(Resource resource, Function<Resource, Reference> f) { Reference reference = f.apply(resource); if (reference == null) { throw FhirUtils.unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.UNKNOWN_PATIENT_ID.getOpcode(), null, "Empty Patient reference in resource %s", resource ); } // Could be contained resources if (reference.getResource() != null) { Patient patient = (Patient) reference.getResource(); return patient.getIdentifier().get(0).getValue(); } return reference.getReference(); }
OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.PATIENT_ID_DOES_NOT_MATCH.getOpcode(), null, "Inconsistent patient references %s",
OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.PATIENT_ID_DOES_NOT_MATCH.getOpcode(), null, "Inconsistent patient references %s",
OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.PATIENT_ID_DOES_NOT_MATCH.getOpcode(), null, "Inconsistent patient references %s",
OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, ErrorCode.PATIENT_ID_DOES_NOT_MATCH.getOpcode(), null, "Inconsistent patient references %s",
@Test public void testToEbXMLRegistryResponse() { EbXMLRegistryResponse ebXML = transformer.toEbXML(response); assertEquals(Status.FAILURE, ebXML.getStatus()); List<EbXMLRegistryError> errors = ebXML.getErrors(); assertEquals(3, errors.size()); EbXMLRegistryError error = errors.get(0); assertEquals("context1", error.getCodeContext()); assertEquals(ErrorCode.PATIENT_ID_DOES_NOT_MATCH.getOpcode(), error.getErrorCode()); assertEquals(Severity.ERROR, error.getSeverity()); assertEquals("location1", error.getLocation()); error = errors.get(1); assertEquals("context2", error.getCodeContext()); assertEquals(ErrorCode.SQL_ERROR.getOpcode(), error.getErrorCode()); assertEquals(Severity.WARNING, error.getSeverity()); assertEquals(null, error.getLocation()); error = errors.get(2); assertEquals("context3", error.getCodeContext()); assertEquals("MyCustomErrorCode", error.getErrorCode()); assertEquals(Severity.ERROR, error.getSeverity()); assertEquals("location3", error.getLocation()); }