com.evolveum.midpoint.schema.processor
Class PropertyContainer

java.lang.Object
  extended by com.evolveum.midpoint.schema.processor.PropertyContainer
Direct Known Subclasses:
MidPointObject, ResourceObject

public class PropertyContainer
extends java.lang.Object

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. 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

Constructor Summary
PropertyContainer()
           
PropertyContainer(javax.xml.namespace.QName name)
           
PropertyContainer(javax.xml.namespace.QName name, PropertyContainerDefinition definition)
           
 
Method Summary
 void applyModification(PropertyModification modification)
           
 void applyModifications(java.util.List<PropertyModification> modifications)
           
 java.lang.String dump()
           
 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.
 PropertyContainerDefinition getDefinition()
          Returns applicable property container definition.
 java.lang.String getDisplayName()
          Returns a display name for the property container type.
 java.lang.String getHelp()
          Returns help message defined for the property container type.
 javax.xml.namespace.QName getName()
          Returns the name of the property container.
 java.util.Set<Property> getProperties()
          Returns a set of properties that the property container contains.
 boolean isEmpty()
           
 java.util.List<org.w3c.dom.Element> serializePropertiesToDom(org.w3c.dom.Document doc)
          Serialize properties to DOM.
 org.w3c.dom.Element serializeToDom(org.w3c.dom.Document doc)
          Serialize entire property container to DOM.
 void setDefinition(PropertyContainerDefinition definition)
          Sets applicable property container definition.
 void setName(javax.xml.namespace.QName name)
          Sets the name of the property container.
 java.lang.String toString()
           
 
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,
                         PropertyContainerDefinition definition)

PropertyContainer

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

getName

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

Returns:
property container name

setName

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

Parameters:
name - the name to set

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 mutable. Life instance of the set is returned, therefore changing the set means changing the contents of property container.

Returns:
set of properties that the property container contains.

getDefinition

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

Returns:
applicable property container definition

setDefinition

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

Parameters:
definition - the definition to set

getDisplayName

public java.lang.String getDisplayName()
Returns a display name for the property container 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 container type

getHelp

public java.lang.String getHelp()
Returns help message defined for the property container 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 container type

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

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

serializePropertiesToDom

public java.util.List<org.w3c.dom.Element> serializePropertiesToDom(org.w3c.dom.Document doc)
                                                             throws SchemaProcessorException
Serialize properties to DOM. 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

serializeToDom

public org.w3c.dom.Element serializeToDom(org.w3c.dom.Document doc)
                                   throws SchemaProcessorException
Serialize entire property container to DOM. Entire property container is returned wrapped in a single DOM element. The properties are serialized as sub-elements. List of DOM elements is returned. The property container must have a schema definition (see getDefinition())

Parameters:
doc - DOM Document
Returns:
serialized property container as DOM element
Throws:
SchemaProcessorException - the schema definition is missing or is inconsistent

toString

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

dump

public java.lang.String dump()

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.