com.evolveum.midpoint.schema.processor
Class PropertyContainerDefinition

java.lang.Object
  extended by com.evolveum.midpoint.schema.processor.Definition
      extended by com.evolveum.midpoint.schema.processor.PropertyContainerDefinition
Direct Known Subclasses:
ObjectDefinition, ResourceObjectDefinition

public class PropertyContainerDefinition
extends Definition

Definition of a property container. 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. This class represents schema definition for property container. See Definition for more details.

Author:
Radovan Semancik

Method Summary
 java.lang.String debugDump(int indent)
           
 PropertyDefinition findPropertyDefinition(javax.xml.namespace.QName name)
          Finds a PropertyDefinition by looking at the property name.
protected
<T extends PropertyDefinition>
T
findPropertyDefinition(javax.xml.namespace.QName name, java.lang.Class<T> clazz)
           
 java.util.Set<PropertyDefinition> getDefinitions()
          Returns set of property definitions.
 PropertyContainer instantiate()
           
 PropertyContainer instantiate(javax.xml.namespace.QName name)
           
 java.util.Set<Property> parseProperties(java.util.List<org.w3c.dom.Element> elements)
          Parses properties from a list of elements.
protected
<T extends Property>
java.util.Set<T>
parseProperties(java.util.List<org.w3c.dom.Element> elements, java.lang.Class<T> clazz)
          Same as parseProperties(List elements), but casts returned properties to a specific type.
protected
<T extends Property>
java.util.Set<T>
parseProperties(java.util.List<org.w3c.dom.Element> elements, java.lang.Class<T> clazz, java.util.Set<? extends PropertyDefinition> selection)
          Same as parseProperties(List elements, Class clazz), but selects only some of the properties to parse.
 java.util.List<org.w3c.dom.Element> serializePropertiesToDom(java.util.Set<Property> properties, org.w3c.dom.Document doc)
          Serializes provided properties to DOM.
 
Methods inherited from class com.evolveum.midpoint.schema.processor.Definition
getDefaultName, getDisplayName, getHelp, getName, getNameOrDefaultName, getTypeName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

findPropertyDefinition

public PropertyDefinition findPropertyDefinition(javax.xml.namespace.QName name)
Finds a PropertyDefinition by looking at the property name. Returns null if nothing is found.

Parameters:
name - property definition name
Returns:
found property definition of null

findPropertyDefinition

protected <T extends PropertyDefinition> T findPropertyDefinition(javax.xml.namespace.QName name,
                                                                  java.lang.Class<T> clazz)

getDefinitions

public java.util.Set<PropertyDefinition> getDefinitions()
Returns set of property definitions. The set contains all property definitions of all types that were parsed. Order of definitions is insignificant.

Returns:
set of definitions

instantiate

public PropertyContainer instantiate()

instantiate

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

parseProperties

public java.util.Set<Property> parseProperties(java.util.List<org.w3c.dom.Element> elements)
Parses properties from a list of elements. The elements must describe properties as defined by this PropertyContainerDefinition. Serializes all the elements from the provided list. min/max constraints are not checked now TODO: maybe we need to check them

Parameters:
elements - list of elements with serialized properties
Returns:
set of deserialized properties

parseProperties

protected <T extends Property> java.util.Set<T> parseProperties(java.util.List<org.w3c.dom.Element> elements,
                                                                java.lang.Class<T> clazz)
Same as parseProperties(List elements), but casts returned properties to a specific type. It is used by subclasses, such as ResourceObjectDefinition that return Attribute instead of Property.

Type Parameters:
T - class to return
Parameters:
elements - elements list of elements with serialized properties
clazz - class to return
Returns:
set of deserialized properties

parseProperties

protected <T extends Property> java.util.Set<T> parseProperties(java.util.List<org.w3c.dom.Element> elements,
                                                                java.lang.Class<T> clazz,
                                                                java.util.Set<? extends PropertyDefinition> selection)
Same as parseProperties(List elements, Class clazz), but selects only some of the properties to parse. Other properties are ignored. Useful to parse identifiers out of complete object or similar things. Used by subclasses.


serializePropertiesToDom

public java.util.List<org.w3c.dom.Element> serializePropertiesToDom(java.util.Set<Property> properties,
                                                                    org.w3c.dom.Document doc)
                                                             throws SchemaProcessorException
Serializes provided properties to DOM. The method assumes that the provided properties are part of the property container that this definition defines. It will produce a list of DOM elements containing all the properties serialized to DOM.

Parameters:
properties - set of properties to serialize
doc - DOM document
Returns:
serialized properties
Throws:
SchemaProcessorException - in case property definition is not found or is inconsistent
See Also:
Property

debugDump

public java.lang.String debugDump(int indent)
Overrides:
debugDump in class Definition


Copyright © 2011 evolveum. All Rights Reserved.