com.evolveum.midpoint.prism
Class PrismContainerDefinition<V extends Containerable>

java.lang.Object
  extended by com.evolveum.midpoint.prism.Definition
      extended by com.evolveum.midpoint.prism.ItemDefinition
          extended by com.evolveum.midpoint.prism.PrismContainerDefinition<V>
All Implemented Interfaces:
DebugDumpable, Dumpable, java.io.Serializable
Direct Known Subclasses:
PrismObjectDefinition, ResourceAttributeContainerDefinition

public class PrismContainerDefinition<V extends Containerable>
extends ItemDefinition

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
See Also:
Serialized Form

Field Summary
protected  java.lang.Class<V> compileTimeClass
           
protected  ComplexTypeDefinition complexTypeDefinition
           
protected  boolean isRuntimeSchema
          This means that the property container is not defined by fixed (compile-time) schema.
 
Fields inherited from class com.evolveum.midpoint.prism.ItemDefinition
name
 
Fields inherited from class com.evolveum.midpoint.prism.Definition
defaultName, displayName, displayOrder, help, ignored, prismContext, typeName
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
PrismContainerDefinition(javax.xml.namespace.QName name, ComplexTypeDefinition complexTypeDefinition, PrismContext prismContext)
          The constructors should be used only occasionally (if used at all).
PrismContainerDefinition(javax.xml.namespace.QName name, ComplexTypeDefinition complexTypeDefinition, PrismContext prismContext, java.lang.Class<V> compileTimeClass)
           
 
Method Summary
 PrismContainerDefinition<V> clone()
          Shallow clone
 PrismContainerDefinition<V> cloneWithReplacedDefinition(javax.xml.namespace.QName itemName, ItemDefinition newDefinition)
           
protected  void copyDefinitionData(PrismContainerDefinition<V> clone)
           
 PrismContainerDefinition<V> createContainerDefinition(javax.xml.namespace.QName name, ComplexTypeDefinition complexTypeDefinition, int minOccurs, int maxOccurs)
           
 PrismContainerDefinition createContainerDefinition(javax.xml.namespace.QName name, javax.xml.namespace.QName typeName)
           
 PrismContainerDefinition createContainerDefinition(javax.xml.namespace.QName name, javax.xml.namespace.QName typeName, int minOccurs, int maxOccurs)
           
 ItemDelta createEmptyDelta(ItemPath path)
           
 PrismPropertyDefinition createPropertyDefinition(javax.xml.namespace.QName name)
           
 PrismPropertyDefinition createPropertyDefinition(javax.xml.namespace.QName name, javax.xml.namespace.QName typeName)
          Creates new instance of property definition and adds it to the container.
 PrismPropertyDefinition createPropertyDefinition(javax.xml.namespace.QName name, javax.xml.namespace.QName typeName, int minOccurs, int maxOccurs)
          Creates new instance of property definition and adds it to the container.
 PrismPropertyDefinition createPropertyDefinition(java.lang.String localName, javax.xml.namespace.QName typeName)
          Creates new instance of property definition and adds it to the container.
 PrismPropertyDefinition createPropertyDefinition(java.lang.String localName, java.lang.String localTypeName)
          Creates new instance of property definition and adds it to the container.
 PrismPropertyDefinition createPropertyDefinition(java.lang.String localName, java.lang.String localTypeName, int minOccurs, int maxOccurs)
          Creates new instance of property definition and adds it to the container.
 java.lang.String debugDump(int indent)
           
protected  void extendToString(java.lang.StringBuilder sb)
           
 PrismContainerDefinition findContainerDefinition(ItemPath path)
          Finds an inner PropertyContainerDefinition by following the property container path.
<X extends Containerable>
PrismContainerDefinition<X>
findContainerDefinition(javax.xml.namespace.QName name)
          Finds an inner PropertyContainerDefinition by looking at the property container name.
<X extends Containerable>
PrismContainerDefinition<X>
findContainerDefinition(java.lang.String name)
           
 ItemDefinition findItemDefinition(ItemPath path)
           
<T extends ItemDefinition>
T
findItemDefinition(ItemPath path, java.lang.Class<T> clazz)
           
 ItemDefinition findItemDefinition(javax.xml.namespace.QName name)
           
<D extends ItemDefinition>
D
findItemDefinition(javax.xml.namespace.QName name, java.lang.Class<D> clazz)
           
 PrismPropertyDefinition findPropertyDefinition(ItemPath path)
           
 PrismPropertyDefinition findPropertyDefinition(javax.xml.namespace.QName name)
          Finds a PropertyDefinition by looking at the property name.
 PrismReferenceDefinition findReferenceDefinition(javax.xml.namespace.QName name)
           
 java.lang.Class<V> getCompileTimeClass()
           
 ComplexTypeDefinition getComplexTypeDefinition()
           
