com.evolveum.midpoint.schema.delta
Class PropertyDelta

java.lang.Object
  extended by com.evolveum.midpoint.schema.delta.PropertyDelta
All Implemented Interfaces:
DebugDumpable, Dumpable

public class PropertyDelta
extends java.lang.Object
implements Dumpable, DebugDumpable

Relative difference (delta) of a property values.

This class describes what values are to be added, removed or replaced in the property. The delta can be either add+delete or replace, but not both. It either describes what values to add and delete from the property (add+delete) or what is the new set of values (replace). Add+delete deltas can be merged without a loss. There are ideal for multi-value properties. If replace deltas are merged, only the last value will be present. These are better suited for single-value properties.

Author:
Radovan Semancik
See Also:
ObjectDelta

Field Summary
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
PropertyDelta(PropertyPath propertyPath)
           
PropertyDelta(PropertyPath parentPath, javax.xml.namespace.QName name)
           
PropertyDelta(javax.xml.namespace.QName name)
           
 
Method Summary
 void addValuesToAdd(java.util.Collection<PropertyValue<java.lang.Object>> newValues)
           
 void addValuesToDelete(java.util.Collection<PropertyValue<java.lang.Object>> newValues)
           
 void addValueToAdd(PropertyValue<java.lang.Object> newValue)
           
 void addValueToDelete(PropertyValue<java.lang.Object> newValue)
           
 void applyTo(Property property)
          Apply this delta (path) to a property.
 void applyTo(PropertyContainer propertyContainer)
          Apply this delta (path) to a property container.
 void clear()
           
static PropertyDelta createDelta(PropertyModificationType propMod, PropertyContainerDefinition pcDef)
           
static PropertyDelta createDelta(PropertyModificationType propMod, Schema schema, java.lang.Class<? extends ObjectType> objectType)
          Creates delta from PropertyModificationType (XML).
 java.lang.String debugDump()
          Show the content of the object intended for diagnostics by system administrator.
 java.lang.String debugDump(int indent)
           
 java.lang.String dump()
          Show the content of the object intended for diagnostics by developer.
 javax.xml.namespace.QName getName()
           
 PropertyPath getParentPath()
           
 PropertyPath getPath()
           
 Property getPropertyNew(PropertyDefinition propertyDefinition, PropertyPath parentPath)
          Returns the "new" state of the property - the state that would be after the delta is applied.
 java.lang.Class<?> getValueClass()
           
<T> java.util.Collection<PropertyValue<T>>
getValues(java.lang.Class<T> type)
          Returns all values regardless of whether they are added or removed or replaced.
 java.util.Collection<PropertyValue<java.lang.Object>> getValuesToAdd()
           
 java.util.Collection<PropertyValue<java.lang.Object>> getValuesToDelete()
           
 java.util.Collection<PropertyValue<java.lang.Object>> getValuesToReplace()
           
 boolean isEmpty()
           
 boolean isRealValueToAdd(PropertyValue<?> value)
           
 boolean isRealValueToDelete(PropertyValue<?> value)
           
 boolean isReplace()
           
 boolean isValueToAdd(PropertyValue<?> value)
           
 boolean isValueToDelete(PropertyValue<?> value)
           
 void merge(PropertyDelta deltaToMerge)
          Merge specified delta to this delta.
 void setName(javax.xml.namespace.QName name)
           
 void setParentPath(PropertyPath parentPath)
           
 void setValuesToReplace(java.util.Collection<PropertyValue<java.lang.Object>> newValues)
           
 java.util.Collection<PropertyModificationType> toPropertyModificationTypes()
          Converts this delta to PropertyModificationType (XML).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyDelta

public PropertyDelta(javax.xml.namespace.QName name)

PropertyDelta

public PropertyDelta(PropertyPath parentPath,
                     javax.xml.namespace.QName name)

PropertyDelta

public PropertyDelta(PropertyPath propertyPath)
Method Detail

getName

public javax.xml.namespace.QName getName()

