Java Code Examples for org.hl7.fhir.r4.model.OperationOutcome#getIssue()

The following examples show how to use org.hl7.fhir.r4.model.OperationOutcome#getIssue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceUtilities.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static String getErrorDescription(OperationOutcome error) {  
if (error.hasText() && error.getText().hasDiv())
	return new XhtmlComposer(XhtmlComposer.XML).composePlainText(error.getText().getDiv());

StringBuilder b = new StringBuilder();
for (OperationOutcomeIssueComponent t : error.getIssue())
	if (t.getSeverity() == IssueSeverity.ERROR)
		b.append("Error:" +t.getDetails()+"\r\n");
	else if (t.getSeverity() == IssueSeverity.FATAL)
		b.append("Fatal:" +t.getDetails()+"\r\n");
	else if (t.getSeverity() == IssueSeverity.WARNING)
		b.append("Warning:" +t.getDetails()+"\r\n");
	else if (t.getSeverity() == IssueSeverity.INFORMATION)
		b.append("Information:" +t.getDetails()+"\r\n");
return b.toString();
}
 
Example 2
Source File: CodeSystemUpdateProvider.java    From cqf-ruler with Apache License 2.0 6 votes vote down vote up
/***
 * Update existing CodeSystems with the codes in all ValueSet resources.
 * System level CodeSystem update operation
 *
 * @return FHIR OperationOutcome detailing the success or failure of the operation
 */
@Operation(name = "$updateCodeSystems", idempotent = true)
public OperationOutcome updateCodeSystems()
{
    IBundleProvider valuesets = this.valueSetDao.search(new SearchParameterMap());
    OperationOutcome response = new OperationOutcome();

    OperationOutcome outcome;
    for (IBaseResource valueSet : valuesets.getResources(0, valuesets.size()))
    {
        outcome = this.performCodeSystemUpdate((ValueSet) valueSet);
        if (outcome.hasIssue())
        {
            for (OperationOutcome.OperationOutcomeIssueComponent issue : outcome.getIssue())
            {
                response.addIssue(issue);
            }
        }
    }

    return response;
}
 
Example 3
Source File: ResourceUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static boolean isAnError(OperationOutcome error) {
	for (OperationOutcomeIssueComponent t : error.getIssue())
		if (t.getSeverity() == IssueSeverity.ERROR)
			return true;
		else if (t.getSeverity() == IssueSeverity.FATAL)
			return true;
	return false;
}
 
Example 4
Source File: ClientUtils.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private boolean hasError(OperationOutcome oo) {
  for (OperationOutcomeIssueComponent t : oo.getIssue())
    if (t.getSeverity() == IssueSeverity.ERROR || t.getSeverity() == IssueSeverity.FATAL)
      return true;
  return false;
}