oo.addIssue().setSeverity(IssueSeverity.INFORMATION).setDiagnostics("Ok to delete"); return new MethodOutcome(new IdType(theId.getValue()), oo);
oo.addIssue().setSeverity(IssueSeverity.INFORMATION).setDiagnostics("Ok to delete"); return new MethodOutcome(new IdType(theId.getValue()), oo);
public static <T extends BaseServerResponseException> T exception(Function<String, T> func, OperationOutcome.IssueSeverity severity, OperationOutcome.IssueType type, String code, String diagnostics, String msg, Object... args) { OperationOutcome operationOutcome = new OperationOutcome(); CodeableConcept errorCode = null; if (code != null) { errorCode = new CodeableConcept(); errorCode.addCoding().setCode(code); } operationOutcome.addIssue() .setSeverity(severity) .setCode(type) .setDetails(errorCode) .setDiagnostics(diagnostics); return exception(func, operationOutcome, msg, args); }
public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); copyElement(src, tgt); tgt.setSeverity(convertIssueSeverity(src.getSeverity())); tgt.setCode(convertIssueType(src.getCode())); tgt.setDetails(convertCodeableConcept(src.getDetails())); if (src.hasDiagnostics()) tgt.setDiagnostics(src.getDiagnostics()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); return tgt; }
public org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); copyElement(src, tgt); tgt.setSeverity(convertIssueSeverity(src.getSeverity())); tgt.setCode(convertIssueType(src.getCode())); tgt.setDetails(convertCodeableConcept(src.getDetails())); tgt.setDiagnostics(src.getDiagnostics()); for (org.hl7.fhir.instance.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); return tgt; }
@Override public void populateEntryWithOperationOutcome(BaseServerResponseException theCaughtEx, Bundle.BundleEntryComponent theEntry) { OperationOutcome oo = new OperationOutcome(); oo.addIssue().setSeverity(OperationOutcome.IssueSeverity.ERROR).setDiagnostics(theCaughtEx.getMessage()); theEntry.getResponse().setOutcome(oo); }
@Validate public MethodOutcome validatePatient(@ResourceParam Patient thePatient, @Validate.Mode ValidationModeEnum theMode, @Validate.Profile String theProfile) { // Actually do our validation: The UnprocessableEntityException // results in an HTTP 422, which is appropriate for business rule failure if (thePatient.getIdentifierFirstRep().isEmpty()) { /* It is also possible to pass an OperationOutcome resource * to the UnprocessableEntityException if you want to return * a custom populated OperationOutcome. Otherwise, a simple one * is created using the string supplied below. */ throw new UnprocessableEntityException("No identifier supplied"); } // This method returns a MethodOutcome object MethodOutcome retVal = new MethodOutcome(); // You may also add an OperationOutcome resource to return // This part is optional though: OperationOutcome outcome = new OperationOutcome(); outcome.addIssue().setSeverity(IssueSeverity.WARNING).setDiagnostics("One minor issue detected"); retVal.setOperationOutcome(outcome); return retVal; } //END SNIPPET: validate
public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); copyElement(src, tgt); tgt.setSeverity(convertIssueSeverity(src.getSeverity())); tgt.setCode(convertIssueType(src.getCode())); tgt.setDetails(convertCodeableConcept(src.getDetails())); if (src.hasDiagnostics()) tgt.setDiagnostics(src.getDiagnostics()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); return tgt; }
public org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); copyElement(src, tgt); tgt.setSeverity(convertIssueSeverity(src.getSeverity())); tgt.setCode(convertIssueType(src.getCode())); tgt.setDetails(convertCodeableConcept(src.getDetails())); tgt.setDiagnostics(src.getDiagnostics()); for (org.hl7.fhir.instance.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); return tgt; }
@Override public void populateEntryWithOperationOutcome(BaseServerResponseException theCaughtEx, Bundle.BundleEntryComponent theEntry) { OperationOutcome oo = new OperationOutcome(); oo.addIssue().setSeverity(OperationOutcome.IssueSeverity.ERROR).setDiagnostics(theCaughtEx.getMessage()); theEntry.getResponse().setOutcome(oo); }