ARoad0.CNot
Class AccessControlLinkImpl

java.lang.Object
  extended by ARoad0.CNot.AccessControlLinkImpl
All Implemented Interfaces:
AccessControlLink, java.lang.Cloneable

public final class AccessControlLinkImpl
extends java.lang.Object
implements AccessControlLink, java.lang.Cloneable

This class is responsible for modeling the rights (and their justications) between two directly connected base objects. An access control link may be viewed as a set of rights with one or several types to say where they come from. The link state is defined by the gWork classes when they analyze the access paths in a view. The two base objects are not referenced in the access control link, but in the DisplayableLinkImpl class which manages a path of base objects and a list of access control links.

There are 20 link types, defined in the AccessControlLink interface. The link type value is typically true when there is a right which is defined for this link type, but the right is not always needed nor known when the value is true. The link type value may be true if it is a structural or pseudo-structural type, where there is a default static right or no right at all. However, the rights of all the types are managed in this class, except for the SPREAD type. Only the ACL and Privilege types may define negative rights, which are access forbiddings.

There are comments for each type link, and they may be set and ridden even when the link type value is false. Some comments are interpreted by the gWork package to display the access paths. They are AccessControlLink constants. Their roles are presented hereinafter:

- for GLOBAL, C_SECONDARY_GROUP tells it is a path link from an Actor to one of its secondary GroupID, with a context similar to the 'current account/group' context,

- for the OWNER and CONTAIN types, C_SET_USER, C_SET_GROUP and C_SET_USER_GROUP say that the AG context of execution is changed.

- for CONTAIN or GLOBAL, C_WEAK_LINK tells it is a path link from a GroupID without priority control from an UserID, and this produces a dashed-line arrow to display the access path in the view,

- for ACL and the Privilege types, C_CONTROL_OTHER_ACS tells an ACS controls another ACS, in the ACS views.

- the SPREAD comment is used to keep the summary of all the effective rights in the last AccessControlLink of each DisplayableLinkImpl. This is for the 'See Why' text. It is the responsibility of the method RightsFactory_Facade.getEffectiveRightsForPair().

- the GLOBAL comment is used to add the comment C_FIRST_RATE to drawn a double-with arrow in the view.

- the GLOBAL comment is used to add the comment C_COPIED_FROM_LINK to indicate, in the 'See Why' text, that some negative rights from other link(s) have been copied in this link.

There are 2 main methods to get a synthesis of all the rights in an AccessControlLink. The getRedondantRights method returns simply the concatenation of all the applicable rights, that is for all the activated link types. The getFilteredRights method returns also all the applicable rights, but it may provide a filtering of the negative and the positive rights, with some specific sets for the immutable rights.

Some AccessControlLinks are able to transfer the Account/Groups context. A first response is returned by the method isTransferingAGcontextWithoutACL(), that returns true when one of the following types is true: OWNER, CONTAIN, IS_MEMBER, IS_INDIRECT_MEMBER, HAS_VIRTUAL_MEMBER, IS_ALIAS, RUN_UNDER, SOFT_RUN_UNDER, LAUNCH. All the ACL provide such a transfert, in the generic algorithms. An ACS addon may change this behavior through its gWork.LinkRight implementation. This class is designed to provide fast methods for the gWork packages. The DisplayableLinkImpl constructors do not allow to add 2 objects that are equals. The equals() method is not implemented in this class.

See Also:
AccessControlLink, DisplayableLinkImpl

Field Summary
protected  boolean acl_
           
protected  java.lang.String aclComments_
           
protected  boolean bridge_
           
protected  java.lang.String bridgeComments_
           
protected  boolean contain_
           
protected  java.lang.String containComments_
           
protected  boolean dataExchange_
           
protected  java.lang.String dataExchangeComments_
           
protected  boolean global_
           
protected  java.lang.String globalComments_
           
protected  boolean hasChild_
           
protected  java.lang.String hasChildComments_
           
protected  boolean hasVirtualMember_
           
protected  java.lang.String hasVirtualMemberComments_
           
private static int INITIAL_CAPACITY
           
protected  boolean isAlias_
           
protected  java.lang.String isAliasComments_
           
protected  boolean isIndirectMember_
           
protected  java.lang.String isIndirectMemberComments_
           
protected  boolean isMember_
           
protected  java.lang.String isMemberComments_
           
protected  StringRight[] l_aclRights_
           
protected  StringRight[] l_bridgeRights_
           
protected  StringRight[] l_containRights_
           
protected  StringRight[] l_dataExchangeRights_
           
