com.evolveum.midpoint.prism
Class PrismContainerValue<T extends Containerable>

java.lang.Object
  extended by com.evolveum.midpoint.prism.PrismValue
      extended by com.evolveum.midpoint.prism.PrismContainerValue<T>
All Implemented Interfaces:
Visitable, DebugDumpable, Dumpable, Serializable

public class PrismContainerValue<T extends Containerable>
extends PrismValue
implements Dumpable, DebugDumpable

Author:
semancik
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.evolveum.midpoint.prism.PrismValue
domElement
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
PrismContainerValue()
           
PrismContainerValue(OriginType type, Objectable source, PrismContainerable container, String id)
           
 
Method Summary
 void accept(Visitor visitor)
           
 void add(Item<?> item)
          Adds an item to a property container.
 void addAll(Collection<? extends Item<?>> itemsToAdd)
          Adds a collection of items to a property container.
 void addAllReplaceExisting(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 applyDefinition(ItemDefinition definition, boolean force)
           
 void applyDefinition(PrismContainerDefinition definition, boolean force)
           
 T asContainerable()
           
 T asContainerable(Class<T> clazz)
           
 void assertDefinitions(boolean tolerateRaw, String sourceDescription)
           
 void assertDefinitions(String sourceDescription)
           
 void checkConsistenceInternal(Itemable rootItem, ItemPath parentPath, boolean requireDefinitions, boolean prohibitRaw)
           
 void clear()
           
 PrismContainerValue<T> clone()
           
protected  void copyValues(PrismContainerValue<T> clone)
           
<X extends Containerable>
PrismContainer<X>
createContainer(QName containerName)
           
protected  Element createDomElement()
           
<X> PrismProperty<X>
createProperty(PrismPropertyDefinition propertyDefinition)
           
<X> PrismProperty<X>
createProperty(QName propertyName)
           
 String debugDump()
          Show the content of the object intended for diagnostics by system administrator.
 String debugDump(int indent)
           
 String dump()
          Show the content of the object intended for diagnostics by developer.
 boolean equals(Object obj)
           
 boolean equalsComplex(PrismContainerValue<?> other, boolean ignoreMetadata, boolean isLiteral)
           
 boolean equalsComplex(PrismValue other, boolean ignoreMetadata, boolean isLiteral)
           
 boolean equivalent(PrismContainerValue<?> other)
           
<X extends Containerable>
PrismContainer<X>
findContainer(QName containerName)
           
<I extends Item<?>>
I
findItem(ItemDefinition itemDefinition, Class<I> type)
           
 Item<?> findItem(ItemPath itemPath)
           
 Item<?> findItem(QName itemName)
           
<I extends Item<?>>
I
findItem(QName itemName, Class<I> type)
           
<T extends Containerable>
PrismContainer<T>
findOrCreateContainer(QName containerName)
           
<X extends Item>
X
findOrCreateItem(ItemPath path, Class<X> type, ItemDefinition definition)
           
 Item<?> findOrCreateItem(QName containerName)
           
<X extends Item>
X
findOrCreateItem(QName containerName, Class<X> type)
           
<X> PrismProperty<X>
findOrCreateProperty(PrismPropertyDefinition propertyDef)
           
<X> PrismProperty<X>
findOrCreateProperty(QName propertyQName)
           
 PrismReference findOrCreateReference(QName referenceName)
           
<X> PrismProperty<X>
findProperty(ItemPath propertyPath)
           
<X> PrismProperty<X>
findProperty(PrismPropertyDefinition propertyDefinition)
          Finds a specific property in the container by definition.
<X> PrismProperty<X>
findProperty(QName propertyQName)
           
 PrismReference findReference(QName elementName)
           
 PrismReference findReferenceByCompositeObjectElementName(QName elementName)
           
 PrismContainer<T> getContainer()
           
 String getId()
           
 List<Item<?>> getItems()
          Returns a set of items that the property container contains.
 Item<?> getNextItem(Item<?> referenceItem)
           
 PrismContainerable<T> getParent()
           
 ItemPath getPath(ItemPath pathPrefix)
           
 Item<?> getPreviousItem(Item<?> referenceItem)
           
 Set<PrismProperty<?>> getProperties()
          Returns a set of properties that the property container contains.
 Collection<QName> getPropertyNames()
           
<T> T
getPropertyRealValue(QName propertyName, Class<T> type)
           
 List<Object> getRawElements()
           
 T getValue()
           
 boolean hasCompleteDefinition()
           
 int hashCode()
           
 boolean isEmpty()
           
 boolean isRaw()
          Returns true if the value is raw.
 void normalize()
           
 void recompute(PrismContext prismContext)
           
 void remove(Item<?> item)
           
 void removeAll()
           
 void removeContainer(ItemPath itemPath)
           
 void removeContainer(QName containerName)
           
 void removeProperty(ItemPath propertyPath)
           
 void removeProperty(QName propertyName)
           
 void replace(Item<?> oldItem, Item<?> newItem)
           
 boolean representsSameValue(PrismContainerValue<T> other)
           
 boolean representsSameValue(PrismValue other)
          Returns true if this and other value represent the same value.
 void revive(PrismContext prismContext)
           
 void setId(String id)
           
 void setPropertyRealValue(QName propertyName, Object realValue)
           
 String toString()
           
 
Methods inherited from class com.evolveum.midpoint.prism.PrismValue
applyDefinition, asDomElement, clearDomElement, cloneCollection, cloneValues, containsRealValue, copyValues, diff, diff, equals, equals, equalsRealValue, equalsRealValue, getOriginObject, getOriginType, getPrismContext, recompute, resetParentCollection, setOriginObject, setOriginType, setParent
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrismContainerValue

public PrismContainerValue()

PrismContainerValue

public PrismContainerValue(OriginType type,
                           Objectable source,
                           PrismContainerable container,
                           String id)
Method Detail

getItems

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

getNextItem

public Item<?> getNextItem(Item<?> referenceItem)

getPreviousItem

public Item<?> getPreviousItem(Item<?> referenceItem)

getProperties

public Set<PrismProperty<?>> 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.

getId

public String getId()

setId

public void setId(String id)

getParent

public PrismContainerable<T> getParent()
Overrides:
getParent in class PrismValue

getContainer

public PrismContainer<T> getContainer()

getPath

public ItemPath getPath(ItemPath pathPrefix)
Overrides:
getPath in class PrismValue

getValue

public T getValue()

asContainerable

public T asContainerable()

asContainerable

public T asContainerable(Class<T> clazz)

getPropertyNames

public Collection<QName> getPropertyNames()

add

public void add(Item<?> item)
         throws SchemaException
Adds an item to a property container.

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

addReplaceExisting

public void addReplaceExisting(Item<?> item)
                        throws SchemaException
Adds an item to a property container. Existing value will be replaced.

Parameters:
item - item to add.
Throws:
SchemaException

remove

public void remove(Item<?> item)

removeAll

public void removeAll()

addAll

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

Parameters:
itemsToAdd - items to add
Throws:
IllegalArgumentException - an attempt to add value that already exists
SchemaException

addAllReplaceExisting

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

Parameters:
itemsToAdd - items to add

replace

public void replace(Item<?> oldItem,
                    Item<?> newItem)
             throws SchemaException
Throws:
SchemaException

clear

public void clear()

findProperty

public <X> PrismProperty<X> findProperty(QName propertyQName)

findProperty

public <X> PrismProperty<X> findProperty(ItemPath propertyPath)

findProperty

public <X> PrismProperty<X> findProperty(PrismPropertyDefinition 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

findContainer

public <X extends Containerable> PrismContainer<X> findContainer(QName containerName)

findReference

public PrismReference findReference(QName elementName)

findReferenceByCompositeObjectElementName

public PrismReference findReferenceByCompositeObjectElementName(QName elementName)

findItem

public <I extends Item<?>> I findItem(QName itemName,
                                      Class<I> type)

findItem

public Item<?> findItem(QName itemName)

findItem

public Item<?> findItem(ItemPath itemPath)

findItem

public <I extends Item<?>> I findItem(ItemDefinition itemDefinition,
                                      Class<I> type)

findOrCreateContainer

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

findOrCreateReference

public PrismReference findOrCreateReference(QName referenceName)
                                     throws SchemaException
Throws:
SchemaException

findOrCreateItem

public Item<?> findOrCreateItem(QName containerName)
                         throws SchemaException
Throws:
SchemaException

findOrCreateItem

public <X extends Item> X findOrCreateItem(QName containerName,
                                           Class<X> type)
                                throws SchemaException
Throws:
SchemaException

findOrCreateItem

public <X extends Item> X findOrCreateItem(ItemPath path,
                                           Class<X> type,
                                           ItemDefinition definition)
                                throws SchemaException
Throws:
SchemaException

findOrCreateProperty

public <X> PrismProperty<X> findOrCreateProperty(QName propertyQName)
                                      throws SchemaException
Throws:
SchemaException

findOrCreateProperty

public <X> PrismProperty<X> findOrCreateProperty(PrismPropertyDefinition propertyDef)
                                      throws SchemaException
Throws:
SchemaException

createContainer

public <X extends Containerable> PrismContainer<X> createContainer(QName containerName)
                                                        throws SchemaException
Throws:
SchemaException

createProperty

public <X> PrismProperty<X> createProperty(QName propertyName)
                                throws SchemaException
Throws:
SchemaException

createProperty

public <X> PrismProperty<X> createProperty(PrismPropertyDefinition propertyDefinition)
                                throws SchemaException
Throws:
SchemaException

removeProperty

public void removeProperty(QName propertyName)

removeProperty

public void removeProperty(ItemPath propertyPath)

removeContainer

public void removeContainer(QName containerName)

removeContainer

public void removeContainer(ItemPath itemPath)

setPropertyRealValue

public void setPropertyRealValue(QName propertyName,
                                 Object realValue)
                          throws SchemaException
Throws:
SchemaException

getPropertyRealValue

public <T> T getPropertyRealValue(QName propertyName,
                                  Class<T> type)

recompute

public void recompute(PrismContext prismContext)
Specified by:
recompute in class PrismValue

accept

public void accept(Visitor visitor)
Specified by:
accept in interface Visitable
Overrides:
accept in class PrismValue

hasCompleteDefinition

public boolean hasCompleteDefinition()

createDomElement

protected Element createDomElement()
Specified by:
createDomElement in class PrismValue

representsSameValue

public boolean representsSameValue(PrismValue other)
Description copied from class: PrismValue
Returns true if this and other value represent the same value. E.g. if they have the same IDs, OIDs or it is otherwise know that they "belong together" without a deep examination of the values.

Overrides:
representsSameValue in class PrismValue

representsSameValue

public boolean representsSameValue(PrismContainerValue<T> other)

isRaw

public boolean isRaw()
Description copied from class: PrismValue
Returns true if the value is raw. Raw value is a semi-parsed value. A value for which we don't have a full definition yet and therefore the parsing could not be finished until the defintion is supplied.

Specified by:
isRaw in class PrismValue

getRawElements

public List<Object> getRawElements()

applyDefinition

public void applyDefinition(ItemDefinition definition,
                            boolean force)
                     throws SchemaException
Overrides:
applyDefinition in class PrismValue
Throws:
SchemaException

applyDefinition

public void applyDefinition(PrismContainerDefinition definition,
                            boolean force)
                     throws SchemaException
Throws:
SchemaException

revive

public void revive(PrismContext prismContext)
Overrides:
revive in class PrismValue

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in class PrismValue

normalize

public void normalize()
Overrides:
normalize in class PrismValue

checkConsistenceInternal

public void checkConsistenceInternal(Itemable rootItem,
                                     ItemPath parentPath,
                                     boolean requireDefinitions,
                                     boolean prohibitRaw)
Specified by:
checkConsistenceInternal in class PrismValue

assertDefinitions

public void assertDefinitions(String sourceDescription)
                       throws SchemaException
Throws:
SchemaException

assertDefinitions

public void assertDefinitions(boolean tolerateRaw,
                              String sourceDescription)
                       throws SchemaException
Throws:
SchemaException

clone

public PrismContainerValue<T> clone()
Specified by:
clone in class PrismValue

copyValues

protected void copyValues(PrismContainerValue<T> clone)

equalsComplex

public boolean equalsComplex(PrismValue other,
                             boolean ignoreMetadata,
                             boolean isLiteral)
Overrides:
equalsComplex in class PrismValue

equalsComplex

public boolean equalsComplex(PrismContainerValue<?> other,
                             boolean ignoreMetadata,
                             boolean isLiteral)

equivalent

public boolean equivalent(PrismContainerValue<?> other)

equals

public boolean equals(Object obj)
Overrides:
equals in class PrismValue

hashCode

public int hashCode()
Overrides:
hashCode in class PrismValue

toString

public String toString()
Overrides:
toString in class Object

dump

public 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
Returns:
content of the object intended for diagnostics.

debugDump

public String debugDump()
Description copied from interface: DebugDumpable
Show the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.

Specified by:
debugDump in interface DebugDumpable
Returns:
content of the object intended for diagnostics by system administrator.

debugDump

public String debugDump(int indent)
Specified by:
debugDump in interface DebugDumpable


Copyright © 2013 evolveum. All Rights Reserved.