com.evolveum.midpoint.schema.processor
Class Property

java.lang.Object
  extended by com.evolveum.midpoint.schema.processor.Item
      extended by com.evolveum.midpoint.schema.processor.Property
All Implemented Interfaces:
DebugDumpable, Dumpable, java.io.Serializable
Direct Known Subclasses:
ObjectReference, ResourceObjectAttribute

public class Property
extends Item

Property is a specific characteristic of an object. It may be considered object "attribute" or "field". For example User has fullName property that contains string value of user's full name.

Properties may be single-valued or multi-valued

Properties may contain primitive types or complex types (defined by XSD schema)

Property values are unordered, implementation may change the order of values

Duplicate values of properties should be silently removed by implementations, but clients must be able tolerate presence of duplicate values.

Operations that modify the objects work with the granularity of properties. They add/remove/replace the values of properties, but do not "see" inside the property.

Property is mutable.

Author:
Radovan Semancik
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.evolveum.midpoint.schema.processor.Item
definition, element, name, parentPath
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
Property(javax.xml.namespace.QName name, PropertyDefinition definition, java.lang.Object element, PropertyPath parentPath)
           
 
Method Summary
 void addValue(PropertyValue<java.lang.Object> pValueToAdd)
           
 void addValues(java.util.Collection<PropertyValue<java.lang.Object>> pValuesToAdd)
           
 void applyValueToElement()
           
 Property clone()
           
 PropertyDelta compareRealValuesTo(Property other)
          This method compares "this" property with other property.
 PropertyDelta compareTo(Property other)
          This method compares "this" property with other property.
protected  void copyValues(Property clone)
           
 PropertyModification createModification(PropertyModification.ModificationType modificationType, PropertyValue<java.lang.Object> modifyValue)
           
 PropertyModification createModification(PropertyModification.ModificationType modificationType, java.util.Set<PropertyValue<java.lang.Object>> modifyValues)
           
 java.lang.String debugDump(int indent)
           
 boolean deleteValue(PropertyValue<java.lang.Object> pValueToDelete)
           
 boolean deleteValues(java.util.Collection<PropertyValue<java.lang.Object>> pValuesToDelete)
           
 boolean equals(java.lang.Object obj)
           
protected  java.lang.String getDebugDumpClassName()
          Return a human readable name of this class suitable for logs.
 PropertyDefinition getDefinition()
          Returns applicable property definition.
<T> java.util.Collection<T>
getRealValues(java.lang.Class<T> type)
           
 PropertyValue<java.lang.Object> getValue()
           
<T> PropertyValue<T>
getValue(java.lang.Class<T> T)
          Returns value of a single-valued property.
 java.util.Set<PropertyValue<java.lang.Object>> getValues()
          Returns property values.
<T> java.util.Set<PropertyValue<T>>
getValues(java.lang.Class<T> T)
          Returns property values.
 int hashCode()
           
 boolean hasRealValue(PropertyValue<java.lang.Object> value)
           
 boolean hasValue(PropertyValue<java.lang.Object> value)
           
 boolean isEmpty()
           
 void replaceValues(java.util.Collection<PropertyValue<java.lang.Object>> valuesToReplace)
           
 void serializeToDom(org.w3c.dom.Node parentNode)
          Serializes property to DOM or JAXB element(s).
 void serializeToDom(org.w3c.dom.Node parentNode, PropertyDefinition propDef, java.util.Set<PropertyValue<java.lang.Object>> alternateValues, boolean recordType)
           
 java.util.List<java.lang.Object> serializeToJaxb(org.w3c.dom.Document doc)
          Serializes property to DOM or JAXB element(s).
 void setDefinition(PropertyDefinition definition)
          Sets applicable property definition.
 void setValue(PropertyValue value)
          Means as a short-hand for setting just a value for single-valued attributes.
 java.lang.String toString()
           
 
Methods inherited from class com.evolveum.midpoint.schema.processor.Item
copyValues, debugDump, dump, getDisplayName, getElement, getHelp, getName, getParentPath, getPath, setElement, setName, setParentPath
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Property

public Property(javax.xml.namespace.QName name,
                PropertyDefinition definition,
                java.lang.Object element,
                PropertyPath parentPath)
Method Detail

getDefinition

public PropertyDefinition getDefinition()
Returns applicable property definition.

May return null if no definition is applicable or the definition is not know.

Overrides:
getDefinition in class Item
Returns:
applicable property definition

setDefinition

public void setDefinition(PropertyDefinition definition)
Sets applicable property definition.

Overrides:
setDefinition in class Item
Parameters:
definition - the definition to set

getValues

public java.util.Set<PropertyValue<java.lang.Object>> getValues()
Returns property values.

The values are returned as set. The order of values is not significant.

Returns:
property values

getValues

public <T> java.util.Set<PropertyValue<T>> getValues(java.lang.Class<T> T)
Returns property values.

The values are returned as set. The order of values is not significant.

The values are cast to the "T" java type.

Type Parameters:
T - Target class for property values
Parameters:
T - Target class for property values
Returns:
property values
Throws:
java.lang.ClassCastException - if the values cannot be cast to "T"

getRealValues

public <T> java.util.Collection<T> getRealValues(java.lang.Class<T> type)

getValue

public <T> PropertyValue<T> getValue(java.lang.Class<T> T)
Returns value of a single-valued property.

The value is cast to the "T" java type.

Type Parameters:
T - Target class for property values
Parameters:
T - Target class for property values
Returns:
value of a single-valued property
Throws:
java.lang.ClassCastException
java.lang.IllegalStateException - more than one value is present

getValue

public PropertyValue<java.lang.Object> getValue()

setValue

public void setValue(PropertyValue value)
Means as a short-hand for setting just a value for single-valued attributes. Will remove all existing values. TODO


addValues

public void addValues(java.util.Collection<PropertyValue<java.lang.Object>> pValuesToAdd)

addValue

public void addValue(PropertyValue<java.lang.Object> pValueToAdd)

deleteValues

public boolean deleteValues(java.util.Collection<PropertyValue<java.lang.Object>> pValuesToDelete)

deleteValue

public boolean deleteValue(PropertyValue<java.lang.Object> pValueToDelete)

replaceValues

public void replaceValues(java.util.Collection<PropertyValue<java.lang.Object>> valuesToReplace)

hasValue

public boolean hasValue(PropertyValue<java.lang.Object> value)

hasRealValue

public boolean hasRealValue(PropertyValue<java.lang.Object> value)

isEmpty

public boolean isEmpty()

createModification

public PropertyModification createModification(PropertyModification.ModificationType modificationType,
                                               java.util.Set<PropertyValue<java.lang.Object>> modifyValues)

createModification

public PropertyModification createModification(PropertyModification.ModificationType modificationType,
                                               PropertyValue<java.lang.Object> modifyValue)

serializeToDom

public void serializeToDom(org.w3c.dom.Node parentNode)
                    throws SchemaException
Description copied from class: Item
Serializes property to DOM or JAXB element(s).

The property name will be used as an element QName. The values will be in the element content. Single-value properties will produce one element (on none), multi-valued properies may produce several elements. All of the elements will have the same QName.

The property must have a definition (getDefinition() must not return null).

Specified by:
serializeToDom in class Item
Parameters:
parentNode - DOM Document
Throws:
SchemaException - No definition or inconsistent definition

serializeToDom

public void serializeToDom(org.w3c.dom.Node parentNode,
                           PropertyDefinition propDef,
                           java.util.Set<PropertyValue<java.lang.Object>> alternateValues,
                           boolean recordType)
                    throws SchemaException
Throws:
SchemaException

serializeToJaxb

public java.util.List<java.lang.Object> serializeToJaxb(org.w3c.dom.Document doc)
                                                 throws SchemaException
Serializes property to DOM or JAXB element(s).

The property name will be used as an element QName. The values will be in the element content. Single-value properties will produce one element (on none), multi-valued properies may produce several elements. All of the elements will have the same QName.

The property must have a definition (getDefinition() must not return null).

Parameters:
doc - DOM Document
Returns:
property serialized to DOM Element or JAXBElement
Throws:
SchemaException - No definition or inconsistent definition

applyValueToElement

public void applyValueToElement()
                         throws SchemaException
Throws:
SchemaException

clone

public Property clone()
Specified by:
clone in class Item

copyValues

protected void copyValues(Property clone)

hashCode

public int hashCode()
Overrides:
hashCode in class Item

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Item

compareRealValuesTo

public PropertyDelta compareRealValuesTo(Property other)
This method compares "this" property with other property. Comparing only real values wrapped in PropertyValue.

Parameters:
other - can be null, property delta will be add all values from "this" property.
Returns:
The result is PropertyDelta which represents differences between them. That means when resulting property delta is applied on other property then other property and "this" property will be equal.

compareTo

public PropertyDelta compareTo(Property other)
This method compares "this" property with other property. Comparing property values as whole.

Parameters:
other - can be null, property delta will be add all values from "this" property.
Returns:
The result is PropertyDelta which represents differences between them. That means when resulting property delta is applied on other property then other property and "this" property will be equal.

toString

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

debugDump

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

getDebugDumpClassName

protected java.lang.String getDebugDumpClassName()
Return a human readable name of this class suitable for logs.

Overrides:
getDebugDumpClassName in class Item


Copyright © 2012 evolveum. All Rights Reserved.