Skip to content

Commit d9e8bd5

Browse files
authored
Issue #2162 - updates to how we handle UnsupportOperationException (#2238)
Signed-off-by: John T.E. Timm <[email protected]>
1 parent 4af75c8 commit d9e8bd5

File tree

9 files changed

+30
-0
lines changed

9 files changed

+30
-0
lines changed

fhir-model/src/main/java/com/ibm/fhir/model/util/FHIRUtil.java

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ public static OperationOutcome.Issue buildOperationOutcomeIssue(IssueSeverity se
159159

160160
public static OperationOutcome.Issue buildOperationOutcomeIssue(IssueSeverity severity, IssueType code, String details,
161161
String expression) {
162+
if (details == null || details.isEmpty()) {
163+
details = "<no details>";
164+
}
162165
if (expression == null || expression.isEmpty()) {
163166
expression = "<no expression>";
164167
}

fhir-term/src/main/java/com/ibm/fhir/term/service/FHIRTermService.java

+11
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ public void addProvider(FHIRTermServiceProvider provider) {
103103
providers.add(provider);
104104
}
105105

106+
/**
107+
* Get a set containing {@link CodeSystem.Concept} instances where all structural
108+
* hierarchies have been flattened.
109+
*
110+
* @param codeSystem
111+
* the code system
112+
* @param code
113+
* the root of the hierarchy containing the Concept instances to be flattened
114+
* @return
115+
* flattened set of Concept instances for the given tree
116+
*/
106117
public Set<Concept> closure(CodeSystem codeSystem, Code code) {
107118
return findProvider(codeSystem).closure(codeSystem, code);
108119
}

operation/fhir-operation-term/src/main/java/com/ibm/fhir/operation/term/ClosureOperation.java

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ protected Parameters doInvoke(
7878
throw e;
7979
} catch (FHIRTermServiceException e) {
8080
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
81+
} catch (UnsupportedOperationException e) {
82+
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
8183
} catch (Exception e) {
8284
throw new FHIROperationException("An error occurred during the ConceptMap closure operation", e);
8385
}

operation/fhir-operation-term/src/main/java/com/ibm/fhir/operation/term/CodeSystemValidateCodeOperation.java

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ protected Parameters doInvoke(
5353
throw e;
5454
} catch (FHIRTermServiceException e) {
5555
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
56+
} catch (UnsupportedOperationException e) {
57+
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
5658
} catch (Exception e) {
5759
throw new FHIROperationException("An error occurred during the CodeSystem validate code operation", e);
5860
}

operation/fhir-operation-term/src/main/java/com/ibm/fhir/operation/term/ExpandOperation.java

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ protected Parameters doInvoke(
4747
throw e;
4848
} catch (FHIRTermServiceException e) {
4949
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
50+
} catch (UnsupportedOperationException e) {
51+
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
5052
} catch (Exception e) {
5153
throw new FHIROperationException("An error occurred during the ValueSet expand operation", e);
5254
}

operation/fhir-operation-term/src/main/java/com/ibm/fhir/operation/term/LookupOperation.java

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ protected Parameters doInvoke(
4848
outcome = service.lookup(coding, LookupParameters.from(parameters));
4949
} catch (FHIRTermServiceException e) {
5050
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
51+
} catch (UnsupportedOperationException e) {
52+
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
5153
} catch(Exception e) {
5254
throw new FHIROperationException("An error occurred during the CodeSystem lookup operation", e);
5355
}

operation/fhir-operation-term/src/main/java/com/ibm/fhir/operation/term/SubsumesOperation.java

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ protected Parameters doInvoke(
5959
throw e;
6060
} catch (FHIRTermServiceException e) {
6161
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
62+
} catch (UnsupportedOperationException e) {
63+
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
6264
} catch (Exception e) {
6365
throw new FHIROperationException("An error occurred during the CodeSystem subsumes operation", e);
6466
}

operation/fhir-operation-term/src/main/java/com/ibm/fhir/operation/term/TranslateOperation.java

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.ibm.fhir.model.type.CodeableConcept;
1515
import com.ibm.fhir.model.type.Coding;
1616
import com.ibm.fhir.model.type.Element;
17+
import com.ibm.fhir.model.type.code.IssueType;
1718
import com.ibm.fhir.registry.FHIRRegistry;
1819
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
1920
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
@@ -46,6 +47,8 @@ protected Parameters doInvoke(
4647
throw e;
4748
} catch (FHIRTermServiceException e) {
4849
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
50+
} catch (UnsupportedOperationException e) {
51+
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
4952
} catch (Exception e) {
5053
throw new FHIROperationException("An error occurred during the ConceptMap translate operation", e);
5154
}

operation/fhir-operation-term/src/main/java/com/ibm/fhir/operation/term/ValueSetValidateCodeOperation.java

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.ibm.fhir.model.type.CodeableConcept;
1515
import com.ibm.fhir.model.type.Coding;
1616
import com.ibm.fhir.model.type.Element;
17+
import com.ibm.fhir.model.type.code.IssueType;
1718
import com.ibm.fhir.registry.FHIRRegistry;
1819
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
1920
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
@@ -46,6 +47,8 @@ protected Parameters doInvoke(
4647
throw e;
4748
} catch (FHIRTermServiceException e) {
4849
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
50+
} catch (UnsupportedOperationException e) {
51+
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
4952
} catch (Exception e) {
5053
throw new FHIROperationException("An error occurred during the ValueSet validate code operation", e);
5154
}

0 commit comments

Comments
 (0)