protected  StringRight[] l_globalRights_
           
protected  StringRight[] l_hasChildRights_
           
protected  StringRight[] l_hasVirtualMemberRights_
           
protected  StringRight[] l_isAliasRights_
           
protected  StringRight[] l_isIndirectMemberRights_
           
protected  StringRight[] l_isMemberRights_
           
protected  StringRight[] l_launchRights_
           
protected  StringRight[] l_linkedPrivRights_
           
protected  StringRight[] l_negAclRights_
           
protected  StringRight[] l_negLinkedPrivRights_
           
protected  StringRight[] l_negTypedPrivRights_
           
protected  StringRight[] l_ownerRights_
           
protected  StringRight[] l_runUnderRights_
           
protected  StringRight[] l_softRunUnderRights_
           
protected  StringRight[] l_typedPrivRights_
           
protected  boolean launch_
           
protected  java.lang.String launchComments_
           
protected  boolean linkedPriv_
           
protected  java.lang.String linkedPrivComments_
           
protected  boolean negAcl_
           
protected  java.lang.String negAclComments_
           
protected  boolean negLinkedPriv_
           
protected  java.lang.String negLinkedPrivComments_
           
protected  boolean negTypedPriv_
           
protected  java.lang.String negTypedPrivComments_
           
protected  boolean owner_
           
protected  java.lang.String ownerComments_
           
private static int PRIME
           
protected  boolean runUnder_
           
protected  java.lang.String runUnderComments_
           
private static long serialVersionUID__
           
protected  boolean softRunUnder_
           
protected  java.lang.String softRunUnderComments_
           
protected  boolean spread_
           
protected  java.lang.String spreadComments_
           
protected  boolean typedPriv_
           
protected  java.lang.String typedPrivComments_
           
 
Fields inherited from interface ARoad0.CNot.AccessControlLink
ACL, BRIDGE, C_CONDITIONAL_ACL, C_CONTROL_OTHER_ACS, C_COPIED_FROM_LINK, C_FIRST_RATE, C_INHERITED_ACL, C_INHERITED_AG, C_INHERITED_PRI, C_MAY_SET_USER_GROUP, C_RECEIVE_ALIAS_RIGHTS, C_SECONDARY_GROUP, C_SET_GROUP, C_SET_USER, C_WEAK_LINK, CONTAIN, DATA_EXCHANGE, GLOBAL, HAS_CHILD, HAS_VIRTUAL_MEMBER, IS_ALIAS, IS_INDIRECT_MEMBER, IS_MEMBER, LAUNCH, LPRI, NEG_ACL, NEG_LPRI, NEG_TPRI, NO_LESS_COMPLIANCE, NO_MORE_COMPLIANCE, OWNER, RUN_UNDER, SOFT_RUN_UNDER, SPREAD, TPRI
 
Constructor Summary
AccessControlLinkImpl()
           
 
Method Summary
 void addComment(java.lang.String _linkType, java.lang.String _comments)
          Adds a new comment to the current comments associated to a link type, if it is not already there.
 boolean addRight(java.lang.String _linkType, StringRight _right)
          Adds a new right to the current rights associated to a link type, and activates the link type if it is false.
 void addRightsArray(java.lang.String _linkType, StringRight[] _l_rights)
          Adds the rights associated to one link type, and )activates the link type if necessary.
 java.lang.Object clone()
          Gets a clone of the link.
 void finalizeForGui()
          Sets the rights to null.
 java.lang.String getActivatedStrengthenTypes()
          Gets the types (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, IS_ALIAS, RUN_UNDER) if they are activated, without any rights.
 java.util.Set getAllComments()
          Gets all the link type comments where the link type value is 'true'.
 java.util.Set getAllNegativeRights(boolean _withType)
          Gets all the link type negative rights where the link type value is activated.
