public abstract class AbstractStoreObjectPersister extends ReadOnlyStoreObjectPersister
Unlike the read-only implementation, this implementation does not assume the cache as the "master copy" of the data. Rather, the "master copy" is considered to be the store itself. Any put or remote based interactions with persisted content are delegated to the store itself. All get operations utilize the cache for performance benefits, with a configured timeout to reintegrogate last modified dates of actual store content.
Since stores are based on file-path semantics, this persister must make assumptions on how to map ids to to file-paths in order to allow for lazy referencing and lazy loading of objects.
The id to file-path and file-path to id conversion methods are split out so that they can be adjusted in inheriting implementations.
In addition, path prefixes support token replacement for object type ids and object ids.
| Modifier and Type | Field and Description |
|---|---|
protected static String |
XML_EXT |
pathPrefix, storecacheDelay, cacheMaxSize, caches, GLOBAL_STORE_ID_SUFFIX, useCacheMODELOBJECT_CLASSES| Constructor and Description |
|---|
AbstractStoreObjectPersister() |
| Modifier and Type | Method and Description |
|---|---|
protected ContentCache<ModelObject> |
createCache()
Creates a new cache.
|
protected String |
generatePath(String objectTypeId,
String objectId)
Generates a persistence path for a given object id
and object type id.
|
Map<String,ModelObject> |
getAllObjects(ModelPersistenceContext context,
String objectTypeId)
Returns a map of all of the objects referenced by this persister.
|
Map<String,ModelObject> |
getAllObjectsByFilter(ModelPersistenceContext context,
String objectTypeId,
String objectIdFilter)
Returns a map of all of the objects referenced by this persister filtered by
the given ID filter.
|
protected Map<String,ModelObject> |
getObjectsFromPaths(ModelPersistenceContext context,
String objectTypeId,
String[] docPaths) |
String |
getPathPrefix(String objectTypeId,
String objectId)
Gets the path prefix for the given token replacements.
|
long |
getTimestamp(ModelPersistenceContext context,
String objectTypeId,
String objectId)
Returns the timestamp of the given object in the underlying store
|
boolean |
hasObject(ModelPersistenceContext context,
String objectTypeId,
String objectId)
Checks whether an object with the given path is persisted
|
ModelObject |
newObject(ModelPersistenceContext context,
String objectTypeId,
String objectId)
Creates a new object
|
protected ModelObject |
newObject(ModelPersistenceContext context,
String objectTypeId,
String objectId,
boolean addToCache) |
boolean |
removeObject(ModelPersistenceContext context,
String objectTypeId,
String objectId)
Removes an object from persisted storage
|
cacheGet, cacheRemove, createObject, getCache, getObject, getObjectByPath, getObjectId, getObjectTypeId, getPathPrefix, hasReadOnlyStore, init, isModelObject, loadObjectAndDependants, reset, saveObject, saveObjects, setPathPrefix, setStore, toStringcachePut, cacheRemove, invalidateCache, setCache, setCacheCheckDelay, setCacheMaxSizedisable, getId, getPersisterService, getServiceRegistry, getWebFrameworkConfiguration, hasObject, isEnabled, removeObject, setBeanName, setPersisterService, setServiceRegistry, setWebFrameworkConfigprotected static final String XML_EXT
protected String generatePath(String objectTypeId, String objectId)
ReadOnlyStoreObjectPersisterThis method should never return a null value.
generatePath in class ReadOnlyStoreObjectPersisterobjectTypeId - the object type idobjectId - the object idpublic String getPathPrefix(String objectTypeId, String objectId)
objectTypeId - the object type idobjectId - the object idpublic boolean removeObject(ModelPersistenceContext context, String objectTypeId, String objectId) throws ModelObjectPersisterException
ModelObjectPersisterremoveObject in interface ModelObjectPersisterremoveObject in class ReadOnlyStoreObjectPersistercontext - ModelPersistenceContextobjectTypeId - StringobjectId - StringModelObjectPersisterExceptionpublic boolean hasObject(ModelPersistenceContext context, String objectTypeId, String objectId) throws ModelObjectPersisterException
ModelObjectPersisterhasObject in interface ModelObjectPersisterhasObject in class ReadOnlyStoreObjectPersistercontext - ModelPersistenceContextobjectTypeId - StringobjectId - StringModelObjectPersisterExceptionpublic ModelObject newObject(ModelPersistenceContext context, String objectTypeId, String objectId) throws ModelObjectPersisterException
ModelObjectPersisternewObject in interface ModelObjectPersisternewObject in class ReadOnlyStoreObjectPersistercontext - ModelPersistenceContextobjectTypeId - StringobjectId - StringModelObjectPersisterExceptionprotected ModelObject newObject(ModelPersistenceContext context, String objectTypeId, String objectId, boolean addToCache) throws ModelObjectPersisterException
ModelObjectPersisterExceptionpublic long getTimestamp(ModelPersistenceContext context, String objectTypeId, String objectId) throws ModelObjectPersisterException
ModelObjectPersistergetTimestamp in interface ModelObjectPersistergetTimestamp in class ReadOnlyStoreObjectPersistercontext - ModelPersistenceContextobjectTypeId - StringobjectId - StringModelObjectPersisterExceptionpublic Map<String,ModelObject> getAllObjects(ModelPersistenceContext context, String objectTypeId) throws ModelObjectPersisterException
ModelObjectPersisterIn general, this is a very expensive call and should be avoided. Each object descriptor referenced by the persister is loaded into the model object cache.
getAllObjects in interface ModelObjectPersistergetAllObjects in class ReadOnlyStoreObjectPersistercontext - ModelPersistenceContextobjectTypeId - StringModelObjectPersisterExceptionpublic Map<String,ModelObject> getAllObjectsByFilter(ModelPersistenceContext context, String objectTypeId, String objectIdFilter) throws ModelObjectPersisterException
ModelObjectPersisterIn general, this is an expensive call but less expensive than getAllObjects(). Each object descriptor referenced by the persister found using the filter is loaded into the model object cache.
getAllObjectsByFilter in interface ModelObjectPersistergetAllObjectsByFilter in class ReadOnlyStoreObjectPersistercontext - ModelPersistenceContextobjectTypeId - StringobjectIdFilter - StringModelObjectPersisterExceptionprotected Map<String,ModelObject> getObjectsFromPaths(ModelPersistenceContext context, String objectTypeId, String[] docPaths) throws ModelObjectPersisterException
context - ModelPersistenceContextobjectTypeId - object type iddocPaths - Array of document pathsModelObjectPersisterExceptionprotected ContentCache<ModelObject> createCache()
AbstractCachedObjectPersistercreateCache in class ReadOnlyStoreObjectPersisterCopyright © 2005–2016 Alfresco Software. All rights reserved.