com.evolveum.midpoint.schema.processor
Class PropertyContainer

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

public class PropertyContainer
extends Item
implements java.io.Serializable

Property container groups properties into logical blocks.The reason for grouping may be as simple as better understandability of data structure. But the group usually means different meaning, source or structure of the data. For example, the property container is frequently used to hold properties that are dynamic, not fixed by a static schema. Such grouping also naturally translates to XML and helps to "quarantine" such properties to avoid Unique Particle Attribute problems.

Property Container contains a set of (potentially multi-valued) properties or inner property containers. The order of properties is not significant, regardless of the fact that it may be fixed in the XML representation. In the XML representation, each element inside Property Container must be either Property or a Property Container.

Property Container is mutable.

Author:
Radovan Semancik
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.evolveum.midpoint.schema.processor.Item
definition, element, name
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
PropertyContainer()
           
PropertyContainer(javax.xml.namespace.QName name)
           
PropertyContainer(javax.xml.namespace.QName name, PropertyContainerDefinition definition)
           
PropertyContainer(javax.xml.namespace.QName name, PropertyContainerDefinition definition, java.lang.Object element)
           
 
Method Summary
 void add(Item item)
          Adds an item to a property container.
 void addAll(java.util.Collection<? extends Item> itemsToAdd)
          Adds a collection of items to a property container.
 void addAllReplaceExisting(java.util.Collection<? extends Item> itemsToAdd)
          Adds a collection of items to a property container.
 void addReplaceExisting(Item item)
          Adds an item to a property container.
 void applyModification(PropertyModification modification)
           
 void applyModifications(java.util.List<PropertyModification> modifications)
           
 java.lang.String debugDump(int indent)
           
 java.lang.String dump()
          Show the content of the object intended for diagnostics by developer.
 Item findItem(ItemDefinition itemDefinition)
          Finds a specific property in the container by definition.
 Item findItem(javax.xml.namespace.QName itemQName)
          Finds a specific property in the container by name.
 Property findProperty(PropertyDefinition propertyDefinition)
          Finds a specific property in the container by definition.
 Property findProperty(javax.xml.namespace.QName propertyQName)
          Finds a specific property in the container by name.
protected  java.lang.String getDebugDumpClassName()
          Return a human readable name of this class suitable for logs.
 PropertyContainerDefinition getDefinition()
          Returns applicable property container definition.
 java.util.Set<Item> getItems()
          Returns a set of items that the property container contains.
 java.util.Set<Property> getProperties()
          Returns a set of properties that the property container contains.
 boolean isEmpty()
           
 java.util.List<java.lang.Object> serializePropertiesToJaxb(org.w3c.dom.Document doc)
          Serialize properties to DOM or JAXB Elements.
 void serializeToDom(org.w3c.dom.Node parentNode)
          Serializes property to DOM or JAXB element(s).
 void setDefinition(PropertyContainerDefinition definition)
          Sets applicable property container definition.
 java.lang.String toString()
           
 
Methods inherited from class com.evolveum.midpoint.schema.processor.Item
debugDump, getDisplayName, getElement, getHelp, getName, setDefinition, setElement, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyContainer

public PropertyContainer()

PropertyContainer

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

PropertyContainer

public PropertyContainer(javax.xml.namespace.QName name,
                         PropertyContainerDefinition definition)

PropertyContainer

public PropertyContainer(javax.xml.namespace.QName name,
                         PropertyContainerDefinition definition,
                         java.lang.Object element)
Method Detail

getItems

public java.util.Set<Item> getItems()
Returns a set of items that the property container contains. The items may be properties or inner property containers. The set must not be null. In case there are no properties an empty set is returned. Returned set is mutable. Live object is returned.

Returns:
set of items that the property container contains.

getProperties

public java.util.Set<Property> getProperties()
Returns a set of properties that the property container contains. The set must not be null. In case there are no properties an empty set is returned. Returned set is immutable! Any change to it will be ignored.

Returns:
set of properties that the property container contains.

add

public void add(Item item)
Adds an item to a property container.

Parameters:
item - item to add.
Throws:
java.lang.IllegalArgumentException - an attempt to add value that already exists

addReplaceExisting

public void addReplaceExisting(Item item)
Adds an item to a property container. Existing value will be replaced.

Parameters:
item - item to add.

addAll

public void addAll(java.util.Collection<? extends Item> itemsToAdd)
Adds a collection of items to a property container.

Parameters:
itemsToAdd - items to add
Throws:
java.lang.IllegalArgumentException - an attempt to add value that already exists

addAllReplaceExisting

public void addAllReplaceExisting(java.util.Collection<? extends Item> itemsToAdd)
Adds a collection of items to a property container. Existing values will be replaced.

Parameters:
itemsToAdd - items to add

getDefinition

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

Overrides:
getDefinition in class Item
Returns:
applicable property container definition

setDefinition

public void setDefinition(PropertyContainerDefinition definition)
Sets applicable property container definition.

Parameters:
definition - the definition to set

findProperty

public Property findProperty(javax.xml.namespace.QName propertyQName)
Finds a specific property in the container by name. Returns null if nothing is found.

Parameters:
propertyQName - property name to find.
Returns:
found property or null

findItem

public Item findItem(javax.xml.namespace.QName itemQName)
Finds a specific property in the container by name. Returns null if nothing is found.

Parameters:
itemQName - property name to find.
Returns:
found property or null

findItem

public Item findItem(ItemDefinition itemDefinition)
Finds a specific property in the container by definition. Returns null if nothing is found.

Parameters:
propertyDefinition - property definition to find.
Returns:
found property or null

findProperty

public Property findProperty(PropertyDefinition propertyDefinition)
Finds a specific property in the container by definition. Returns null if nothing is found.

Parameters:
propertyDefinition - property definition to find.
Returns:
found property or null

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
Throws:
SchemaException

serializePropertiesToJaxb

public java.util.List<java.lang.Object> serializePropertiesToJaxb(org.w3c.dom.Document doc)
                                                           throws SchemaException
Serialize properties to DOM or JAXB Elements. The properties are serialized to DOM and returned as a list. The property container element is not serialized.

Parameters:
doc - DOM Document
Returns:
list of serialized properties
Throws:
SchemaProcessorException - the schema definition is missing or is inconsistent
SchemaException

toString

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

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
Overrides:
dump in class Item
Returns:
content of the object intended for diagnostics.

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

isEmpty

public boolean isEmpty()

applyModifications

public void applyModifications(java.util.List<PropertyModification> modifications)

applyModification

public void applyModification(PropertyModification modification)


Copyright © 2011 evolveum. All Rights Reserved.