com.evolveum.midpoint.schema.processor
Class Property

java.lang.Object
  extended by com.evolveum.midpoint.schema.processor.Property
Direct Known Subclasses:
ObjectReference, ResourceObjectAttribute

public class Property
extends java.lang.Object

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

Constructor Summary
Property()
           
Property(javax.xml.namespace.QName name)
           
Property(javax.xml.namespace.QName name, PropertyDefinition definition)
           
Property(javax.xml.namespace.QName name, PropertyDefinition definition, java.util.Set<java.lang.Object> values)
           
 
Method Summary
 PropertyModification createModification(PropertyModification.ModificationType modificationType, java.lang.Object modifyValue)
           
 PropertyModification createModification(PropertyModification.ModificationType modificationType, java.util.Set<java.lang.Object> modifyValues)
           
 java.lang.String dump()
           
 PropertyDefinition getDefinition()
          Returns applicable property definition.
 java.lang.String getDisplayName()
          Returns a display name for the property type.
 java.lang.String getHelp()
          Returns help message defined for the property type.
 javax.xml.namespace.QName getName()
          Returns the name of the property.
 java.lang.Object getValue()
           
<T> T
getValue(java.lang.Class<T> T)
          Returns value of a single-valued property.
 java.util.Set<java.lang.Object> getValues()
          Returns property values.
<T> java.util.Set<T>
getValues(java.lang.Class<T> T)
          Returns property values.
 java.util.List<org.w3c.dom.Element> serializeToDom(org.w3c.dom.Document doc)
          Serializes property to DOM element(s).
 void setDefinition(PropertyDefinition definition)
          Sets applicable property definition.
 void setName(javax.xml.namespace.QName name)
          Sets the name of the property.
 void setValue(java.lang.Object value)
          Means as a short-hand for setting just a value for single-valued attributes.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Property

public Property()

Property

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

Property

public Property(javax.xml.namespace.QName name,
                PropertyDefinition definition)

Property

public Property(javax.xml.namespace.QName name,
                PropertyDefinition definition,
                java.util.Set<java.lang.Object> values)
Method Detail

getDefinition

public PropertyDefinition getDefinition()
Returns applicable property definition. May return null if no definition is applicable or the definition is not know.

Returns:
applicable property definition

getName

public javax.xml.namespace.QName getName()
Returns the name of the property. The name is a QName. It uniquely defines a property. The name may be null, but such a property will not work. The name is the QName of XML element in the XML representation.

Returns:
property name

setName

public void setName(javax.xml.namespace.QName name)
Sets the name of the property. The name is a QName. It uniquely defines a property. The name may be null, but such a property will not work. The name is the QName of XML element in the XML representation.

Parameters:
name - the name to set

setDefinition

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

Parameters:
definition - the definition to set

getValues

public java.util.Set<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<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"

getValue

public <T> 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 java.lang.Object getValue()

setValue

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


getDisplayName

public java.lang.String getDisplayName()
Returns a display name for the property type. Returns null if the display name cannot be determined. The display name is fetched from the definition. If no definition (schema) is available, the display name will not be returned.

Returns:
display name for the property type

getHelp

public java.lang.String getHelp()
Returns help message defined for the property type. Returns null if the help message cannot be determined. The help message is fetched from the definition. If no definition (schema) is available, the help message will not be returned.

Returns:
help message for the property type

createModification

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

createModification

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

serializeToDom

public java.util.List<org.w3c.dom.Element> serializeToDom(org.w3c.dom.Document doc)
                                                   throws SchemaProcessorException
Serializes property to DOM 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
Throws:
SchemaProcessorException - No definition or inconsistent definition

toString

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

dump

public java.lang.String dump()


Copyright © 2011 evolveum. All Rights Reserved.