static java.util.List<java.lang.String> getAllNegativeRightsTypes()
          Called by setRights().
 java.util.Set getAllPositiveRights(boolean _withType)
          Gets all the positive rights for which the link type is activated.
 java.util.Set[] getFilteredRights(int _immutableRange, boolean _withoutGroupInAGOrights, boolean _withoutOtherInAGOrights)
          Gets all the applicable rights, after a filtering of the negative and the positive rights, with some specific returned sets for the immutable rights.
 java.util.List<java.lang.String> getL_ActivatedPseudoStructuralTypes()
          Gets the AccessControlLink types (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, HAS_VIRTUAL_MEMBER, IS_ALIAS, RUN_UNDER, SOFT_RUN_UNDER, LAUNCH) if they are activated, without any rights.
 java.util.List<java.lang.String> getL_ActivatedStrengthenTypes()
          Gets the AccessControlLink types (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, IS_ALIAS, RUN_UNDER) if they are activated, without any rights.
 java.util.List<java.lang.String> getL_AllActivatedTypes()
          Gets all the AccessControlLink types that are activated, without any rights.
 java.lang.String getLinkTypeComments(java.lang.String _linkType)
          Gets the comments associated to one link type, if the link type value is true.
 boolean getLinkTypeValue(java.lang.String _linkType)
          Gets the state of activation for one link type.
 java.util.Set getRedondantRights()
          Gets all the link type rights where the link type value is activated.
 StringRight[] getRights(java.lang.String _linkType)
          Gets the rights associated to one link type, if the link type value is true.
 long getSerialVersionUID()
           
 int hashCode()
          Gets some right hashcodes without including the rights, nor the comments.
 boolean isEmpty()
          Processes the link type values only, not the comments nor the rights.
 boolean isFirstRateLink()
          Called by GraphicEPRView.hasFirstRateLinkInOneDLink().
 boolean isTransferingAGcontextWithoutACL()
          The Account/Group context of a node may be transfered along the next nodes of a DisplayableLinkImpl if the next AccessControlLinks are activated for some given types.
 boolean isTrueForOneAclLinkType()
          Called by Linux and CompoundRightsFactoryImpl.
 boolean isTrueForOneLinkType()
          NO USE.
 boolean isTrueForOneNegativeLinkType()
          Called by RightsFactory_Facade.getEffectiveRightsForPair()..
 boolean isTrueForOnePseudoStructuralLinkType()
          Gets the state of activation for (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, HAS_VIRTUAL_MEMBER, IS_ALIAS, RUN_UNDER, LAUNCH).
 boolean isTrueForOneStrengthenLinkType()
          Gets the state of activation for (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, IS_ALIAS, RUN_UNDER).
 boolean isTrueForOneStructuralLinkType()
          Gets the state of activation for (IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, IS_ALIAS).
 boolean isTrueForOwnerOrContainLinkType()
          Called by DisplayableLinkImpl.containsOwnerContainLinkTypes() and LinuxRightsFactoryImpl.addOtherRights()/detectOtherRights().
 boolean isWeak()
          True if this is the first link of a DisplayableLink from a GroupID to a Resource, to say that the effective rights depend on the AGO rights Actor which uses the link to this GroupID, and so this is a weak DisplayableLink.
 boolean mergeAccessControlLinkWithoutFiltering(AccessControlLinkImpl _acLink)
          Adds all the argument rights and comments in the rights and comments of this instance, for each activated type in the argument.
 void mergeCommentsWithoutFiltering(AccessControlLinkImpl _acLink)
          Adds all the argument comments to this instance comments, whatever the link type value in the argument and this instance.
 void mergeRightsForOneLinkType(java.lang.String _linkType, StringRight[] _l_rights)
          NO USE.
 void removeComment(java.lang.String _linkType, java.lang.String _comments)
          Removes all the instances of the comments associated to one link type if they exist.
 void removeRight(java.lang.String _linkType, StringRight _right)
          Removes a right associated to one link type if it exists, and desactivates the link type if it is the last right.
 void setEmpty()
          Sets the link type values to false, the rights to null and the comments to empty values.
 void setLinkTypeComments(java.lang.String _linkType, java.lang.String _comments)
          Sets the comments associated to one link type, whatever the link type value.
 void setLinkTypesWithoutFiltering(AccessControlLinkImpl _acLink)
          Sets all the link types with the _acLink link types.
 void setLinkTypeToFalse(java.lang.String _linkType)
          Desactivates a link type.
 void setLinkTypeToTrue(java.lang.String _linkType)
          Activates a link type.
 void setRights(java.lang.String _linkType, StringRight[] _rights)
          Sets the rights associated to one link type, and (des)activates the link type.
 java.lang.String toSeeWhyText()
          Returns the comments for all the type link values which are true, but not the rights.
 java.lang.String toString()
          Returns the comments for all the type link values which are true, but not the rights.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID__

private static final long serialVersionUID__
See Also:
Constant Field Values

PRIME

private static final int PRIME
See Also:
Constant Field Values

INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

global_

protected boolean global_

bridge_

protected boolean bridge_

acl_

protected boolean acl_

negAcl_

protected boolean negAcl_

owner_

protected boolean owner_

