Package com.ibm.fhir.persistence.context
Class FHIRPersistenceEvent
- java.lang.Object
-
- com.ibm.fhir.persistence.context.FHIRPersistenceEvent
-
public class FHIRPersistenceEvent extends Object
This class represents an event fired by the FHIR persistence interceptor framework.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROPNAME_PATCH
This property holds the FHIRPatch instance associated with the request.static 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 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 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 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 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 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(Resource fhirResource, Map<String,Object> properties)
Ctor which 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.String
getFhirResourceId()
Returns the resource id associated with the FHIR REST API request that triggered the interceptor invocation.String
getFhirResourceType()
Returns the resource type associated with the FHIR REST API request that triggered the interceptor invocation.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.Map<String,Object>
getProperties()
Retrieves the set of properties associated with the event that triggered the interceptor invocation.Object
getProperty(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.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 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 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 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 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 other operations, this property will be null.- See Also:
- Constant Field Values
-
PROPNAME_VERSION_ID
public static final 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 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 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
-
-
Constructor Detail
-
FHIRPersistenceEvent
public FHIRPersistenceEvent()
Default ctor.
-
FHIRPersistenceEvent
public FHIRPersistenceEvent(Resource fhirResource, Map<String,Object> properties)
Ctor which 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 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 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, history, or non-conditional update/delete operation.
-
getFhirVersionId
public 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 Object getProperty(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 Map<String,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.
-
-