@Repository public class SqlRepositoryServiceImpl extends SqlBaseService implements RepositoryService
Modifier and Type | Field and Description |
---|---|
static int |
MAX_CONSTRAINT_NAME_LENGTH |
static String |
PERFORMANCE_LOG_NAME |
LOCKING_EXP_THRESHOLD, LOCKING_MAX_ATTEMPTS, LOCKING_TIMEOUT_STEP
ADD_OBJECT, ADVANCE_SEQUENCE, CLAIM_TASK, CLASS_NAME_WITH_DOT, CLEANUP_TASKS, COUNT_OBJECTS, DELETE_OBJECT, EXECUTE_QUERY_DIAGNOSTICS, GET_OBJECT, GET_VERSION, LIST_ACCOUNT_SHADOW, LIST_OBJECTS, LIST_RESOURCE_OBJECT_SHADOWS, MODIFY_OBJECT, RELEASE_TASK, RETURN_UNUSED_VALUES_TO_SEQUENCE, SEARCH_CONTAINERS, SEARCH_OBJECTS, SEARCH_OBJECTS_ITERATIVE, SEARCH_SHADOW_OWNER
Constructor and Description |
---|
SqlRepositoryServiceImpl(SqlRepositoryFactory repositoryFactory) |
Modifier and Type | Method and Description |
---|---|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
addObject(PrismObject<T> object,
RepoAddOptions options,
OperationResult result)
Add new object.
|
long |
advanceSequence(String oid,
OperationResult parentResult)
This operation is guaranteed to be atomic.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
countObjects(Class<T> type,
ObjectQuery query,
OperationResult result)
Returns the number of objects that match specified criteria.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
deleteObject(Class<T> type,
String oid,
OperationResult result)
Deletes object with specified OID.
|
RepositoryQueryDiagResponse |
executeQueryDiagnostics(RepositoryQueryDiagRequest request,
OperationResult result)
A bit of hack - execute arbitrary query, e.g.
|
OrgClosureManager |
getClosureManager() |
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
getObject(Class<T> type,
String oid,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult result)
Returns object for provided OID.
|
RepositoryDiag |
getRepositoryDiag()
Provide repository run-time configuration and diagnostic information.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
getVersion(Class<T> type,
String oid,
OperationResult parentResult)
Returns object version for provided OID.
|
boolean |
isAnySubordinate(String upperOrgOid,
Collection<String> lowerObjectOids) |
PrismObject<com.evolveum.midpoint.xml.ns._public.common.common_3.UserType> |
listAccountShadowOwner(String accountOid,
OperationResult result)
Deprecated.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType> |
listResourceObjectShadows(String resourceOid,
Class<T> resourceObjectShadowType,
OperationResult result)
Search for resource object shadows of a specified type that belong to the
specified resource.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
modifyObject(Class<T> type,
String oid,
Collection<? extends ItemDelta> modifications,
OperationResult result)
Modifies object using relative change description.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
modifyObject(Class<T> type,
String oid,
Collection<? extends ItemDelta> modifications,
RepoModifyOptions options,
OperationResult result) |
void |
repositorySelfTest(OperationResult parentResult)
Runs a short, non-descructive repository self test.
|
void |
returnUnusedValuesToSequence(String oid,
Collection<Long> unusedValues,
OperationResult parentResult)
The sequence may ignore the values, e.g.
|
<T extends Containerable> |
searchContainers(Class<T> type,
ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult parentResult)
Search for "sub-object" structures, i.e.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
searchObjects(Class<T> type,
ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult result)
Search for objects in the repository.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
searchObjectsIterative(Class<T> type,
ObjectQuery query,
ResultHandler<T> handler,
Collection<SelectorOptions<GetOperationOptions>> options,
boolean strictlySequential,
OperationResult result)
Search for objects in the repository in an iterative fashion.
|
<F extends com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType> |
searchShadowOwner(String shadowOid,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult result)
Returns the object representing owner of specified shadow.
|
void |
testOrgClosureConsistency(boolean repairIfNecessary,
OperationResult testResult)
Checks a closure for consistency, repairing any problems found.
|
getConfiguration, getMatchingRuleRegistry, getPerformanceMonitor, getPrismContext, setMatchingRuleRegistry, setPrismContext
public static final String PERFORMANCE_LOG_NAME
public static final int MAX_CONSTRAINT_NAME_LENGTH
public SqlRepositoryServiceImpl(SqlRepositoryFactory repositoryFactory)
public OrgClosureManager getClosureManager()
public <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> PrismObject<T> getObject(Class<T> type, String oid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result) throws ObjectNotFoundException, SchemaException
RepositoryService
getObject
in interface RepositoryService
oid
- OID of the object to getresult
- parent OperationResult (in/out)ObjectNotFoundException
- requested object does not existSchemaException
- error dealing with storage schemapublic <F extends com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType> PrismObject<F> searchShadowOwner(String shadowOid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result)
RepositoryService
Returns the object representing owner of specified shadow.
Implements the backward "owns" association between account shadow and user. Forward association is implemented by linkRef reference in subclasses of FocusType.
Returns null if there is no owner for the shadow.This is a "search" operation even though it may return at most one owner. However the operation implies searching the repository for an owner, which may be less efficient that following a direct association. Hence it is called "search" to indicate that there may be non-negligible overhead.
This method should not die even if the specified shadow does not exist. Even if the shadow is gone, it still may be used in some linkRefs. This method should be able to find objects with such linkeRefs otherwise we will not be able to do proper cleanup.
searchShadowOwner
in interface RepositoryService
shadowOid
- OID of shadowresult
- parentResult parent OperationResult (in/out)@Deprecated public PrismObject<com.evolveum.midpoint.xml.ns._public.common.common_3.UserType> listAccountShadowOwner(String accountOid, OperationResult result) throws ObjectNotFoundException
RepositoryService
Returns the User object representing owner of specified account (account shadow).
May return null if there is no owner specified for the account.
May only be called with OID of AccountShadow object.
Implements the backward "owns" association between account shadow and user. Forward association is implemented by property "account" of user object.
This is a "list" operation even though it may return at most one owner. However the operation implies searching the repository for an owner, which may be less efficient that following a direct association. Hence it is called "list" to indicate that there may be non-negligible overhead.
listAccountShadowOwner
in interface RepositoryService
accountOid
- OID of account shadowresult
- parentResult parent OperationResult (in/out)ObjectNotFoundException
- specified object does not existpublic <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> SearchResultList<PrismObject<T>> searchObjects(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result) throws SchemaException
RepositoryService
Search for objects in the repository.
If no search criteria specified, list of all objects of specified type is returned.
Searches through all object types. Returns a list of objects that match search criteria.
Returns empty list if object type is correct but there are no objects of that type. The ordering of the results is not significant and may be arbitrary unless sorting in the paging is used.
Should fail if object type is wrong. Should fail if unknown property is specified in the query.
searchObjects
in interface RepositoryService
query
- search queryresult
- parent OperationResult (in/out)SchemaException
- unknown property used in search querypublic <T extends Containerable> SearchResultList<T> searchContainers(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult) throws SchemaException
RepositoryService
searchContainers
in interface RepositoryService
SchemaException
public <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> String addObject(PrismObject<T> object, RepoAddOptions options, OperationResult result) throws ObjectAlreadyExistsException, SchemaException
RepositoryService
Add new object.
The OID provided in the input message may be empty. In that case the OID will be assigned by the implementation of this method and it will be provided as return value.
This operation should fail if such object already exists (if object with the provided OID already exists).
The operation may fail if provided OID is in an unusable format for the storage. Generating own OIDs and providing them to this method is not recommended for normal operation.
Should be atomic. Should not allow creation of two objects with the same OID (even if created in parallel).
The operation may fail if the object to be created does not conform to the underlying schema of the storage system or the schema enforced by the implementation.
Note: no need for explicit type parameter here. The object parameter contains the information.
addObject
in interface RepositoryService
object
- object to createresult
- parent OperationResult (in/out)ObjectAlreadyExistsException
- object with specified identifiers already exists, cannot addSchemaException
- error dealing with storage schema, e.g. schema violationpublic <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> void deleteObject(Class<T> type, String oid, OperationResult result) throws ObjectNotFoundException
RepositoryService
Deletes object with specified OID.
Must fail if object with specified OID does not exists. Should be atomic.
deleteObject
in interface RepositoryService
oid
- OID of object to deleteresult
- parent OperationResult (in/out)ObjectNotFoundException
- specified object does not existpublic <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> int countObjects(Class<T> type, ObjectQuery query, OperationResult result)
RepositoryService
Returns the number of objects that match specified criteria.
If no search criteria specified, count of all objects of specified type is returned.
Should fail if object type is wrong. Should fail if unknown property is specified in the query.
countObjects
in interface RepositoryService
query
- search queryresult
- parent OperationResult (in/out)public <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> void modifyObject(Class<T> type, String oid, Collection<? extends ItemDelta> modifications, OperationResult result) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException
RepositoryService
Modifies object using relative change description.
Must fail if user with provided OID does not exists. Must fail if any of the described changes cannot be applied. Should be atomic.If two or more modify operations are executed in parallel, the operations should be merged. In case that the operations are in conflict (e.g. one operation adding a value and the other removing the same value), the result is not deterministic.
The operation may fail if the modified object does not conform to the underlying schema of the storage system or the schema enforced by the implementation.
TODO: optimistic lockingmodifyObject
in interface RepositoryService
result
- parent OperationResult (in/out)ObjectNotFoundException
- specified object does not existSchemaException
- resulting object would violate the schemaObjectAlreadyExistsException
- if resulting object would have name which already exists in another object of the same typepublic <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> void modifyObject(Class<T> type, String oid, Collection<? extends ItemDelta> modifications, RepoModifyOptions options, OperationResult result) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException
modifyObject
in interface RepositoryService
ObjectNotFoundException
SchemaException
ObjectAlreadyExistsException
public <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType> List<PrismObject<T>> listResourceObjectShadows(String resourceOid, Class<T> resourceObjectShadowType, OperationResult result) throws ObjectNotFoundException, SchemaException
RepositoryService
Search for resource object shadows of a specified type that belong to the specified resource.
Returns a list of such object shadows or empty list if nothing was found.
Implements the backward "has" association between resource and resource object shadows. Forward association is implemented by property "resource" of resource object shadow.
May only be called with OID of Resource object.
listResourceObjectShadows
in interface RepositoryService
resourceOid
- OID of resource definition (ResourceType)result
- parentResult parent OperationResult (in/out)ObjectNotFoundException
- specified object does not existSchemaException
- found object is not type of ShadowType
public RepositoryDiag getRepositoryDiag()
RepositoryService
getRepositoryDiag
in interface RepositoryService
public void repositorySelfTest(OperationResult parentResult)
RepositoryService
repositorySelfTest
in interface RepositoryService
public void testOrgClosureConsistency(boolean repairIfNecessary, OperationResult testResult)
RepositoryService
testOrgClosureConsistency
in interface RepositoryService
public <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> String getVersion(Class<T> type, String oid, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
RepositoryService
getVersion
in interface RepositoryService
oid
- OID of the object to getparentResult
- parent OperationResult (in/out)ObjectNotFoundException
- requested object does not existSchemaException
- error dealing with storage schemapublic <T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> SearchResultMetadata searchObjectsIterative(Class<T> type, ObjectQuery query, ResultHandler<T> handler, Collection<SelectorOptions<GetOperationOptions>> options, boolean strictlySequential, OperationResult result) throws SchemaException
RepositoryService
Search for objects in the repository in an iterative fashion.
Searches through all object types. Calls a specified handler for each object found. If no search criteria specified, list of all objects of specified type is returned.
Searches through all object types. Returns a list of objects that match search criteria.
Returns empty list if object type is correct but there are no objects of that type. The ordering of the results is not significant and may be arbitrary unless sorting in the paging is used.
Should fail if object type is wrong. Should fail if unknown property is specified in the query.
searchObjectsIterative
in interface RepositoryService
query
- search queryhandler
- result handlerstrictlySequential
- takes care not to skip any object nor to process objects more than once;
currently requires paging NOT to be used - uses its own pagingresult
- parent OperationResult (in/out)SchemaException
- unknown property used in search querypublic boolean isAnySubordinate(String upperOrgOid, Collection<String> lowerObjectOids) throws SchemaException
isAnySubordinate
in interface RepositoryService
SchemaException
public long advanceSequence(String oid, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
RepositoryService
advanceSequence
in interface RepositoryService
oid
- sequence OIDObjectNotFoundException
- the sequence does not existSchemaException
- the sequence cannot produce a value (e.g. maximum counter reached)public void returnUnusedValuesToSequence(String oid, Collection<Long> unusedValues, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
RepositoryService
returnUnusedValuesToSequence
in interface RepositoryService
ObjectNotFoundException
SchemaException
public RepositoryQueryDiagResponse executeQueryDiagnostics(RepositoryQueryDiagRequest request, OperationResult result)
RepositoryService
executeQueryDiagnostics
in interface RepositoryService
Copyright © 2016 evolveum. All rights reserved.