public OperationOutcomeIssueComponent asIssue(OperationOutcome op) throws Exception { OperationOutcomeIssueComponent issue = new OperationOutcome.OperationOutcomeIssueComponent(); issue.setCode(new CodeableConcept()); issue.getCode().addCoding().setSystem(type.getSystem()).setCode(type.toCode()); if (location != null) { StringType s = new StringType(); s.setValue( location + (line >= 0 && col >= 0 ? " (line " + Integer.toString(line) + ", col" + Integer.toString(col) + ")" : "")); issue.getLocation().add(s); } issue.setSeverity(level); issue.setDetails(message); if (source != null) { issue.getExtension().add(ToolingExtensions.makeIssueSource(source)); } return issue; }