|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectARoad0.gBase.StringMetaRightImpl
public final class StringMetaRightImpl
This class is responsible for managing the canonical (or generic) rights for all the base objects. A metaright is a StringRight, so it provides rights in a rights network, but without link to an ACS. It handles the links to the StringRights in every rights network managed by an ACS. A metaright has a position in a matrix (power,field). So each metaright has:
- a power, which is bigger as the power of the right is powerfull
- a field, which is the name of a column where the closer metarights are grouped
A metaright may be in a floating subnetwork of one or several ACS rights which are not associated to the main stream of metarights, without any capacity to compare the powers.
A metaright may be used as a right in an ACS, to avoid StringRight creation and to have a pool of rights for several ACS. A metaright is never typed and may be classed. Most of denying rights have 'deny_' as first caracters in their right, and 'none' is the single exception. Note: the implementation class is not a subclass of StringRightImpl, to be faster, and it uses an embedded StringRightImpl instance, following the 'composition' pattern. It is a javabean with the following bound properties: 'Comment', 'Parent', 'Slave', 'Desactivated', 'UpperRights', 'LowerRights', 'ACSRights'. 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 updating methods, and a dialog box is displayed to inform the user.
UtilityImpl.getFirstIncreasingRightsChain(ARoad0.gBaseInterface.StringRight, ARoad0.gBaseInterface.StringRight, ARoad0.gBaseInterface.StringRight)
,
Serialized FormField Summary | |
---|---|
static StringMetaRightImpl |
EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. |
private int |
field_
This is the field, which is the colomn value in the matrix (power, field) which helps to locate the metaright. |
private boolean |
grant_
boolean true if the metaright is in a granting right, not a denying one. |
private static int |
INCREMENT_CAPACITY
|
private boolean |
inFloatingSubNetwork_
boolean true if the metaright is in a floating subnetwork for an ACS, without any association outside the subnetwork. |
private static int |
INITIAL_CAPACITY
|
private java.util.Set |
l_ACSRightsChangeSupport_
list of PropertyChangeListeners for the property 'ACSRights'. |
protected java.util.HashMap |
m_ACSRights_
This is the ACS StringRights which are strictly equivallent to this StringMetaRight in each open ACS. |
private int |
power_
This is the power, which is the line value in the matrix (power, field) which helps to locate the metaright. |
static java.io.ObjectStreamField[] |
serialPersistentFields
standardized variable for the JDK 2 serialization |
private static long |
serialVersionUID
|
protected StringRightImpl |
sRight_
The right, as an embedded instance. |
Constructor Summary | |
---|---|
StringMetaRightImpl()
Constructor used by EMPTY_INSTANCE. |
|
StringMetaRightImpl(java.lang.String _kernelRight,
java.lang.String _targetClass,
java.lang.Integer _internalKey,
java.lang.Integer _power,
java.lang.Integer _field,
boolean _grant)
Effective constructor. |
Method Summary | |
---|---|
protected void |
addACSRight(StringRightImpl _right)
Add an ACS right which is associated to this metaright in an ACS. |
protected void |
addLowerRight(StringMetaRight _right)
Add a lower metaright which are strictly lesser than this metaright without any intermediate right, following the network of metarights. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener _l)
Add a listener to the bean, for all the bound properties. |
void |
addPropertyChangeListener(java.lang.String _propertyName,
java.beans.PropertyChangeListener _l)
Add a listener to the bean. |
void |
addUpperRight(StringMetaRight _right)
Add an upper metaright which are strictly greater than this metaright without any intermediate right, following the network of metarights. |
int |
compareTo(java.lang.Object _o)
Compare two StringRight instances through the internal key and, if not null, acsname comparisons, whatever the right, power and field. |
boolean |
equals(java.lang.Object _obj)
Compares the two StringMetaRights without comparison of the property m_ACSRights_, since a deserialized metaright in an ACS rights array, may have a null m_ACSRights_ althought it has be to considered as equal to the reference metaright from BaseManagerImpl. |
protected void |
finalizeClosedRight()
This method is to use only for closed rights in the relevant ACS list, to set an empty instance. |
void |
finalizeForBase()
UNUSED METHOD. |
void |
finalizeForUser()
UNUSED METHOD. |
protected void |
firePropertyChange(java.lang.String _propertyName,
java.lang.Object _oldValue,
java.lang.Object _newValue)
Fire an event to every registered listener, in any order. |
ImmutableName |
getAcsName()
|
StringRight[] |
getACSRightsForOneACS(ImmutableName _aCSname)
Get the StringRights which are equivallent to this MetaStringRight in one ACS. |
java.lang.String |
getComment()
|
StringMetaRight |
getEorMetaRight()
Get the global Access Road right which is a generic description of this ACS right. |
int |
getField()
Get the field, which is the colomn value in the matrix (power, field) which helps to locate the metaright. |
ImmutableName |
getFullName()
Get the full name of the right, which is unique for the program. |
boolean |
getInFloatingSubNetwork()
|
int |
getInternalKey()
|
StringRight[] |
getLowerRights()
Get the set of lower metarights which are strictly lesser than this metaright without any intermediate right, following the network of metarights. |
java.util.Map<java.lang.String,StringRight[]> |
getM_ACSRights()
Get the ACS StringRights which are equivallent to this MetaStringRight in each ACS. |
ImmutableName |
getName()
Get the BaseObject name of the metaright, that is its full name. |
java.lang.String |
getNickName()
Gets a short name limited to 5 characters if positive, 16 first characters if starts with '|' and positive, and 7 if negative, for displaying this right in the views. |
int |
getPower()
Get the power, which is the line value in the matrix (power, field) which helps to locate the metaright. |
java.lang.String |
getRight()
If the metaright is non-classed, the result contains the kernel right only. |
long |
getSerialVersionUID()
|
java.lang.String |
getTargetClass()
|
java.lang.String |
getTargetClassType()
|
StringRight[] |
getUpperRights()
Get the set of upper metarights which are strictly greater than this metaright without any intermediate right, following the network of metarights. |
int |
hashCode()
|
boolean |
isDesactivated()
Get if the right is desactivated. |
boolean |
isEmpty()
|
boolean |
isGrantingRight()
|
boolean |
isParent()
|
boolean |
isSlave()
A slave right has a strong link with a parent right. |
boolean |
isTargetClassed()
|
boolean |
isTargetClassTyped()
|
boolean |
isUnused()
When some relevant ACS are closed, the link to them remain in this metaright. |
protected void |
removeACSRight(StringRightImpl _right)
Remove an ACS right which is associated to this metaright. |
protected void |
removeLowerRight(StringMetaRight _right)
Remove a lower metaright which are strictly lesser than this metaright without any intermediate right, following the network of metarights. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener _l)
Remove a listener to the bean, for all the bound properties. |
void |
removePropertyChangeListener(java.lang.String _propertyName,
java.beans.PropertyChangeListener _l)
Remove a listener to the bean. |
void |
removeUpperRight(StringMetaRight _right,
java.lang.Object _caller)
Remove a upper metaright which are strictly greater than this metaright without any intermediate right, following the network of metarights. |
void |
setComment(java.lang.String _s)
Set any comment related to this right. |
void |
setDesactivated(boolean _b)
Set that the right is desactivated. |
protected void |
setField(int _f)
Set the field, which is the colomn value in the matrix (power, field) which helps to locate the metaright. |
void |
setInFloatingSubNetwork(boolean _b)
It is not a bound property, since it is set only at the creation. |
void |
setParent(boolean _b)
UNUSED, the value is always false. |
protected void |
setPower(int _p)
Set the power, which is the line value in the matrix (power, field) which helps to locate the metaright. |
void |
setSlave(boolean _b)
UNUSED, the value is always false. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private static final int INITIAL_CAPACITY
private static final int INCREMENT_CAPACITY
protected StringRightImpl sRight_
private int power_
private int field_
protected transient java.util.HashMap m_ACSRights_
private boolean inFloatingSubNetwork_
private boolean grant_
private transient java.util.Set l_ACSRightsChangeSupport_
public static final StringMetaRightImpl EMPTY_INSTANCE
public static final java.io.ObjectStreamField[] serialPersistentFields
Constructor Detail |
---|
public StringMetaRightImpl()
public StringMetaRightImpl(java.lang.String _kernelRight, java.lang.String _targetClass, java.lang.Integer _internalKey, java.lang.Integer _power, java.lang.Integer _field, boolean _grant) throws CreateError
_kernelRight
- is the right if the StringRight is not typed, or otherwise
it is the beginning of the right. Never null._targetClass
- is the target class, non-null only when this StringRight is typed.
Do not use the 'Immutable' version of the interface. A typical value
is "ARoad0.gBaseInterface.Directory"._internalKey
- is the internal key which allows rights comparisons.
From 1 to 99999._power
- is the line value in the matrix (power, field). From 1 to 99. Not null._field
- is the colomn value in the matrix (power, field). From 1 to 99. Not null._grant
- is true if it is a granting metaright. False for a denying right.
CreateError
- if the StringRightImpl constructor
- the instance must then be deleted !Method Detail |
---|
public final ImmutableName getAcsName()
getAcsName
in interface StringRight
public final ImmutableName getFullName()
here, ':: ' is added by gBase.NameImpl.toString(). This name is used only outside gBase, following BaseObject interface. All the denying rights have 'deny_' as first caracters in their right.
getFullName
in interface BaseObject
getFullName
in interface StringRight
public final ImmutableName getName()
getName
in interface BaseObject
getFullName()
,
BaseUtilityImpl.getRightFromNameAsString(java.lang.String, ARoad0.gBaseInterface.ACSRun)
public final java.lang.String getNickName()
The exception is for the administrative rights where the 15 first characters are put in 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.
getNickName
in interface BaseObject
getNickName
in interface StringRight
public final int getInternalKey()
getInternalKey
in interface StringRight
public final boolean isTargetClassed()
isTargetClassed
in interface StringRight
public final boolean isTargetClassTyped()
isTargetClassTyped
in interface StringRight
public boolean isGrantingRight()
isGrantingRight
in interface StringRight
public boolean isEmpty()
isEmpty
in interface StringRight
public final java.lang.String getRight()
getRight
in interface StringRight
public final java.lang.String getTargetClass()
getTargetClass
in interface StringRight
public final java.lang.String getTargetClassType()
getTargetClassType
in interface StringRight
public void setComment(java.lang.String _s)
setComment
in interface StringRight
_s
- is an user comment which is associated to the right.public final java.lang.String getComment()
getComment
in interface StringRight
public final void addUpperRight(StringMetaRight _right) throws BaseError
addUpperRight
in interface StringMetaRight
_right
- is directly included in this right. Never null.
BaseError
- if the right is null, if this instance is a slave,
or if the upper right is not superior to this instance,
or an upper right is an administration right while the new right is not,
or the number of upper rights is already 5.public final void removeUpperRight(StringMetaRight _right, java.lang.Object _caller)
removeUpperRight
in interface StringMetaRight
_right
- is directly included in this right. Never null._caller
- is the object which calls this method; used to
identify the upper right finalizing operation with _caller == _right.public final StringRight[] getUpperRights()
getUpperRights
in interface StringRight
public final StringRight[] getLowerRights()
getLowerRights
in interface StringRight
public final StringMetaRight getEorMetaRight()
getEorMetaRight
in interface StringRight
public final boolean isParent()
isParent
in interface StringRight
public final boolean isSlave()
isSlave
in interface StringRight
public final void setParent(boolean _b) throws BaseError
setParent
in interface StringRight
_b
- is true to set the right as a parent of slave rights
BaseError
- if there are lower rights.public final void setSlave(boolean _b) throws BaseError
setSlave
in interface StringRight
_b
- is true to set the right as a slave of a parent right
BaseError
- if there is more than one upper right,
or if it is not a parent.public final void setDesactivated(boolean _b)
setDesactivated
in interface StringRight
_b
- is true to desactivate the rightpublic final boolean isDesactivated()
isDesactivated
in interface StringRight
public final void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
addPropertyChangeListener
in interface BoundBean
_l
- PropertyChangeListener to add. Caution: the listener must NOT
have specific hashCode() and equals() methods, to work with HashSet
in the removing operations.public final void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
addPropertyChangeListener
in interface BoundBean
_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.public void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
removePropertyChangeListener
in interface BoundBean
_l
- PropertyChangeListener to removepublic void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
removePropertyChangeListener
in interface BoundBean
_propertyName
- String is the name of the property_l
- PropertyChangeListener to removepublic final boolean equals(java.lang.Object _obj)
equals
in interface BaseObject
equals
in interface StringRight
equals
in class java.lang.Object
_obj
- to compare
public final int hashCode()
hashCode
in interface BaseObject
hashCode
in interface StringRight
hashCode
in class java.lang.Object
public final int compareTo(java.lang.Object _o) throws java.lang.ClassCastException
compareTo
in interface StringRight
compareTo
in interface java.lang.Comparable
_o
- to compare
java.lang.ClassCastException
- - if the specified object's type
prevents it from being compared to this current Objectpublic long getSerialVersionUID()
public final java.lang.String toString()
toString
in interface StringRight
toString
in class java.lang.Object
public final int getPower()
getPower
in interface StringMetaRight
public final int getField()
getField
in interface StringMetaRight
public final java.util.Map<java.lang.String,StringRight[]> getM_ACSRights()
getM_ACSRights
in interface StringMetaRight
public final StringRight[] getACSRightsForOneACS(ImmutableName _aCSname)
getACSRightsForOneACS
in interface StringMetaRight
_aCSname
- an ACS name
public final boolean getInFloatingSubNetwork()
getInFloatingSubNetwork
in interface StringMetaRight
public void setInFloatingSubNetwork(boolean _b)
setInFloatingSubNetwork
in interface StringMetaRight
_b
- is true if the metaright is in a floating subnetwork for an ACS,
without any association to the main metarights in the network.public final boolean isUnused()
isUnused
in interface StringMetaRight
public final void finalizeForUser() throws UpDateError
finalizeForUser
in interface FinalizedObjectForUser
finalizeForUser
in interface StringRight
UpDateError
- if the base does not known the right (if
it is a clone, typically).public final void finalizeForBase() throws UpDateError
finalizeForBase
in interface FinalizedObject
UpDateError
- if the base does not known the right (if
it is a clone, typically).protected void setPower(int _p)
protected void setField(int _f)
protected final void addACSRight(StringRightImpl _right)
_right
- which associates this metaright to it. No action if null.protected void removeACSRight(StringRightImpl _right)
_right
- directly associates this right to it. No action if null or
unknown.protected final void addLowerRight(StringMetaRight _right)
_right
- is directly included in this right. Never null.protected void removeLowerRight(StringMetaRight _right)
_right
- is directly included in this right. Never null.protected final void firePropertyChange(java.lang.String _propertyName, java.lang.Object _oldValue, java.lang.Object _newValue)
_propertyName
- name of the changing property_oldValue
- of the property_newValue
- of the property. No operation if equal to _oldValue
and not null.protected final void finalizeClosedRight()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |