Class AbstractFhirAuditStrategy<AuditDatasetType extends FhirAuditDataset, O extends IBaseOperationOutcome>

java.lang.Object
org.openehealth.ipf.commons.ihe.core.atna.AuditStrategySupport<AuditDatasetType>
org.openehealth.ipf.commons.ihe.fhir.audit.AbstractFhirAuditStrategy<AuditDatasetType, O>
All Implemented Interfaces:
AuditStrategy<AuditDatasetType>
Direct Known Subclasses:
FhirAuditStrategy

public abstract class AbstractFhirAuditStrategy<AuditDatasetType extends FhirAuditDataset, O extends IBaseOperationOutcome> extends AuditStrategySupport<AuditDatasetType>
Generic Audit Strategy for FHIR transactions
Since:
3.2
Author:
Christian Ohr
  • Constructor Details

    • AbstractFhirAuditStrategy

      protected AbstractFhirAuditStrategy(boolean serverSide)
  • Method Details

    • doAudit

      public void doAudit(AuditContext auditContext, AuditDatasetType auditDataset)
      Description copied from class: AuditStrategySupport
      Builds the audit message and hands it to the audit context.

      Nothing that goes wrong on the way out of here reaches the caller. Auditing runs in the finally of the interceptors, where a thrown exception would replace the outcome of the transaction being audited -- so a malformed access token, a participant the builder cannot make sense of, or any other defect in assembling the record would turn a served request into a server error. Failures go to the configured AuditExceptionHandler instead, the same place a failed serialization or delivery ends up; deployments that want auditing to be fatal can plug a rethrowing handler.

      Specified by:
      doAudit in interface AuditStrategy<AuditDatasetType extends FhirAuditDataset>
      Overrides:
      doAudit in class AuditStrategySupport<AuditDatasetType extends FhirAuditDataset>
      Parameters:
      auditContext - audit context
      auditDataset - audit dataset
    • enrichAuditDatasetFromRequest

      public AuditDatasetType enrichAuditDatasetFromRequest(AuditDatasetType auditDataset, Object request, Map<String,Object> parameters)
      Description copied from interface: AuditStrategy
      Enriches the given audit dataset with transaction-specific contents of the request message and Camel exchange.
      Specified by:
      enrichAuditDatasetFromRequest in interface AuditStrategy<AuditDatasetType extends FhirAuditDataset>
      Overrides:
      enrichAuditDatasetFromRequest in class AuditStrategySupport<AuditDatasetType extends FhirAuditDataset>
      Parameters:
      auditDataset - audit dataset to be enriched.
      request - Object representing the request.
      parameters - additional parameters
    • enrichAuditDatasetFromResponse

      public boolean enrichAuditDatasetFromResponse(AuditDatasetType auditDataset, Object response, AuditContext auditContext)
      Description copied from interface: AuditStrategy
      Enriches the given audit dataset with transaction-specific contents of the response message.
      Specified by:
      enrichAuditDatasetFromResponse in interface AuditStrategy<AuditDatasetType extends FhirAuditDataset>
      Overrides:
      enrichAuditDatasetFromResponse in class AuditStrategySupport<AuditDatasetType extends FhirAuditDataset>
      Parameters:
      auditDataset - audit dataset to be enriched.
      response - Object representing the responded resource.
      auditContext - audit context, if relevant
      Returns:
      true if response indicates success, false otherwise
    • getEventOutcomeIndicator

      public EventOutcomeIndicator getEventOutcomeIndicator(AuditDatasetType auditDataset, Object response)
      Description copied from interface: AuditStrategy
      Determines which event outcome corresponds with the provided response POJO
      Parameters:
      auditDataset - Audit dataset
      response - POJO
      Returns:
      event outcome code
    • getEventOutcomeCodeFromResource

      protected EventOutcomeIndicator getEventOutcomeCodeFromResource(AuditDatasetType auditDataset, IBaseResource resource)
      A resource is returned from the business logic. This may usually success unless it's OperationOutcome
      Parameters:
      resource - FHIR resource
      Returns:
      event outcome code
    • getEventOutcomeDescription

      public String getEventOutcomeDescription(AuditDatasetType auditDataset, Object response)
      Description copied from interface: AuditStrategy
      Determines which event outcome description corresponds with the provided response POJO
      Parameters:
      auditDataset - Audit dataset
      response - POJO
      Returns:
      event outcome description
    • getEventOutcomeCodeFromOperationOutcome

      public abstract EventOutcomeIndicator getEventOutcomeCodeFromOperationOutcome(FhirContext fhirContext, O response)
      Operation Outcomes are sets of error, warning and information messages that provide detailed information about the outcome of some attempted system operation. They are provided as a direct system response, or component of one, where they provide information about the outcome of the operation.
      Parameters:
      response - IBaseOperationOutcome to be analyzed
      Returns:
      ATNA outcome code
    • getEventOutcomeDescriptionFromOperationOutcome

      public abstract String getEventOutcomeDescriptionFromOperationOutcome(FhirContext fhirContext, O response)