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 OperationOutcomeIssueComponent copy() { OperationOutcomeIssueComponent dst = new OperationOutcomeIssueComponent(); copyValues(dst); dst.severity = severity == null ? null : severity.copy(); dst.code = code == null ? null : code.copy(); dst.details = details == null ? null : details.copy(); dst.diagnostics = diagnostics == null ? null : diagnostics.copy(); if (location != null) { dst.location = new ArrayList<StringType>(); for (StringType i : location) dst.location.add(i.copy()); }; if (expression != null) { dst.expression = new ArrayList<StringType>(); for (StringType i : expression) dst.expression.add(i.copy()); }; return dst; }
oo.addIssue().setSeverity(IssueSeverity.INFORMATION).setDiagnostics("Ok to delete"); return new MethodOutcome(new IdType(theId.getValue()), oo);
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case 1478300413: // severity value = new IssueSeverityEnumFactory().fromType(castToCode(value)); this.severity = (Enumeration) value; // Enumeration<IssueSeverity> return value; case 3059181: // code value = new IssueTypeEnumFactory().fromType(castToCode(value)); this.code = (Enumeration) value; // Enumeration<IssueType> return value; case 1557721666: // details this.details = castToCodeableConcept(value); // CodeableConcept return value; case -740386388: // diagnostics this.diagnostics = castToString(value); // StringType return value; case 1901043637: // location this.getLocation().add(castToString(value)); // StringType return value; case -1795452264: // expression this.getExpression().add(castToString(value)); // StringType return value; default: return super.setProperty(hash, name, value); } }
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("severity")) { value = new IssueSeverityEnumFactory().fromType(castToCode(value)); this.severity = (Enumeration) value; // Enumeration<IssueSeverity> } else if (name.equals("code")) { value = new IssueTypeEnumFactory().fromType(castToCode(value)); this.code = (Enumeration) value; // Enumeration<IssueType> } else if (name.equals("details")) { this.details = castToCodeableConcept(value); // CodeableConcept } else if (name.equals("diagnostics")) { this.diagnostics = castToString(value); // StringType } else if (name.equals("location")) { this.getLocation().add(castToString(value)); } else if (name.equals("expression")) { this.getExpression().add(castToString(value)); } else return super.setProperty(name, value); return value; }
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 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 org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.instance.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.dstu3.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); return tgt; }
public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.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.dstu3.model.StringType t : src.getLocation()) tgt.addLocation(t.getValue()); for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) tgt.addExpression(t.getValue()); return tgt; }
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case 1478300413: return getSeverityElement(); case 3059181: return getCodeElement(); case 1557721666: return getDetails(); case -740386388: return getDiagnosticsElement(); case 1901043637: return addLocationElement(); case -1795452264: return addExpressionElement(); default: return super.makeProperty(hash, name); } }
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 String getEventOutcomeDescriptionFromOperationOutcome(OperationOutcome response) { if (!response.hasIssue()) { return null; } return response.getIssue().get(0).getDiagnostics(); } }
@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; }
@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 boolean hasIssue() { if (this.issue == null) return false; for (OperationOutcomeIssueComponent item : this.issue) if (!item.isEmpty()) return true; return false; }
public OperationOutcomeIssueComponent addIssue() { //3 OperationOutcomeIssueComponent t = new OperationOutcomeIssueComponent(); if (this.issue == null) this.issue = new ArrayList<OperationOutcomeIssueComponent>(); this.issue.add(t); return t; }
outcome.addIssue().setDiagnostics("One minor issue detected"); retVal.setOperationOutcome(outcome);
outcome.addIssue().setDiagnostics("One minor issue detected"); retVal.setOperationOutcome(outcome);
@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