ARoad0.gBase
Class PrivilegeAbst

java.lang.Object
  extended by ARoad0.gBase.PrivilegeAbst
All Implemented Interfaces:
ACSObject, BaseObject, BoundBean, DetailledName, FinalizedObject, FinalizedObjectForUser, ImmutablePrivilege, Privilege, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
PrivilegeForLinksImpl, PrivilegeForTypeImpl

public abstract class PrivilegeAbst
extends java.lang.Object
implements java.io.Serializable, Privilege

This abstract class is used by its subclasses for creating the Privileges. A privilege instance is controlled by an ACS, and delivers rights applicable to couples (source or sources set or source containers set, target or targets set). The rights of a privilege are immutable after its creation, while the AclEntry has immutable source and target, but with editable rights after the creation. The objects in the couple may be external sometimes. In other words, they do not belong to the privilege ACS. If the ACS constraints define no rights, the privilege cannot have any effective right. These ACS constraints depend on the privilege main type.

There are 7 main types of privilege defined in this class, and two interfaces which are implemented by two classes: - PrivilegeForType interface, where the source and target types are the main criteria to apply the privilege rights to sources and targets which are not known by the privilege, with the four types TYPED, TYPED_CLASSED, TYPED_CLASSED_SPECIFIC, and TYPED_FOR_SEED. TYPED_CLASSED privilege is a TYPED one with contraints on source and target classes. TYPED_CLASSED_SPECIFIC is a TYPED_CLASSED privilege for designated source or target. TYPED_FOR_SEED is a TYPED privilege reserved for Authorization (or Rights) Servers. - PrivilegeForLinks interface, where the dynamic links to the source and the target are the single criteria to apply the privilege, which then knows to which entities it is applied, with the three types LINKED, LINKED_IF_ALL_SOURCES and LINKED_FOR_ONE_TO_ONE. The access sources are EligibleParties, and the access targets are Resources or VirtualFolders. The LINKED type allows to define in one privilege, a immutable set of rights, and each EligibleParty which is source have all the rights on all the targets. With LINKED_IF_ALL_SOURCES, the true access sources are not the linked sources, since they must be EligibleParties belonging to ALL the set of source containers (GroupIDMembers or DirectoryEPs) which are the authorized linked sources. The LINKED_FOR_ONE_TO_ONE type is very like an AclEntry, but with static rights, for GroupIDs only as sources, but for Resources, EP and Resource VirtualFolders as targets (VirtualFolders are not used by AclEntry).

Directory and Resource may manage container-for-target privilege inheritance from its parent and to its children, but this is provided only for PrivilegeForLinks having the types LINKED and LINKED_FOR_ONE_TO_ONE, and only one target is then possible. At the source side, the container-for-source principle is an inner principle in GroupID to deliver rights to its members. The container-for-source principle is also managed in DirectoryEP (future version) to deliver rights to its children.

A Privilege instance is always dedicated to one ACS. There is a 'See why' description to complement the comment. For PrivilegeForTypes, sources and target may be any ACSObject, to allow to give a privilege to a Directory, and to allow certificate seeds in Authorization Servers. For most of the PrivilegeForLinks, the source is any EligibleParty, but only GroupIDMembers are allowed for the LINKED_IF_ALL_SOURCES type, and only GroupIDs are allowed for the LINKED_FOR_ONE_TO_ONE type. For PrivilegeForLinks, access targets are only Resources or VirtualFolders.

The privileges may be applicable to external objects (that is, other ACS than the Privilege ACS) for LINKED_FOR_ONE_TO_ONE PrivilegeForLinks, and they are always applicable for the TYPED_FOR_SEED PrivilegeForTypes. In the other cases, privileges are limited to their own ACS objects. The copy of PrivilegeForType is for the same ACS, and the copy of PrivilegeForLinks may be for another ACS. The TYPED_FOR_SEED PrivilegeForTypes are the only privileges which are not registered in their sources and targets. The external LINKED_FOR_ONE_TO_ONE PrivilegeForLinks change their detailled names when the state external/internal changes. An ACS saving produces the deleting of the external LINKED_FOR_ONE_TO_ONE PrivilegeForLinks to be replaced, at the next ACS restoring, by some true copies. An ACS cannot manage both the external AclEntries and the external linked Privileges.

All the typed privileges have a detailled name which starts with 'TYPED'. All the linked privileges have a detailled name which starts with 'LINKED', but after the ACS name if it is an external linked privilege. Starting with 'TYPED' is detected by Gui2.ExplorerTreeCellRenderer.getTreeCellRendererComponent(). Each main type may be used to set some constraints in the ACS on the allowed rights. For instance, 'Privilege.PrivilegeRights.TYPED' is a possible key for a standard rights policy in the ACS. It is also possible to use specialized rights and to select them from the type, exactly like a Resource or an EligibleParty.

It is a javabean with the following bound properties:

- 'Comment'

- 'SeeWhy' is an optional description, usually longer than the comment

- 'SecondType'

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, and a dialog box is displayed to inform the user. See the Copyright.

See Also:
Privilege, Serialized Form

Field Summary
protected  ImmutableACS aCS_
          The ACS which manages the privilege.
protected  ImmutableName acsName_
          The acs name, wich is used in clone()
protected  java.beans.PropertyChangeSupport changeSupport_
          manages all the property change listeners of this classes and its subclasses
protected  java.lang.String comment_
          Privilege comment updated by the user
protected  java.lang.String detailledName_
          The privilege key is built up with the format: privilegeType >> nickName || grant/deny.
static Privilege EMPTY_INSTANCE
          The empty instance is an empty PrivilegeForType
protected static int INCREMENT_CAPACITY
           
protected static int INITIAL_CAPACITY
           
protected  StringRight[] l_rights_
          Positive or negative rights set for the privilege
protected static java.util.List L_TYPES
           
static java.lang.String LINKED
           
static java.lang.String LINKED_FOR_ONE_TO_ONE
           
static java.lang.String LINKED_IF_ALL_SOURCES
           
protected  java.lang.String mainType_
          The possible values of the main type are in L_TYPES.
protected  java.lang.String nickName_
          Short privilege description displayed to the user in the beamer
protected  boolean positiveRight_
           
protected static int PRIME
           
protected  java.lang.String secondType_
          The possible values of the second type are defined by the ACS.
protected  java.lang.String seeWhy_
          Long description to understand the privilege
static java.io.ObjectStreamField[] serialPersistentFields
          variable for the JDK 2 serialization
private static long serialVersionUID
           
static java.lang.String TYPED
           
static java.lang.String TYPED_CLASSED
           
static java.lang.String TYPED_CLASSED_SPECIFIC
           
static java.lang.String TYPED_FOR_SEED
           
 
Constructor Summary
PrivilegeAbst()
          Constructor to use only as a transient value for initialization, or used from ARoad0.gBase.PrivilegeImplBeanInfo.getPropertyDescriptors() in ARoad0.Gui1.CollectionPropertyEditor.getValue().
PrivilegeAbst(ACS _aCS, java.lang.String _nickName, java.lang.String _mainType, StringRight[] _l_rights, java.lang.String _secondType)
          This is the only way to create an instance.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
 void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
protected static java.lang.String buildUpDetailledName(java.lang.String _mainType, java.lang.String _nickName, java.lang.String _firstRight, java.lang.String _sourceType, java.lang.String _targetType)
          This method allows to create the detailled name, unique in the ACS.
 java.lang.Object clone()
          Used to clone a Privilege when an acs is closing, or to clone an ACS.
 int compareTo(java.lang.Object o)
          Based on the main type first, and then on the nick name, if the main types are equals, then on the detailled names at the end.
 boolean equals(java.lang.Object _obj)
           
 void finalizeForBase()
          It sets to null almost all variables, so the instance is equals to a new PrivilegeAbst().
 void finalizeForUser()
          It sets to null almost all variables, so the instance is equals to a new PrivilegeForTypeImpl().
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.
 ImmutableACS getAcsFromName(ImmutableName _name)
          Gets the ACS from the privilege name.
 ImmutableName getAcsName()
           
 java.lang.String getComment()
           
 java.lang.String getDetailledName()
          This method returns the detailled name for the explorer, which gives the key components of the object.
 java.lang.String getDetailledNameFromName(ImmutableName _name)
          Gets the detailled name from the privilege name.
 ImmutableACS getEorACS()
           
 ImmutableName[] getKeyPropertiesFromDetailledName(java.lang.String _displayedName)
          Extracts the 3 key properties from the key of an object.