contain_

protected boolean contain_

spread_

protected boolean spread_

isMember_

protected boolean isMember_

hasChild_

protected boolean hasChild_

isIndirectMember_

protected boolean isIndirectMember_

hasVirtualMember_

protected boolean hasVirtualMember_

typedPriv_

protected boolean typedPriv_

negTypedPriv_

protected boolean negTypedPriv_

linkedPriv_

protected boolean linkedPriv_

negLinkedPriv_

protected boolean negLinkedPriv_

isAlias_

protected boolean isAlias_

runUnder_

protected boolean runUnder_

softRunUnder_

protected boolean softRunUnder_

dataExchange_

protected boolean dataExchange_

launch_

protected boolean launch_

l_globalRights_

protected StringRight[] l_globalRights_

l_bridgeRights_

protected StringRight[] l_bridgeRights_

l_aclRights_

protected StringRight[] l_aclRights_

l_negAclRights_

protected StringRight[] l_negAclRights_

l_ownerRights_

protected StringRight[] l_ownerRights_

l_containRights_

protected StringRight[] l_containRights_

l_isMemberRights_

protected StringRight[] l_isMemberRights_

l_hasChildRights_

protected StringRight[] l_hasChildRights_

l_isIndirectMemberRights_

protected StringRight[] l_isIndirectMemberRights_

l_hasVirtualMemberRights_

protected StringRight[] l_hasVirtualMemberRights_

l_typedPrivRights_

protected StringRight[] l_typedPrivRights_

l_negTypedPrivRights_

protected StringRight[] l_negTypedPrivRights_

l_linkedPrivRights_

protected StringRight[] l_linkedPrivRights_

l_negLinkedPrivRights_

protected StringRight[] l_negLinkedPrivRights_

l_isAliasRights_

protected StringRight[] l_isAliasRights_

l_runUnderRights_

protected StringRight[] l_runUnderRights_

l_softRunUnderRights_

protected StringRight[] l_softRunUnderRights_

l_dataExchangeRights_

protected StringRight[] l_dataExchangeRights_

l_launchRights_

protected StringRight[] l_launchRights_

globalComments_

protected java.lang.String globalComments_

bridgeComments_

protected java.lang.String bridgeComments_

aclComments_

protected java.lang.String aclComments_

negAclComments_

protected java.lang.String negAclComments_

ownerComments_

protected java.lang.String ownerComments_

containComments_

protected java.lang.String containComments_

spreadComments_

protected java.lang.String spreadComments_

isMemberComments_

protected java.lang.String isMemberComments_

hasChildComments_

protected java.lang.String hasChildComments_

isIndirectMemberComments_

protected java.lang.String isIndirectMemberComments_

hasVirtualMemberComments_

protected java.lang.String hasVirtualMemberComments_

typedPrivComments_

protected java.lang.String typedPrivComments_

negTypedPrivComments_

protected java.lang.String negTypedPrivComments_

linkedPrivComments_

protected java.lang.String linkedPrivComments_

negLinkedPrivComments_

protected java.lang.String negLinkedPrivComments_

isAliasComments_

protected java.lang.String isAliasComments_

runUnderComments_

protected java.lang.String runUnderComments_

softRunUnderComments_

protected java.lang.String softRunUnderComments_

dataExchangeComments_

protected java.lang.String dataExchangeComments_

launchComments_

protected java.lang.String launchComments_
Constructor Detail

AccessControlLinkImpl

public AccessControlLinkImpl()
Method Detail

getAllNegativeRightsTypes

public static java.util.List<java.lang.String> getAllNegativeRightsTypes()
Called by setRights().

Returns:
the types GLOBAL, NEG_ACL, NEG_LPRI and NEG_TPRI.

setLinkTypeToTrue

public void setLinkTypeToTrue(java.lang.String _linkType)
Activates a link type. Do nothing if the argument is not a link type. If the rights array is null, sets it as an empty array. Caution: the link type rights or comments are still empty.

Parameters:
_linkType - link type in AccessControlLink
See Also:
for the list of the link types

setLinkTypeToFalse

public void setLinkTypeToFalse(java.lang.String _linkType)
Desactivates a link type. Does nothing if the argument is not a link type. Is used for invalidating link type rights.

Parameters:
_linkType - is a link type in AccessControlLink
See Also:
for link types

getLinkTypeValue

public boolean getLinkTypeValue(java.lang.String _linkType)
Gets the state of activation for one link type.

