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

java.lang.Object
  extended by com.evolveum.midpoint.prism.Item<PrismContainerValue<V>>
      extended by com.evolveum.midpoint.prism.PrismContainer<V>
All Implemented Interfaces:
Itemable, PrismContainerable<V>, Visitable, DebugDumpable, Dumpable, java.io.Serializable
Direct Known Subclasses:
PrismObject, ResourceAttributeContainer

public class PrismContainer<V extends Containerable>
extends Item<PrismContainerValue<V>>
implements PrismContainerable<V>

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
protected  java.lang.Class<V> compileTimeClass
           
 
Fields inherited from class com.evolveum.midpoint.prism.Item
definition, name, parent, prismContext
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
  PrismContainer(javax.xml.namespace.QName name)
           
  PrismContainer(javax.xml.namespace.QName name, java.lang.Class<V> compileTimeClass)
           
protected PrismContainer(javax.xml.namespace.QName name, PrismContainerDefinition<V> definition, PrismContext prismContext)
           
 
Method Summary
 void add(Item<?> item)
          Convenience method.
protected  java.lang.String additionalDumpDescription()
           
 void applyDefinition(ItemDefinition definition)
           
 void assertDefinitions(boolean tolarateRaw, java.lang.String sourceDescription)
           
 boolean canRepresent(java.lang.Class<?> compileTimeClass)
          Returns true if this object can represent specified compile-time class.
 void checkConsistenceInternal(Itemable rootItem, ItemPath path, boolean requireDefinitions, boolean prohibitRaw)
           
protected  void checkDefinition(ItemDefinition def)
           
 PrismContainer<V> clone()
           
 boolean containsEquivalentValue(PrismContainerValue<V> value)
           
protected  void copyValues(PrismContainer<V> clone)
           
 ContainerDelta<V> createDelta(ItemPath path)
          Creates specific sublcass of ItemDelta appropriate for type of item that this definition represents (e.g.
 PrismContainerValue<V> createNewValue()
           
 java.lang.String debugDump(int indent)
           
 java.lang.String dump()
          Show the content of the object intended for diagnostics by developer.
 boolean equals(java.lang.Object obj)
           
 boolean equivalent(java.lang.Object obj)
          this method ignores some part of the object during comparison (e.g.
<T extends Containerable>
PrismContainer<T>
findContainer(ItemPath path)
           
<T extends Containerable>
PrismContainer<T>
findContainer(javax.xml.namespace.QName containerName)
           
<X extends PrismValue>
Item<X>
findItem(ItemPath propPath)
           
<I extends Item<?>>
I
findItem(ItemPath propPath, java.lang.Class<I> type)
           
 Item<?> findItem(javax.xml.namespace.QName itemQName)
           
<I extends Item<?>>
I
findItem(javax.xml.namespace.QName itemQName, java.lang.Class<I> type)
           
<T extends Containerable>
PrismContainer<T>
findOrCreateContainer(ItemPath containerPath)
           
<T extends Containerable>
PrismContainer<T>
findOrCreateContainer(javax.xml.namespace.QName containerName)
           
<T extends Item<?>>
T
findOrCreateItem(ItemPath containerPath, java.lang.Class<T> type)
           
<T extends Item<?>>
T
findOrCreateItem(ItemPath containerPath, java.lang.Class<T> type, ItemDefinition definition)
           
<T> PrismProperty<T>
findOrCreateProperty(ItemPath propertyPath)
           
<T> PrismProperty<T>
findOrCreateProperty(javax.xml.namespace.QName propertyName)
           
 PrismReference findOrCreateReference(ItemPath propertyPath)
           
 PrismReference findOrCreateReference(javax.xml.namespace.QName propertyName)
           
<T> PrismProperty<T>
findProperty(ItemPath path)
           
<T> PrismProperty<T>
findProperty(javax.xml.namespace.QName propertyQName)
           
 PrismReference findReference(ItemPath path)
           
 PrismReference findReference(javax.xml.namespace.QName referenceQName)
           
 PrismReference findReferenceByCompositeObjectElementName(javax.xml.namespace.QName elementName)
           
 java.lang.Class<V> getCompileTimeClass()
           
protected  java.lang.String getDebugDumpClassName()
          Return a human readable name of this class suitable for logs.
 PrismContainerDefinition<V> getDefinition()
          Returns applicable property container definition.
 PrismContainerValue<V> getNextValue(PrismValue value)
          Returns values that is following the specified value.
 PrismContainerValue<V> getPreviousValue(PrismValue value)
          Returns value that is previous to the specified value.
<T> T
getPropertyRealValue(javax.xml.namespace.QName propertyName, java.lang.Class<T> type)
           
 PrismContainerValue<V> getValue()
           
 PrismContainerValue<V> getValue(java.lang.String id)
           
 java.util.List<PrismContainerValue<V>> getValues()
           
 boolean hasCompleteDefinition()
          Returns true if the object and all contained prisms have proper definition.
 int hashCode()
           
 boolean isEmpty()
           
 void mergeValue(PrismContainerValue<V> otherValue)
           
 void mergeValues(java.util.Collection<PrismContainerValue<V>> otherValues)
           
 void mergeValues(PrismContainer<V> other)
           
 void remove(Item<?> item)
          Convenience method.
 void removeContainer(ItemPath path)
           
 void removeContainer(javax.xml.namespace.QName containerQName)
           
<I extends Item<?>>
void
removeItem(ItemPath path, java.lang.Class<I> itemType)
           
 void removeProperty(ItemPath path)
           
 void removeProperty(javax.xml.namespace.QName propertyQName)
           
 void removeReference(ItemPath path)
           
 void removeReference(javax.xml.namespace.QName referenceQName)
           
 void setDefinition(PrismContainerDefinition<V> definition)
          Sets applicable property container definition.
 void setPropertyRealValue(javax.xml.namespace.QName propertyName, java.lang.Object realValue)
           
 void setValue(PrismContainerValue<V> value)
           
 java.lang.String toString()
           
 void trim()
          Remove all empty values
 
Methods inherited from class com.evolveum.midpoint.prism.Item
accept, add, addAll, applyDefinition, asDomElements, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, clear, cloneCollection, contains, contains, containsRealValue, copyValues, createNewDefinitionlessItem, debugDump, diff, diff, diff, diffInternal, equalsRealValue, findValue, fixupDelta, getClonedValues, getDisplayName, getHelp, getName, getParent, getPath, getPrismContext, getUserData, getUserData, getValue, hasRaw, hasRealValue, hasValue, hasValue, isRaw, normalize, remove, remove, removeAll, replace, replaceAll, resetParentCollection, revive, setDefinition, setName, setParent, setPrismContext, setUserData, size
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.evolveum.midpoint.prism.Itemable
getName, getPath, getPrismContext
 

Field Detail

compileTimeClass

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

PrismContainer

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

PrismContainer

public PrismContainer(javax.xml.namespace.QName name,
                      java.lang.Class<V> compileTimeClass)

PrismContainer

protected PrismContainer(javax.xml.namespace.QName name,
                         PrismContainerDefinition<V> definition,
                         PrismContext prismContext)
Method Detail

getCompileTimeClass

public java.lang.Class<V> getCompileTimeClass()
Specified by:
getCompileTimeClass in interface PrismContainerable<V extends Containerable>

canRepresent

public boolean canRepresent(java.lang.Class<?> compileTimeClass)
Returns true if this object can represent specified compile-time class. I.e. this object can be presented in the compile-time form that is an instance of a specified class.


getValues

public java.util.List<PrismContainerValue<V>> getValues()
Overrides:
getValues in class Item<PrismContainerValue<V extends Containerable>>

getValue

public PrismContainerValue<V> getValue()

setValue

public void setValue(PrismContainerValue<V> value)
              throws SchemaException
Throws:
SchemaException

getPreviousValue

public PrismContainerValue<V> getPreviousValue(PrismValue value)
Description copied from class: Item
Returns value that is previous to the specified value. Note that the order is semantically insignificant and this is used only for presentation consistency in order-sensitive formats such as XML or JSON.

Overrides:
getPreviousValue in class Item<PrismContainerValue<V extends Containerable>>

getNextValue

public PrismContainerValue<V> getNextValue(PrismValue value)
Description copied from class: Item
Returns values that is following the specified value. Note that the order is semantically insignificant and this is used only for presentation consistency in order-sensitive formats such as XML or JSON.

Overrides:
getNextValue in class Item<PrismContainerValue<V extends Containerable>>

getValue

public PrismContainerValue<V> getValue(java.lang.String id)

setPropertyRealValue

public void setPropertyRealValue(javax.xml.namespace.QName propertyName,
                                 java.lang.Object realValue)
                          throws SchemaException
Throws:
SchemaException

getPropertyRealValue

public <T> T getPropertyRealValue(javax.xml.namespace.QName propertyName,
                                  java.lang.Class<T> type)

add

public void add(Item<?> item)
         throws SchemaException
Convenience method. Works only on single-valued containers.

Throws:
SchemaException

createNewValue

public PrismContainerValue<V> createNewValue()

mergeValues

public void mergeValues(PrismContainer<V> other)
                 throws SchemaException
Throws:
SchemaException

mergeValues

public void mergeValues(java.util.Collection<PrismContainerValue<V>> otherValues)
                 throws SchemaException
Throws:
SchemaException

mergeValue

public void mergeValue(PrismContainerValue<V> otherValue)
                throws SchemaException
Throws:
SchemaException

trim

public void trim()
Remove all empty values


getDefinition

public PrismContainerDefinition<V> getDefinition()
Returns applicable property container definition.

May return null if no definition is applicable or the definition is not know.

Specified by:
getDefinition in interface Itemable
Specified by:
getDefinition in interface PrismContainerable<V extends Containerable>
Overrides:
getDefinition in class Item<PrismContainerValue<V extends Containerable>>
Returns:
applicable property container definition

setDefinition

public void setDefinition(PrismContainerDefinition<V> definition)
Sets applicable property container definition.

Parameters:
definition - the definition to set

applyDefinition

public void applyDefinition(ItemDefinition definition)
                     throws SchemaException
Overrides:
applyDefinition in class Item<PrismContainerValue<V extends Containerable>>
Throws:
SchemaException

findItem

public <I extends Item<?>> I findItem(javax.xml.namespace.QName itemQName,
                                      java.lang.Class<I> type)

hasCompleteDefinition

public boolean hasCompleteDefinition()
Returns true if the object and all contained prisms have proper definition.

Overrides:
hasCompleteDefinition in class Item<PrismContainerValue<V extends Containerable>>

findItem

public Item<?> findItem(javax.xml.namespace.QName itemQName)

findItem

public <I extends Item<?>> I findItem(ItemPath propPath,
                                      java.lang.Class<I> type)

findItem

public <X extends PrismValue> Item<X> findItem(ItemPath propPath)

findContainer

public <T extends Containerable> PrismContainer<T> findContainer(ItemPath path)

findContainer

public <T extends Containerable> PrismContainer<T> findContainer(javax.xml.namespace.QName containerName)

findProperty

public <T> PrismProperty<T> findProperty(ItemPath path)

findProperty

public <T> PrismProperty<T> findProperty(javax.xml.namespace.QName propertyQName)

findReference

public PrismReference findReference(ItemPath path)

findReference

public PrismReference findReference(javax.xml.namespace.QName referenceQName)

findReferenceByCompositeObjectElementName

public PrismReference findReferenceByCompositeObjectElementName(javax.xml.namespace.QName elementName)

findOrCreateItem

public <T extends Item<?>> T findOrCreateItem(ItemPath containerPath,
                                              java.lang.Class<T> type)
                                   throws SchemaException
Throws:
SchemaException

findOrCreateItem

public <T extends Item<?>> T findOrCreateItem(ItemPath containerPath,
                                              java.lang.Class<T> type,
                                              ItemDefinition definition)
                                   throws SchemaException
Throws:
SchemaException

findOrCreateContainer

public <T extends Containerable> PrismContainer<T> findOrCreateContainer(ItemPath containerPath)
                                                              throws SchemaException
Throws:
SchemaException

findOrCreateContainer

public <T extends Containerable> PrismContainer<T> findOrCreateContainer(javax.xml.namespace.QName containerName)
                                                              throws SchemaException
Throws:
SchemaException

findOrCreateProperty

public <T> PrismProperty<T> findOrCreateProperty(ItemPath propertyPath)
                                      throws SchemaException
Throws:
SchemaException

findOrCreateProperty

public <T> PrismProperty<T> findOrCreateProperty(javax.xml.namespace.QName propertyName)
                                      throws SchemaException
Throws:
SchemaException

findOrCreateReference

public PrismReference findOrCreateReference(ItemPath propertyPath)
                                     throws SchemaException
Throws:
SchemaException

findOrCreateReference

public PrismReference findOrCreateReference(javax.xml.namespace.QName propertyName)
                                     throws SchemaException
Throws:
SchemaException

remove

public void remove(Item<?> item)
Convenience method. Works only on single-valued containers.


removeProperty

public void removeProperty(javax.xml.namespace.QName propertyQName)

removeProperty

public void removeProperty(ItemPath path)

removeContainer

public void removeContainer(javax.xml.namespace.QName containerQName)

removeContainer

public void removeContainer(ItemPath path)

removeReference

public void removeReference(javax.xml.namespace.QName referenceQName)

removeReference

public void removeReference(ItemPath path)

removeItem

public <I extends Item<?>> void removeItem(ItemPath path,
                                           java.lang.Class<I> itemType)

createDelta

public ContainerDelta<V> createDelta(ItemPath path)
Description copied from class: Item
Creates specific sublcass of ItemDelta appropriate for type of item that this definition represents (e.g. PropertyDelta, ContainerDelta, ...)

Specified by:
createDelta in class Item<PrismContainerValue<V extends Containerable>>

isEmpty

public boolean isEmpty()
Overrides:
isEmpty in class Item<PrismContainerValue<V extends Containerable>>

checkDefinition

protected void checkDefinition(ItemDefinition def)
Specified by:
checkDefinition in class Item<PrismContainerValue<V extends Containerable>>

checkConsistenceInternal

public void checkConsistenceInternal(Itemable rootItem,
                                     ItemPath path,
                                     boolean requireDefinitions,
                                     boolean prohibitRaw)
Overrides:
checkConsistenceInternal in class Item<PrismContainerValue<V extends Containerable>>

assertDefinitions

public void assertDefinitions(boolean tolarateRaw,
                              java.lang.String sourceDescription)
                       throws SchemaException
Overrides:
assertDefinitions in class Item<PrismContainerValue<V extends Containerable>>
Throws:
SchemaException

clone

public PrismContainer<V> clone()
Specified by:
clone in class Item<PrismContainerValue<V extends Containerable>>

copyValues

protected void copyValues(PrismContainer<V> clone)

containsEquivalentValue

public boolean containsEquivalentValue(PrismContainerValue<V> value)
Overrides:
containsEquivalentValue in class Item<PrismContainerValue<V extends Containerable>>

hashCode

public int hashCode()
Overrides:
hashCode in class Item<PrismContainerValue<V extends Containerable>>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Item<PrismContainerValue<V extends Containerable>>

equivalent

public boolean equivalent(java.lang.Object obj)
this method ignores some part of the object during comparison (e.g. source demarkation in values) These methods compare the "meaningful" parts of the objects.


toString

public java.lang.String toString()
Overrides:
toString in class Item<PrismContainerValue<V extends Containerable>>

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<PrismContainerValue<V extends Containerable>>
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<PrismContainerValue<V extends Containerable>>

additionalDumpDescription

protected java.lang.String additionalDumpDescription()

getDebugDumpClassName

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

Overrides:
getDebugDumpClassName in class Item<PrismContainerValue<V extends Containerable>>


Copyright © 2012 evolveum. All Rights Reserved.