ARoad0.gBase
Class StringRightImpl

java.lang.Object
  extended by ARoad0.gBase.StringRightImpl
All Implemented Interfaces:
BaseObject, BoundBean, FinalizedObject, FinalizedObjectForUser, StringRight, java.io.Serializable, java.lang.Comparable

public final class StringRightImpl
extends java.lang.Object
implements StringRight

This class is responsible for managing a right. A right is defined without connection to the user right and the access target. This connection is the role of the right categories as AGO rights or ACL rights for instance. There are two types of rights, the canonical metarights, outside any ACS, and the ACS rights:

- this class manages the ACS rights, registered in their ACSRun,

- this class manages also the embedded right including in a generic or metaright.

Each ACS right has a metaright as equivallent which is a StringMetaRightImpl, subclass of StringRightImpl. The generic right is used to compare rights from different ACS, and to explain precisely the ACS right semantic.

The two types of right may be classed, that is associated to a target class, or ACS right only may be typed, that is associated to a type in a target class. If an ACS right is classed, it is also the generic right class. If it is typed, it is always classed. For a generic right, the class isnot added at the end of the kernel right. For an ACS right, the class and the type are added at the end of the kernel right.

For instance, in LCA Lotus Notes, 'read_javascript' is a typed right for the target class Actor, where 'javascript' is a type of Actor. When a right is classed or typed, the class and the type may be superior to the right container (AGO, ACL, PRI, BDG) specification, or may be inferior, and this is specified by the ACS policy. For instance, if an ACL has an actor as target, and if it uses a classed right where the target class is Directory, then the ACL will be effective only if its ACS sets that the ACL specification is superior to the right class (Directory, there). The ACS may also set that both specifications are applicable if they are compatible, and if not, they are forgotten.

There are several levels of right handling in the program:

- the generic or ACS right contains the semantic of a granting or a denying,

- the ACS defines the set of authorized generic/acs rights for each right category, plus some subsets managed in the specialized rights,

- the ACS right category like AGO rights, ACL rights,... handle a form of connection between a right user, a generic/acs right, and an access target,

- the right realization is the expression of a right category through the filter of ACS rules and inter-ACS applicable adaptors,

- the AccessControlLink is the set of all the right realizations between two nodes of an access path in an information system,

- the access path is a collection of AccessControlLinks from an user right to an access target, and it is handles by a DisplayableLinkImpl,

- the effective rights of an access path are the expression of the right categories through the filter of ACS rules and inter-ACS applicable adaptors.

The right handles the links to the upper and lower rights in a rights network, allowing to compare them. Each ACS has a rights network, somtimes a very simple one. There is also one metarights network. The next upper and lower rights are managed, including the synchronization from the lower rights when the link is updated. So, the upper rights are updated when they are unregistered in the lower rights. There are at most 5 upper rights.

A two-levels right (in Windows for instance) is managed as one parent right which has a detailled description in a set of lower rights. The parent is the unique upper right of these slave rights. Multi-level rights is a generalization where a right is both a parent and a slave. Some rights set may have these tree structure (it is not a network) without be marked as multi-level rights.

A right may be desactivated, and then it is not used by the program in the search of access paths.

It is possible to use a quite empty right when only the getRight() method is needed: use then the constructor with a null ACS, the right and an empty metaright, and use finalizeForUser() at the end. A right may be conditional, and it is then used in an AclEntry to activate it when the condition criterion is fulfilled. The criterion is to be membership to one or several groups. These groups are defined in the kernel right with the separator <IF> before each last component of the group name, for instance in the kernel right 'read<IF>admin' where 'admin' is the name of a group. Caution: the meta_ property is transient and should be restored after each deserialization of an instance. It is a javabean with the following bound properties: 'Comment', 'Parent', 'Slave', 'Desactivated', 'UpperRights', 'LowerRights'. The listeners are proper to this instance, outside gBase, transient (not serialized in this instance backup). They are called in any order. They receive only a copy of the new value, to protect the property. All the exceptions from the listeners are catched in the 'set' method, and a dialog box is displayed to inform the user.

See Also:
Serialized Form

Field Summary
private  ImmutableName acsName_
          The name of the ACSRun which manages this right.
private  ACSRun acsRun_
          The ACSFactory which creates this right when it is an acsright.