setName

public void setName(javax.xml.namespace.QName name)

getParentPath

public PropertyPath getParentPath()

setParentPath

public void setParentPath(PropertyPath parentPath)

getPath

public PropertyPath getPath()

isReplace

public boolean isReplace()

getValuesToAdd

public java.util.Collection<PropertyValue<java.lang.Object>> getValuesToAdd()

getValuesToDelete

public java.util.Collection<PropertyValue<java.lang.Object>> getValuesToDelete()

clear

public void clear()

getValuesToReplace

public java.util.Collection<PropertyValue<java.lang.Object>> getValuesToReplace()

getValues

public <T> java.util.Collection<PropertyValue<T>> getValues(java.lang.Class<T> type)
Returns all values regardless of whether they are added or removed or replaced. Useful for iterating over all the changed values.


merge

public void merge(PropertyDelta deltaToMerge)
Merge specified delta to this delta. This delta is assumed to be chronologically earlier.


applyTo

public void applyTo(PropertyContainer propertyContainer)
Apply this delta (path) to a property container.


getValueClass

public java.lang.Class<?> getValueClass()

applyTo

public void applyTo(Property property)
Apply this delta (path) to a property.


addValuesToAdd

public void addValuesToAdd(java.util.Collection<PropertyValue<java.lang.Object>> newValues)

addValueToAdd

public void addValueToAdd(PropertyValue<java.lang.Object> newValue)

addValuesToDelete

public void addValuesToDelete(java.util.Collection<PropertyValue<java.lang.Object>> newValues)

addValueToDelete

public void addValueToDelete(PropertyValue<java.lang.Object> newValue)

setValuesToReplace

public void setValuesToReplace(java.util.Collection<PropertyValue<java.lang.Object>> newValues)

isEmpty

public boolean isEmpty()

isValueToAdd

public boolean isValueToAdd(PropertyValue<?> value)

isRealValueToAdd

public boolean isRealValueToAdd(PropertyValue<?> value)

isValueToDelete

public boolean isValueToDelete(PropertyValue<?> value)

isRealValueToDelete

public boolean isRealValueToDelete(PropertyValue<?> value)

createDelta

public static PropertyDelta createDelta(PropertyModificationType propMod,
                                        Schema schema,
                                        java.lang.Class<? extends ObjectType> objectType)
                                 throws SchemaException
Creates delta from PropertyModificationType (XML). The values inside the PropertyModificationType are converted to java. That's the reason this method needs schema and objectType (to locate the appropriate definitions).

Throws:
SchemaException

createDelta

public static PropertyDelta createDelta(PropertyModificationType propMod,
                                        PropertyContainerDefinition pcDef)
                                 throws SchemaException
Throws:
SchemaException

toPropertyModificationTypes

public java.util.Collection<PropertyModificationType> toPropertyModificationTypes()
                                                                           throws SchemaException
Converts this delta to PropertyModificationType (XML).

Throws:
SchemaException

getPropertyNew

public Property getPropertyNew(PropertyDefinition propertyDefinition,
                               PropertyPath parentPath)
Returns the "new" state of the property - the state that would be after the delta is applied. Assumes "replace" delta.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

debugDump

public java.lang.String debugDump()
Description copied from interface: DebugDumpable
Show the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.

Specified by:
debugDump in interface DebugDumpable
Returns:
content of the object intended for diagnostics by system administrator.

debugDump

public java.lang.String debugDump(int indent)
Specified by:
debugDump in interface DebugDumpable

dump

public java.lang.String dump()
Description copied from interface: Dumpable
Show the content of the object intended for diagnostics by developer. The content may be multi-line, in case of hierarchical objects it may be intended. The use of this method may not be efficient. It is not supposed to be used in normal operation. However, it is very useful in tests or in case of dumping objects in severe error situations.

Specified by:
dump in interface Dumpable
Returns:
content of the object intended for diagnostics.


Copyright © 2012 evolveum. All Rights Reserved.