static java.util.List<java.lang.String> getL_PrivilegeTypes()
          Gets the immutable main types, not the second types which depends on the ACS.
 StringRight[] getL_Rights()
          Gets the effective privilege rights.
 java.lang.String getMainType()
          The main type has several uses: - to define the general behavior of the privilege, - to define the authorized privilege standard rights.
 ImmutableName getNameFromDetailledName(ImmutableACS _acs, java.lang.String _detailledName)
          Extracts the BaseObject name from the detailled name of a Privilege.
 java.lang.String getNickName()
          This short name is NOT unique for the Access Road program nor the ACS if it is an ACS object.
 boolean getPositiveRight()
           
 java.lang.String getPreviousDetailledName()
          This method returns the previous detailled name for the explorer, which gives the key components of the object.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String _propertyName)
          Returns the change listeners for a property.
 java.lang.String getSecondType()
          The second type is defined at the creation of the object, then it may be updated by the user.
 java.lang.String getSeeWhy()
          Currently unused.
 long getSerialVersionUID()
          Return long value for serialization
 int hashCode()
          Note: cannot use detailledName_ because it may be changed in PrivilegeForLinksImpl.
 void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
          removes a listener to the bean.
 void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
 void setComment(java.lang.String _s)
          Sets any comment related to this privilege.
protected  void setRights(StringRight[] _st)
          Sets the rights array mainly at the instance construction.
 void setSecondType(java.lang.String _st)
          If the new value is allowed by the ACS, sets the second type of this privilege.
 void setSeeWhy(java.lang.String _see)
          Currently unused.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutablePrivilege
getEmptyInstance, getKeyReferencesFromName, getName, isEmpty, isExternalPrivilege
 
Methods inherited from interface ARoad0.gBaseInterface.BaseObject
getFullName
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

PRIME

protected static final int PRIME
See Also:
Constant Field Values

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
See Also:
Constant Field Values

INCREMENT_CAPACITY

protected static final int INCREMENT_CAPACITY
See Also:
Constant Field Values

TYPED

public static final java.lang.String TYPED
See Also:
Constant Field Values

TYPED_CLASSED

public static final java.lang.String TYPED_CLASSED
See Also:
Constant Field Values

TYPED_CLASSED_SPECIFIC

public static final java.lang.String TYPED_CLASSED_SPECIFIC
See Also:
Constant Field Values

TYPED_FOR_SEED

public static final java.lang.String TYPED_FOR_SEED
See Also:
Constant Field Values

LINKED

public static final java.lang.String LINKED
See Also:
Constant Field Values

LINKED_IF_ALL_SOURCES

public static final java.lang.String LINKED_IF_ALL_SOURCES
See Also:
Constant Field Values

LINKED_FOR_ONE_TO_ONE

public static final java.lang.String LINKED_FOR_ONE_TO_ONE
See Also:
Constant Field Values

L_TYPES

protected static final java.util.List L_TYPES

aCS_

protected ImmutableACS aCS_
The ACS which manages the privilege.


acsName_

protected ImmutableName acsName_
The acs name, wich is used in clone()


detailledName_

protected java.lang.String detailledName_
The privilege key is built up with the format: privilegeType >> nickName || grant/deny.


nickName_

protected java.lang.String nickName_
Short privilege description displayed to the user in the beamer


