Package io.hcxprotocol.interfaces
Interface IncomingRequest
-
- All Known Implementing Classes:
HCXIncomingRequest
public interface IncomingRequestThe Incoming Request Interface provide the methods to help in processing the JWE Payload and extract FHIR Object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleandecryptPayload(String jwePayload, Map<String,Object> output)Decrypt the JWE Payload using the Participant System Private Key (which is available from the configuration).booleanprocess(String jwePayload, io.hcxprotocol.utils.Operations operation, Map<String,Object> output)Process the JWE Payload based on the Operation to validate and extract the FHIR Object.booleansendResponse(Map<String,Object> error, Map<String,Object> output)Generates the HCX Protocol API response using validation errors and the output object.booleanvalidatePayload(String fhirPayload, io.hcxprotocol.utils.Operations operation, Map<String,Object> error)Validates the FHIR Object structure and required attributes using HCX FHIR IG.booleanvalidateRequest(String jwePayload, io.hcxprotocol.utils.Operations operation, Map<String,Object> error)Validates the HCX Protocol Headers from the JWE Payload.
-
-
-
Method Detail
-
process
boolean process(String jwePayload, io.hcxprotocol.utils.Operations operation, Map<String,Object> output)
Process the JWE Payload based on the Operation to validate and extract the FHIR Object. It has the implementation of below steps.- Validating HCX Protocol headers
- Decryption of the payload and extracting FHIR object
- Validating the FHIR object using HCX FHIR IG.
- Parameters:
jwePayload- The JWE payload from the incoming API request body.operation- The HCX operation name.output- A wrapper map to collect the outcome (errors or response) of the JWE Payload processing.- output -
{ "headers":{}, - protocol headers "fhirPayload":{}, - fhir object "responseObj":{} - success/error response object } - success response object -
{ "timestamp": , - unix timestamp "correlation_id": "", - fetched from incoming request "api_call_id": "" - fetched from incoming request } - error response object -
{ "timestamp": , - unix timestamp "error": { "code" : "", - error code "message": "", - error message "trace":"" - error trace } }
- output -
- Returns:
- It is a boolean value to understand the incoming request processing is successful or not.
- true - It is successful.
- false - It is failure.
-
validateRequest
boolean validateRequest(String jwePayload, io.hcxprotocol.utils.Operations operation, Map<String,Object> error)
Validates the HCX Protocol Headers from the JWE Payload. This method is used by IncomingInterface.processFunction for validate the headers.- Parameters:
jwePayload- The JWE payload from the incoming API request body.operation- The HCX operation or action defined by specs to understand the functional behaviour.error- A wrapper map to collect the errors from the JWE Payload.{ "error_code": "error_message" }- Returns:
- It is a boolean value to understand the validation status of JWE Payload.
- true - Validation is successful.
- false - Validation is failure.
-
decryptPayload
boolean decryptPayload(String jwePayload, Map<String,Object> output)
Decrypt the JWE Payload using the Participant System Private Key (which is available from the configuration). The JWE Payload follows RFC7516.- Parameters:
jwePayload- The JWE payload from the incoming API request body.output- A wrapper map to collect the outcome (errors or response) of the JWE Payload after decryption.- success output -
{ "headers":{}, - protocol headers "fhirPayload":{} - fhir object } - error output -
{ "error_code": "error_message" }
- success output -
- Returns:
- It is a boolean value to understand the decryption status of JWE Payload.
- true - Decryption is successful.
- false - Decryption is failure.
-
validatePayload
boolean validatePayload(String fhirPayload, io.hcxprotocol.utils.Operations operation, Map<String,Object> error)
Validates the FHIR Object structure and required attributes using HCX FHIR IG.- Parameters:
fhirPayload- The FHIR object extracted from the incoming JWE Payload.operation- The HCX operation or action defined by specs to understand the functional behaviour.error- A wrapper map to collect the errors from the FHIR Payload validation.{ "error_code": "error_message" }- Returns:
- It is a boolean value to understand the validation status of FHIR Payload.
- true - Validation is successful.
- false - Validation is failure.
-
sendResponse
boolean sendResponse(Map<String,Object> error, Map<String,Object> output)
Generates the HCX Protocol API response using validation errors and the output object.- Parameters:
error- A wrapper map to collect the errors from the JWE or FHIR Payload validations.output- A wrapper map to collect the response of the JWE Payload processing.- output -
{ "headers":{}, - protocol headers "fhirPayload":{}, - fhir object "responseObj":{} - success/error response object } - success response object -
{ "timestamp": , - unix timestamp "correlation_id": "", - fetched from incoming request "api_call_id": "" - fetched from incoming request } - error response object -
{ "timestamp": , - unix timestamp "error": { "code" : "", - error code "message": "", - error message "trace":"" - error trace } }
- output -
- Returns:
- It is a boolean value to understand the final status is successful or failure.
-
-