protected  java.beans.PropertyChangeSupport changeSupport_
          manages all the property change listeners of this classes and its subclasses
private  java.lang.String comment_
          The user comment about this right.
static StringRightImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected static int INITIAL_CAPACITY
           
protected  int internalKey_
          The right key, to compare it in the network rights.
private  boolean isDesactivated_
          True when the right is desactivated.
private  boolean isParent_
          True when the right is set as a parent.
private  boolean isSlave_
          True when the right is set as a slave, with only one upper right (the parent).
private  java.util.Set l_CommentChangeSupport_
          list of PropertyChangeListeners for the property 'Comment'.
private  java.util.Set l_DesactivatedChangeSupport_
          list of PropertyChangeListeners for the property 'Desactivated'.
protected  StringRight[] l_lowerRights_
          This is the list of the ACS rights or metarights (if embedded) which are directly less powerfull, than this instance in the rights network.
private  java.util.Set l_LowerRightsChangeSupport_
          list of PropertyChangeListeners for the property 'LowerRights'.
private  java.util.Set l_ParentChangeSupport_
          list of PropertyChangeListeners for the property 'Parent'.
private  java.util.Set l_SlaveChangeSupport_
          list of PropertyChangeListeners for the property 'Slave'.
protected  StringRight[] l_upperRights_
          This is the list of the ACS rights or metarights (if embedded) which are directly more powerfull, than this instance in the rights network.
private  java.util.Set l_UpperRightsChangeSupport_
          list of PropertyChangeListeners for the property 'UpperRights'.
(package private)  StringMetaRight meta_
          For ACS rights, this is the equivalent to this instance in the metarights space.
(package private)  java.lang.String metaRight_
          For ACS rights, this is the value returned by meta_.getRight().
private  java.lang.String right_
          The effective right, for typed and untyped rights.
static java.io.ObjectStreamField[] serialPersistentFields
          standardized variable for the JDK 2 serialization
private static long serialVersionUID
           
private  java.lang.Class targetClass_
          If it is a classed right, this is the target class for the target of the right.
private  java.lang.String targetClassType_
          If it is a typed right, this is the target type for which this right is applied, only for the target class defined by targetClass_.
 
Constructor Summary
  StringRightImpl()
          Constructor used by EMPTY_INSTANCE.
protected StringRightImpl(java.lang.String _kernelRight, java.lang.Integer _internalKey, java.lang.String _targetClass)
          Constructor used for the creation of an embedded right in a StringMetaRightImpl instance.
  StringRightImpl(java.lang.String _kernelRight, StringMetaRight _meta, java.lang.Integer _internalKey, StringRightImpl[] _l_upperRights, java.lang.String _targetClassType, ACSRun _acsRun)
          Constructor used for the creation of an ACS right.
 
Method Summary
protected  void addLowerRight(StringRight _right)
          Adds a lower right which are strictly lesser than this right without any intermediate right, following the network of rights in the ACS.
 void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
          Adds a listener to the bean, for all the bound properties.
 void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
protected  void addUpperMetaRight(StringMetaRightImpl _right)
          Adds, for an embedded right only, an upper metaright which are strictly greater than this embedded right owner, without any intermediate metaright.
 int compareTo(java.lang.Object _o)
          Compares two StringRight instances through the internal key, the sens and the right, in that order, and, if not null, through an acs names comparison, whatever the powers and the fields.
 boolean equals(java.lang.Object _obj)
          Compares the two StringRights, without comparison of the properties l_upperRights_ and l_lowerRights_.
protected  void finalize()
          This method removes the right from the ACS list, but there is no guarantee that the JVM calls this method before the end of the application.
protected  void finalizeClosedRight()
          This method is to use only for closed rights in the relevant ACS list, to set an empty instance.
 void finalizeForBase()
          This method removes the StringRight from the ACS list, from the metaright, from the lower and upper rights.
 void finalizeForUser()
          This method removes the StringRight from the ACS list, from the metaright, from the lower and upper rights.