Parameters:
_linkType - is a link type in AccessControlLink
Returns:
the activation state for the link type (if the argument is not a link type, return false).
See Also:
for link types

isTrueForOneLinkType

public boolean isTrueForOneLinkType()
NO USE.

Returns:
true if at least one link type value is set to 'true'.

isTrueForOneAclLinkType

public boolean isTrueForOneAclLinkType()
Called by Linux and CompoundRightsFactoryImpl.

Returns:
true if at least one ACL link type value (ACL, NEG_ACL) is activated.

isTrueForOneNegativeLinkType

public boolean isTrueForOneNegativeLinkType()
Called by RightsFactory_Facade.getEffectiveRightsForPair()..

Returns:
true if at least one negative ACL link type value (NEG_ACL, NEG_TPRI, NEG_LPRI) is activated.

isFirstRateLink

public boolean isFirstRateLink()
Called by GraphicEPRView.hasFirstRateLinkInOneDLink(). The GLOBAL type without activation is used to add the comment C_FIRST_RATE. This is used in a last link of a DisplayableLinkImpl in two cases:

- in the generic access path search, if there is a negative-right path (A to B) while there are two paths (A to C) and (C to B) which have positive rights, the path (A to B) is set as 'first-rate' to say the negative right is a prioritary one, and A cannot access to B through C.

- outside the generic access path search, in any AcsAddon where specific priorities are managed, like in the MySQL server AcsAddon.

Returns:
true if the GLOBAL type comment contains C_FIRST_RATE.

isTrueForOwnerOrContainLinkType

public boolean isTrueForOwnerOrContainLinkType()
Called by DisplayableLinkImpl.containsOwnerContainLinkTypes() and LinuxRightsFactoryImpl.addOtherRights()/detectOtherRights().

Returns:
true if at least one link type value (CONTAIN, OWNER) is activated.

isTrueForOnePseudoStructuralLinkType

public boolean isTrueForOnePseudoStructuralLinkType()
Gets the state of activation for (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, HAS_VIRTUAL_MEMBER, IS_ALIAS, RUN_UNDER, LAUNCH). They include the strengthen types, then the structural types. Called by RightsFactoryUtilities.isActivePath() and RightsFactory_Facade.getEffectiveRightsForPair().

Returns:
true if at least one link type is activated

isTrueForOneStructuralLinkType

public boolean isTrueForOneStructuralLinkType()
Gets the state of activation for (IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, IS_ALIAS). They are also pseudo-structural and strengthen types. Called by DisplayableLinkImpl.containsStructureLinkTypes() which is not used. Called by isTrueForOneStrengthenLinkType().

Returns:
true if at least one link type value is set to 'true'.

isTrueForOneStrengthenLinkType

public boolean isTrueForOneStrengthenLinkType()
Gets the state of activation for (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, IS_ALIAS, RUN_UNDER). They include the structural types. SOFT_RUN_UNDER is not a strengthen type. Called by DisplayableLinkImpl.containsStrengthenLinkTypes().

Returns:
true if at least one link type value is set to 'true'.

isTransferingAGcontextWithoutACL

public boolean isTransferingAGcontextWithoutACL()
The Account/Group context of a node may be transfered along the next nodes of a DisplayableLinkImpl if the next AccessControlLinks are activated for some given types. To allow this transfer, one of the following types has to be set to true: OWNER, CONTAIN, IS_MEMBER, IS_INDIRECT_MEMBER, HAS_VIRTUAL_MEMBER, IS_ALIAS, RUN_UNDER, SOFT_RUN_UNDER, LAUNCH. The relation ACL tranfers the AG context only for the internal ACL, and this cannot be set by this class. The privilege types do not transfer the AG context in this core method, but an AcsAddon implementation of LinkRight may change this behavior. Called by LinkRightsImpl.isTransferingAGcontext().

Returns:
true if at least one of the relevant link type value is activated.
See Also:
LinkRightsImpl.isTransferingAGcontext(ARoad0.CNot.AccessControlLinkImpl, ARoad0.gBaseInterface.ImmutableACS, ARoad0.gBaseInterface.ImmutableACS)

getRedondantRights

public java.util.Set getRedondantRights()
Gets all the link type rights where the link type value is activated. The rights are strings and are not redundant for each link type, but may be redundant over the link types of the same DisplayableLink. In other words, there are never two 'execute' rights for one same type, but it is possible to has it both for ACL and CONTAIN for instance. Calls getAllNegativeRights() and getAllPositiveRights().

Returns:
Set of StringRights. May be empty but not null.
See Also:
for link types

getFilteredRights

public java.util.Set[] getFilteredRights(int _immutableRange,
                                         boolean _withoutGroupInAGOrights,
                                         boolean _withoutOtherInAGOrights)
Gets all the applicable rights, after a filtering of the negative and the positive rights, with some specific returned sets for the immutable rights. For each returned set, there is no filtering of the headers. There is no SPREAD rights. The 'Other rights' in AGO rights are managed by GLOBAL rights, and GLOBAL that may be also used for 'current account/group', 'ext-acl' or 'bridge'. Called by DisplayableLinkUtilities.getEffectiveRightsAndCommentOnRights().

Parameters:
_immutableRange - is 0 if there is no right to put in the two immutable sets (unused),

1 if only owner rights are to put in the two immutable sets,

2 if owner and structural rights are to be get as immutable (unused),

3 if owner, structural, bridge and data_exchange rights are to be get as immutable (unused).

_withoutGroupInAGOrights - true if the CONTAIN rights are not returned, and false to return it
_withoutOtherInAGOrights - true if the 'Other rights' in AGO rights are not returned, and false to return it.
Returns:
four Set of StringRights: the immutable positive ones at the index 0, the immutable negative ones at the index 1, the other positive rights at 2, and the other negative ones at 3. May contain empty sets, but the array and its 4 values are never null.

getActivatedStrengthenTypes

public java.lang.String getActivatedStrengthenTypes()
Gets the types (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, IS_ALIAS, RUN_UNDER) if they are activated, without any rights. Called by GraphicEPRView.buildUpArrowsAndRights().

Returns:
the strengthen types. May be empty but not null.
See Also:
for the link types

getL_ActivatedStrengthenTypes

public java.util.List<java.lang.String> getL_ActivatedStrengthenTypes()
Gets the AccessControlLink types (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, IS_ALIAS, RUN_UNDER) if they are activated, without any rights. Called by getL_ActivatedPseudoStructuralTypes(), GraphicEPRView.buildUpArrowsAndRights() DisplayableLinkImpl.containsStrengthenLinkTypes() and RightsFactory_Facade.getEffectiveRightsForPair().

Returns:
the activated strengthen types. May be empty but not null.
See Also:
for the link types

getL_ActivatedPseudoStructuralTypes

public java.util.List<java.lang.String> getL_ActivatedPseudoStructuralTypes()
Gets the AccessControlLink types (OWNER, IS_MEMBER, HAS_CHILD, IS_INDIRECT_MEMBER, HAS_VIRTUAL_MEMBER, IS_ALIAS, RUN_UNDER, SOFT_RUN_UNDER, LAUNCH) if they are activated, without any rights. Calls getL_ActivatedStrengthenTypes(). Called by RightsFactory_Facade.getEffectiveRightsForPair().

Returns:
the activated types. May be empty but not null.
See Also:
for the link types

getL_AllActivatedTypes

public java.util.List<java.lang.String> getL_AllActivatedTypes()
Gets all the AccessControlLink types that are activated, without any rights. Calls getL_ActivatedPseudoStructuralTypes(). Called by CompoundRightsFactoryImpl.

Returns:
the activated types. May be empty but not null.
See Also:
for the link types

getAllPositiveRights

public java.util.Set getAllPositiveRights(boolean _withType)
Gets all the positive rights for which the link type is activated. The rights are not redundant for each link type, but may be redundant over the link types of the same DisplayableLink. In other words, there are never two executing rights for one same type, but it is possible to have it both for ACL and for CONTAIN. There is no SPREAD rights.

Parameters:
_withType - true to have the link type at the beginning of the rights list for each type, in the returned Set
Returns:
Set of StringRights, in any order. May be empty but not null.
See Also:
for link types

getAllNegativeRights

public java.util.Set getAllNegativeRights(boolean _withType)
Gets all the link type negative rights where the link type value is activated. The rights are not redundant for each link type, but may be redundant over the link types of the same DisplayableLink. In other words, there are never two 'no executing' rights for one same type, but it is possible to have it both for NEG_ACL and for NEG_LPRI.

Parameters:
_withType - true to have the link type at the beginning of the rights list for each type, in the returned Set
Returns:
Set of StringRights, in any order. May be empty but not null.
See Also:
for link types

getAllComments

public java.util.Set getAllComments()
Gets all the link type comments where the link type value is 'true'. If addLinkTypeComments() has been used, the comments are separated by spaces in each comments type. Note: The comments are strings and are not redundant for each link type and over all the link types. This a quite slow method.

