@Component public class ModelController extends Object implements ModelService, ModelInteractionService
Modifier and Type | Field and Description |
---|---|
static String |
ADD_OBJECT_WITH_EXCLUSION |
static String |
CHANGE_ACCOUNT |
static String |
CLASS_NAME_WITH_DOT |
static String |
CREATE_ACCOUNT |
static String |
GET_SYSTEM_CONFIGURATION |
static String |
MODIFY_OBJECT_WITH_EXCLUSION |
static String |
PROCESS_USER_TEMPLATE |
static String |
RESOLVE_ACCOUNT_ATTRIBUTES |
static String |
RESOLVE_USER_ATTRIBUTES |
static String |
SEARCH_OBJECTS |
static String |
UPDATE_ACCOUNT |
COUNT_OBJECTS, DISCOVER_CONNECTORS, EXECUTE_CHANGES, GET_OBJECT, GET_PROPERTY_AVAILABLE_VALUES, IMPORT_ACCOUNTS_FROM_RESOURCE, IMPORT_OBJECTS_FROM_FILE, IMPORT_OBJECTS_FROM_STREAM, LIST_ACCOUNT_SHADOW_OWNER, LIST_OBJECTS, LIST_RESOURCE_OBJECT_SHADOWS, LIST_RESOURCE_OBJECTS, POST_INIT, RECOMPUTE, TEST_RESOURCE
PREVIEW_CHANGES
Constructor and Description |
---|
ModelController() |
Modifier and Type | Method and Description |
---|---|
<T extends ObjectType> |
countObjects(Class<T> type,
ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options,
Task task,
OperationResult parentResult) |
Set<ConnectorType> |
discoverConnectors(ConnectorHostType hostType,
OperationResult parentResult)
Discovers local or remote connectors.
|
void |
executeChanges(Collection<ObjectDelta<? extends ObjectType>> deltas,
ModelExecuteOptions options,
Task task,
OperationResult parentResult)
Execute the provided object deltas.
|
PrismObject<UserType> |
findShadowOwner(String accountOid,
Task task,
OperationResult parentResult)
Returns the User object representing owner of specified account (account
shadow).
|
<T extends ObjectType> |
getObject(Class<T> clazz,
String oid,
Collection<SelectorOptions<GetOperationOptions>> options,
Task task,
OperationResult parentResult)
Returns object for provided OID.
|
ModelObjectResolver |
getObjectResolver() |
void |
importFromResource(String resourceOid,
QName objectClass,
Task task,
OperationResult parentResult)
Import accounts from resource.
|
void |
importObjectsFromFile(File input,
ImportOptionsType options,
Task task,
OperationResult parentResult)
Import objects from file.
|
void |
importObjectsFromStream(InputStream input,
ImportOptionsType options,
Task task,
OperationResult parentResult)
Import objects from stream.
|
List<PrismObject<? extends ShadowType>> |
listResourceObjects(String resourceOid,
QName objectClass,
ObjectPaging paging,
Task task,
OperationResult parentResult)
Returns all resource objects of specified type that are currently
available to the system.
|
void |
postInit(OperationResult parentResult)
Finish initialization of the model and lower system components
(provisioning, repository, etc).
|
<F extends ObjectType,P extends ObjectType> |
previewChanges(Collection<ObjectDelta<? extends ObjectType>> deltas,
ModelExecuteOptions options,
Task task,
OperationResult parentResult)
Computes the most likely changes triggered by the provided delta.
|
<F extends FocusType> |
recompute(Class<F> type,
String oid,
Task task,
OperationResult parentResult)
Recomputes focal object with the specified OID.
|
protected void |
resolve(PrismObject<?> object,
Collection<SelectorOptions<GetOperationOptions>> options,
Task task,
OperationResult result) |
<T extends ObjectType> |
searchObjects(Class<T> type,
ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options,
Task task,
OperationResult parentResult)
Search for objects.
|
<T extends ObjectType> |
searchObjectsIterative(Class<T> type,
ObjectQuery query,
ResultHandler<T> handler,
Collection<SelectorOptions<GetOperationOptions>> options,
Task task,
OperationResult parentResult) |
OperationResult |
testResource(String resourceOid,
Task task)
Test the resource connection and basic resource connector functionality.
|
<F extends ObjectType,P extends ObjectType> |
unwrapModelContext(LensContextType wrappedContext,
OperationResult result) |
public static final String CLASS_NAME_WITH_DOT
public static final String SEARCH_OBJECTS
public static final String ADD_OBJECT_WITH_EXCLUSION
public static final String MODIFY_OBJECT_WITH_EXCLUSION
public static final String CHANGE_ACCOUNT
public static final String GET_SYSTEM_CONFIGURATION
public static final String RESOLVE_USER_ATTRIBUTES
public static final String RESOLVE_ACCOUNT_ATTRIBUTES
public static final String CREATE_ACCOUNT
public static final String UPDATE_ACCOUNT
public static final String PROCESS_USER_TEMPLATE
public ModelObjectResolver getObjectResolver()
public <T extends ObjectType> PrismObject<T> getObject(Class<T> clazz, String oid, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException
ModelService
Returns object for provided OID.
Must fail if object with the OID does not exists.
getObject
in interface ModelService
clazz
- (class) of an object to getoid
- OID of the object to getparentResult
- parent OperationResult (in/out)ObjectNotFoundException
- requested object does not existSchemaException
- the object is not schema compliantCommunicationException
ConfigurationException
SecurityViolationException
protected void resolve(PrismObject<?> object, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException
public void executeChanges(Collection<ObjectDelta<? extends ObjectType>> deltas, ModelExecuteOptions options, Task task, OperationResult parentResult) throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException
ModelService
Execute the provided object deltas.
The operation executes the provided object deltas. All deltas must relate to analogous objects (e.g. user and linked accounts). The implementation may throw an error if the objects are not analogous. The implementation also implicitly links the objects (mark them to be analogous) if such a link is part of the data model. E.g. the implementation links all accounts to the user if they are passed in a single delta collection. This is especially useful if the account deltas are ADD deltas without OID and therefore cannot be linked explicitly.
There must be no more than one delta for each object. The order of execution is not defined and the implementation is free to determine the correct or most suitable ordering.
The OID provided in ADD deltas may be empty. In that case the OID will be assigned by the implementation and the OIDs will be set in the deltas after the operation is completed.
Execution of ADD deltas should fail if such object already exists (if object with the provided OID already exists). Execution of MODIFY and DELETE deltas should fail if such objects do not exist.
The operation may fail if provided OIDs are in an unusable format for the storage. Generating own OIDs and providing them to this method is not recommended for normal operation.
There are no explicit atomicity guarantees for the operations. Some of the operations may pass, some may fail or even fail partially. The consistency of the data and state are not based on operation atomicity but rather a data model that can "repair" inconsistencies.
The operation may fail if any of the objects to be created or modified does not conform to the underlying schema of the storage system or the schema enforced by the implementation.
executeChanges
in interface ModelService
deltas
- Collection of object deltas to executeparentResult
- parent OperationResult (in/out)ObjectAlreadyExistsException
- object with specified identifiers already exists, cannot addObjectNotFoundException
- object required to complete the operation was not found (e.g.
appropriate connector or resource definition)SchemaException
- error dealing with resource schema, e.g. created object does
not conform to schemaExpressionEvaluationException
- evaluation of expression associated with the object has failedCommunicationException
ConfigurationException
PolicyViolationException
- Policy violation was detected during processing of the objectSecurityViolationException
public <F extends FocusType> void recompute(Class<F> type, String oid, Task task, OperationResult parentResult) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException
ModelService
recompute
in interface ModelService
type
- type (class) of an object to recomputeoid
- OID of the object to recomputeparentResult
- parent OperationResult (in/out)SchemaException
PolicyViolationException
ExpressionEvaluationException
ObjectNotFoundException
ObjectAlreadyExistsException
CommunicationException
ConfigurationException
SecurityViolationException
public <F extends ObjectType,P extends ObjectType> ModelContext<F,P> previewChanges(Collection<ObjectDelta<? extends ObjectType>> deltas, ModelExecuteOptions options, Task task, OperationResult parentResult) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException
ModelInteractionService
public <T extends ObjectType> List<PrismObject<T>> searchObjects(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException
ModelService
Search for objects.
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.
Should fail if object type is wrong. Should fail if unknown property is specified in the query.
searchObjects
in interface ModelService
query
- search queryparentResult
- parent OperationResult (in/out)SchemaException
- unknown property used in search queryObjectNotFoundException
- object required for a search was not found (e.g. resource
definition)CommunicationException
- error communicating with the resourceConfigurationException
SecurityViolationException
public <T extends ObjectType> void searchObjectsIterative(Class<T> type, ObjectQuery query, ResultHandler<T> handler, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException
searchObjectsIterative
in interface ModelService
SchemaException
ObjectNotFoundException
CommunicationException
ConfigurationException
SecurityViolationException
public <T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, CommunicationException
countObjects
in interface ModelService
SchemaException
ObjectNotFoundException
ConfigurationException
SecurityViolationException
CommunicationException
public PrismObject<UserType> findShadowOwner(String accountOid, Task task, OperationResult parentResult) throws ObjectNotFoundException
ModelService
Returns the User object representing owner of specified account (account shadow).
May return null if there is no owner specified for the account.
Implements the backward "owns" association between account shadow and user. Forward association is implemented by property "account" of user object.
findShadowOwner
in interface ModelService
accountOid
- OID of the account to look for an ownerparentResult
- parent OperationResult (in/out)ObjectNotFoundException
- specified account was not foundpublic List<PrismObject<? extends ShadowType>> listResourceObjects(String resourceOid, QName objectClass, ObjectPaging paging, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException
ModelService
Returns all resource objects of specified type that are currently available to the system.
Returns empty list if object type is correct but there are no objects of that type. The operation should fail if object type is wrong (e.g. specified type is not part of resource schema).
This method does NOT use any repository shadow objects for reference or any other business objects in the local repository. It goes directly to the resource. The returned objects (indirectly) comply with the resource schema, but it is returned re-formated in a form of detached shadow object. Although the form is the same as shadow object, this is NOT really a shadow object because it is not stored in the repository (it is detached). It does NOT have OID.
The objects are identified by whatever identification properties/attributes are defined by the resource schema.
The purpose of this operation is diagnostics. It works directly with the resource without the potential problems of underlying implementation. E.g. it may be used to test resource connectivity or correctness of resource setup. It may also be used to reach object types that are not directly supported as "shadows" by the implementation. Therefore this method is not required to implement any form of caching, queuing, reference resolution or any other "smart" algorithm.
listResourceObjects
in interface ModelService
resourceOid
- OID of the resource to fetch objects fromobjectClass
- Object class of the objects to fetchpaging
- paging specification to limit operation result (optional)parentResult
- parent OperationResult (in/out)SchemaException
- error handling resource schemaObjectNotFoundException
- specified resource object does not existCommunicationException
- error communicating with the resourceConfigurationException
public OperationResult testResource(String resourceOid, Task task) throws ObjectNotFoundException
ModelService
Test the resource connection and basic resource connector functionality.
This operation will NOT throw exception in case the resource connection fails. It such case it will indicate the failure in the return message, but the operation itself succeeds. The operations fails only if the provided arguments are wrong, in case of system error, system misconfiguration, etc.
This returns OperationResult instead of taking it as in/out argument. This is different from the other methods. The testResource method is not using OperationResult to track its own execution but rather to track the execution of resource tests (that in fact happen in provisioning).
testResource
in interface ModelService
resourceOid
- OID of resource to testObjectNotFoundException
- specified object does not existpublic void importFromResource(String resourceOid, QName objectClass, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException
ModelService
Import accounts from resource.
Invocation of this method may be switched to background.
TODO: OperationResultimportFromResource
in interface ModelService
SchemaException
ObjectNotFoundException
CommunicationException
ConfigurationException
SecurityViolationException
public void importObjectsFromFile(File input, ImportOptionsType options, Task task, OperationResult parentResult)
ModelService
importObjectsFromFile
in interface ModelService
public void importObjectsFromStream(InputStream input, ImportOptionsType options, Task task, OperationResult parentResult)
ModelService
importObjectsFromStream
in interface ModelService
public Set<ConnectorType> discoverConnectors(ConnectorHostType hostType, OperationResult parentResult) throws CommunicationException
ModelService
discoverConnectors
in interface ModelService
hostType
- definition of a connector host or nullparentResult
- parentResult parent OperationResult (in/out)CommunicationException
- error communicating with the connector hostpublic void postInit(OperationResult parentResult)
ModelService
postInit
in interface ModelService
public <F extends ObjectType,P extends ObjectType> ModelContext<F,P> unwrapModelContext(LensContextType wrappedContext, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException
unwrapModelContext
in interface ModelInteractionService
SchemaException
ConfigurationException
ObjectNotFoundException
CommunicationException
Copyright © 2013 evolveum. All rights reserved.