protected  void firePropertyChange(java.lang.String _propertyName, java.lang.Object _oldValue, java.lang.Object _newValue)
          Fires an event to every registered listener, in any order.
 ImmutableName getAcsName()
          Called from the constructor through StringMetaRightImpl.addACSRight() It is both the name of the ACS and then name of its ACSFactory.
 java.lang.String getComment()
           
 ACSRun getEorACS()
          After the ACS creation, this method calls BaseManager to get the open ACS.
 StringMetaRight getEorMetaRight()
          Gets the canonical metaright which is a generic description of this ACS right.
 ImmutableName getFullName()
          Gets the full name of the right, which is unique for the program.
 int getInternalKey()
           
 StringRight[] getLowerRights()
          Gets the set of lower rights which are strictly lesser than this right without any intermediate right, following the network of rights in the ACS.
 ImmutableName getName()
          Gets the BaseObject name of the right, as a current name with less information than the full name.
 java.lang.String getNickName()
          Gets a short name limited to 5 characters if positive, 14 first characters if it starts with '|' and positive, and 7 if negative, for displaying this right in the views.
 java.lang.String getRight()
          If the right is not typed, the result contains the kernel right only.
 long getSerialVersionUID()
           
 java.lang.String getTargetClass()
           
 java.lang.String getTargetClassType()
           
 StringRight[] getUpperRights()
          Gets the set of upper rights which are strictly greater than this right without any intermediate right, following the network of rights in the ACS.
 int hashCode()
           
 boolean isAcsRightUnderOpenACS()
           
 boolean isDesactivated()
          Get if the right is desactivated.
 boolean isEmpty()
           
 boolean isGrantingRight()
          Called from the constructor for ACS rights, by getNickName() and compareTo().
 boolean isParent()
          For two-levels rights, this right manages tasks, and its slaves manage operations.
 boolean isSlave()
          A slave right has a strong link with a parent right.
 boolean isTargetClassed()
           
 boolean isTargetClassTyped()
           
protected  void removeLowerRight(StringRight _right)
          Removes a lower rights which are strictly lesser than this right (or the metaright, if this instance is embedded) without any intermediate right, following the network of rights in the ACS.
 void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
          Removes a listener to the bean, for all the bound properties.
 void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
protected  void removeUpperRight(StringRight _right, java.lang.Object _caller)
          Removes a upper right which are strictly greater than this right without any intermediate right, following the network of metarights.
 void setComment(java.lang.String _s)
          Sets any comment related to this right.
 void setDesactivated(boolean _b)
          Sets that the right is desactivated.
 void setParent(boolean _b)
          Sets the right as parent of lower rights - the slaves - in a multi-level right.
 void setSlave(boolean _b)
          Sets that the right has an unique upper right - the parent, already registered - in a multi-level right.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
See Also:
Constant Field Values

acsName_

private ImmutableName acsName_
The name of the ACSRun which manages this right. Never null for an ACS right. For an embedded right in a StringMetaRightImpl, it is always null.


acsRun_

private transient ACSRun acsRun_
The ACSFactory which creates this right when it is an acsright. Used only in the constructor, clone() and finalizeForUser().


right_

private java.lang.String right_
The effective right, for typed and untyped rights. The default value is ''.


internalKey_

protected int internalKey_
The right key, to compare it in the network rights. Two StringRights may have the same key. Key values are from 1 to 999 for StringRightImpl, and from 1 to 99999 for StringMetaRightImpl. Metarights with the same power have keys in a space of 100. This key is used in gWork and for the NoThanViewInBases, to check the fullfilment to the criteria.


targetClass_

private java.lang.Class targetClass_
If it is a classed right, this is the target class for the target of the right. Exemple: in the right 'execute_script', 'script' is a targetClassType_ for the targetClass_ Actor in the relevant ACS. If non-classed right, targetClass_ is null. Otherwise, it is non-null.


targetClassType_

private java.lang.String targetClassType_
If it is a typed right, this is the target type for which this right is applied, only for the target class defined by targetClass_. This value is at the end of the effective right. Exemple: in the right 'execute script', 'script' is a targetClassType_ for the targetClass_ Actor in the relevant ACS. If non-typed right, targetClassType_ is null. Otherwise, it is non-null.


comment_

private java.lang.String comment_
The user comment about this right.


l_upperRights_

protected StringRight[] l_upperRights_
This is the list of the ACS rights or metarights (if embedded) which are directly more powerfull, than this instance in the rights network. May be null.


l_lowerRights_

protected StringRight[] l_lowerRights_
This is the list of the ACS rights or metarights (if embedded) which are directly less powerfull, than this instance in the rights network. May be null.


