|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.platform.admin.apiimpl.PermissionDataNodeTreeViewImpl
public class PermissionDataNodeTreeViewImpl
Provides a view into the tree of PermissionDataNode
s and supports utility
methods that perform funcions on the tree as a whole.
A property can be set (or toggled) to determine if clients want methods to return nodes marked
hidden. See setShowHidden(boolean)
.
Constructor Summary | |
---|---|
PermissionDataNodeTreeViewImpl(PermissionNode root)
Construct a PermissionDataNode . |
Method Summary | |
---|---|
boolean |
allDescendantsShareActions(PermissionNode startingPoint)
Determine whether all descendants of the given node share the exact same actions as the given node. |
protected PermissionDataNodeImpl |
assertPermissionDataNode(PermissionNode node)
Perform safe runtime casts. |
java.util.Iterator |
breadthFirstIterator()
Obtain a breadth-first Iterator over the whole tree starting at the root. |
java.util.Iterator |
breadthFirstIterator(PermissionNode startingPoint)
Obtain a breadth-first Iterator starting at the given node. |
java.util.List |
getChildren(PermissionNode parent)
Obtain the set of entries that are considered the children of the specified PermissionDataNode . |
java.util.List |
getDescendants(PermissionNode startingPoint)
Obtain all the PermissionDataNode s in the tree under the given
node. |
java.util.List |
getDescendantsWithActions(PermissionNode startingPoint,
AuthorizationActions actions,
boolean strict)
Obtain all the PermissionDataNode s in the tree under the given
node. |
java.util.Set |
getMarked()
Obtain all the marked PermissionDataNode s in the tree. |
java.util.Set |
getMarkedDescendants(PermissionNode startingPoint)
Obtain all the marked PermissionDataNode s in the tree under the given
node. |
java.util.List |
getModified()
Obtain all the modified PermissionDataNode s in the tree.This method will get hidden nodes if showHidden == true . |
java.util.List |
getModifiedBreadthFirst()
Obtain the modified PermissionDataNode s closest to the root in the tree. |
java.util.List |
getModifiedDescendants(PermissionNode startingPoint)
Obtain all the modified PermissionDataNode s in the tree under the
given node. |
PermissionNode |
getParent(PermissionNode node)
Determine the parent PermissionDataNode for the specified entry, or null if
the specified entry is a root. |
PermissionNode |
getRoot()
Obtain the root PermissionDataNode of the tree. |
java.util.List |
getRoots()
Obtain a list of PermissionDataNode s which are the children of the root. |
java.util.List |
getUnModifiedDescendants(PermissionNode startingPoint)
Obtain all the unmodified PermissionDataNode s in the tree under the
given node. |
void |
hideAllSystemNodes()
Hide all nodes whose resource name starts with "System". |
boolean |
isAncestorOf(PermissionNode ancestor,
PermissionNode descendant)
Determine whether the given descendant is a descendant of the given
ancestor .This method will check all ancesters of the descendant, even if they are marked hidden. |
boolean |
isDescendantOf(PermissionNode ancestor,
PermissionNode descendant)
Determine whether the given descendant is a descendant of the given
ancestor .This method will check all descendants of the ancester, even if they are marked hidden. |
java.util.Iterator |
iterator()
Obtain a depth-first Iterator over the whole tree starting at the root. |
java.util.Iterator |
iterator(PermissionNode startingPoint)
Obtain a depth-first Iterator starting at the given node. |
void |
resetTree()
Reset all tree nodes to their original AuthorizationActions values. |
void |
setBranchAllowedActions(PermissionNode startingPoint,
AuthorizationActions actions)
Set the allowed AuthorizationActions for the subtree rooted at this node (inclusive). |
void |
setBranchHidden(PermissionNode startingPoint)
Set the subtree rooted at this node as hidden (inclusive). |
void |
setMarked(PermissionNode entry,
boolean markedState)
(Un)Mark this node. |
java.util.Collection |
setPermissions(java.util.Collection permissions)
Set the permissions on the node containing each permission's resource. |
void |
setShowHidden(boolean showHidden)
Determines whether methods in this class return hidden nodes in results. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PermissionDataNodeTreeViewImpl(PermissionNode root)
PermissionDataNode
.
Method Detail |
---|
protected PermissionDataNodeImpl assertPermissionDataNode(PermissionNode node)
node
- The node to check.
public void setShowHidden(boolean showHidden)
false
(don't show hidden nodes).
setShowHidden
in interface PermissionTreeView
showHidden
- If true
, hidden nodes will be returned in results, if
false
, they will not.public void hideAllSystemNodes()
hideAllSystemNodes
in interface PermissionDataNodeTreeView
public void setMarked(PermissionNode entry, boolean markedState)
setMarked
in interface PermissionTreeView
entry
- The node to mark or unmark.markedState
- If true
, the node will be marked, if false
,
the node will be unmarked.public java.util.Iterator iterator(PermissionNode startingPoint)
Iterator
starting at the given node.
iterator
in interface PermissionTreeView
public java.util.Iterator iterator()
Iterator
over the whole tree starting at the root.
iterator
in interface PermissionTreeView
public java.util.Iterator breadthFirstIterator(PermissionNode startingPoint)
Iterator
starting at the given node.
breadthFirstIterator
in interface PermissionTreeView
public java.util.Iterator breadthFirstIterator()
Iterator
over the whole tree starting at the root.
breadthFirstIterator
in interface PermissionTreeView
public PermissionNode getRoot()
PermissionDataNode
of the tree. The root of this tree is always
hidden but will always be returned even if the state of showHidden
is
false
.
getRoot
in interface PermissionTreeView
public java.util.List getRoots()
PermissionDataNode
s which are the children of the root. These
nodes are the real roots of the tree, since the root is just a placeholder that holds
the real roots.
getRoots
in interface PermissionTreeView
PermissionDataNode
s that are the roots of the forest.public PermissionNode getParent(PermissionNode node)
PermissionDataNode
for the specified entry, or null if
the specified entry is a root.
getParent
in interface PermissionTreeView
node
- the PermissionDataNode
instance for which the parent is to be obtained;
may not be null
public java.util.List getChildren(PermissionNode parent)
PermissionDataNode
.
getChildren
in interface PermissionTreeView
parent
- the PermissionDataNode
instance for which the child entries
are to be obtained; may not be null
PermissionDataNode
instances that are considered
the children of the specified entry; never null but possibly emptypublic boolean isAncestorOf(PermissionNode ancestor, PermissionNode descendant)
descendant
is a descendant of the given
ancestor
.
ancestor
- The node to check to see if it is an ancestor of the descendant
.descendant
- The node to check to see if it is a descendant ancestor
.
true
if ancestor
is the ancestor of descendant
.public boolean isDescendantOf(PermissionNode ancestor, PermissionNode descendant)
descendant
is a descendant of the given
ancestor
.
isDescendantOf
in interface PermissionTreeView
ancestor
- The node to check to see if it is an ancestor of the descendant
.descendant
- The node to check to see if it is a descendant ancestor
.
true
if ancestor
is the ancestor of descendant
.public void setBranchAllowedActions(PermissionNode startingPoint, AuthorizationActions actions)
AuthorizationActions
for the subtree rooted at this node (inclusive).
entry
- The node to mark or unmark.actions
- The actions to allow on this node and its descendants.public void setBranchHidden(PermissionNode startingPoint)
setBranchHidden
in interface PermissionTreeView
entry
- The node to mark or unmark.setShowHidden
public void resetTree()
AuthorizationActions
values.
resetTree
in interface PermissionTreeView
public java.util.Set getMarked()
PermissionDataNode
s in the tree. Note that the
nodes are not nessesarily in tree form. They are just a collection of nodes.showHidden == true
.
getMarked
in interface PermissionTreeView
Set
of all marked nodes in the tree.public java.util.Set getMarkedDescendants(PermissionNode startingPoint)
PermissionDataNode
s in the tree under the given
node. Note that the nodes are not nessesarily in tree form. They are just a
collection of nodes.
showHidden == true
.
getMarkedDescendants
in interface PermissionTreeView
Set
of all marked nodes in the tree below startingPoint
.public java.util.List getDescendants(PermissionNode startingPoint)
PermissionDataNode
s in the tree under the given
node. Note that the nodes are not nessesarily in tree form. They are just a
collection of nodes.
showHidden == true
.
getDescendants
in interface PermissionTreeView
startingPoint
- The point in the tree to start the search for descendants.
List
of all nodes in the tree below startingPoint
.public java.util.List getDescendantsWithActions(PermissionNode startingPoint, AuthorizationActions actions, boolean strict)
PermissionDataNode
s in the tree under the given
node. Note that the nodes are not nessesarily in tree form. They are just a
collection of nodes.
showHidden == true
.
startingPoint
- The point in the tree to start the search for descendants.actions
- Get only those descendants that possess the given AuthorizationActions
.strict
- If true
, get only those descendants with actions equal to
the given actions.
List
of all nodes in the tree below startingPoint
that
possess the given actions.public java.util.List getModified()
PermissionDataNode
s in the tree.showHidden == true
.
getModified
in interface PermissionTreeView
List
of all modified nodes in the tree.public java.util.List getModifiedBreadthFirst()
PermissionDataNode
s closest to the root in the tree.
showHidden == true
.
getModifiedBreadthFirst
in interface PermissionTreeView
List
of all top level modified nodes in the tree.public java.util.List getModifiedDescendants(PermissionNode startingPoint)
PermissionDataNode
s in the tree under the
given node. Note that the nodes are not nessesarily in tree form.
showHidden == true
.
getModifiedDescendants
in interface PermissionTreeView
List
of all modified nodes in the tree below startingPoint
.public java.util.List getUnModifiedDescendants(PermissionNode startingPoint)
PermissionDataNode
s in the tree under the
given node. Note that the nodes are not nessesarily in tree form.
showHidden == true
.
getUnModifiedDescendants
in interface PermissionTreeView
List
of all unmodified nodes in the tree below startingPoint
.public boolean allDescendantsShareActions(PermissionNode startingPoint)
showHidden
.
allDescendantsShareActions
in interface PermissionDataNodeTreeView
startingPoint
- The root of the subtree to check.public java.util.Collection setPermissions(java.util.Collection permissions)
setPermissions
in interface PermissionDataNodeTreeView
permissions
- The Collection
of BasicAuthorizationPermission
s to set
(each contains the the resource and an AuthorizationAction.)
Collection
of DataNodeExceptions
s each containing
a resource name that was not found in the tree.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |