Class FHIROperationUtil
- java.lang.Object
-
- org.linuxforhealth.fhir.server.spi.operation.FHIROperationUtil
-
public final class FHIROperationUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringENV_DISABLED_OPERATIONS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FHIROperationExceptionbuildExceptionWithIssue(java.lang.String msg, IssueType issueType)Helper method to generate a FHIROperationException with a fixed IssueTypestatic FHIROperationExceptionbuildExceptionWithIssue(java.lang.String msg, IssueType issueType, java.lang.Throwable cause)Helper method to generate a FHIROperationException with a fixed IssueTypestatic voidcheckAndVerifyOperationAllowed(java.lang.String operationName)check and verify operation allowedstatic FHIROperationExceptiongenerateForbiddenOperationException(java.lang.String operationName)static ParametersgetInputParameters(OperationDefinition definition, java.util.Map<java.lang.String,java.util.List<java.lang.String>> queryParameters)Construct a Parameters object from the input parameters passed via query parametersstatic ParametersgetInputParameters(OperationDefinition definition, Resource resource)Construct a Parameters object with a single parameter named resourcestatic ParametersgetOutputParameters(java.lang.String name, Resource resource)generates an output parameter with a specific name.static ParametersgetOutputParameters(java.lang.String name, Element element)Generates an output parameters, with a parameter for a specified element.static ParametersgetOutputParameters(Resource resource)Generates an output Parameter resourcestatic ResourcegetSingleResourceOutputParameter(Parameters parameters)static booleanhasSingleResourceOutputParameter(Parameters parameters)static voidinit()Initializes the FHIR Operation Utility so disallowedOperations are loaded one time.
-
-
-
Field Detail
-
ENV_DISABLED_OPERATIONS
public static final java.lang.String ENV_DISABLED_OPERATIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init()
Initializes the FHIR Operation Utility so disallowedOperations are loaded one time. First, the code checks the environment operations. Second, the code checks the configuration. This is initialized one time for the system.
-
getInputParameters
public static Parameters getInputParameters(OperationDefinition definition, java.util.Map<java.lang.String,java.util.List<java.lang.String>> queryParameters) throws FHIROperationException
Construct a Parameters object from the input parameters passed via query parameters- Parameters:
definition- not nullqueryParameters- not null- Returns:
- Throws:
FHIROperationException
-
getInputParameters
public static Parameters getInputParameters(OperationDefinition definition, Resource resource) throws java.lang.Exception
Construct a Parameters object with a single parameter named resource- Parameters:
definition-resource-- Returns:
- Throws:
java.lang.Exception
-
getOutputParameters
public static Parameters getOutputParameters(Resource resource)
Generates an output Parameter resource- Parameters:
resource-- Returns:
-
getOutputParameters
public static Parameters getOutputParameters(java.lang.String name, Resource resource)
generates an output parameter with a specific name.- Parameters:
name-resource-- Returns:
-
getOutputParameters
public static Parameters getOutputParameters(java.lang.String name, Element element)
Generates an output parameters, with a parameter for a specified element.- Parameters:
name- the parameter nameelement- the element, or null- Returns:
- output parameters
-
hasSingleResourceOutputParameter
public static boolean hasSingleResourceOutputParameter(Parameters parameters)
-
getSingleResourceOutputParameter
public static Resource getSingleResourceOutputParameter(Parameters parameters) throws java.lang.Exception
- Throws:
java.lang.Exception
-
checkAndVerifyOperationAllowed
public static void checkAndVerifyOperationAllowed(java.lang.String operationName) throws FHIROperationExceptioncheck and verify operation allowed- Parameters:
operationName-- Throws:
FHIROperationException
-
generateForbiddenOperationException
public static FHIROperationException generateForbiddenOperationException(java.lang.String operationName)
-
buildExceptionWithIssue
public static FHIROperationException buildExceptionWithIssue(java.lang.String msg, IssueType issueType)
Helper method to generate a FHIROperationException with a fixed IssueType- Parameters:
msg- the message to be packed in the exceptionissueType- the type of the issue- Returns:
-
buildExceptionWithIssue
public static FHIROperationException buildExceptionWithIssue(java.lang.String msg, IssueType issueType, java.lang.Throwable cause)
Helper method to generate a FHIROperationException with a fixed IssueType- Parameters:
msg- the message to be packed in the exceptionissueType- the type of the issuecause- the throwable that causes this OperationOutcome/Exception- Returns:
-
-