meta_

transient StringMetaRight meta_
For ACS rights, this is the equivalent to this instance in the metarights space. It is used to compare rights from different ACS. At the ACS saving, this property is transient to avoid a direct link to the metarights network, and the property metaRight_ is used to restore this instance meta_ value when the ACS is opened or when the NoThanViewInBase is opened. It is not copied in clone(). For an embedded right in a StringMetaRightImpl, it is always null.


metaRight_

java.lang.String metaRight_
For ACS rights, this is the value returned by meta_.getRight().


isParent_

private boolean isParent_
True when the right is set as a parent.


isSlave_

private boolean isSlave_
True when the right is set as a slave, with only one upper right (the parent).


isDesactivated_

private boolean isDesactivated_
True when the right is desactivated. It is then used only as a node in a right network. It is no more used to deliver rights, but it remains usefull in the search of child rights in StringRightUtilityImpl.


changeSupport_

protected transient java.beans.PropertyChangeSupport changeSupport_
manages all the property change listeners of this classes and its subclasses


l_CommentChangeSupport_

private transient java.util.Set l_CommentChangeSupport_
list of PropertyChangeListeners for the property 'Comment'. No use of SwingChangePropertySupport class (bug in hasListeners() method).


l_ParentChangeSupport_

private transient java.util.Set l_ParentChangeSupport_
list of PropertyChangeListeners for the property 'Parent'. No use of SwingChangePropertySupport class (bug in hasListeners() method).


l_SlaveChangeSupport_

private transient java.util.Set l_SlaveChangeSupport_
list of PropertyChangeListeners for the property 'Slave'. No use of SwingChangePropertySupport class (bug in hasListeners() method).


l_DesactivatedChangeSupport_

private transient java.util.Set l_DesactivatedChangeSupport_
list of PropertyChangeListeners for the property 'Desactivated'. 'UpperRights', 'LowerRights' No use of SwingChangePropertySupport class (bug in hasListeners() method).


l_UpperRightsChangeSupport_

private transient java.util.Set l_UpperRightsChangeSupport_
list of PropertyChangeListeners for the property 'UpperRights'. No use of SwingChangePropertySupport class (bug in hasListeners() method).


l_LowerRightsChangeSupport_

private transient java.util.Set l_LowerRightsChangeSupport_
list of PropertyChangeListeners for the property 'LowerRights'. No use of SwingChangePropertySupport class (bug in hasListeners() method).


EMPTY_INSTANCE

public static final StringRightImpl EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. Caution: never change the state of the returned instance.


serialPersistentFields

public static final java.io.ObjectStreamField[] serialPersistentFields
standardized variable for the JDK 2 serialization

Constructor Detail

StringRightImpl

public StringRightImpl()
Constructor used by EMPTY_INSTANCE.


StringRightImpl

protected StringRightImpl(java.lang.String _kernelRight,
                          java.lang.Integer _internalKey,
                          java.lang.String _targetClass)
                   throws CreateError
Constructor used for the creation of an embedded right in a StringMetaRightImpl instance.

There is no links between the most upper metarights dedicated to the rights administration, like '|is_superadmin|', and the lower positive metarights headed by 'full_control' and which have opposite negative rights (like 'deny_all' for 'full_control'). So a subtraction of any lower right to one administration right does not change the administration right. These administration metarights have a strenght superior to 90000, which is the 'full_control' strenght.

Used by BaseUtilityImpl.initializeBasicMetaRights().

Parameters:
_kernelRight - is the right if the StringRight. Never null.
_internalKey - is the internal key which allows ACS right comparisons. From 1000 to 99999. '1000' is the lesser value. Never null.
_targetClass - is the target interface (in gBaseInterface) for the ACS or embedded right; if not null, this StringRight is classed. Do not use the 'Immutable' version of the interface as _targetClass.
Throws:
CreateError - if the target class is not a gBase interface or if the kernel right or the internal key is not correct, the instance has then to be deleted!

StringRightImpl

public StringRightImpl(java.lang.String _kernelRight,
                       StringMetaRight _meta,
                       java.lang.Integer _internalKey,
                       StringRightImpl[] _l_upperRights,
                       java.lang.String _targetClassType,
                       ACSRun _acsRun)
                throws CreateError