protected  java.lang.String getDebugDumpClassName()
          Return a human readable name of this class suitable for logs.
 java.util.Collection<ItemDefinition> getDefinitions()
          Returns set of property definitions.
 java.util.Set<PrismPropertyDefinition> getPropertyDefinitions()
          Returns set of property definitions.
protected  java.lang.String getSchemaNamespace()
           
 PrismContainer<V> instantiate()
          Create property container instance with a default name.
 PrismContainer<V> instantiate(javax.xml.namespace.QName name)
          Create property container instance with a specified name and element.
 boolean isEmpty()
           
 boolean isRuntimeSchema()
           
 void setCompileTimeClass(java.lang.Class<V> compileTimeClass)
           
 void setComplexTypeDefinition(ComplexTypeDefinition complexTypeDefinition)
           
 void setRuntimeSchema(boolean isRuntimeSchema)
           
 
Methods inherited from class com.evolveum.midpoint.prism.ItemDefinition
copyDefinitionData, equals, getDefaultName, getMaxOccurs, getMinOccurs, getName, getNameOrDefaultName, getNamespace, hashCode, isDynamic, isMandatory, isMultiValue, isOptional, isSingleValue, isValidFor, setDynamic, setMaxOccurs, setMinOccurs, setName, toString
 
Methods inherited from class com.evolveum.midpoint.prism.Definition
copyDefinitionData, debugDump, dump, getDisplayName, getDisplayOrder, getHelp, getPrismContext, getSchemaRegistry, getTypeClass, getTypeName, isIgnored, setDisplayName, setDisplayOrder, setHelp, setIgnored, setTypeName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

complexTypeDefinition

protected ComplexTypeDefinition complexTypeDefinition

compileTimeClass

protected java.lang.Class<V extends Containerable> compileTimeClass

isRuntimeSchema

protected boolean isRuntimeSchema
This means that the property container is not defined by fixed (compile-time) schema. This in fact means that we need to use getAny in a JAXB types. It does not influence the processing of DOM that much, as that does not really depend on compile-time/run-time distinction.

Constructor Detail

PrismContainerDefinition

public PrismContainerDefinition(javax.xml.namespace.QName name,
                                ComplexTypeDefinition complexTypeDefinition,
                                PrismContext prismContext)
The constructors should be used only occasionally (if used at all). Use the factory methods in the ResourceObjectDefintion instead.


PrismContainerDefinition

public PrismContainerDefinition(javax.xml.namespace.QName name,
                                ComplexTypeDefinition complexTypeDefinition,
                                PrismContext prismContext,
                                java.lang.Class<V> compileTimeClass)
Method Detail

getCompileTimeClass

public java.lang.Class<V> getCompileTimeClass()

setCompileTimeClass

public void setCompileTimeClass(java.lang.Class<V> compileTimeClass)

getSchemaNamespace

protected java.lang.String getSchemaNamespace()

getComplexTypeDefinition

public ComplexTypeDefinition getComplexTypeDefinition()

setComplexTypeDefinition

public void setComplexTypeDefinition(ComplexTypeDefinition complexTypeDefinition)

findItemDefinition

public <D extends ItemDefinition> D findItemDefinition(javax.xml.namespace.QName name,
                                                       java.lang.Class<D> clazz)

findItemDefinition

public <T extends ItemDefinition> T findItemDefinition(ItemPath path,
                                                       java.lang.Class<T> clazz)

findItemDefinition

public ItemDefinition findItemDefinition(javax.xml.namespace.QName name)

findItemDefinition

public ItemDefinition findItemDefinition(ItemPath path)

findPropertyDefinition

public PrismPropertyDefinition 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 or null

findPropertyDefinition

public PrismPropertyDefinition findPropertyDefinition(ItemPath path)

findReferenceDefinition

public PrismReferenceDefinition findReferenceDefinition(javax.xml.namespace.QName name)

findContainerDefinition

public <X extends Containerable> PrismContainerDefinition<X> findContainerDefinition(javax.xml.namespace.QName name)
Finds an inner PropertyContainerDefinition by looking at the property container name.

Returns null if nothing is found.

Parameters:
name - property container definition name
Returns:
found property container definition or null

findContainerDefinition

public <X extends Containerable> PrismContainerDefinition<X> findContainerDefinition(java.lang.String name)

findContainerDefinition

public PrismContainerDefinition findContainerDefinition(ItemPath path)
Finds an inner PropertyContainerDefinition by following the property container path.

Returns null if nothing is found.

Parameters:
path - property container path
Returns:
found property container definition or null

getDefinitions

public java.util.Collection<ItemDefinition> getDefinitions()
Returns set of property definitions.

WARNING: This may return definitions from the associated complex type. Therefore changing the returned set may influence also the complex type definition.