seeWhy_

protected java.lang.String seeWhy_
Long description to understand the privilege


comment_

protected java.lang.String comment_
Privilege comment updated by the user


l_rights_

protected StringRight[] l_rights_
Positive or negative rights set for the privilege


mainType_

protected java.lang.String mainType_
The possible values of the main type are in L_TYPES.


positiveRight_

protected boolean positiveRight_

secondType_

protected java.lang.String secondType_
The possible values of the second type are defined by the ACS. The default value is ''.


EMPTY_INSTANCE

public static final Privilege EMPTY_INSTANCE
The empty instance is an empty PrivilegeForType


changeSupport_

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


serialPersistentFields

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

Constructor Detail

PrivilegeAbst

public PrivilegeAbst()
Constructor to use only as a transient value for initialization, or used from ARoad0.gBase.PrivilegeImplBeanInfo.getPropertyDescriptors() in ARoad0.Gui1.CollectionPropertyEditor.getValue().


PrivilegeAbst

PrivilegeAbst(ACS _aCS,
              java.lang.String _nickName,
              java.lang.String _mainType,
              StringRight[] _l_rights,
              java.lang.String _secondType)
        throws CreateError
This is the only way to create an instance. Used by the subclasses, which have to check the unicity of the detailled name.

Parameters:
_aCS - is the ACS which owns this Privilege. Non-null External Object Reference. This instance is not registered in the ACS; it is done by subclasses.
_nickName - is the short privilege name. Cannot be null. It may be the StringRight.getRight() value of the main right in the privilege.
_mainType - must be one of the PrivilegeAbst constant
_l_rights - is a StringRight array of privilege rights. May be null, but a null value is not allowed at the first position. Creates an empty array with a length of 0 if the argument is null. All rights have to be all positive or all negative.
_secondType - second type which drives the rights and the immutability, just like a Basic type. If null, the value is set to "<undefined>".
Throws:
CreateError - if the rights or the privilege type is not correct, or if the nick name contains '::' or '>>', contains a character that is not a letter, if a null right or a right which is not authorized.
java.lang.InternalError - if the ACS does not manage the privilege rights, or the required privilege type.
Method Detail

buildUpDetailledName

protected static java.lang.String buildUpDetailledName(java.lang.String _mainType,
                                                       java.lang.String _nickName,
                                                       java.lang.String _firstRight,
                                                       java.lang.String _sourceType,
                                                       java.lang.String _targetType)
                                                throws CreateError
This method allows to create the detailled name, unique in the ACS. Used in the Privilege implementation constructor. The format of the returned value is as following:

privilegeType || nickName || first right

Called by the constructors, PrivilegeForType.getDetailledNameFromNameForType() and PrivilegeForLinks.getDetailledNameFromNameForLinks(). Overridden by PrivilegeForTypeImpl and PrivilegeForLinksImpl.

Parameters:
_mainType - main type of the privilege. Never null.
_nickName - nick name of the privilege. Never null.
_firstRight - first right of the privilege. Never null.
_sourceType - source type of the privilege. Used only in PrivilegeForTypeImpl which overrides this method, and unused otherwise.
_targetType - target type of the privilege. Used only in PrivilegeForTypeImpl which overrides this method, and unused otherwise.
Returns:
the privilege detailled name, even if all the parameters are null.
Throws:
CreateError - if '||', '>>' or '::' is in _nickName

getL_PrivilegeTypes

public static final java.util.List<java.lang.String> getL_PrivilegeTypes()
Gets the immutable main types, not the second types which depends on the ACS. Called by BaseUtilityImpl.getL_AcsRestrictedRights().

Returns:
the 7 privilege main types.

getAcsFromName

public ImmutableACS getAcsFromName(ImmutableName _name)
                            throws BaseError
Gets the ACS from the privilege name.

Specified by:
getAcsFromName in interface ImmutablePrivilege
Parameters:
_name - a privilege name
Returns:
the opened ACS.
Throws:
BaseError - if the argument is not a privilege name, if it is a closed ACS or if it is unknown