Constructor used for the creation of an ACS right. It is designed to facilitate the creation of a whole network rights, down from the most powerfull rights.

Registers this instance in its ACS and its metaright. An upper right cannot be an administrative right (that is, its metaright has a strenght superior to 90000) if this instance is not an administrative right. The argument _targetClassType is not null only when the metaright is classed, and the type should be ampong the class of the metaright. But this is not controlled by the constructor, and if it is not true, the right will simply not be used in the right analysis. The _acsRun argument delivers both the name of the ACSFactoryImpl which creates the new ACS, and the name of the created ACS. Used by the GUI to create the ACS rights for an ACSFactoryImpl instance.

Parameters:
_kernelRight - is the right if the StringRight if not typed, or otherwise it is the start of the right. Never null and do not contain the character '-'. Contain one or several '<IF>' to have a conditional right.
_meta - is the StringMetaRight which is equivallent to this StringRight. Never null, empty or desactivated.
_internalKey - is the internal key which allows ACS right comparisons. From 1 to 999. '1' is the lesser value. Never null.
_l_upperRights - is the set of upper rights which are strictly greater than this right without any intermediate rights, following the network of rights in the same ACS. The number of upper rights is from 0 to 5 (including). May be null.
_targetClassType - is the type which is the end of the right. To use only when the _meta target class is not null. May be null. Is added after '_' at the end of the kernel right, for having the displayed right.
_acsRun - is the ACSFactory owning this right. Never null.
Throws:
CreateError - if ACSFactoryImpl.addRight() throws it, or if the kernel right, the metaright or the internal key is not correct, an upper right is not superior to this instance; an upper right has a metaright which is inferior to _meta; an upper right is an administration right while the new right is not; the instance has then to be deleted!
Method Detail

getAcsName

public final ImmutableName getAcsName()
Called from the constructor through StringMetaRightImpl.addACSRight() It is both the name of the ACS and then name of its ACSFactory. This method implements the ACSObject without declaring this class as implementing ACSObject, since the subclass StringMetaRight is never an ACSObject.

Specified by:
getAcsName in interface StringRight
Returns:
ImmutableName of the ACSRun that owns this object. Empty if it is an embedded right.

getEorACS

public final ACSRun getEorACS()
After the ACS creation, this method calls BaseManager to get the open ACS. It also works during the creation of ACS rights by an ACSFactory. So, BeamerManager can be informed when an ACS rights has been deleted, since it calls this method to be registered as listener in the acsright ACS or ACSRun.

Returns:
ACS or ACSFactory creating the ACS, if this right is an acsright. Null otherwise.

getFullName

public final ImmutableName getFullName()
Gets the full name of the right, which is unique for the program. The name is composed of: :: <FOR_ACS>:: ACS name or no_acs plus, if there is a target class, :: <AND>:: target class, or Target class:: class type <VALUE>:: right

here, ':: ' is added by gBase.NameImpl.toString(). This name is used only outside gBase, following BaseObject interface.

Specified by:
getFullName in interface BaseObject
Specified by:
getFullName in interface StringRight
Returns:
the full name of the right, which is empty if it is an empty right

getName

public final ImmutableName getName()
Gets the BaseObject name of the right, as a current name with less information than the full name. The name is composed of: :: <FOR_ACS>:: ACS name or no_acs <VALUE>:: right

This name is used only outside gBase, following BaseObject interface.

Specified by:
getName in interface BaseObject
Returns:
ImmutableName of the right, which is empty if it is an empty right
See Also:
getFullName(), BaseUtilityImpl.getRightFromNameAsString(java.lang.String, ARoad0.gBaseInterface.ACSRun)

getNickName

public final java.lang.String getNickName()
Gets a short name limited to 5 characters if positive, 14 first characters if it starts with '|' and positive, and 7 if negative, for displaying this right in the views.

The exception is for the administrative rights where the 17 last characters are used from the nick name.

If right_ is '|modify_security_descriptor|', the nick name is '|modify_security|'.

If right_ is 'read', the nick name is the same. If right_ is 'read&execute', the nick name is 'read&'. If right_ contains '_', the nick name 2 last characters are '_%' where '%' is here the character at the right of the last '_' in right_. For example, 'write_for_directory' gives 'wri_d'. The nick name for a negative right starts with 'd_', if the right starts by 'deny_'. The other parts of the nick name are like for a positive right. If right is 'deny_read', the nick name is 'd_read'. If the right is 'deny_write_for_directory', the nick name is 'd_wri_d'. If the negative right does not start with 'deny_', it is processed like a positive right and the nick name size is limited to 5. This short name is NOT unique for the Access Road program, nor for the ACS if it is an ACS object.

Specified by:
getNickName in interface BaseObject
Specified by:
getNickName in interface StringRight
Returns:
the nick name. Never null.

getInternalKey

public final int getInternalKey()
Specified by:
getInternalKey in interface StringRight
Returns:
the internal key

isTargetClassed

public final boolean isTargetClassed()
Specified by:
isTargetClassed in interface StringRight
Returns:
true if the right is always associated to a class for a target, as for exemple 'delete_Actor' for the class Actor.

isTargetClassTyped

public final boolean isTargetClassTyped()
Specified by:
isTargetClassTyped in interface StringRight
Returns:
true if the right is always associated to a type for a target class, as for exemple in LCA Lotus Notes 'read_javascript' for the class Actor.

getRight

public final java.lang.String getRight()
If the right is not typed, the result contains the kernel right only. If the right is typed (for ACS rights only), the result contains the kernel right, then '_' and the target class type.

Specified by:
getRight in interface StringRight
Returns:
the right to apply

getTargetClass

public final java.lang.String getTargetClass()
Specified by:
getTargetClass in interface StringRight
Returns:
the target class for which the right is provided. Null if the right is not classed.

getTargetClassType

public final java.lang.String getTargetClassType()
Specified by:
getTargetClassType in interface StringRight
Returns:
the target type. Null if the right is not typed.

setComment

public void setComment(java.lang.String _s)
Sets any comment related to this right. It is a bound property.

Specified by:
setComment in interface StringRight
Parameters:
_s - is an user comment which is associated to the right.

getComment

public final java.lang.String getComment()
Specified by:
getComment in interface StringRight
Returns:
the comment which is associated to the right. May be null.

isGrantingRight

public boolean isGrantingRight()
Called from the constructor for ACS rights, by getNickName() and compareTo().

Specified by:
isGrantingRight in interface StringRight
Returns:
true if the right is a granting rights - the opposite one is a denying right.

isEmpty

public final boolean isEmpty()
Specified by:
isEmpty in interface StringRight
Returns:
true if the instance is equals to an empty instance

isParent

public final boolean isParent()
For two-levels rights, this right manages tasks, and its slaves manage operations.

Specified by:
isParent in interface StringRight
Returns:
true if the right is a parent of lower rights - the slaves - in a multi-level right.

isSlave

public final boolean isSlave()
A slave right has a strong link with a parent right. For two-levels rights, this right manages operations, and its parent manages tasks.

Specified by:
isSlave in interface StringRight
Returns:
true if the right has an unique upper right - the parent - in a multi-level right.

isAcsRightUnderOpenACS

public boolean isAcsRightUnderOpenACS()
Returns:
true if it is an acsright managed by an open ACS after its creation

setParent

public final void setParent(boolean _b)
                     throws BaseError
Sets the right as parent of lower rights - the slaves - in a multi-level right. For two-levels rights, this right manages tasks, and its slaves manage operations. This method has to be used before the registration of the lower rights. Caution: some lower rights may be not slaves, so this instance may be not parent for all its lower rights. It is a bound property.

Specified by:
setParent in interface StringRight
Parameters:
_b - is true to set the right as parent
Throws:
BaseError - when _b true if there are some lower rights or if it is after the ACS creation process.

setSlave

public final void setSlave(boolean _b)
                    throws BaseError
Sets that the right has an unique upper right - the parent, already registered - in a multi-level right. For two-levels rights, this right manages operations, and its parent manages tasks. It is a bound property.

Specified by:
setSlave in interface StringRight
Parameters:
_b - is true to set the right as slave
Throws:
BaseError - when _b true if there is not exactly one upper right, or if the upper right is not a parent, or if it is after the ACS creation process.

setDesactivated

public final void setDesactivated(boolean _b)
Sets that the right is desactivated. Used to create a list of flat rights with one single desactivated root. This method is called when the metaright equivallent method is called. It is a bound property.

Specified by:
setDesactivated in interface StringRight
Parameters:
_b - is true to desactivate the right

isDesactivated

public final boolean isDesactivated()
Get if the right is desactivated.

Specified by:
isDesactivated in interface StringRight

getEorMetaRight

public final StringMetaRight getEorMetaRight()
Gets the canonical metaright which is a generic description of this ACS right. Metarights are used in the rights comparison and analysis to compare rights from different ACS and in the same ACS. This property is set to null by ACSImpl.closeAcsRights().

Specified by:
getEorMetaRight in interface StringRight
Returns:
as a generic description of the right. Is null only when the instance is embedded in a StringMetaRightImpl, or after the closing of its ACS.

getLowerRights

public final StringRight[] getLowerRights()
Gets the set of lower rights which are strictly lesser than this right without any intermediate right, following the network of rights in the ACS. For an embedded right, return an array of StringMetaRightImpl.

Specified by:
getLowerRights in interface StringRight
Returns:
is an array of rights which are strictly lesser than right. Never null but may be empty.

getUpperRights

public final StringRight[] getUpperRights()
Gets the set of upper rights which are strictly greater than this right without any intermediate right, following the network of rights in the ACS. For an embedded right, return an array of StringMetaRightImpl.

Specified by:
getUpperRights in interface StringRight
Returns:
is an array of connected rights which are strictly greater than this right. Never null but may be empty.

equals

public final boolean equals(java.lang.Object _obj)
Compares the two StringRights, without comparison of the properties l_upperRights_ and l_lowerRights_.

Specified by:
equals in interface BaseObject
Specified by:
equals in interface StringRight
Overrides:
equals in class java.lang.Object
Parameters:
_obj - to compare
Returns:
true if the properties acsName_, right_ are equals and internalKey_ and meta_ are the same

hashCode

public final int hashCode()
Specified by:
hashCode in interface BaseObject
Specified by:
hashCode in interface StringRight
Overrides:
hashCode in class java.lang.Object
Returns:
hashcode value for this instance.

compareTo

public final int compareTo(java.lang.Object _o)
                    throws java.lang.ClassCastException
Compares two StringRight instances through the internal key, the sens and the right, in that order, and, if not null, through an acs names comparison, whatever the powers and the fields. All metarights are superior to any acsright. The comparison 'xx'.compareTo('deny_xx') returns +1 since a positive right is superior to its opposite. Note: it is recommanded to always compare the metarights of two acsrights, rather than the acsrights directly.

Specified by:
compareTo in interface StringRight
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
_o - to compare
Returns:
0 if the rights have the same internal key, sens, right and acs name, a negative integer if this object is lesser than the argument, and a positive integer if this object is greater than the argument.
Throws:
java.lang.ClassCastException - - if the specified object's type prevents it from being compared to this current Object

getSerialVersionUID

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

toString

public final java.lang.String toString()
Specified by:
toString in interface StringRight
Overrides:
toString in class java.lang.Object
Returns:
getRight()

finalizeForUser

public void finalizeForUser()
                     throws UpDateError
This method removes the StringRight from the ACS list, from the metaright, from the lower and upper rights. If the instance is a parent, all slaves are also finalized. Calls finalizeForBase().

Specified by:
finalizeForUser in interface FinalizedObjectForUser
Specified by:
finalizeForUser in interface StringRight
Throws:
UpDateError - if the ACS does not known the right (if it is a clone, typically), if the metaright is wrong, or if a lower or upper right is not correct.

finalizeForBase

public void finalizeForBase()
                     throws UpDateError
This method removes the StringRight from the ACS list, from the metaright, from the lower and upper rights. If the instance is a parent, all slaves are also finalized. This method may be called after an exception from the constructor, to reinitialize the links to other objects. This method is called by finalize(), but finalize() may be not called. An unused object has to be deleted to inform the other objects, and this method HAS TO BE CALLED before deleting the StringRight. See finalizeClosedRight() for closing a deprecated right without updating the external references.

Specified by:
finalizeForBase in interface FinalizedObject
Throws:
UpDateError - if the ACS does not known the right (if it is a clone, typically), if the metaright is wrong, or if a lower or upper right is not correct.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
Adds a listener to the bean, for all the bound properties. Used by ViewInBaseImpl to detect the changes in the view rights.

