@Override protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { OperationOutcome oo = new OperationOutcome(); OperationOutcomeIssueComponent issue = oo.addIssue(); issue.getSeverityElement().setValueAsString(theSeverity); issue.setDiagnostics(theMessage); try { issue.setCode(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.fromCode(theCode)); } catch (FHIRException e) { ourLog.error("Unknown code: {}", theCode); } return oo; }
public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); return tgt; }
public org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.instance.model.OperationOutcome src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); copyDomainResource(src, tgt); for (org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); 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
outcome.addIssue().setDiagnostics("One minor issue detected"); retVal.setOperationOutcome(outcome);
@Override public Base addChild(String name) throws FHIRException { if (name.equals("issue")) { return addIssue(); } else return super.addChild(name); }
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case 100509913: return addIssue(); default: return super.makeProperty(hash, name); } }
/** * @return The first repetition of repeating field {@link #issue}, creating it if it does not already exist */ public OperationOutcomeIssueComponent getIssueFirstRep() { if (getIssue().isEmpty()) { addIssue(); } return getIssue().get(0); }
outcome.addIssue().setDiagnostics("One minor issue detected"); retVal.setOperationOutcome(outcome);
oo.addIssue().setSeverity(IssueSeverity.INFORMATION).setDiagnostics("Ok to delete"); return new MethodOutcome(new IdType(theId.getValue()), oo);
@Override protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { OperationOutcome oo = new OperationOutcome(); OperationOutcomeIssueComponent issue = oo.addIssue(); issue.getSeverityElement().setValueAsString(theSeverity); issue.setDiagnostics(theMessage); try { issue.setCode(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.fromCode(theCode)); } catch (FHIRException e) { ourLog.error("Unknown code: {}", theCode); } return oo; }
public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); copyDomainResource(src, tgt); for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); return tgt; }
public org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.instance.model.OperationOutcome src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); copyDomainResource(src, tgt); for (org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) tgt.addIssue(convertOperationOutcomeIssueComponent(t)); 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); }
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); }
oo.addIssue().setSeverity(IssueSeverity.INFORMATION).setDiagnostics("Ok to delete"); return new MethodOutcome(new IdType(theId.getValue()), oo);