getDetailledNameFromName

public java.lang.String getDetailledNameFromName(ImmutableName _name)
                                          throws BaseError
Gets the detailled name from the privilege name. The format of the returned value depends on the privilege, since a typed privilege and a linked privilege have not the same format for their detailled names. Calls PrivilegeForTypeImpl.getDetailledNameFromNameForType() and PrivilegeForLinksImpl.getDetailledNameFromNameForLinks(). Called by ACS_Facade.getPrivilege().

Specified by:
getDetailledNameFromName in interface DetailledName
Parameters:
_name - name of a typed or a linked privilege
Returns:
the detailled name of the privilege
Throws:
BaseError - if the argument has a wrong format
See Also:
buildUpDetailledName(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)

getAcsName

public ImmutableName getAcsName()
Specified by:
getAcsName in interface ACSObject
Returns:
the ACS name for the acs that owns this object, even if the acs is closed.

getNickName

public java.lang.String getNickName()
This short name is NOT unique for the Access Road program nor the ACS if it is an ACS object.

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

getDetailledName

public java.lang.String getDetailledName()
This method returns the detailled name for the explorer, which gives the key components of the object. The formats of the returned value are:

privilegeType || nickName || grant/deny

or, for a PrivilegeForType:

privilegeType || nickName || first right || source type >> target type

Furthermore, an external privilege starts with 'ACS: acs_name | '.

Specified by:
getDetailledName in interface DetailledName
Returns:
the detailled name. May be null.
See Also:
getKeyPropertiesFromDetailledName(java.lang.String)

getPreviousDetailledName

public java.lang.String getPreviousDetailledName()
This method returns the previous detailled name for the explorer, which gives the key components of the object. An external object has a detailled name starting with 'ACS: acs_name | '. When the state of external changes, this method allows to get the previous detailled name, with or without the ACS name. This is used only by One-to-One PrivilegeForLinks when the single source or the single target are updated with an external object. Otherwise, the previous detailled name is the detailled name.

Returns:
the detailled name if it has not changed, or the other version of the detailled name

getMainType

public final java.lang.String getMainType()
The main type has several uses:

- to define the general behavior of the privilege,

- to define the authorized privilege standard rights.

Specified by:
getMainType in interface ImmutablePrivilege
Returns:
the privilege type. As a PrivilegeAbst constant, the value may be TYPED, TYPED_CLASSED, TYPED_CLASSED_SPECIFIC, TYPED_FOR_SEED, LINKED, LINKED_IF_ALL_SOURCE, LINKED_FOR_ONE_TO_ONE

getSecondType

public java.lang.String getSecondType()
The second type is defined at the creation of the object, then it may be updated by the user. It has several uses:

- to define the type updating policy from the ACS,

- to define the authorized privilege specialized rights,

- to manage the capacity to delete the instance.

This is not the main type, which is get by getMainType().

Specified by:
getSecondType in interface ImmutablePrivilege
Returns:
second type, as for exemple "read" or "role one". Not null.

setSecondType

public void setSecondType(java.lang.String _st)
                   throws UpDateError
If the new value is allowed by the ACS, sets the second type of this privilege. This method is used to switch from an 'immutable' type which forbids the updates of a protected property, and to return to this protecting type. Then, it is possible to switch for instance from 'read' to ''immutable' read', but not to ''immutable' write'. From the default value 'undefined', any first update may be done. '12345678901234567890' is a program-reserved value. Even if not allowed by the ACS, '12345678901234567890' is the only new value for which a current type containing 'byAcsCreator' may be changed. From '12345678901234567890', any new value may be set from the allowed ones, and this starting value is the only one which allows to set a value containing 'byAcsCreator'. Calls ACS.getM_TypesAndGUIPolicy() to have the allowed values for the key 'PrivilegeForType.SecondType' if the instance is a PrivilegeForType, or 'PrivilegeForLinks.SecondType' if the instance is a PrivilegeForLinks. Called by the constructor and the GUI. Fires the event 'SecondType'.

Specified by:
setSecondType in interface Privilege
Parameters:
_st - second type of the privilege. It is not the main type.
Throws:
UpDateError - if the type is null, starts with '<byAcsCreator>', or not known by the ACS, or not associated to the previous type.

getPositiveRight

public final boolean getPositiveRight()
Specified by:
getPositiveRight in interface ImmutablePrivilege
Returns:
true if the privilege rights grant access to the source, and false if the rights deny an access type.

getSeeWhy

public final java.lang.String getSeeWhy()
Currently unused.

Specified by:
getSeeWhy in interface ImmutablePrivilege
Returns:
a long description which is displayed to the user. May be null.

getL_Rights

public final StringRight[] getL_Rights()
Gets the effective privilege rights. Unworkable for a PrivilegeForType with a wrong initialization. If a PrivilegeForType is classed but with a null source class or target class, returns an empty array.

Specified by:
getL_Rights in interface ImmutablePrivilege
Returns:
the rights. May be an empty array.

setRights

protected void setRights(StringRight[] _st)
                  throws CreateError
Sets the rights array mainly at the instance construction. ACSImpl, when a linked privilege is restored after an ACS opening, calls this method if there are rights which has been deleted by the user before the opening.

Controls the rights constraints in the ACS from the privilege main type. If there is a null array of allowed rights, no right is set and there is an exception.

Creates a 0-size array if the argument is null. Controls if the rights are allowed by the ACS, and it may depend on the privilege type if they are some matched specialized rights in the ACS. Only non-null, non-empty rights are set as new rights, if they have the sens of the property positiveRight_. If they have another sens, they are simply forgotten without exception. It is not a bound property; no event "PrivilegeRights" firing to the listeners. Sets the positiveRight_ property. Calls BaseUtilityImpl.getL_AcsRestrictedRights() for having the range of the authorized values. Calls UtilityImpl.selectHeaders(). Called only by the constructors.

Parameters:
_st - is a StringRight array of rights for the couple (resource, eligibleparty) in the Privilege ACS. The actual list of authorized rights depends on the ACS. _st cannot be null.
Throws:
CreateError - if a right is not allowed by the ACS, or null rights, or if all rights have not the same sens.

setSeeWhy

public final void setSeeWhy(java.lang.String _see)
Currently unused. Sets the description which is displayed to the user.

Specified by:
setSeeWhy in interface Privilege
Parameters:
_see - may be null.

setComment

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

Specified by:
setComment in interface Privilege
Parameters:
_s - comment which is associated to the privilege.

getComment

public final java.lang.String getComment()
Specified by:
getComment in interface ImmutablePrivilege
Returns:
the comment which is associated to the privilege.

getEorACS

public final ImmutableACS getEorACS()
Specified by:
getEorACS in interface ACSObject
Specified by:
getEorACS in interface ImmutablePrivilege
Returns:
the ACS of this PrivilegeImpl, as an External Object Reference

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String _propertyName,
                                      java.beans.PropertyChangeListener _l)
Adds a listener to the bean. Used by Gui1.CommonPropertyEditor for the 'Comment' and 'SeeWhy' properties. Overidden method.

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

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
Adds a listener to the bean. Overidden method.

Specified by:
addPropertyChangeListener in interface BoundBean
Parameters:
_l - PropertyChangeListener to add

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
Removes a listener to the bean. Used by Gui1.CommonPropertyEditor for the 'Comment' and 'SeeWhy' properties. Overidden method.

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

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
removes a listener to the bean. Overidden method.

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

getPropertyChangeListeners

public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String _propertyName)
Returns the change listeners for a property. Used by the AcsAddons.

Specified by:
getPropertyChangeListeners in interface ImmutablePrivilege
Parameters:
_propertyName - name of the listened property.
Returns:
the change listeners. May be null or empty.

clone

public java.lang.Object clone()
Used to clone a Privilege when an acs is closing, or to clone an ACS. Clones the acs name. Shallow copy of the rights array, thus with the rights network of the metarights and the rights network of the acsrights.

Overrides:
clone in class java.lang.Object
Returns:
Object without any change in the ACS reference but copy of this reference.

hashCode

public int hashCode()
Note: cannot use detailledName_ because it may be changed in PrivilegeForLinksImpl.

Specified by:
hashCode in interface BaseObject
Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode value for this object

equals

public boolean equals(java.lang.Object _obj)
Specified by:
equals in interface BaseObject
Overrides:
equals in class java.lang.Object
Parameters:
_obj - to compare.
Returns:
true if _obj is equal with the same class, not only an implementation of Privilege.

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Based on the main type first, and then on the nick name, if the main types are equals, then on the detailled names at the end. The rights are NOT compared. Called by ACSImpl.newEorPrivilege() (through Arrays.sort()), ACSTreeUtilities.addDetailledNameUnderNode() and by Gui1.CollectionPropertyEditor.propertyChange() to display the Privileges.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - to compare must be an ImmutableAclEntry
Returns:
0 if the ACL are almost equals, 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()
Return long value for serialization


getKeyPropertiesFromDetailledName

public final ImmutableName[] getKeyPropertiesFromDetailledName(java.lang.String _displayedName)
                                                        throws BaseError
Extracts the 3 key properties from the key of an object. From the DetailledName interface.

Specified by:
getKeyPropertiesFromDetailledName in interface DetailledName
Parameters:
_displayedName - is the detailled name of a privilege
Returns:
an array of 3 names:

- at the index 0, the main type in a one-component name

- at the index 1, the nick name in a one-component name

- at the index 2, the first right name in a one-component name

Throws:
BaseError - if the argument is not a valid key, or if a main component string is not provided by NameImpl.toString().

getNameFromDetailledName

public ImmutableName getNameFromDetailledName(ImmutableACS _acs,
                                              java.lang.String _detailledName)
                                       throws BaseError
Extracts the BaseObject name from the detailled name of a Privilege. This is a pseudo-static method, since it does not depend on the instance. Calls ACSCatalog.getOnePrivilegeFromDetailledName(). Called by TreeManager.analyzeSelectedNodeInExplorer() and SimplePropertyEditor.viewOneElement().

Specified by:
getNameFromDetailledName in interface DetailledName
Parameters:
_detailledName - the viewable name of the object in the explorer
_acs - ACS of the BaseObject
Returns:
name of the Privilege, or empty
Throws:
BaseError

finalizeForUser

public void finalizeForUser()
                     throws UpDateError
It sets to null almost all variables, so the instance is equals to a new PrivilegeForTypeImpl(). This method removes the associates, then calls finalizeForBase(). Called by the GUI. Calls finalizeForBase() and AssociateUtilityImpl.removeAssociatesAfterDeletion() to remove the associates. It is public to let the gWork methods to call it, but is is not described in the BeanInfo since the beamer must use only finalizeForUser() to delete an object. This method does not raise PropertyChangeEvents since the BeanInfo for this class specifies that its ACS informs the listeners when this instance is finalized. To test if an instance has been finalized, uses (aCS_ == null).

Specified by:
finalizeForUser in interface FinalizedObjectForUser
Throws:
UpDateError - from finalizeFromBase()

finalizeForBase

public void finalizeForBase()
                     throws UpDateError
It sets to null almost all variables, so the instance is equals to a new PrivilegeAbst(). The StringRights are not finalized, but the links are cut. The privilege is not unregistered in its ACS. Overridden by all the subclasses. Called by the subclasses methods, including finalizeFromDeserialization().

Specified by:
finalizeForBase in interface FinalizedObject
Throws:
no - UpDateError throwing
UpDateError - if the resource is unknown of the main ACS (if it is a clone without setName(), typically)

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. Called by setComment() for the bound properties:

- 'Comment',

- 'SeeWhy',

- 'SecondType',

and for all the subclasses property changes.

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