|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectARoad0.CNot.DisplayableLinkImpl
public final class DisplayableLinkImpl
This class is responsible for modeling a displayable link that manages a path of base objects connected through AccessControlLinkImpls. Typically, it is associated to an item in a graphical view (an arrow or a line for instance) between two view objects. A displayable link manages a chain of nodes where there is one node for one base object. It manages also the access control links between nodes, defining the paths. The results in the right searching for a view are put by the gWork classes in DisplayableLinkImpl instances. They may be seen as a dynamic data base of the access paths in the open views. They are ridden both to get the effective rights and to directly generate the 'See Why' text of the view.
A displayable link may be simple - it contains then only the 2 base objects as ends and one link between them - or it may be a chain of n base objects (or nodes) with n-1 links. In this last case, the intermediate base objects are often hidden, if it is for a view. The two ends are always immutable. They can't be changed in the displayable link, but it is possible to create a new link from a previous link with the static method valueOf().
An internal list contains the chain of BaseObjects and AccessControlLinks which defines the DisplayableLink. Usually, the intermediate BaseObjects are ImmutableSources: Actors, GroupIDMembers, VirtualFolders. The possible sizes of the internal vector is 3, 5, 7... Its structure is designed to add easily a link or a node without changing of the ends. It is:
- 0: first end,
- 1: second end,
- 2: first access control link between the first end and its next node (which is the second end if the displayable link is simple),
- 3: first intermediate node if the displayable link is not simple,
- 4: second access control link between the first intermediate node and the second intermediate node, if it exists, or the second end if the path has 3 nodes.
- ...
Some general properties are defined for a DisplayableLinkImpl in a map. The first use is the 2 map keys AG_CONTEXT_NODE_POSITION and AG_CONTEXT_SET, for the Account/Groups context of the link. The AG context is a set of GroupIDMembers that may contain, first, an optional couple (UserID, GroupID), and, second, a list of optional GroupIDs. AG_CONTEXT_NODE_POSITION is the index of a node in the DislayableLinkImpl for which there is a defined Account/Groups context. The key AG_CONTEXT_SET returns a couple (UserID, GroupID) the node at AG_CONTEXT_NODE_POSITION may use as Account/Main_Group context. The key AG_CONTEXT_SET may also return complementary groups.
The links depend on the varied ACS which are implied in the view, and also may depend on some ACS not implied in the view but which control some intermediate base objects. A displayable link is not always displayed in a view. For instance, it may contain a right between two objects which is deleted by a stronger right in another displayable link containing the same objects.
AccessControlLinkImpl
,
DisplayableLinkUtilities.getEffectiveRightsAndCommentOnRights(ARoad0.CNot.DisplayableLinkImpl, boolean)
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
AG_CONTEXT_NODE_POSITION
Key of l_properties_ where the value is the position of the node having the AG context set in AG_CONTEXT_SET. |
static java.lang.String |
AG_CONTEXT_SET
Key of l_properties_ where the value is the Set of (O to 1) UserId and (0 to N) GroupIDs that defines the Account/Groups context of the node given by the key AG_CONTEXT_NODE_POSITION. |
protected static int |
INITIAL_CAPACITY
|
protected java.util.Map<java.lang.String,java.lang.Object> |
m_properties_
This map describes the general properties of the DisplayableLinkImpl. |
private static int |
PRIME
|
static java.io.ObjectStreamField[] |
serialPersistentFields
standardized variable for the JDK 2 serialization |
private static long |
serialVersionUID__
|
protected java.util.ArrayList |
vector_
This list contains the chain of BaseObjects and AccessControlLinks which defines the DisplayableLink. |
Constructor Summary | |
---|---|
DisplayableLinkImpl()
|
|
DisplayableLinkImpl(java.util.ArrayList _components)
Used by valueOf(). |
|
DisplayableLinkImpl(BaseObject _firstEnd,
BaseObject _secondEnd,
AccessControlLinkImpl _link)
|
|
DisplayableLinkImpl(BaseObject _firstEnd,
BaseObject _secondEnd,
BaseObject[] _path)
Returns instance of a displayable link with empty AccessControlLinks. |
Method Summary | |
---|---|
void |
addEorNode(int _index,
BaseObject _newNode,
AccessControlLinkImpl _firstLink,
AccessControlLinkImpl _secondLink)
Adds a node at the position _index with its two AccessControlLinkImpl. |
java.lang.Object |
addProperty(java.lang.String _key,
java.lang.Object _value)
Sets a new value for a known key or a new key. |
java.lang.Object |
clone()
Gets a clone of a displayable link, with a shallow copy of each node and value in the properties map, and a deep copy of each AccessControlLink. |
boolean |
contains2NodesSequenceAndFirstEnd(BaseObject[] _l_sequence,
BaseObject _firstEnd)
Detects the presence of a sequence of 2 nodes in this instance, in the same order, for a given first end. |
boolean |
contains3NodesSequence(BaseObject[] _l_sequence)
Detects the presence of a sequence of 3 nodes in this instance, in the same order. |
boolean |
containsAclLinkTypes()
Tests if each of its AccessControlLinks has a ACL or NEG_ACL relation. |
boolean |
containsBaseObject(BaseObject _obj)
|
boolean |
containsOwnerContainLinkTypes()
Tests if each of its AccessControlLinks has a OWNER or CONTAIN relation. |
boolean |
containsPseudoStructuralLinkTypes()
No use. |
boolean |
containsRight(StringRight _right)
Tests if a right is in any AccessControlLink in this instance, through the use of AccessControlLinkImpl.getRedondantRights(). |
boolean |
containsStrengthenLinkTypes()
GraphicEPRView displays a strengthen relation as a line, not an arrow. |
boolean |
containsStructureLinkTypes()
NO USE. |
boolean |
equals(java.lang.Object _obj)
Two DisplayableLinkImpls are equals if and only if the sequences of nodes are identical, and all the nodes are identical, and not simply equal. |
void |
finalizeForGui()
Finalizes the AccessControlLinkImpl associated to this instance, and clears the list vector_. |
java.util.List<java.lang.Integer> |
getAclLinkTypePositions()
Gets the positions in getEorAllACLinks(), if any, of the AccessControlLinks having the types ACL or NEG_ACL. |
java.util.List<java.lang.Integer> |
getContainLinkTypePositions()
Gets the positions in getEorAllACLinks(), if any, of the AccessControlLinks having the type CONTAIN. |
AccessControlLinkImpl[] |
getEorAllACLinks()
Gets an array of all the AccessControlLinkImpl in this DisplayableLinkImpl. |
BaseObject[] |
getEorAllNodes()
Returns a sorted array of all the nodes, including the first end at the index 0 and the second end at the end of the array. |
AccessControlLinkImpl[] |
getEorConnectedLinks(BaseObject _obj)
Gets the 2 AccessControlLinks connected to a BaseObject which this DisplayableLinkImpl contains. |
BaseObject[] |
getEorConnectedNodes(AccessControlLinkImpl _link)
|
BaseObject |
getEorFirstEnd()
|
AccessControlLinkImpl |
getEorFirstLink()
If the instance is simple, return the single aclink. |
ImmutableActor |
getEorLastActorInPath()
The path contains all the intermediate nodes between the two ends. |
AccessControlLinkImpl |
getEorLastLink()
If the instance is simple, returns the single aclink. |
ImmutableVirtualFolder |
getEorLastVirtualFolderInPath()
The path contains all the intermediate nodes between the two ends. |
BaseObject |
getEorNodeJustBeforeTheSecondEnd()
|
BaseObject[] |
getEorNodesPath()
Note: getEorAllNodes() is a little bit faster. |
BaseObject |
getEorSecondEnd()
|
java.util.List<java.lang.Integer> |
getNegativeAclLinkTypePositions()
Gets the positions in getEorAllACLinks(), if any, of the AccessControlLinks having the type NEG_ACL. |
java.util.List<java.lang.Integer> |
getOwnerLinkTypePositions()
Gets the positions in getEorAllACLinks(), if any, of the AccessControlLinks having the type OWNER. |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Gets the general properties of this DisplayableLinkImpl. |
long |
getSerialVersionUID()
|
int |
hashCode()
Based on the hashCode nodes. |
java.util.List |
immutableComponents()
|
int |
indexOfBaseObject(BaseObject _obj)
Returns the position of the BaseObject as node returned in getEorAllNodes(). |
boolean |
isEmpty()
|
boolean |
isSimple()
|
boolean |
isWeak()
|
boolean |
mergeCommentsWithoutFiltering(DisplayableLinkImpl _dLink)
If the argument has the same ends and the same path, adds all the comments in the _dLink AccessControlLinks to the relevant AccessControlLinks of this instance, whatever the link type values in each AccessControlLink. |
java.lang.String |
mergeGlobalComments()
Merges all the GLOBAL comments in the AccessControlLinks of this instance. |
boolean |
mergeRightsWithoutFiltering(DisplayableLinkImpl _dLink)
If the argument has the same ends and the same path, and for the activated AccessControlLink types, adds all the rights and the comments of the argument to the relevant AccessControlLinks of this instance. |
int |
noOfComponents()
|
int |
noOfNodes()
Returns the number of nodes, including the first and the second ends. |
java.lang.Object |
removeProperty(java.lang.String _key)
Removes a known key. |
java.lang.String |
toString()
Returns the list of the nodes and links between them, where the two first objects are the first end and the second end. |
static DisplayableLinkImpl |
valueOf(DisplayableLinkImpl _dLink,
BaseObject _secondEnd,
AccessControlLinkImpl _lastLink)
To create a new DisplayableLinkImpl, extends a current DisplayableLinkImpl _dLink to which, after a deep copy, a new node is added as the new second end. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID__
private static final int PRIME
protected static final int INITIAL_CAPACITY
public static final java.lang.String AG_CONTEXT_SET
public static final java.lang.String AG_CONTEXT_NODE_POSITION
protected java.util.ArrayList vector_
- 0: first end,
- 1: second end,
- 2: first access control link between the first end and its next node (which is the second end if the displayable link is simple),
- 3: first intermediate node if the displayable link is not simple,
- 4: second access control link between the first intermediate node and the second intermediate node, if it exists, or the second end if the path has 3 nodes.
- ...
protected java.util.Map<java.lang.String,java.lang.Object> m_properties_
public static final java.io.ObjectStreamField[] serialPersistentFields
Constructor Detail |
---|
public DisplayableLinkImpl()
public DisplayableLinkImpl(java.util.ArrayList _components)
_components
- is copied without detailled controls on its structure
java.lang.InternalError
- if _components is null, or if one node or one aclink is null
or duplicatedpublic DisplayableLinkImpl(BaseObject _firstEnd, BaseObject _secondEnd, AccessControlLinkImpl _link)
_firstEnd
- is a non-null BaseObject as the first end of the displayable link.
It is not copied._secondEnd
- is a non-null BaseObject as the second end of the displayable link.
It is not copied._link
- is a non-null first AccessControlLinkImpl
java.lang.InternalError
- if one parameter is null or a duplicatepublic DisplayableLinkImpl(BaseObject _firstEnd, BaseObject _secondEnd, BaseObject[] _path)
_firstEnd
- is a non-null BaseObject as the first end of the displayable link.
It is not copied._secondEnd
- is a non-null BaseObject as the second end of the displayable link.
It is not copied._path
- is an array of BaseObjects which are the intermediate nodes
of the displayable link. May be null, but if not, each _path item must be non-null
without duplication over the nodes.
java.lang.InternalError
- if a BaseObject is null or a duplicateMethod Detail |
---|
public static final DisplayableLinkImpl valueOf(DisplayableLinkImpl _dLink, BaseObject _secondEnd, AccessControlLinkImpl _lastLink)
_secondEnd
- to add at the end of _dLink to define a new second end. Never null._lastLink
- to put before _secondEnd in the new DisplayableLinkImpl. Never null.
java.lang.InternalError
- if one parameter is null.public boolean isEmpty()
public boolean isSimple()
public boolean isWeak()
public BaseObject getEorFirstEnd()
public BaseObject getEorSecondEnd()
public BaseObject getEorNodeJustBeforeTheSecondEnd()
public AccessControlLinkImpl getEorFirstLink()
public AccessControlLinkImpl getEorLastLink()
public BaseObject[] getEorAllNodes()
public BaseObject[] getEorNodesPath()
public AccessControlLinkImpl[] getEorAllACLinks()
public ImmutableActor getEorLastActorInPath()
public ImmutableVirtualFolder getEorLastVirtualFolderInPath()
public java.util.List immutableComponents()
public int noOfComponents()
public int noOfNodes()
public boolean containsBaseObject(BaseObject _obj)
_obj
- BaseObject
public int indexOfBaseObject(BaseObject _obj)
_obj
- BaseObject
public boolean contains3NodesSequence(BaseObject[] _l_sequence)
_l_sequence
- array of 3 non-null nodes. Never null.
public boolean contains2NodesSequenceAndFirstEnd(BaseObject[] _l_sequence, BaseObject _firstEnd)
_l_sequence
- array of 2 non-null nodes. Never null. Return false if the array
has not a lenght of 2._firstEnd
- first end
public boolean containsRight(StringRight _right)
_right
- to test
public boolean containsPseudoStructuralLinkTypes()
public boolean containsStructureLinkTypes()
public boolean containsStrengthenLinkTypes()
public boolean containsOwnerContainLinkTypes()
public boolean containsAclLinkTypes()
public java.util.List<java.lang.Integer> getOwnerLinkTypePositions()
public java.util.List<java.lang.Integer> getContainLinkTypePositions()
public java.util.List<java.lang.Integer> getAclLinkTypePositions()
public java.util.List<java.lang.Integer> getNegativeAclLinkTypePositions()
public AccessControlLinkImpl[] getEorConnectedLinks(BaseObject _obj)
_obj
- is in this displayable link
public BaseObject[] getEorConnectedNodes(AccessControlLinkImpl _link)
_link
- is in this displayable link
public void addEorNode(int _index, BaseObject _newNode, AccessControlLinkImpl _firstLink, AccessControlLinkImpl _secondLink)
_index
- int where to add _newNode. Can't be 0 nor pair._newNode
- BaseObject to add to this displayable link_firstLink
- AccessControlLinkImpl to put between _newNode and the node
at _index - 2_secondLink
- AccessControlLinkImpl to put between _newNode and the node
at _index + 2, which was at _index before the add operation
java.lang.InternalError
- if _index is null or pair, if _newNode is known.public boolean mergeRightsWithoutFiltering(DisplayableLinkImpl _dLink)
_dLink
- to merge
java.lang.InternalError
- in _dLink has not the same path,
if an end is not the same.AccessControlLinkImpl.mergeAccessControlLinkWithoutFiltering(ARoad0.CNot.AccessControlLinkImpl)
public boolean mergeCommentsWithoutFiltering(DisplayableLinkImpl _dLink)
_dLink
-
java.lang.InternalError
- in _dLink has not the same path,
if an end is not the same.public java.lang.String mergeGlobalComments()
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
AG_CONTEXT_NODE_POSITION is the index of a node in the DislayableLinkImpl for which there is a defined Account/Groups context. The key AG_CONTEXT_SET returns a couple (UserID, GroupID) the node at AG_CONTEXT_NODE_POSITION may use as Account/Main_Group context. The key AG_CONTEXT_SET may also return complementary groups. The UserID is generally, but not only, given by the last UserID node in the DisplayableLinkImpl that is the source for an AccessControlLink with the types OWNER. The UserID is get through a chain of links that transfers the AG context. The GroupID is given by the last GroupID node in the DisplayableLinkImpl that is the source for an AccessControlLink with the types CONTAIN, and through a chain of links that transfers the AG context.
The list of GroupIDs depends on the node giving its proper context, if the chain of links transfers the AG context. If the first end is a GroupIDMember, the list contains the groups to which this GroupIDMember is member, if any. If the first end is an Actor, the list may contain the secondary groups of this Actor, if any. If the chain of links does not transfer the first end AG context, the list of GroupIDs is the secondary groups of the last intermediate Actor starting from no previous transfered AG context. The values in the retured map may be an ImmutableName, an Integer, a HashSet, an ArrayList or anything else.
DisplayableLinkUtilities.getSecondEndAGcontext(ARoad0.CNot.DisplayableLinkImpl)
,
LinkRightsImpl.setNextNodeAGrunningContext(ARoad0.CNot.DisplayableLinkImpl, int)
public java.lang.Object addProperty(java.lang.String _key, java.lang.Object _value)
_key
- the key for the new property_value
- the new value may be a Name, a Set or another object
DisplayableLinkUtilities.getSecondEndAGcontext(ARoad0.CNot.DisplayableLinkImpl)
public java.lang.Object removeProperty(java.lang.String _key)
_key
- the key for the property to remove
public java.lang.Object clone()
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public boolean equals(java.lang.Object _obj)
equals
in class java.lang.Object
_obj
- the object to compare
public int hashCode()
hashCode
in class java.lang.Object
public void finalizeForGui()
public long getSerialVersionUID()
public java.lang.String toString()
tom |localhost| ACL: EXECU; (
to desccribe a link where the suite of 3 nodes is ('tom', 'Amounts view alias', '|localhost|'),
where the first AccessControlLink from 'tom' to 'Amounts view alias' is
described by 'ACL: EXECU; (
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |