Class ModelCrudService
- java.lang.Object
-
- com.evolveum.midpoint.model.impl.ModelCrudService
-
@Component public class ModelCrudService extends Object
Simple version of model service exposing CRUD-like operations. This is common facade for webservice and REST services. It takes care of all the "details" of externalized objects such as applying correct definitions and so on. Other methods (not strictly related to CRUD operations) requiring some pre-processing may come here later; if needed for both WS and REST services.- Author:
- Radovan Semancik
-
-
Constructor Summary
Constructors Constructor Description ModelCrudService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends ObjectType>
StringaddObject(PrismObject<T> object, ModelExecuteOptions options, Task task, OperationResult parentResult)
Add new object.<T extends ObjectType>
voiddeleteObject(Class<T> clazz, String oid, ModelExecuteOptions options, Task task, OperationResult parentResult)
Deletes object with specified OID.<T extends ObjectType>
PrismObject<T>getObject(Class<T> clazz, String oid, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult parentResult)
<T extends ObjectType>
voidmodifyObject(Class<T> type, String oid, Collection<? extends ItemDelta> modifications, ModelExecuteOptions options, Task task, OperationResult parentResult)
Modifies object using relative change description.<T extends ObjectType>
List<PrismObject<T>>searchObjects(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult parentResult)
-
-
-
Method Detail
-
getObject
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, ExpressionEvaluationException
-
searchObjects
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, ExpressionEvaluationException
-
addObject
public <T extends ObjectType> String addObject(PrismObject<T> object, ModelExecuteOptions options, Task task, OperationResult parentResult) throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException
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.
- Parameters:
object
- object to createparentResult
- parent OperationResult (in/out)- Returns:
- OID assigned to the created object
- Throws:
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 objectIllegalArgumentException
- wrong OID format, etc.SystemException
- unknown error from underlying layers or other unexpected stateSecurityViolationException
-
deleteObject
public <T extends ObjectType> void deleteObject(Class<T> clazz, String oid, ModelExecuteOptions options, Task task, OperationResult parentResult) throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, PolicyViolationException, SecurityViolationException
Deletes object with specified OID.
Must fail if object with specified OID does not exists. Should be atomic.
- Parameters:
oid
- OID of object to deleteparentResult
- parent OperationResult (in/out)- Throws:
ObjectNotFoundException
- specified object does not existIllegalArgumentException
- wrong OID format, described change is not applicableCommunicationException
- Communication problem was detected during processing of the objectConfigurationException
- Configuration problem was detected during processing of the objectPolicyViolationException
- Policy violation was detected during processing of the objectSystemException
- unknown error from underlying layers or other unexpected stateSchemaException
SecurityViolationException
-
modifyObject
public <T extends ObjectType> void modifyObject(Class<T> type, String oid, Collection<? extends ItemDelta> modifications, ModelExecuteOptions options, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, ObjectAlreadyExistsException, PolicyViolationException, SecurityViolationException
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.
- Parameters:
parentResult
- parent OperationResult (in/out)- Throws:
ObjectNotFoundException
- specified object does not existSchemaException
- resulting object would violate the schemaExpressionEvaluationException
- evaluation of expression associated with the object has failedCommunicationException
- Communication problem was detected during processing of the objectObjectAlreadyExistsException
- If the account or another "secondary" object already exists and cannot be createdPolicyViolationException
- Policy violation was detected during processing of the objectIllegalArgumentException
- wrong OID format, described change is not applicableSystemException
- unknown error from underlying layers or other unexpected stateConfigurationException
SecurityViolationException
-
-