|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.palo.api.impl.HierarchyImpl
public class HierarchyImpl
TODO DOCUMENT ME
Field Summary |
---|
Fields inherited from interface org.palo.api.PaloObject |
---|
TYPE_ATTRIBUTE, TYPE_NORMAL, TYPE_SYSTEM, TYPE_USER_INFO |
Method Summary | |
---|---|
Attribute |
addAttribute(java.lang.String name)
Creates a new Attribute and adds it to the hierarchy. |
Element |
addElement(java.lang.String name,
int type)
Adds an Element to this Hierarchy . |
void |
addElements(java.lang.String[] names,
int[] types)
Batch adds many elements. |
void |
addElements(java.lang.String[] names,
int[] types,
Element[][] children,
double[][] weights)
Available for Palo Server version 3 and above. |
void |
addElements(java.lang.String[] names,
int type,
Element[][] children,
double[][] weights)
|
Subset |
addSubset(java.lang.String name)
Adds a new Subset with the given name to the hierarchy. |
boolean |
canBeModified()
Returns true if this object can be modified (renamed, deleted, ...), false otherwise. |
boolean |
canCreateChildren()
Returns true if this object can create child objects, false otherwise. |
boolean |
equals(java.lang.Object other)
|
ElementNode[] |
getAllElementNodes()
Returns an array of all element nodes of the consolidation hierarchy of this hierarchy. |
Attribute |
getAttribute(java.lang.String attrId)
Returns the Attribute which corresponds to the given id or
null if no Attribute with this id exists |
Attribute |
getAttributeByName(java.lang.String attrName)
Returns the Attribute which corresponds to the given name or
null if no Attribute with this name exists |
Cube |
getAttributeCube()
Returns the attribute Cube corresponding to this hierarchy or
null if the attribute cube couldn't be loaded or does
not exist. |
Hierarchy |
getAttributeHierarchy()
Returns the corresponding attribute Hierarchy or
null if the attribute hierarchy couldn't be loaded or does
not exist. |
Attribute[] |
getAttributes()
Returns all Attribute s this hierarchy has. |
java.lang.Object[] |
getAttributeValues(Attribute[] attributes,
Element[] elements)
Convenient method to receive the values from several Attribute s in one go, i.e. the i.th object in the returned
array is the i.th value of the i.th attribute for the i.th element. |
Dimension |
getDimension()
Returns the parent dimension of this hierarchy. |
Element |
getElementAt(int index)
Returns the Element stored at the given index. |
Element |
getElementById(java.lang.String id)
Returns the Element stored under the given id or
null if no such Element exists. |
Element |
getElementByName(java.lang.String name)
Returns the Element stored under the given name or
null if no such Element exists. |
int |
getElementCount()
Returns the number of Element s of this instance. |
java.lang.String[] |
getElementNames()
Returns the names of the elements of this Hierarchy . |
Element[] |
getElements()
Returns an array of Element instances available
for this instance. |
Element[] |
getElementsInOrder()
Returns all elements of the hierarchy in an order that is determined by the consolidation hierarchy. |
ElementNode[] |
getElementsTree()
Returns the root-nodes of the element-tree. |
java.lang.String |
getId()
Returns the unique identifier of this palo object. |
int |
getMaxDepth()
Returns the maximum depth of this hierarchy. |
int |
getMaxLevel()
Returns the maximum level of this hierarchy. |
java.lang.String |
getName()
Returns the name of the entity. |
Element[] |
getRootElements()
Returns all root-elements (those without parents in the consolidation-hierarchy). |
Subset |
getSubset(java.lang.String id)
Returns the subset which is registered with the given id or null if no subset with this id could be found |
SubsetHandler |
getSubsetHandler()
Returns the SubsetHandler for managing the new subsets. |
Subset[] |
getSubsets()
Returns all subsets currently registered with this hierarchy |
int |
getType()
TODO please comment :) |
int |
hashCode()
|
boolean |
isAttributeHierarchy()
Checks if this Hierarchy is an attribute hierarchy, i.e. |
boolean |
isNormal()
Returns if this hierarchy is a normal hierarchy (as opposed to being a system hierarchy). |
boolean |
isSubsetHierarchy()
Checks if this Hierarchy is a subset hierarchy, i.e. |
Consolidation |
newConsolidation(Element element,
Element parent,
double weight)
Creates a Consolidation for later use in this hierarchy. |
void |
reload(boolean doEvents)
Reloads the internal hierarchy structure from database. |
void |
removeAllAttributes()
Removes all attributes from the hierarchy |
void |
removeAttribute(Attribute attribute)
Removes the given Attribute from the hierarchy |
void |
removeElement(Element element)
Removes the given Element from this Hierarchy |
void |
removeElements(Element[] elements)
Removes the given Element s from this Hierarchy |
void |
removeSubset(Subset subset)
Removes the given subset from the dimension |
void |
rename(java.lang.String name)
Renames this hierarchy. |
void |
renameElement(Element element,
java.lang.String newName)
Renames given Element . |
void |
setAttributeValues(Attribute[] attributes,
Element[] elements,
java.lang.Object[] values)
Convenient method to set the values for several Attribute s
at once, i.e. the i.th value is assigned to the i.th attribute for the
i.th element. |
java.lang.String |
toString()
|
void |
visitElementTree(ElementNodeVisitor visitor)
Visits the element-tree of this hierarchy. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.lang.String getId()
PaloObject
Important note: for a correct usage please note that the returned id is only unique within the parent scope of this palo object. Furthermore in case of deletion the id is reused, i.e. if a palo object is removed its id could be given to a newly created palo object afterwards!!
getId
in interface PaloObject
public java.lang.String getName()
NamedEntity
getName
in interface NamedEntity
public boolean isNormal()
Hierarchy
isNormal
in interface Hierarchy
public void rename(java.lang.String name)
Hierarchy
rename
in interface Hierarchy
name
- the the name for the hierarchy.public boolean canBeModified()
Writable
canBeModified
in interface Writable
public boolean canCreateChildren()
Writable
canCreateChildren
in interface Writable
public int getType()
PaloObject
getType
in interface PaloObject
public Dimension getDimension()
Hierarchy
getDimension
in interface Hierarchy
public int getElementCount()
Hierarchy
Element
s of this instance.
Note that a single hierarchy with consolidated elements might
consolidate a particular element more than once.
getElementCount
in interface Hierarchy
Element
s of this instance.public final Element[] getElements()
Hierarchy
Element
instances available
for this instance.
The returned array is a copy of the internal data structure. Changing the returned array does not change this instance.
getElements
in interface Hierarchy
Element
instances available
for this Hierarchy
.public final Element getElementAt(int index)
Hierarchy
Element
stored at the given index.
If the index does not correspond to a legal position
in the internally managed array of elements of this
instance, then null
is returned.
getElementAt
in interface Hierarchy
index
- the index
Element
stored at the given index
or null
.public final ElementNode[] getAllElementNodes()
Hierarchy
getAllElementNodes
in interface Hierarchy
public final Attribute addAttribute(java.lang.String name)
Hierarchy
Attribute
and adds it to the hierarchy.
Note: adding an attribute to a hierarchy which is itself of type
attribute hierarchy is prohibited and will result in a
PaloAPIException
.
addAttribute
in interface Hierarchy
name
- the name of the new attribute
Attribute
public final void removeAllAttributes()
Hierarchy
removeAllAttributes
in interface Hierarchy
public final void removeAttribute(Attribute attribute)
Hierarchy
Attribute
from the hierarchy
removeAttribute
in interface Hierarchy
attribute
- the attribute instance to removepublic final Attribute[] getAttributes()
Hierarchy
Attribute
s this hierarchy has.
getAttributes
in interface Hierarchy
Attribute
s of this hierarchypublic final Attribute getAttribute(java.lang.String attrId)
Hierarchy
Attribute
which corresponds to the given id or
null
if no Attribute
with this id exists
getAttribute
in interface Hierarchy
attrId
- identifier of the Attribute
to get
Attribute
or null
public final Attribute getAttributeByName(java.lang.String attrName)
Hierarchy
Attribute
which corresponds to the given name or
null
if no Attribute
with this name exists
getAttributeByName
in interface Hierarchy
attrName
- the name of the Attribute
to get
Attribute
or null
public final java.lang.Object[] getAttributeValues(Attribute[] attributes, Element[] elements)
Hierarchy
Attribute
s in one go, i.e. the i.th object in the returned
array is the i.th value of the i.th attribute for the i.th element.PaloAPIException
is thrown.
getAttributeValues
in interface Hierarchy
attributes
- the attributes to get the values fromelements
- the effected elements
public final Cube getAttributeCube()
Hierarchy
Cube
corresponding to this hierarchy or
null
if the attribute cube couldn't be loaded or does
not exist.
Note: this is a convenient method to provide raw access to the internal attribute handling. Its usage is not recommended!!
getAttributeCube
in interface Hierarchy
public final void setAttributeValues(Attribute[] attributes, Element[] elements, java.lang.Object[] values)
Hierarchy
Attribute
s
at once, i.e. the i.th value is assigned to the i.th attribute for the
i.th element.PaloAPIException
is thrown.
setAttributeValues
in interface Hierarchy
attributes
- the attributes to set the values forelements
- the effected elementsvalues
- the new valuespublic final Hierarchy getAttributeHierarchy()
Hierarchy
Hierarchy
or
null
if the attribute hierarchy couldn't be loaded or does
not exist.
Note: this is a convenient method to provide raw access to the internal attribute handling. Its usage is not recommended!!
getAttributeHierarchy
in interface Hierarchy
public final Element addElement(java.lang.String name, int type)
Hierarchy
Element
to this Hierarchy
.
addElement
in interface Hierarchy
name
- the name of the element to add.type
- the type of the element to add as defined by the constants
in the Element
class.public final void addElements(java.lang.String[] names, int[] types)
Hierarchy
addElements
in interface Hierarchy
names
- the names of the elements to add.types
- the types of the elements to add.public final void addElements(java.lang.String[] names, int type, Element[][] children, double[][] weights)
addElements
in interface Hierarchy
public final void addElements(java.lang.String[] names, int[] types, Element[][] children, double[][] weights)
Hierarchy
addElements
in interface Hierarchy
public final ElementNode[] getElementsTree()
Hierarchy
getElementsTree
in interface Hierarchy
public final Element[] getRootElements()
Hierarchy
getRootElements
in interface Hierarchy
public final void visitElementTree(ElementNodeVisitor visitor)
Hierarchy
visitElementTree
in interface Hierarchy
visitor
- the visitor-callback to invoke
during traversal.public final void removeElements(Element[] elements)
Hierarchy
Element
s from this Hierarchy
removeElements
in interface Hierarchy
elements
- Element
s to remove.public final Element getElementById(java.lang.String id)
Hierarchy
Element
stored under the given id or
null
if no such Element
exists.
getElementById
in interface Hierarchy
id
- the element-id to look-up.
Element
stored under the given id or
null
if no such Element
exists.public final Element getElementByName(java.lang.String name)
Hierarchy
Element
stored under the given name or
null
if no such Element
exists.
getElementByName
in interface Hierarchy
name
- the element-name to look-up.
Element
stored under the given name or
null
if no such Element
exists.public final java.lang.String[] getElementNames()
Hierarchy
Hierarchy
.
The returned array is a copy of the internal data structure. Changing the returned array does not change this instance.
getElementNames
in interface Hierarchy
Element
s instances available
for this Dimension>
.public final void renameElement(Element element, java.lang.String newName)
Hierarchy
Element
.
renameElement
in interface Hierarchy
element
- the Element
to rename.newName
- the new name for this Element
.public final Element[] getElementsInOrder()
Hierarchy
getElementsInOrder
in interface Hierarchy
public final Consolidation newConsolidation(Element element, Element parent, double weight)
Hierarchy
Consolidation
for later use in this hierarchy.
newConsolidation
in interface Hierarchy
element
- the Element
to consolidate.parent
- the parent-Element
of the consolidation.weight
- the consolidation weight.
Consolidation
object.public final void removeElement(Element element)
Hierarchy
Element
from this Hierarchy
removeElement
in interface Hierarchy
element
- the Element
to remove.public final int getMaxDepth()
Hierarchy
Element.getDepth()
for an explanation of how the depth is
determined
getMaxDepth
in interface Hierarchy
public final int getMaxLevel()
Hierarchy
Element.getLevel()
for an explanation of how the level is
determined
getMaxLevel
in interface Hierarchy
public final boolean isAttributeHierarchy()
Hierarchy
Hierarchy
is an attribute hierarchy, i.e.
its elements represent Attribute
s.
isAttributeHierarchy
in interface Hierarchy
public final boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public final void reload(boolean doEvents)
Hierarchy
reload
in interface Hierarchy
doEvents
- specify true
to get event notification on
hierarchy changes or false
otherwisepublic Subset addSubset(java.lang.String name)
Hierarchy
Subset
with the given name to the hierarchy.
addSubset
in interface Hierarchy
name
- the name of the subset
public Subset getSubset(java.lang.String id)
Hierarchy
getSubset
in interface Hierarchy
id
- the subset id
public SubsetHandler getSubsetHandler()
Hierarchy
SubsetHandler
for managing the new subsets.
Please use Database.supportsNewSubsets()
to check if new
subsets are supported.
getSubsetHandler
in interface Hierarchy
SubsetHandler
for managing new subsetspublic Subset[] getSubsets()
Hierarchy
getSubsets
in interface Hierarchy
public void removeSubset(Subset subset)
Hierarchy
removeSubset
in interface Hierarchy
subset
- the subset to removepublic final boolean isSubsetHierarchy()
Hierarchy
Hierarchy
is a subset hierarchy, i.e.
its elements represent Subset
s.
isSubsetHierarchy
in interface Hierarchy
public final java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |