Class AbstractOperation
- java.lang.Object
 - 
- com.ibm.fhir.server.operation.spi.AbstractOperation
 
 
- 
- All Implemented Interfaces:
 FHIROperation
- Direct Known Subclasses:
 AbstractTermOperation,ApplyOperation,ConvertOperation,DocumentOperation,EverythingOperation,ExportOperation,HealthcheckOperation,ImportOperation,ReindexOperation,StatusOperation,ValidateOperation
public abstract class AbstractOperation extends Object implements FHIROperation
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected OperationDefinitiondefinition 
- 
Constructor Summary
Constructors Constructor Description AbstractOperation() 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected FHIROperationExceptionbuildExceptionWithIssue(String msg, IssueType issueType)protected FHIROperationExceptionbuildExceptionWithIssue(String msg, IssueType issueType, Throwable cause)protected abstract OperationDefinitionbuildOperationDefinition()protected intcountParameters(Parameters parameters, String name)protected abstract ParametersdoInvoke(FHIROperationContext operationContext, Class<? extends Resource> resourceType, String logicalId, String versionId, Parameters parameters, FHIRResourceHelpers resourceHelper)This is the method that concrete subclasses must implement to perform the operation logic.protected OperationDefinition.ParameterfindOpDefParameter(List<OperationDefinition.Parameter> parameters, String name)Returns the OperationDefinitionParameter with the specified name or null if it wasn't found.OperationDefinitiongetDefinition()StringgetName()protected Parameters.ParametergetParameter(Parameters parameters, String name)protected List<OperationDefinition.Parameter>getParameterDefinitions(OperationParameterUse use)protected List<Parameters.Parameter>getParameters(Parameters parameters, String name)protected List<String>getResourceTypeNames()Parametersinvoke(FHIROperationContext operationContext, Class<? extends Resource> resourceType, String logicalId, String versionId, Parameters parameters, FHIRResourceHelpers resourceHelper)Validate the input parameters, invoke the operation, validate the output parameters, and return the result.protected voidvalidateInputParameters(FHIROperationContext operationContext, Class<? extends Resource> resourceType, String logicalId, String versionId, Parameters parameters)protected voidvalidateOperationContext(FHIROperationContext operationContext, Class<? extends Resource> resourceType)protected voidvalidateOutputParameters(Parameters result)protected voidvalidateParameters(Parameters parameters, OperationParameterUse use) 
 - 
 
- 
- 
Field Detail
- 
definition
protected OperationDefinition definition
 
 - 
 
- 
Method Detail
- 
getDefinition
public OperationDefinition getDefinition()
- Specified by:
 getDefinitionin interfaceFHIROperation
 
- 
getName
public String getName()
- Specified by:
 getNamein interfaceFHIROperation
 
- 
invoke
public final Parameters invoke(FHIROperationContext operationContext, Class<? extends Resource> resourceType, String logicalId, String versionId, Parameters parameters, FHIRResourceHelpers resourceHelper) throws FHIROperationException
Validate the input parameters, invoke the operation, validate the output parameters, and return the result.- Specified by:
 invokein interfaceFHIROperation- Throws:
 FHIROperationException- if input or output parameters fail validation or an exception occurs
 
- 
buildOperationDefinition
protected abstract OperationDefinition buildOperationDefinition()
 
- 
countParameters
protected int countParameters(Parameters parameters, String name)
 
- 
doInvoke
protected abstract Parameters doInvoke(FHIROperationContext operationContext, Class<? extends Resource> resourceType, String logicalId, String versionId, Parameters parameters, FHIRResourceHelpers resourceHelper) throws FHIROperationException
This is the method that concrete subclasses must implement to perform the operation logic.- Returns:
 - The Parameters object to return or null if there is no response Parameters object to return
 - Throws:
 FHIROperationException
 
- 
getParameter
protected Parameters.Parameter getParameter(Parameters parameters, String name)
 
- 
getParameterDefinitions
protected List<OperationDefinition.Parameter> getParameterDefinitions(OperationParameterUse use)
 
- 
getParameters
protected List<Parameters.Parameter> getParameters(Parameters parameters, String name)
 
- 
validateInputParameters
protected void validateInputParameters(FHIROperationContext operationContext, Class<? extends Resource> resourceType, String logicalId, String versionId, Parameters parameters) throws FHIROperationException
- Throws:
 FHIROperationException
 
- 
validateOperationContext
protected void validateOperationContext(FHIROperationContext operationContext, Class<? extends Resource> resourceType) throws FHIROperationException
- Throws:
 FHIROperationException
 
- 
validateOutputParameters
protected void validateOutputParameters(Parameters result) throws FHIROperationException
- Throws:
 FHIROperationException
 
- 
validateParameters
protected void validateParameters(Parameters parameters, OperationParameterUse use) throws FHIROperationException
- Throws:
 FHIROperationException
 
- 
findOpDefParameter
protected OperationDefinition.Parameter findOpDefParameter(List<OperationDefinition.Parameter> parameters, String name)
Returns the OperationDefinitionParameter with the specified name or null if it wasn't found.- Parameters:
 parameters- the list of parameters from the OperationDefinitionname- the name of the parameter to find- Returns:
 
 
- 
buildExceptionWithIssue
protected FHIROperationException buildExceptionWithIssue(String msg, IssueType issueType) throws FHIROperationException
- Throws:
 FHIROperationException
 
- 
buildExceptionWithIssue
protected FHIROperationException buildExceptionWithIssue(String msg, IssueType issueType, Throwable cause) throws FHIROperationException
- Throws:
 FHIROperationException
 
 - 
 
 -