Returns:
Set of String comments. May be empty.
See Also:
for link types

getRights

public StringRight[] getRights(java.lang.String _linkType)
Gets the rights associated to one link type, if the link type value is true. The SPREAD rights are not ridden by this method. Called by AclRightsFactoryImpl.addACLRightsInDisplayableLink() and CompoundRightsFactoryImpl.detectOneHiddenNodeCompoundRights() for GLOBAL and ACL.

Parameters:
_linkType - is a link type in AccessControlLink
Returns:
a copy of the rights or an empty array. Never null.
See Also:
for link types

getLinkTypeComments

public java.lang.String getLinkTypeComments(java.lang.String _linkType)
Gets the comments associated to one link type, if the link type value is true.

Parameters:
_linkType - is a link type in AccessControlLink. If not, return "".
Returns:
comments or ""
See Also:
for link types

setLinkTypeComments

public void setLinkTypeComments(java.lang.String _linkType,
                                java.lang.String _comments)
Sets the comments associated to one link type, whatever the link type value. No action if _linkType is not a link type, or if _comments is null. Operates even if the link type is not activated, but to be in the getAllComments() returned value, the link type value must be activated. The SPREAD type is reserved to the last AccessControlLinkImpl of a DisplayableLinkImpl. The GLOBAL type without activation is used to add the comment C_FIRST_RATE.

Parameters:
_linkType - is a link type in AccessControlLink
_comments - may be ""
See Also:
for link types

addRightsArray

public void addRightsArray(java.lang.String _linkType,
                           StringRight[] _l_rights)
Adds the rights associated to one link type, and )activates the link type if necessary. No action on comments. The null, empty or desactivated rights are not added. No action if _linkType is not a link type, if _rights is null or empty, and for the structure links. Controls the redondances among the rights. Only the types GLOBAL, NEG_ACL, NEG_LPRI and NEG_TPRI may have negative rights, and the third last ones cannot have positive rights. The SPREAD type is forbidden, since it is reserved to comments only.

Parameters:
_linkType - is a link type in AccessControlLink, excepted SPREAD
_l_rights - may be null, new StringRight[0], or an array of non-null elements.
Throws:
java.lang.InternalError - if the sens of a right does not comply to the link type policy, or if SPREAD is the link type
See Also:
for link types

setRights

public void setRights(java.lang.String _linkType,
                      StringRight[] _rights)
Sets the rights associated to one link type, and (des)activates the link type. If the rights argument is null or empty, the link type is desactivated. No action on comments. The null, empty or desactivated rights are not added. No action if _linkType is not a link type, if _rights is null or empty, and for the structure links. No control of the redondances among the rights. Only the types GLOBAL, NEG_ACL, NEG_LPRI and NEG_TPRI may have negative rights, and the third last ones cannot have positive rights. The SPREAD type is forbidden, since it is reserved to comments only.

Parameters:
_linkType - is a link type in AccessControlLink, excepted SPREAD
_rights - may be null, new StringRight[0], or an array of non-null elements.
Throws:
java.lang.InternalError - if the sens of a right does not comply to the link type policy, or if SPREAD is the link type
See Also:
for link types

mergeRightsForOneLinkType

public void mergeRightsForOneLinkType(java.lang.String _linkType,
                                      StringRight[] _l_rights)
NO USE. Merges the current rights (which may be empty) and the new rights. No redondance in the result. Quite slow method which calls getRights() and setRights().

Parameters:
_linkType - is a link type in AccessControlLink.
_l_rights - are the rights to add. May be empty, but not null.
See Also:
for link types

addRight

public boolean addRight(java.lang.String _linkType,
                        StringRight _right)
Adds a new right to the current rights associated to a link type, and activates the link type if it is false. No action if _linkType is not a link type, if _right is null, empty or already known. The link type state is activated. Optimized to be a fast method.

Parameters:
_linkType - is a link type in AccessControlLink
_right - to add
Returns:
true if the argument has been addded to, and false otherwise, including when the right is null or has a sens which does not comply to the link type policy
See Also:
for link types

addComment

public void addComment(java.lang.String _linkType,
                       java.lang.String _comments)
Adds a new comment to the current comments associated to a link type, if it is not already there. The new comments are added to the current ones after a space. No action if _linkType is not a link type, if _comments is null, empty, or already known. Caution: the link type state is not controlled, and it is not activated by this method.

Parameters:
_linkType - is a link type in AccessControlLink
_comments - to add
See Also:
for link types

removeRight

