Class UpdateImpl
- java.lang.Object
-
- org.identityconnectors.framework.impl.api.local.operations.APIOperationRunner
-
- org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunner
-
- org.identityconnectors.framework.impl.api.local.operations.UpdateImpl
-
- All Implemented Interfaces:
APIOperation
,UpdateApiOp
public class UpdateImpl extends ConnectorAPIOperationRunner implements UpdateApiOp
Handles both version of update this include simple replace and the advance update.
-
-
Field Summary
-
Fields inherited from interface org.identityconnectors.framework.api.operations.APIOperation
NO_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description UpdateImpl(ConnectorOperationalContext context, Connector connector)
Determines which type of update a connector supports and then uses that handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Uid
addAttributeValues(ObjectClass objclass, Uid uid, Set<Attribute> valuesToAdd, OperationOptions options)
Update the object specified by theObjectClass
andUid
, adding to the current values of each attribute the values provided.Set<Attribute>
merge(Set<Attribute> updateAttrs, Set<Attribute> baseAttrs, boolean add)
Merges two connector objects into a single updated object.Uid
removeAttributeValues(ObjectClass objclass, Uid uid, Set<Attribute> valuesToRemove, OperationOptions options)
Update the object specified by theObjectClass
andUid
, removing from the current values of each attribute the values provided.Uid
update(ObjectClass objectClass, Uid uid, Set<Attribute> replaceAttributes, OperationOptions options)
Update the object specified by theObjectClass
andUid
, replacing the current values of each attribute with the values provided.static void
validateInput(ObjectClass objectClass, Uid uid, Set<Attribute> replaceAttributes, boolean isDelta)
Makes things easier if you can trust the input.-
Methods inherited from class org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunner
getConnector, getNormalizer, getOperationalContext
-
-
-
-
Constructor Detail
-
UpdateImpl
public UpdateImpl(ConnectorOperationalContext context, Connector connector)
Determines which type of update a connector supports and then uses that handler.
-
-
Method Detail
-
update
public Uid update(ObjectClass objectClass, Uid uid, Set<Attribute> replaceAttributes, OperationOptions options)
Description copied from interface:UpdateApiOp
Update the object specified by theObjectClass
andUid
, replacing the current values of each attribute with the values provided.For each input attribute, replace all of the current values of that attribute in the target object with the values of that attribute.
If the target object does not currently contain an attribute that the input set contains, then add this attribute (along with the provided values) to the target object.
If the value of an attribute in the input set is
null
, then do one of the following, depending on which is most appropriate for the target:- If possible, remove that attribute from the target object entirely.
- Otherwise, replace all of the current values of that
attribute in the target object with a single value of
null
.
- Specified by:
update
in interfaceUpdateApiOp
- Parameters:
objectClass
- the type of object to modify. Must not be null.uid
- the uid of the object to modify. Must not be null.replaceAttributes
- set of newAttribute
. the values in this set represent the new, merged values to be applied to the object. This set may also includeoperational attributes
. Must not be null.options
- additional options that impact the way this operation is run. May be null.- Returns:
- the
Uid
of the updated object in case the update changes the formation of the unique identifier.
-
addAttributeValues
public Uid addAttributeValues(ObjectClass objclass, Uid uid, Set<Attribute> valuesToAdd, OperationOptions options)
Description copied from interface:UpdateApiOp
Update the object specified by theObjectClass
andUid
, adding to the current values of each attribute the values provided.For each attribute that the input set contains, add to the current values of that attribute in the target object all of the values of that attribute in the input set.
NOTE that this does not specify how to handle duplicate values. The general assumption for an attribute of a
ConnectorObject
is that the values for an attribute may contain duplicates. Therefore, in general simply append the provided values to the current value for each attribute.IMPLEMENTATION NOTE: for connectors that merely implement
UpdateOp
and notUpdateAttributeValuesOp
this method will be simulated by fetching, merging, and callingUpdateOp.update(ObjectClass, Uid, Set, OperationOptions)
. Therefore, connector implementations are encourage to implementUpdateAttributeValuesOp
from a performance and atomicity standpoint.- Specified by:
addAttributeValues
in interfaceUpdateApiOp
- Parameters:
objclass
- the type of object to modify. Must not be null.uid
- the uid of the object to modify. Must not be null.valuesToAdd
- set ofAttribute
deltas. The values for the attributes in this set represent the values to add to attributes in the object. merged. This set must not includeoperational attributes
. Must not be null.options
- additional options that impact the way this operation is run. May be null.- Returns:
- the
Uid
of the updated object in case the update changes the formation of the unique identifier.
-
removeAttributeValues
public Uid removeAttributeValues(ObjectClass objclass, Uid uid, Set<Attribute> valuesToRemove, OperationOptions options)
Description copied from interface:UpdateApiOp
Update the object specified by theObjectClass
andUid
, removing from the current values of each attribute the values provided.For each attribute that the input set contains, remove from the current values of that attribute in the target object any value that matches one of the values of the attribute from the input set.
NOTE that this does not specify how to handle unmatched values. The general assumption for an attribute of a
ConnectorObject
is that the values for an attribute are merely representational state. Therefore, the implementer should simply ignore any provided value that does not match a current value of that attribute in the target object. Deleting an unmatched value should always succeed.IMPLEMENTATION NOTE: for connectors that merely implement
UpdateOp
and notUpdateAttributeValuesOp
this method will be simulated by fetching, merging, and callingUpdateOp.update(ObjectClass, Uid, Set, OperationOptions)
. Therefore, connector implementations are encourage to implementUpdateAttributeValuesOp
from a performance and atomicity standpoint.- Specified by:
removeAttributeValues
in interfaceUpdateApiOp
- Parameters:
objclass
- the type of object to modify. Must not be null.uid
- the uid of the object to modify. Must not be null.valuesToRemove
- set ofAttribute
deltas. The values for the attributes in this set represent the values to remove from attributes in the object. merged. This set must not includeoperational attributes
. Must not be null.options
- additional options that impact the way this operation is run. May be null.- Returns:
- the
Uid
of the updated object in case the update changes the formation of the unique identifier.
-
merge
public Set<Attribute> merge(Set<Attribute> updateAttrs, Set<Attribute> baseAttrs, boolean add)
Merges two connector objects into a single updated object.
-
validateInput
public static void validateInput(ObjectClass objectClass, Uid uid, Set<Attribute> replaceAttributes, boolean isDelta)
Makes things easier if you can trust the input.
-
-