The set contains all property definitions of all types that were parsed. Order of definitions is insignificant.

Returns:
set of definitions

getPropertyDefinitions

public java.util.Set<PrismPropertyDefinition> getPropertyDefinitions()
Returns set of property definitions.

The set contains all property definitions of all types that were parsed. Order of definitions is insignificant.

The returned set is immutable! All changes may be lost.

Returns:
set of definitions

isRuntimeSchema

public boolean isRuntimeSchema()

setRuntimeSchema

public void setRuntimeSchema(boolean isRuntimeSchema)

instantiate

public PrismContainer<V> instantiate()
Create property container instance with a default name.

This is a preferred way how to create property container.

Specified by:
instantiate in class ItemDefinition
Returns:
created item instance

instantiate

public PrismContainer<V> instantiate(javax.xml.namespace.QName name)
Create property container instance with a specified name and element.

This is a preferred way how to create property container.

Specified by:
instantiate in class ItemDefinition
Returns:
created item instance

createEmptyDelta

public ItemDelta createEmptyDelta(ItemPath path)
Specified by:
createEmptyDelta in class ItemDefinition

clone

public PrismContainerDefinition<V> clone()
Shallow clone

Specified by:
clone in class ItemDefinition

copyDefinitionData

protected void copyDefinitionData(PrismContainerDefinition<V> clone)

cloneWithReplacedDefinition

public PrismContainerDefinition<V> cloneWithReplacedDefinition(javax.xml.namespace.QName itemName,
                                                               ItemDefinition newDefinition)

createPropertyDefinition

public PrismPropertyDefinition createPropertyDefinition(javax.xml.namespace.QName name,
                                                        javax.xml.namespace.QName typeName)
Creates new instance of property definition and adds it to the container.

This is the preferred method of creating a new definition.

Parameters:
name - name of the property (element name)
typeName - XSD type of the property
Returns:
created property definition

createPropertyDefinition

public PrismPropertyDefinition createPropertyDefinition(javax.xml.namespace.QName name,
                                                        javax.xml.namespace.QName typeName,
                                                        int minOccurs,
                                                        int maxOccurs)
Creates new instance of property definition and adds it to the container.

This is the preferred method of creating a new definition.

Parameters:
name - name of the property (element name)
typeName - XSD type of the property
minOccurs - minimal number of occurrences
maxOccurs - maximal number of occurrences (-1 means unbounded)
Returns:
created property definition

createPropertyDefinition

public PrismPropertyDefinition createPropertyDefinition(javax.xml.namespace.QName name)

createPropertyDefinition

public PrismPropertyDefinition createPropertyDefinition(java.lang.String localName,
                                                        javax.xml.namespace.QName typeName)
Creates new instance of property definition and adds it to the container.

This is the preferred method of creating a new definition.

Parameters:
localName - name of the property (element name) relative to the schema namespace
typeName - XSD type of the property
Returns:
created property definition

createPropertyDefinition

public PrismPropertyDefinition createPropertyDefinition(java.lang.String localName,
                                                        java.lang.String localTypeName)
Creates new instance of property definition and adds it to the container.

This is the preferred method of creating a new definition.

Parameters:
localName - name of the property (element name) relative to the schema namespace
localTypeName - XSD type of the property
Returns:
created property definition

createPropertyDefinition

public PrismPropertyDefinition createPropertyDefinition(java.lang.String localName,
                                                        java.lang.String localTypeName,
                                                        int minOccurs,
                                                        int maxOccurs)
Creates new instance of property definition and adds it to the container.

This is the preferred method of creating a new definition.

Parameters:
localName - name of the property (element name) relative to the schema namespace
localTypeName - XSD type of the property
minOccurs - minimal number of occurrences
maxOccurs - maximal number of occurrences (-1 means unbounded)
Returns:
created property definition

createContainerDefinition

public PrismContainerDefinition createContainerDefinition(javax.xml.namespace.QName name,
                                                          javax.xml.namespace.QName typeName)

createContainerDefinition

public PrismContainerDefinition createContainerDefinition(javax.xml.namespace.QName name,
                                                          javax.xml.namespace.QName typeName,
                                                          int minOccurs,
                                                          int maxOccurs)

createContainerDefinition

public PrismContainerDefinition<V> createContainerDefinition(javax.xml.namespace.QName name,
                                                             ComplexTypeDefinition complexTypeDefinition,
                                                             int minOccurs,
                                                             int maxOccurs)

debugDump

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

isEmpty

public boolean isEmpty()

getDebugDumpClassName

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

Specified by:
getDebugDumpClassName in class Definition

extendToString

protected void extendToString(java.lang.StringBuilder sb)
Overrides:
extendToString in class ItemDefinition


Copyright © 2012 evolveum. All Rights Reserved.