Interface IKeyedObjectService<T extends IKeyedObject<T>>
-
- Type Parameters:
T- the subclass for the object being managed.
- All Known Subinterfaces:
IBitemporalObjectService<T>,ISignOffProcessDefinitionService,ISignOffProcessInstanceService,IVersionedObjectService<T>
- All Known Implementing Classes:
ABitemporalObjectJpaService,AKeyedObjectJpaService,AVersionedObjectJpaService,SignOffProcessDefinitionJpaService,SignOffProcessInstanceJpaService
public interface IKeyedObjectService<T extends IKeyedObject<T>>Interface for managing persistence ofkeyed objects.To support objects spending time in a workflow process before being persisted, separate methods are provided to validate operations before they are attempted.
- Author:
- ActiveViam
- See Also:
IKeyedObject,AKeyedObjectDTO,AKeyedObjectJpaService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Tcreate(T object)Create a new object in the persistence layer.TcreateOrUpdate(T object)Create or Update an object in the persistence layer.Tdelete(String key)Delete an object (referenced by key) in the persistence layer.default Tdelete(T object)Delete an object in the persistence layer.Map<String,T>get()Retrieve all objects.Tget(String key)Retrieve an object by key.Tupdate(T object)Update an object in the persistence layer.voidvalidateCreate(T object)Validate the object for creation.voidvalidateCreateOrUpdate(T object)Validate the object for creation or update.voidvalidateDelete(String key)Validate the deletion of an object referenced by key.voidvalidateUpdate(T object)Validate the object for update.
-
-
-
Method Detail
-
validateCreate
void validateCreate(T object) throws ValidationException
Validate the object for creation. This method can be used upon starting the workflow process for approving the object creation, and prior to callingcreate(IKeyedObject).Included in the validation will be checking that an object with the same key does not already exist.
- Parameters:
object- the object to create- Throws:
ValidationException- if the new object cannot be created
-
create
T create(T object) throws ValidationException
Create a new object in the persistence layer. This method can be called once the object has been approved in the workflow process.The object will also be validated using
validateCreate(IKeyedObject)- Parameters:
object- the object being created- Returns:
- the object that was persisted
- Throws:
ValidationException- if the object fails validation.
-
validateUpdate
void validateUpdate(T object) throws ValidationException
Validate the object for update. This method can be used upon starting the workflow process for approving the object update, and prior to callingupdate(IKeyedObject).Included in the validation will be checking that an object with the same key exists and that the update is compatible with the existing object.
- Parameters:
object- the object to update- Throws:
ValidationException- if the existing object cannot be updated with the new value
-
update
T update(T object) throws ValidationException
Update an object in the persistence layer. This method can be called once the update has been approved in the workflow process.The object will also be validated using
validateUpdate(IKeyedObject)- Parameters:
object- the object being updated- Returns:
- the object that was persisted
- Throws:
ValidationException- if the update fails validation.
-
validateCreateOrUpdate
void validateCreateOrUpdate(T object) throws ValidationException
Validate the object for creation or update. This method can be used upon starting the workflow process for approving the object update, and prior to callingcreateOrUpdate(IKeyedObject).The validation may depend on if the objects exists or not.
- Parameters:
object- the object to validate- Throws:
ValidationException- if the object cannot be created or updated with the new value
-
createOrUpdate
T createOrUpdate(T object) throws ValidationException
Create or Update an object in the persistence layer. This method can be used if it is unknown if the object already exists, for example when importing multiple objects. This method can be called once the update has been approved in the workflow process.The object will also be validated using
validateCreateOrUpdate(IKeyedObject)- Parameters:
object- the object being created or updated- Returns:
- the object that was persisted
- Throws:
ValidationException- if the object fails validation.
-
validateDelete
void validateDelete(String key) throws ValidationException
Validate the deletion of an object referenced by key. This method can be used upon starting the workflow process for deleting the object referenced by the key, and prior to callingdelete(String).Included in the validation will be checking that an object with the key exists.
- Parameters:
key- unique key for the object to delete- Throws:
ValidationException- if an object with this key cannot be deleted
-
delete
T delete(String key) throws ValidationException
Delete an object (referenced by key) in the persistence layer. This method can be called once the deletion has been approved in the workflow process.The object will also be validated using
validateDelete(String)- Parameters:
key- unique key for the object being deleted- Returns:
- the old value of the object that was deleted
- Throws:
ValidationException- if the deletion fails validation.
-
delete
default T delete(T object) throws ValidationException
Delete an object in the persistence layer. This method can be called once the deletion has been approved in the workflow process.The object will also be validated using
validateDelete(String)- Parameters:
object- the object being deleted- Returns:
- the old value of the object that was deleted
- Throws:
ValidationException- if the deletion fails validation.
-
get
T get(String key)
Retrieve an object by key.- Parameters:
key- the reference to the object to retrieve- Returns:
- the object with the specified key
-
-