Class FHIRPersistenceEvent
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.context.FHIRPersistenceEvent
-
public class FHIRPersistenceEvent extends java.lang.Object
This class represents an event fired by the FHIR persistence interceptor framework.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPNAME_PATCH
This property holds the FHIRPatch instance associated with the request.static java.lang.String
PROPNAME_PERSISTENCE_IMPL
This property is of type FHIRPersistence and is the handle to the persistence layer implementation being used by the FHIR Server while processing the current request.static java.lang.String
PROPNAME_RESOURCE_ID
This property is of type String and contains the resource id associated with an update, read, vread, history, or delete operation.static java.lang.String
PROPNAME_RESOURCE_LOCATION_URI
This property is of type String and contains the location URI that can be used to retrieve the resource via a GET request.static java.lang.String
PROPNAME_RESOURCE_TYPE
This property is of type String and contains the resource type associated with a create, update, read, vread, history, search, or delete operation.static java.lang.String
PROPNAME_SEARCH_CONTEXT_IMPL
This property is of type FHIRSearchContext and is the search context associated with a search request, but it may be null.static java.lang.String
PROPNAME_SYSTEM_HISTORY_CONTEXT_IMPL
This property is of type FHIRSystemHistoryContext and is the system history context associated with a system history request, but it may be null.static java.lang.String
PROPNAME_VERSION_ID
This property is of type String and contains the version id associated with a vread operation.
-
Constructor Summary
Constructors Constructor Description FHIRPersistenceEvent()
Default ctor.FHIRPersistenceEvent(java.util.Map<java.lang.String,java.lang.Object> properties)
Ctor that accepts a collection of properties.FHIRPersistenceEvent(Resource fhirResource, java.util.Map<java.lang.String,java.lang.Object> properties)
Ctor that accepts the FHIR resource and a collection of properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resource
getFhirResource()
Returns the resource associated with the REST API request that triggered the interceptor invocation.java.lang.String
getFhirResourceId()
Returns the resource id associated with the FHIR REST API request that triggered the interceptor invocation.java.lang.String
getFhirResourceType()
Returns the resource type associated with the FHIR REST API request that triggered the interceptor invocation.java.lang.String
getFhirVersionId()
Returns the version id associated with the FHIR REST API request that triggered the interceptor invocation.FHIRPersistence
getPersistenceImpl()
Returns the FHIRPersistence instance currently being used by the FHIR REST API layer to process the current request.Resource
getPrevFhirResource()
Returns the "previous" resource associated with the REST API request that triggered the interceptor invocation.java.util.Map<java.lang.String,java.lang.Object>
getProperties()
Retrieves the set of properties associated with the event that triggered the interceptor invocation.java.lang.Object
getProperty(java.lang.String propertyName)
Retrieves the named property from the set of properties available to the interceptor.FHIRSearchContext
getSearchContextImpl()
Returns the FHIRSearchContext instance currently being used by the FHIR REST API layer to process the current request.FHIRSystemHistoryContext
getSystemHistoryContextImpl()
Returns the FHIRSystemHistoryContext instance currently being used by the FHIR REST API layer to process the current request.boolean
isPrevFhirResourceSet()
This method returns true if and only if the "previous resource" field has in fact been set.boolean
isStandardResourceType()
Returns true if and only if the resource type value contained in the persistence event represents a standard FHIR resource type.void
setFhirResource(Resource resource)
Sets the specific resource in 'this'.void
setPrevFhirResource(Resource prevFhirResource)
Sets the "previous" resource associated with an "update" request.
-
-
-
Field Detail
-
PROPNAME_PERSISTENCE_IMPL
public static final java.lang.String PROPNAME_PERSISTENCE_IMPL
This property is of type FHIRPersistence and is the handle to the persistence layer implementation being used by the FHIR Server while processing the current request. Persistence interceptors can use this handle to invoke persistence operations.- See Also:
- Constant Field Values
-
PROPNAME_RESOURCE_LOCATION_URI
public static final java.lang.String PROPNAME_RESOURCE_LOCATION_URI
This property is of type String and contains the location URI that can be used to retrieve the resource via a GET request.- See Also:
- Constant Field Values
-
PROPNAME_RESOURCE_TYPE
public static final java.lang.String PROPNAME_RESOURCE_TYPE
This property is of type String and contains the resource type associated with a create, update, read, vread, history, search, or delete operation. For other operations, this property will be null.- See Also:
- Constant Field Values
-
PROPNAME_RESOURCE_ID
public static final java.lang.String PROPNAME_RESOURCE_ID
This property is of type String and contains the resource id associated with an update, read, vread, history, or delete operation. For update and delete it may be null (i.e. for conditional updates/deletes) For whole-system history, this property will be null. For other operations, this property will be null.- See Also:
- Constant Field Values
-
PROPNAME_VERSION_ID
public static final java.lang.String PROPNAME_VERSION_ID
This property is of type String and contains the version id associated with a vread operation. For other operations, this property will be null.- See Also:
- Constant Field Values
-
PROPNAME_PATCH
public static final java.lang.String PROPNAME_PATCH
This property holds the FHIRPatch instance associated with the request.- See Also:
- Constant Field Values
-
PROPNAME_SEARCH_CONTEXT_IMPL
public static final java.lang.String PROPNAME_SEARCH_CONTEXT_IMPL
This property is of type FHIRSearchContext and is the search context associated with a search request, but it may be null. For other operations, this property will be null.- See Also:
- Constant Field Values
-
PROPNAME_SYSTEM_HISTORY_CONTEXT_IMPL
public static final java.lang.String PROPNAME_SYSTEM_HISTORY_CONTEXT_IMPL
This property is of type FHIRSystemHistoryContext and is the system history context associated with a system history request, but it may be null. For other operations, this property will be null.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FHIRPersistenceEvent
public FHIRPersistenceEvent()
Default ctor.
-
FHIRPersistenceEvent
public FHIRPersistenceEvent(java.util.Map<java.lang.String,java.lang.Object> properties)
Ctor that accepts a collection of properties.- Parameters:
properties
- the set of properties associated with the event
-
FHIRPersistenceEvent
public FHIRPersistenceEvent(Resource fhirResource, java.util.Map<java.lang.String,java.lang.Object> properties)
Ctor that accepts the FHIR resource and a collection of properties.- Parameters:
fhirResource
- the FHIR resource associated with the eventproperties
- the set of properties associated with the event
-
-
Method Detail
-
getFhirResource
public Resource getFhirResource()
Returns the resource associated with the REST API request that triggered the interceptor invocation. This will be non-null before and after a create or update operation, and will be non-null after a read, vread, history or search operation.
-
setFhirResource
public void setFhirResource(Resource resource)
Sets the specific resource in 'this'. Interceptor implementations should *not* call this method. This method is reserved for use by the FHIR Server.
-
getPrevFhirResource
public Resource getPrevFhirResource()
Returns the "previous" resource associated with the REST API request that triggered the interceptor invocation. This field is set only for an "update" operation and represents the existing version of the resource prior to the new resource being stored.
-
setPrevFhirResource
public void setPrevFhirResource(Resource prevFhirResource)
Sets the "previous" resource associated with an "update" request.- Parameters:
prevFhirResource
- the existing most recent version of the resource prior to the update operation being processed.
-
isPrevFhirResourceSet
public boolean isPrevFhirResourceSet()
This method returns true if and only if the "previous resource" field has in fact been set. This flag exists so that we can differentiate between these two scenarios:- The "previous resource" field is explicitly set to null.
- The "previous resource" field is not explicitly set at all.
- Returns:
- true if the "previous resource" field is set (including the situation where it is set to null); false otherwise
-
getFhirResourceType
public java.lang.String getFhirResourceType()
Returns the resource type associated with the FHIR REST API request that triggered the interceptor invocation. This will be non-null for a create, update, read, vread, history, search, or delete operation.
-
getFhirResourceId
public java.lang.String getFhirResourceId()
Returns the resource id associated with the FHIR REST API request that triggered the interceptor invocation. This will be non-null for a read, vread, non-whole-system history, or non-conditional update/delete operation.
-
getFhirVersionId
public java.lang.String getFhirVersionId()
Returns the version id associated with the FHIR REST API request that triggered the interceptor invocation. This will be non-null for a vread operation.
-
isStandardResourceType
public boolean isStandardResourceType()
Returns true if and only if the resource type value contained in the persistence event represents a standard FHIR resource type.
-
getPersistenceImpl
public FHIRPersistence getPersistenceImpl()
Returns the FHIRPersistence instance currently being used by the FHIR REST API layer to process the current request.
-
getProperty
public java.lang.Object getProperty(java.lang.String propertyName)
Retrieves the named property from the set of properties available to the interceptor.- Parameters:
propertyName
- the name of the property to retrieve.
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Retrieves the set of properties associated with the event that triggered the interceptor invocation.
-
getSearchContextImpl
public FHIRSearchContext getSearchContextImpl()
Returns the FHIRSearchContext instance currently being used by the FHIR REST API layer to process the current request.
-
getSystemHistoryContextImpl
public FHIRSystemHistoryContext getSystemHistoryContextImpl()
Returns the FHIRSystemHistoryContext instance currently being used by the FHIR REST API layer to process the current request.
-
-