Specified by:
addPropertyChangeListener in interface BoundBean
Parameters:
_l - PropertyChangeListener to add. Caution: the listener must NOT have specific hashCode() and equals() methods, to work with HashSet in the removing operations.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String _propertyName,
                                      java.beans.PropertyChangeListener _l)
Adds a listener to the bean. Used by Gui1.CommonPropertyEditor for the properties: 'Comment', 'Parent', 'Slave', 'Desactivated', 'LowerRights', 'UpperRights'.

Specified by:
addPropertyChangeListener in interface BoundBean
Parameters:
_propertyName - String is the name of the property
_l - PropertyChangeListener to add. Caution: the listener must NOT have specific hashCode() and equals() methods, to work with HashSet in the removing operations.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
Removes a listener to the bean, for all the bound properties.

Specified by:
removePropertyChangeListener in interface BoundBean
Parameters:
_l - is the PropertyChangeListener to remove

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
Removes a listener to the bean. Used by Gui1.CommonPropertyEditor for the properties: 'Comment', 'Parent', 'Slave', 'Desactivated', 'LowerRights', 'UpperRights'.

Specified by:
removePropertyChangeListener in interface BoundBean
Parameters:
_propertyName - String is the name of the property
_l - is the PropertyChangeListener to remove

addUpperMetaRight

protected void addUpperMetaRight(StringMetaRightImpl _right)
                          throws BaseError
Adds, for an embedded right only, an upper metaright which are strictly greater than this embedded right owner, without any intermediate metaright. Register the owner in the upper metaright (its embedded right, in fact). Called only by the owner metaright. The upper right is not updated. No comparison between the upper right target class and this right target class, but BaseUtilityImpl.initializeBasicMetaRights() is written to avoid an upper right with a more restricted target class. Noop if the new right is already known. It is a bound property.

Parameters:
_right - which directly includes this right. Never null.
Throws:
BaseError - if the right is a slave, or the parameter is null, or the number of upper rights is already 5, or an upper right is an administration right while the new right is not, or it is not an embedded right.

removeUpperRight

protected void removeUpperRight(StringRight _right,
                                java.lang.Object _caller)
Removes a upper right which are strictly greater than this right without any intermediate right, following the network of metarights. Called by the upper right finalizeForUser() and, for embedded right, by the owner metaright. It is a bound property.

Parameters:
_right - directly includes this right. Never null.
_caller - is the object which calls this method; used to identify the upper right finalizing operation with _caller == _right for an ACS right only.

addLowerRight

protected void addLowerRight(StringRight _right)
Adds a lower right which are strictly lesser than this right without any intermediate right, following the network of rights in the ACS. Called by the lower StringRightImpl constructor and by StringMetaRightImpl.addUpperRight() through addLowerRight(), after a check if it is a lower right. Noop if the new right is already known. It is a bound property.

Parameters:
_right - is directly included in this right. Never null.

removeLowerRight

protected void removeLowerRight(StringRight _right)
Removes a lower rights which are strictly lesser than this right (or the metaright, if this instance is embedded) without any intermediate right, following the network of rights in the ACS. Called by the lower right finalizeForUser() method, and by StringMetaRightImpl when it is an embedded right. It is a bound property.

Parameters:
_right - is directly included in this right. Never null.

firePropertyChange

protected void firePropertyChange(java.lang.String _propertyName,
                                  java.lang.Object _oldValue,
                                  java.lang.Object _newValue)
Fires an event to every registered listener, in any order. For the bound properties 'Comment', 'Parent', 'Slave', 'Desactivated', 'LowerRights', 'UpperRights'. Called by all the updating methods. Used as the same method in java.beans.PropertyChangeSupport, which is not used because hasListeners() has a bug in JDK 1.3.0-C of SUN.

Parameters:
_propertyName - name of the changing property
_oldValue - of the property
_newValue - of the property. No operation if equal to _oldValue and not null.

finalizeClosedRight

protected void finalizeClosedRight()
This method is to use only for closed rights in the relevant ACS list, to set an empty instance. It cuts all the Object External References, without updating these objects as finalizeForUser() does. It sets to null all variables, so the instance becames empty. Called by StringMetaRightImpl.finalizeClosedRight().


finalize

protected void finalize()
                 throws java.lang.Throwable
This method removes the right from the ACS list, but there is no guarantee that the JVM calls this method before the end of the application.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable