public final class ObjectPersistenceService extends Object
Generalized service for the loading, retrieving and persisting of model objects to one or more back-end persisters.
This service works at the level of objects - it does not concern itself with path-based representations of the objects (that is the role of the persisters).
Objects that are loaded from a persisters retain knowledge of their source location so that future writes occur against the same persister.
New objects are created using a specified persister or they will default to using the particular object type's registered default persister.
| Constructor and Description |
|---|
ObjectPersistenceService() |
| Modifier and Type | Method and Description |
|---|---|
Map<String,ModelObject> |
getAllObjects(String objectTypeId)
Retrieves all objects of a given type id.
|
Map<String,ModelObject> |
getAllObjects(String objectTypeId,
String filter)
Retrieves all objects of a given type id with the given object ID filter
|
ModelObject |
getObject(String objectTypeId,
String objectId)
Retrieves an object from the persister that manages the given object type.
|
ModelPersistenceContext |
getPersistenceContext()
Provides a model persistence context
If Surf is running in preview mode, the model persistence context will be populated
with information to inform the persisters of how to bind to the appropriate
Alfresco store.
|
PersisterService |
getPersisterService()
Returns the persister service
|
boolean |
hasObject(ModelObject object)
Returns true if the object is present in a persister
|
boolean |
hasObject(String objectTypeId,
String objectId)
Returns true if the object is present in a persister
|
void |
invalidateCache()
Invalidates the cache for all persisters in this persistence context
|
ModelObject |
newObject(String objectTypeId)
Create a new object.
|
ModelObject |
newObject(String objectTypeId,
String objectId)
Create a new object.
|
boolean |
removeObject(ModelObject object)
Removes the object.
|
boolean |
removeObject(String objectTypeId,
String objectId)
Removes the object.
|
boolean |
saveObject(ModelObject object)
Saves the object to its persister.
|
boolean |
saveObjects(List<ModelObject> objects)
Saves a list of objects to their respective persisters.
|
void |
setPersisterService(PersisterService persisterService)
Sets the persister service
|
public void setPersisterService(PersisterService persisterService)
persisterService - persister servicepublic PersisterService getPersisterService()
public ModelPersistenceContext getPersistenceContext()
public ModelObject getObject(String objectTypeId, String objectId)
If the object is not available in cache, it is loaded from storage.
objectTypeId - the object type idobjectId - the object idpublic ModelObject newObject(String objectTypeId, String objectId)
objectTypeId - the object type idobjectId - the object idpublic ModelObject newObject(String objectTypeId)
objectTypeId - the object type idpublic boolean saveObject(ModelObject object) throws ModelObjectPersisterException
object - the ModelObject to saveModelObjectPersisterExceptionpublic boolean saveObjects(List<ModelObject> objects) throws ModelObjectPersisterException
objects - the List of ModelObject's to saveModelObjectPersisterExceptionpublic boolean removeObject(ModelObject object)
object - the ModelObject to removepublic boolean removeObject(String objectTypeId, String objectId)
objectTypeId - the object type idobjectId - the object idpublic boolean hasObject(ModelObject object)
object - the ModelObject to test forpublic boolean hasObject(String objectTypeId, String objectId)
objectTypeId - the object type idobjectId - the object idpublic Map<String,ModelObject> getAllObjects(String objectTypeId)
objectTypeId - Type IDpublic Map<String,ModelObject> getAllObjects(String objectTypeId, String filter)
objectTypeId - the object type idpublic void invalidateCache()
Copyright © 2005–2016 Alfresco Software. All rights reserved.