public interface WorkObjectService
Provides services for accessing and manipulating WorkObject
instances.
Modifier and Type | Method and Description |
---|---|
void |
cancelWorkObject(String workObjectId)
Cancels or terminates any background activities / processes associated with the given work object.
|
long |
countWorkObjects(Predicate predicate)
Counts the work objects that match the query with the given predicate.
|
long |
countWorkObjects(Predicate predicate,
SearchScope searchScope)
Counts the work objects that match the query with the given predicate in given scope.
|
long |
countWorkObjects(Query query)
Counts the work objects that match the given query.
|
long |
countWorkObjects(Query query,
SearchScope searchScope)
Counts the work objects that match the given query in given scope.
|
String |
create(String definitionId)
Creates a new root work object based on the given definition.
|
String |
create(String definitionId,
String parentId)
Creates a new child work object based on the given definition.
|
String |
create(WorkObject templateWorkObject)
Creates a new root work object based on the given template work object.
|
String |
create(WorkObject templateWorkObject,
String parentId)
Creates a new child work object based on the given template work object.
|
WorkObjectUpdateBuilder |
createUpdateBuilder(String id)
Creates a new work object update builder.
|
void |
deleteWorkObject(String id)
Deletes the given work object with all its values.
|
void |
deleteWorkObjectWithHierarchy(String id)
Deletes the given work object with all its values and descendants.
|
Optional<String> |
findParentId(WorkObject workObject)
Returns the optional parent work object ID.
|
Optional<String> |
findParentIdByType(WorkObject workObject,
String requiredType)
Returns the optional ID of the closest parent work object of the given type for a given work object.
|
Optional<String> |
findTopMostParentIdByType(WorkObject workObject,
String requiredType,
boolean includeSelf)
Returns the optional ID of the top-most parent work object of the given type for a given work object.
|
Optional<WorkObject> |
findWorkObject(Predicate predicate)
Finds the work object that matches the query with the given predicate.
|
Optional<WorkObject> |
findWorkObject(Predicate predicate,
SearchScope searchScope)
Finds the work object that matches the query with the given predicate in given scope.
|
Optional<WorkObject> |
findWorkObject(Query query)
Finds the work object that matches the given query.
|
Optional<WorkObject> |
findWorkObject(Query query,
SearchScope searchScope)
Finds the work object that matches the given query in given scope.
|
Optional<WorkObject> |
findWorkObject(String id)
Finds the work object with the given ID.
|
Optional<WorkObject> |
findWorkObject(String id,
SearchScope searchScope)
Finds the work object with the given ID in the given scope.
|
Optional<String> |
findWorkObjectId(String globalId)
Finds the work object ID corresponding to a given global ID in the current tenant.
|
List<WorkObject> |
findWorkObjects(Predicate predicate)
Finds the work objects that match the query with the given predicate.
|
List<WorkObject> |
findWorkObjects(Predicate predicate,
SearchScope searchScope)
Finds the work objects that match the query with the given predicate in given scope.
|
List<WorkObject> |
findWorkObjects(Query query)
Finds the work objects that match the given query.
|
List<WorkObject> |
findWorkObjects(Query query,
SearchScope searchScope)
Finds the work objects that match the given query in given scope.
|
String |
getGlobalId(String workObjectId)
Finds the global ID corresponding to a given work object ID.
|
String |
getRootId(WorkObject workObject)
Returns the root work object ID for a given work object.
|
<T> T |
getServiceInterface(String providerId,
Class<T> serviceInterfaceClass)
Returns a specific provider service interface for the given provider ID.
|
<T> List<T> |
getServiceInterfaces(Class<T> serviceInterfaceClass)
Returns all instances of a typed service interface for the current providers.
|
WorkObject |
getWorkObject(Predicate predicate)
Returns the work object that matches the predicate.
|
WorkObject |
getWorkObject(Predicate predicate,
SearchScope searchScope)
Returns the work object that matches the predicate in given scope.
|
WorkObject |
getWorkObject(Query query)
Returns the work object that matches the query.
|
WorkObject |
getWorkObject(Query query,
SearchScope searchScope)
Returns the work object that matches the query in given scope.
|
WorkObject |
getWorkObject(String id)
Returns the work object with the given ID.
|
WorkObject |
getWorkObject(String id,
SearchScope searchScope)
Returns the work object with the given ID in the given scope.
|
String |
getWorkObjectId(String globalId)
Finds the work object ID corresponding to a given global ID in the current tenant.
|
String getGlobalId(String workObjectId)
Finds the global ID corresponding to a given work object ID.
workObjectId
- the work object IDEntityNotFoundException
- if the work object cannot be foundString getWorkObjectId(String globalId)
Finds the work object ID corresponding to a given global ID in the current tenant.
globalId
- the global IDEntityNotFoundException
- if the work object cannot be foundOptional<String> findWorkObjectId(String globalId)
Finds the work object ID corresponding to a given global ID in the current tenant.
globalId
- the global IDWorkObject getWorkObject(String id)
Returns the work object with the given ID.
If no work object matches the given ID, an exception is thrown.
id
- the work object IDEntityNotFoundException
- if the work object cannot be foundWorkObject getWorkObject(String id, SearchScope searchScope)
Returns the work object with the given ID in the given scope.
If no work object matches the given ID, an exception is thrown.
id
- the ID of the work object to findsearchScope
- the scope in which to search for the work objectEntityNotFoundException
- if the work object cannot be foundWorkObject getWorkObject(Predicate predicate)
Returns the work object that matches the predicate.
If no match is found or more than one work object matches the predicate, an exception is thrown.
Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the work object predicateEntityNotFoundException
- if the work object cannot be foundWorkObject getWorkObject(Predicate predicate, SearchScope searchScope)
Returns the work object that matches the predicate in given scope.
If more than one work object matches the query with the predicate in given scope, an exception is thrown.
Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the work object predicatesearchScope
- the scope in which to search for the work objectEntityNotFoundException
- if the work object cannot be foundWorkObject getWorkObject(Query query)
Returns the work object that matches the query.
If no match is found or more than one work object matches the predicate, an exception is thrown.
Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
query
- the work object queryEntityNotFoundException
- if the work object cannot be foundWorkObject getWorkObject(Query query, SearchScope searchScope)
Returns the work object that matches the query in given scope.
If more than one work object matches the query with the predicate in given scope, an exception is thrown.
Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
query
- the work object querysearchScope
- the scope in which to search for the work objectEntityNotFoundException
- if the work object cannot be foundOptional<WorkObject> findWorkObject(String id)
Finds the work object with the given ID.
id
- the ID of the work object to findOptional<WorkObject> findWorkObject(String id, SearchScope searchScope)
Finds the work object with the given ID in the given scope.
id
- the ID of the work object to findsearchScope
- the scope in which to search for the work objectOptional<WorkObject> findWorkObject(Predicate predicate)
Finds the work object that matches the query with the given predicate.
If more than one work object matches the query with the predicate, an exception is thrown.
Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the predicate to apply when executing the queryOptional<WorkObject> findWorkObject(Predicate predicate, SearchScope searchScope)
Finds the work object that matches the query with the given predicate in given scope.
If more than one work object matches the query with the predicate in given scope, an exception is thrown.
Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the predicate to apply when executing the querysearchScope
- the scope in which to search for the work objectOptional<WorkObject> findWorkObject(Query query)
Finds the work object that matches the given query.
If more than one work object matches the query, an exception is thrown.
query
- the query to executeOptional<WorkObject> findWorkObject(Query query, SearchScope searchScope)
Finds the work object that matches the given query in given scope.
If more than one work object matches the query, an exception is thrown.
query
- the query to executesearchScope
- the scope in which to search for the work objectsList<WorkObject> findWorkObjects(Predicate predicate)
Finds the work objects that match the query with the given predicate.
If no work object matches the query with the given predicate, an empty list is returned.
Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the predicate to apply when executing the queryList<WorkObject> findWorkObjects(Predicate predicate, SearchScope searchScope)
Finds the work objects that match the query with the given predicate in given scope.
If no work object matches the query with the given predicate in given scope, an empty list is returned.
Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the predicate to apply when executing the querysearchScope
- the scope in which to search for the work objectsList<WorkObject> findWorkObjects(Query query)
Finds the work objects that match the given query. If no work object matches the given query, an empty list is returned.
query
- the query to executelong countWorkObjects(Predicate predicate)
Counts the work objects that match the query with the given predicate.
predicate
- the predicate to apply when executing the querylong countWorkObjects(Predicate predicate, SearchScope searchScope)
Counts the work objects that match the query with the given predicate in given scope.
predicate
- the predicate to apply when executing the querysearchScope
- the scope in which to count the number of work objectsList<WorkObject> findWorkObjects(Query query, SearchScope searchScope)
Finds the work objects that match the given query in given scope.
If no work object matches the given query in given scope, an empty list is returned.
query
- the query to executesearchScope
- the scope in which to search for the work objectsOptional<String> findParentId(WorkObject workObject)
Returns the optional parent work object ID.
Optional<String> findParentIdByType(WorkObject workObject, String requiredType)
Returns the optional ID of the closest parent work object of the given type for a given work object.
workObject
- the starting work objectrequiredType
- the required work object typeOptional<String> findTopMostParentIdByType(WorkObject workObject, String requiredType, boolean includeSelf)
Returns the optional ID of the top-most parent work object of the given type for a given work object.
workObject
- the starting work objectrequiredType
- the required work object typeincludeSelf
- true
if the starting work object should also be consideredString getRootId(WorkObject workObject)
Returns the root work object ID for a given work object.
workObject
- the starting work objectlong countWorkObjects(Query query)
Counts the work objects that match the given query.
query
- the query to executelong countWorkObjects(Query query, SearchScope searchScope)
Counts the work objects that match the given query in given scope.
query
- the query to executesearchScope
- the scope in which to count the number of work objectsString create(WorkObject templateWorkObject)
Creates a new root work object based on the given template work object.
A provider will be used to manage the work object creation if one of the following conditions are met:
if the template has a valid definition ID, then the provider responsible for the definition is used
if the template has a valid provider ID, then the corresponding to the provider ID is used
if the template has both a valid definition ID and a valid provider ID and they refer to the same provider then the corresponding provider will be used
If the definition ID and provider ID are both set but they refer to different providers then an
IllegalArgumentException
will be thrown.
If neither the definition ID or provider ID is set then the work object will simply be persisted without a provider being notified.
templateWorkObject
- the work object templateIllegalArgumentException
- if inconsistent provider information is suppliedString create(WorkObject templateWorkObject, String parentId)
Creates a new child work object based on the given template work object.
A provider will be used to manage the work object creation if one of the following conditions are met:
if the template has a valid definition ID, then the provider responsible for the definition is used
if the template has a valid provider ID, then the corresponding to the provider ID is used
if the template has both a valid definition ID and a valid provider ID and they refer to the same provider then the corresponding provider will be used
If the definition ID and provider ID are both set but they refer to different providers then an
IllegalArgumentException
will be thrown.
If neither the definition ID or provider ID is set then the work object will simply be persisted without a provider being notified.
templateWorkObject
- the work object templateparentId
- the parent work object IDIllegalArgumentException
- if inconsistent provider information is suppliedString create(String definitionId)
Creates a new root work object based on the given definition.
To set additional values on the created work object please use the template-based methods.
definitionId
- the definition IDEntityNotFoundException
- if the definition was not foundString create(String definitionId, String parentId)
Creates a new child work object based on the given definition.
To set additional values on the created work object please use the template-based methods.
definitionId
- the definition IDparentId
- the parent work object IDEntityNotFoundException
- if the definition was not foundWorkObjectUpdateBuilder createUpdateBuilder(String id)
Creates a new work object update builder.
An update builder is used to collect updates to the persisted work object, that can then applied in a single operation.
The resulting builder will not support calls to the getter methods, and will throw an UnsupportedMethodException if this is attempted.
id
- the ID of the target work objectEntityNotFoundException
- if no work object with the given ID can be foundvoid deleteWorkObjectWithHierarchy(String id)
Deletes the given work object with all its values and descendants.
id
- the work object to delete identified by IDEntityNotFoundException
- if no work object with given work object ID was foundvoid deleteWorkObject(String id)
Deletes the given work object with all its values. If the work object has children then an IllegalArgumentException
is thrown such that the path of the children
is always valid.
id
- the work object to delete identified by IDEntityNotFoundException
- if no work object with given work object ID was foundvoid cancelWorkObject(String workObjectId)
Cancels or terminates any background activities / processes associated with the given work object.
If no background activity is present then this method will have no effect.
workObjectId
- the ID of the work object to be cancelled<T> T getServiceInterface(String providerId, Class<T> serviceInterfaceClass)
Returns a specific provider service interface for the given provider ID.
T
- the type of the required service interfaceproviderId
- the provider IDserviceInterfaceClass
- the required service interface classIllegalStateException
- if no matching provider is foundClassCastException
- if the provider doesn’t implement the service interface<T> List<T> getServiceInterfaces(Class<T> serviceInterfaceClass)
Returns all instances of a typed service interface for the current providers.
T
- the type of the required service interfaceserviceInterfaceClass
- the required service interface classCopyright © 2010 - 2018 edorasware ag. All Rights Reserved.