public abstract class EntityHandler
extends java.lang.Object
Handler interface for CRUD (create/read/update/delete) operations on entities.
Constructor and Description |
---|
EntityHandler() |
Modifier and Type | Method and Description |
---|---|
void |
allowUnused(java.lang.Object value)
Helper function so generated subclasses can explicitly ignore a value.
|
abstract void |
createEntity(EntityValue entity)
Handles the creation of an entity.
|
abstract void |
createLink(EntityValue source,
Property sourceProperty,
EntityValue target)
Handles the creation of a link.
|
abstract void |
createMedia(EntityValue entity,
ByteStream stream)
Handles the creation of a media entity.
|
abstract void |
deleteEntity(EntityValue entity)
Handles the deletion of an entity.
|
abstract void |
deleteLink(EntityValue source,
Property sourceProperty,
EntityValue target)
Handles the deletion of a link.
|
abstract void |
deleteStream(EntityValue entity,
StreamLink link)
Handles the deletion of a stream property.
|
abstract void |
downloadMedia(EntityValue entity,
ByteStream stream)
Handles the downloading of a media entity.
|
abstract void |
downloadStream(EntityValue entity,
StreamLink link,
ByteStream stream)
Handles the downloading of a stream property.
|
abstract DataValue |
executeQuery(DataQuery query)
Handles the execution of a query.
|
abstract java.lang.String |
getNameForMetrics()
Return component name for data metrics.
|
abstract boolean |
isBackendHandler()
Return does this entity handler delegate to a backend system (as opposed to the main service database).
|
DataValue |
loadAll(DataQuery query)
Retrieve all entities (that are to be cached) from the backend system.
|
DataValue |
loadPartition(DataQuery query,
EntityValue partition)
Retrieve all entities for a particular partition (that are to be cached) from the backend system.
|
abstract void |
refreshAfter(EntityHandler priorHandler,
EntitySet priorEntitySet,
EntitySet entitySet)
Register the cache refresh of an entity set to be scheduled after the refresh of a prior entity set.
|
abstract void |
refreshCache(EntitySet entitySet,
boolean onDemand)
Refresh the database with changes from the corresponding backend system (if applicable).
|
abstract void |
updateEntity(EntityValue entity)
Handles the updating of an entity.
|
abstract void |
updateLink(EntityValue source,
Property sourceProperty,
EntityValue target)
Handles the updating of a link.
|
abstract void |
uploadMedia(EntityValue entity,
ByteStream stream)
Handles the uploading of a media stream.
|
abstract void |
uploadStream(EntityValue entity,
StreamLink link,
ByteStream stream)
Handles the uploading of a stream property.
|
public void allowUnused(java.lang.Object value)
Helper function so generated subclasses can explicitly ignore a value.
value
- Value to be ignored.public abstract void createEntity(EntityValue entity)
Handles the creation of an entity.
entity
- Entity value.public abstract void createLink(EntityValue source, Property sourceProperty, EntityValue target)
Handles the creation of a link.
source
- Source entity.sourceProperty
- Source property.target
- Target entity.public abstract void createMedia(EntityValue entity, ByteStream stream)
Handles the creation of a media entity.
entity
- Media entity.stream
- Input stream, to access uploaded content.public abstract void deleteEntity(EntityValue entity)
Handles the deletion of an entity.
entity
- Entity value.public abstract void deleteLink(EntityValue source, Property sourceProperty, EntityValue target)
Handles the deletion of a link.
source
- Source entity.sourceProperty
- Source property.target
- Target entity.public abstract void deleteStream(EntityValue entity, StreamLink link)
Handles the deletion of a stream property.
entity
- Owning entity.link
- Stream link, identifying the stream property the client is deleting.public abstract void downloadMedia(EntityValue entity, ByteStream stream)
Handles the downloading of a media entity.
entity
- Media entity.stream
- Output stream, to receive downloaded content.public abstract void downloadStream(EntityValue entity, StreamLink link, ByteStream stream)
Handles the downloading of a stream property.
entity
- Owning entity.link
- Stream link, identifying the stream property the client is downloading.stream
- Output stream, to receive downloaded content.public abstract DataValue executeQuery(DataQuery query)
Handles the execution of a query.
query
- Data query.public abstract java.lang.String getNameForMetrics()
Return component name for data metrics.
public abstract boolean isBackendHandler()
Return does this entity handler delegate to a backend system (as opposed to the main service database).
public DataValue loadAll(DataQuery query)
Retrieve all entities (that are to be cached) from the backend system.
query
- Data query for backend call.EntityValue
or EntityValueList
.public DataValue loadPartition(DataQuery query, EntityValue partition)
Retrieve all entities for a particular partition (that are to be cached) from the backend system.
query
- Data query for backend call.partition
- Entity identifying the cache partition.EntityValue
or EntityValueList
.public abstract void refreshAfter(EntityHandler priorHandler, EntitySet priorEntitySet, EntitySet entitySet)
Register the cache refresh of an entity set to be scheduled after the refresh of a prior entity set.
priorHandler
- Entity handler for refresh of the prior entity set.priorEntitySet
- Prior entity set which entitySet
will be refreshed after.entitySet
- Entity set to be refreshed after priorEntitySet
.public abstract void refreshCache(EntitySet entitySet, boolean onDemand)
Refresh the database with changes from the corresponding backend system (if applicable).
entitySet
- Entity set to be refreshed.onDemand
- true
for on-demand refresh, false
for scheduled refresh.public abstract void updateEntity(EntityValue entity)
Handles the updating of an entity.
entity
- Entity value.public abstract void updateLink(EntityValue source, Property sourceProperty, EntityValue target)
Handles the updating of a link.
source
- Source entity.sourceProperty
- Source property.target
- Target entity.public abstract void uploadMedia(EntityValue entity, ByteStream stream)
Handles the uploading of a media stream.
entity
- Owning media entity.stream
- Input stream, to access uploaded content.public abstract void uploadStream(EntityValue entity, StreamLink link, ByteStream stream)
Handles the uploading of a stream property.
entity
- Owning entity.link
- Stream link, identifying the stream property the client is uploading.stream
- Input stream, to access uploaded content.