public void removeRight(java.lang.String _linkType,
                        StringRight _right)
Removes a right associated to one link type if it exists, and desactivates the link type if it is the last right. No action if _linkType is not a link type, if _right is null, empty or unknown. Not optimized to be a fast method.

Parameters:
_linkType - is a link type in AccessControlLink
_right - to remove
See Also:
for link types

removeComment

public void removeComment(java.lang.String _linkType,
                          java.lang.String _comments)
Removes all the instances of the comments associated to one link type if they exist. The link type state is not controlled, and it is never changed. Not optimized to be a fast method.

Parameters:
_linkType - is a link type in AccessControlLink; No action if _linkType is not a link type, if _commenst is unknown.
_comments - to remove one or several times; no action if null or empty.
See Also:
for link types

mergeAccessControlLinkWithoutFiltering

public boolean mergeAccessControlLinkWithoutFiltering(AccessControlLinkImpl _acLink)
Adds all the argument rights and comments in the rights and comments of this instance, for each activated type in the argument. If the link type is desactivated in the argument, there is no adding of rights nor comments. If the link type value is activated and the link type rights are empty, there is generally no adding of comments, but the exception is for BRIDGE, where the comments are then added. Optimized to be a fast method. Called by DisplayableLinkImpl.mergeRightsWithoutFiltering() and CompoundRightsFactoryImpl.detectHiddenCompoundEpRights().

Parameters:
_acLink - to merge
Returns:
boolean true if one _acLink right has been added to (comment addings are not taken in account)

mergeCommentsWithoutFiltering

public void mergeCommentsWithoutFiltering(AccessControlLinkImpl _acLink)
Adds all the argument comments to this instance comments, whatever the link type value in the argument and this instance. Optimized to be a fast method. Called by DisplayableLinkImpl.mergeCommentsWithoutFiltering().

Parameters:
_acLink - a link with comments to put in this link

setLinkTypesWithoutFiltering

public void setLinkTypesWithoutFiltering(AccessControlLinkImpl _acLink)
Sets all the link types with the _acLink link types.

Parameters:
_acLink - is an AccessControlLinkImpl to copy

isWeak

public boolean isWeak()
True if this is the first link of a DisplayableLink from a GroupID to a Resource, to say that the effective rights depend on the AGO rights Actor which uses the link to this GroupID, and so this is a weak DisplayableLink. A link which is based on non-AGO rights is never weak. Note: the link may be weak through an AGO other relation from a group, and then there is no contain relation.

Returns:
true if the contain or the global comments include AccessControlLink.WEAK_LINK, even if the type is not activated.

isEmpty

public boolean isEmpty()
Processes the link type values only, not the comments nor the rights.

Returns:
true if all link type values are desactivated

clone

public java.lang.Object clone()
Gets a clone of the link. Called by DisplayableLinkImpl.valueOf().

Overrides:
clone in class java.lang.Object
Returns:
a cloned and no-backed instance.
Throws:
java.lang.CloneNotSupportedException

hashCode

public int hashCode()
Gets some right hashcodes without including the rights, nor the comments. Uses only 10 types upon 20.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode value for this instance. May be 3768901 if empty.

finalizeForGui

public void finalizeForGui()
Sets the rights to null.


setEmpty

public void setEmpty()
Sets the link type values to false, the rights to null and the comments to empty values.


getSerialVersionUID

public long getSerialVersionUID()
Returns:
long serial version UID for a future serialization of the class

toSeeWhyText

public java.lang.String toSeeWhyText()
Returns the comments for all the type link values which are true, but not the rights. In RightsFactory_Facade.getEffectiveRightsForPair(), the SPREAD comment (starting with 'All Rights:') is used in the last link of a DisplayableLink, to show the list of all the effective rights before the rights subtraction. This is why the SPREAD comment is returned after the other comments. The GLOBAL comment is used for delivering general comments, like for an AclEntry from another ACS or a conditional AclEntry. It is put just before the SPREAD comment. Optimized to be a fast method. Called by gWork.FactoryUtilities.getXXXWhyText() for each AccesControlLink in each DisplayableLink in the 'See Why' text.

Returns:
text for the 'See why' information

toString

public java.lang.String toString()
Returns the comments for all the type link values which are true, but not the rights. In RightsFactory_Facade.getEffectiveRightsForPair(), the SPREAD comment is used in the last link of a DisplayableLink to get the list of the effective rights in the DisplayableLinkImpl. Called by DisplayableLinkImpl.toString().

Overrides:
toString in class java.lang.Object
Returns:
String