ARoad0.gBase
Class BaseUtilityImpl

java.lang.Object
  extended by ARoad0.gBase.BaseUtilityImpl
All Implemented Interfaces:
Singleton
Direct Known Subclasses:
BaseUtilityMySQLImpl, BaseUtilityUbuntuImpl

public class BaseUtilityImpl
extends java.lang.Object
implements Singleton

This class is an utility class for all the ACS, with only static methods. It provides synchronized methods to copy, get a BaseObject or a BeanInfo. This class is not used by the view core algorithms, since its methods are dedicated to the updating and the displaying of the gBase class properties. A lot of methods are final, to provide generic operations. The subclasses of this class are in the AcsAddon packages. Caution: this class is not defined in ACSFactoryUtilityImpl.M_GENERIC_ACS_VOCABULARY, then it is not possible to get its subclasses in the AcsAddons, through ARoad0.gBaseInterface.ACSRun.getM_AcsVocabulary(). Then, a BaseUtilityImpl subclass is always reserved to its AcsAddon packages and its own subclasses.


Field Summary
protected static int INITIAL_CAPACITY
           
protected static BaseUtilityImpl instance__
           
 
Constructor Summary
protected BaseUtilityImpl()
          Protected constructor for the subclasses.
 
Method Summary
static java.util.List addObjectInDecreasingSort(java.util.List _l_current, java.lang.Comparable _newObject)
          Adds a comparable object, and sort the resulting set with compareTo() to put the object in a decreasing order.
static StringRight[] addRightInDecreasingSort(StringRight[] _l_currentRights, StringRight _newRight)
          Adds a right, and sort the resulting set with StringRightImpl.compareTo() to put the right in a decreasing order.
static Directory copyDirectoriesAndActorsWithoutInternalAcl(Directory _dirToCopy, Directory _dir)
          Copies all the actors and all the subdirectories without internal acl copy.
static Directory copyDirectoriesAndResources(Directory _dirToCopy, Directory _dir)
          Applies ((ResourceImpl)child).copyOwnAcl() to each element under _dir.
static Directory copyDirectoryChildren(Directory _dirToCopy, Directory _dir)
          Copies a DirectoryImpl, and copies all the children and children of children without any specific order.
static ACS copyDirectoryChildrenForACS(ACS _acsToCopy, ACS _acs)
          Copies all the ACS directories, and copies all the children and children of children with the standard copy() method of the Copyable interface.
static GroupID[] copyGroupsTree(GroupID _groupToCopy, GroupID _grp)
          UNUSED - copies a GroupID tree with all members, to register in _grp (not copied) all the _groupToCopy members
static GroupID[] copyOrAddGroupMembers(GroupID _groupToCopy, GroupID _grp)
          Copies or adds members to a GroupID from another one members
static ImmutableName getAcsNameFromName(ImmutableName _rightName)
          Get the ACS name from the acsright name.
static java.util.Set<ImmutableGroupIDMember> getAllIndirectGroupMembers(GroupID _grp)
          Gets all the direct and all the indirect members of a group.
static java.util.Set<ImmutableEligibleParty> getAllIndirectGroupMembersAndRunningUnderActors(GroupID _grp)
          Gets all the direct and indirect members of a group, and all the running-under actors for which this group is a primary or a secondary group.
static ImmutableName getBaseObjectTrueName(ImmutableName _initialName, java.lang.Class _class)
          For UserIDs and GroupIDs, adds '<U>' or '<G>' before the name last component.
static java.lang.String getBeanInfoNameForISnode(java.lang.String _text)
          Gets the name of the BeanInfo class from the ISNodeImpl type.
protected static StringRight[] getChildRightsFromParentAGRights(StringRight[] _l_parentRights, ImmutableACS _acs)
          Gets the child inherited rights from the AG directory rights, for the children.
protected static java.util.Set<StringRight> getChildRightsSetFromParentAGRights(StringRight[] _l_parentRights, ImmutableACS _acs)
          Gets the child inherited rights from the AG directory rights, for the children.
static java.util.List<java.lang.String> getClassicSuperInterfacesFromBeanInfo(BeanInfoPattern _baseObjectBeanInfo)
          Gets the set of all the classical interfaces and super-interfaces of the BaseObject from its BeanInfo.getBeanDescriptor().getBeanClass().
static BaseObject getEorBaseObject(ImmutableName _name)
          Gets the BaseObject from the open entities only.
static ImmutableName getFromKownACS(ImmutableName _name)
          A Basic name starts with its ACS name, and this is used to detect if a name is from a known ACS in the full structure.
static BaseUtilityImpl getInstance()
          Method to obtain the unique instance of BaseUtilityImpl.
static StringRight[] getL_AcsRestrictedRights(BeanInfoPattern _baseObjectBeanInfo, BaseObject _source, java.lang.String _propertyName, ImmutableACS _acs, java.lang.String _type)
          Gets the restricted rights from the ACS for the property of an ACSObject.
static java.lang.String[] getL_AcsRestrictedTypes(BeanInfoPattern _baseObjectBeanInfo, java.lang.String _propertyName, ImmutableACS _acs)
          Gets the restricted ACSObject types for the property of an ACSObject to set in the GUI.
static StringRight[] getL_AcsSpecializedRights(java.lang.String _propertyName, ImmutableACS _acs, java.lang.String _resourceType, java.lang.String _EPType, java.util.Collection _l_interfaces)
          Gets the allowed specialized rights from the ACS for the property of an ACSObject.
static boolean getNoDisplayThisRightProperty(ACSObject _object, java.beans.PropertyDescriptor _propertyDescriptor, ACS _acs)
          Detects the need to display a right property in the beamer, following the ACS policy about its standard and specialized rights.
static java.lang.Object[] getRestrictedValues(BeanInfoPattern _baseObjectBeanInfo, java.lang.String _propertyName, ACSRun _acs, BaseObject _source, java.lang.String _type)
          Gets the restricted String or StringRight values for the argument of a new ACSObject.
static StringRight getRightFromNameAsString(java.lang.String _text, ACSRun _acs)
          Get the right from the string returned by getName().toString(), both for StringRightImpl and StringMetaRightImpl instances.
static boolean isAcsRightName(ImmutableName _rightName)
          Called by BeamerManager.
static boolean isExternalACSobject(ACSImpl _acs, ImmutableName _objName, boolean _forSource)
          Called by ACSImpl and PrivilegeForLinksImpl.finalizeForBase(), to check the presence of the ACSObject named _objName as a source of an external AclEntry or an external Linked Privilege, if _forSource is true, or as a target, also for an external AclEntry or an external linked Privilege.
static java.lang.String removeSpacesInString(java.lang.String _propertyName)
          Removes the whitespaces.
static boolean withAcrossToDirectoryAGRights(StringRight[] _l_rights)
          Analyzes the directory rights to say if the AG inherited rights which are derived from the directory rights allow some access to the child.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance__

protected static BaseUtilityImpl instance__

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
See Also:
Constant Field Values
Constructor Detail

BaseUtilityImpl

protected BaseUtilityImpl()
Protected constructor for the subclasses.

Method Detail

getInstance

public static BaseUtilityImpl getInstance()
Method to obtain the unique instance of BaseUtilityImpl.

Returns:
BaseUtilityImpl

getEorBaseObject

public static final BaseObject getEorBaseObject(ImmutableName _name)
                                         throws BaseError
Gets the BaseObject from the open entities only. It must be an ACS, a view, a metaright, or an ACSObject. If a view or an acs has the same name than an ACSObject, the view or the acs is returned without warning. Called by BaseManagerImpl.newEorACS(), and it is there normal to not find the BaseObject. Calls the first instance of UtilityImpl.getBaseObject().

Parameters:
_name - name of the object
Returns:
the non-null object
Throws:
BaseError - if there is no open object with this name

getBaseObjectTrueName

public static final ImmutableName getBaseObjectTrueName(ImmutableName _initialName,
                                                        java.lang.Class _class)
For UserIDs and GroupIDs, adds '<U>' or '<G>' before the name last component. Called by AssociateUtilityImpl.addAssociateActions().

Parameters:
_initialName - to analyze. Not null.
_class - of the BaseObject. Never null.
Returns:
the true name of the BaseObject. It is _initialName in most of the cases.

getFromKownACS

public static final ImmutableName getFromKownACS(ImmutableName _name)
A Basic name starts with its ACS name, and this is used to detect if a name is from a known ACS in the full structure. Does not work for an AclEntry or a Privilege. The returned value is the first ACS name which is found in removing the last components in the argument. Called by FolderAbst.prepareAfterRestoring().

Parameters:
_name - the name of the ACSObject, which may be unknown by the ACS
Returns:
the name of the known ACS which owns the ACSObject, and this ACS may be closed or not, or null if it is not a known ACS

getRestrictedValues

public static final java.lang.Object[] getRestrictedValues(BeanInfoPattern _baseObjectBeanInfo,
                                                           java.lang.String _propertyName,
                                                           ACSRun _acs,
                                                           BaseObject _source,
                                                           java.lang.String _type)
Gets the restricted String or StringRight values for the argument of a new ACSObject. When a value is restricted, the allowed values are get:

- first, if _propertyName contains 'Rights', from the ACS.getM_SpecializedRights() map if there is a matched key, and then, the values are in a StringRight array,

- second, if _propertyName contains 'Rights', from the ACS.getM_StandardRights() map if there is a matched key, and then, the values are in a StringRight array,

- third, from the ACS.getM_SpecializedTypesAndExplorer() map if there is a matched key, and then, the values are in a String array,

- fourth, from the property descriptor in the BeanInfo if 'limitedSetForValues' is not null, and then, the values are in a String array.

For the privilege 'MainType' property in the constructor, returns only the simple typed and the simple linked privilege types. Called:

- by BaseObjectHandler.getArgumentEditor() with a null or non-null ACSRun argument,

- by CollectioPropertyEditor.actionPerformed() for the Select button.

Calls getL_AcsRestrictedRights() and getL_AcsRestrictedStrings().

Parameters:
_baseObjectBeanInfo - is the BeanInfo instance where the properties are described
_propertyName - is the name of the restricted property in the BeanInfo, with spaces between words or not.
_acs - is the new object ACS or ACSFactory. May be null.
_source - is generally the object having _propertyName as property. May be null only if _propertyName does not contain 'Rights', since it is used for searching specialized rights. If _source is instance of AclEntry, the caller has to replace it by the AclEntry Resource to test the type. If it is for Privilege rights, _source has to be a Privilege.
_type - not null only when _propertyName is 'AclRights' or 'PrivilegeRights', to give the type of the AclEntry EligibleParty or the Privilege type. May be null.
Returns:
the restricted values as a String or a StringRight array, or null if they are not found for these arguments.

getL_AcsRestrictedRights

public static final StringRight[] getL_AcsRestrictedRights(BeanInfoPattern _baseObjectBeanInfo,
                                                           BaseObject _source,
                                                           java.lang.String _propertyName,
                                                           ImmutableACS _acs,
                                                           java.lang.String _type)
Gets the restricted rights from the ACS for the property of an ACSObject.

- first, search of the specialized right constraints,

- second, search of the general right constraints.

The class in the ACS must be one of the interfaces of the ACSObject class. Returns the first matching result which is found. In each of the two searches, the search order is the order of interfaces get from getClassicSuperInterfacesFromBeanInfo(). When _propertyName is 'AclRights', it is recommanded to have a non-null _type only when the eligible party belongs to _acs, like in AclEntryImpl.setRights(). When _propertyName is 'PrivilegeRights', there is no search of the specialized right constraints. Called by getRestrictedValues(), getNoDisplayThisRightProperty(), ResourceImpl, AclEntryImpl, PrivilegeAbst. Calls getClassicSuperInterfacesFromBeanInfo(), removeSpacesInString(), getL_AcsSpecializedRights(), getClassNameFromArrayOrInterface() and getACSVocabularyFromArrayOrInterface(). BaseUtilityImpl.getClassNameFromArrayOrInterface() and getBeanInfoNameFromClass().

Parameters:
_baseObjectBeanInfo - is the BeanInfo instance where the properties are described. Used only when _source is a Privilege.
_source - is the object for which there is the property and a BeanInfo. For AclEntry, it is the AclEntry Resource or EligibleParty. For Privilege, it is an empty PrivilegeForTypeImpl, even for a linked privilege. For other objects, it is the source of the property.
_propertyName - is the property name, with spaces in the name or not
_acs - is the ACSObject ACS
_type - to use only when _propertyName is 'AclRights' for an ACL source, to give the type of the eligible party or the privilege type. May be null, even with the property 'AclRights'.
Returns:
the StringRight array of the restricted values for the property. Null if there is no applicable restricted values in _acs for these arguments.

getL_AcsRestrictedTypes

public static final java.lang.String[] getL_AcsRestrictedTypes(BeanInfoPattern _baseObjectBeanInfo,
                                                               java.lang.String _propertyName,
                                                               ImmutableACS _acs)
Gets the restricted ACSObject types for the property of an ACSObject to set in the GUI. The values to remove are defined in the ACS by the key 'CreationByBeamer.NoType' in getM_TypesAndGUIPolicy(). The class in the ACS must be one of the interfaces of the ACSObject interface. The integrity rules on types are so not enforced by the gBase package, but by GUI packages, typically with the PropertyEditor classes and the ActionNewResource class.

The search order of the possible values in getM_TypesAndGUIPolicy() is the order of interfaces get from the method getClassicSuperInterfacesFromBeanInfo(), where the searched keys have the format 'interface name.property name'. The possible values are get from the first key to match.

The user can create some ACSObjects having only the types the ACS authorizes. Typically, the types 'ResourceType.<byAcsCreator>' and 'EPType.<byAcsCreator>' are not allowed. After the first selection of allowed types, it may have a removing of some values from the getM_TypesAndGUIPolicy() key 'CreationByBeamer.NoType'. The forbidden types in the array have one of the following forms : 'ResourceType.forbidden type', 'EPType.forbidden type', 'DirectoryType.forbidden type', 'ActorType.forbidden type', 'UserIDType.forbidden type', 'GroupIDType.forbidden type', 'VirtualFolderType.forbidden type', 'PrivilegeSecondType.forbidden type'. A forbidden type for EligibleParty is not forbidden to all the EligibleParty subclasses. This is also true for a forbidden type for Resource. Like the order of interfaces, the 'ActorType.forbidden type' list is the single list to applied to an Actor, just like 'DirectoryType.forbidden type' for the Directories, and 'UserIDType.forbidden type' for the UserID.

Caution: this method does provide all the types of the objects the program has created at the ACS construction, although these types may be useful in varied operations like the construction of a new typed privilege.

'VirtualFolderType' is converted to ResourceVFType or to EPVFType. ResourceVFType is the first choice, if _acs manages the VirtualFolders of Targets. Then if the 2 VirtualFolder types are used by the ACS, the key 'VirtualFolder.EPVFType' is unused, and the selection of a type for a VirtualFolder of EP Targets is let to the user among the extended list. If its type choice is wrong, the VirtualFolder constructor fires an exception.

Called by getRestrictedValues() and SimplePropertyEditor.getRestrictedValues().

Parameters:
_baseObjectBeanInfo - is the BeanInfo of a BaseObject class
_propertyName - is the property name, with spaces in the name or not
_acs - is the ACSObject ACS
Returns:
the array of the restricted values for the property. Null if there is no applicable restricted types in _acs for these arguments.
See Also:
ACSCatalog.getM_TypesAndGUIPolicy()

getL_AcsSpecializedRights

public static final StringRight[] getL_AcsSpecializedRights(java.lang.String _propertyName,
                                                            ImmutableACS _acs,
                                                            java.lang.String _resourceType,
                                                            java.lang.String _EPType,
                                                            java.util.Collection _l_interfaces)
Gets the allowed specialized rights from the ACS for the property of an ACSObject. If there are several matched keys, the returned array contains the rights which are in all the matched arrays. So, to forbid a source type for instance, a null array should be associated to it in the ACS properties. Called by getL_AcsRestrictedRights(). Calls getClassicSuperInterfacesFromBeanInfo() and getL_MapKeysForSpecializedRights().

Parameters:
_propertyName - is the property name, with spaces in the name or not. Has to contain 'Rights' since it is a right property.
_acs - is the base object ACS
_resourceType - is the type of the new object as Resource. May be null.
_EPType - is the type of the new object as EligibleParty. May be null.
_l_interfaces - interfaces to consider
Returns:
the array of the restricted values for the property. Null if there is no restricted values in _acs for these arguments.

getClassicSuperInterfacesFromBeanInfo

public static final java.util.List<java.lang.String> getClassicSuperInterfacesFromBeanInfo(BeanInfoPattern _baseObjectBeanInfo)
Gets the set of all the classical interfaces and super-interfaces of the BaseObject from its BeanInfo.getBeanDescriptor().getBeanClass(). The hierarchy of package names ('ARoad0.gBaseInterface.') is not returned. The order of the items is get initially from the Class.getInterfaces() method, but the final sorting is Actor, then Directory then Resource, and UserID then GroupID then EligibleParty. For the AcsAddons, the returned list does not include the interfaces from the AcsAdon, like 'ActorZZZ' from the interface 'ARoad0.XXX.YYY.gBaseInterface.ActorZZZ'. Called by getL_AcsRestrictedValues() and getL_AcsSpecializedRights().

Parameters:
_baseObjectBeanInfo - is the bean info of a BaseObject class. Never null.
Returns:
classic interfaces without the package names. Never null.

getNoDisplayThisRightProperty

public static final boolean getNoDisplayThisRightProperty(ACSObject _object,
                                                          java.beans.PropertyDescriptor _propertyDescriptor,
                                                          ACS _acs)
Detects the need to display a right property in the beamer, following the ACS policy about its standard and specialized rights. The check of the specialized rights is based on the right category, but it does not include the verification of the target or the source, and the interface/type of the object to display. Does not display, for a Resource, the panes 'AG' and 'Inheritance' if the userID is null and the type contains '<byAcsCreator>'. Calls getL_AcsRestrictedRights() for testing the ACL and Privilege rights in Resources. Called by BeamerManager.getNoDisplayThisProperty(). getL_AcsSpecializedRights() should allow to get a more precise view of what is authorized, but it is not fast, and this method is called for each property to display in the beamer. So, the CollectionPropertyEditor 'Select' button is processed to explain to the user when there is no authorized values for a property of a given ACSObject.

Parameters:
_object - to display. May be null.
_propertyDescriptor - is a property descriptor from a BeanInfo
_acs - contains _object
Returns:
false if the property has to NOT be displayed. Always true if _object is null.

removeSpacesInString

public static final java.lang.String removeSpacesInString(java.lang.String _propertyName)
Removes the whitespaces. Example: "Acl Rights" becomes "AclRights". Called by getRestrictedValues() and getL_AcsRestrictedValues(). By the way, this is used by BaseObjectHandler and CollectionPropertyEditor, but it is not usefull, since the property names in getBeanDescriptor() have no more spaces.

Parameters:
_propertyName - is a set of words separated or not by one or several spaces, may be with whitespaces at the end and the beginning
Returns:
a compacted set of characters, in one word

copyDirectoryChildren

public static Directory copyDirectoryChildren(Directory _dirToCopy,
                                              Directory _dir)
Copies a DirectoryImpl, and copies all the children and children of children without any specific order. Called from ActionCopy.handleNewBaseObject(). Calls copyDirectoriesAndActorsWithoutInternalAcl(), ResourceImpl.copyOwnAcl() and copyDirectoriesAndResources().

Parameters:
_dirToCopy - is the ResourceImpl to copy
_dir - is the instance which has been just created, and is updated with _dirToCopy variables copies
Returns:
Directory _dir

copyDirectoryChildrenForACS

public static ACS copyDirectoryChildrenForACS(ACS _acsToCopy,
                                              ACS _acs)
Copies all the ACS directories, and copies all the children and children of children with the standard copy() method of the Copyable interface. Has the copyDirectoryChildren() structure. Called from ACSImpl.copy(). Calls copyDirectoriesAndActorsWithoutInternalAcl(), copyDirectoriesAndResources(), ResourceImpl.copyOwnAcl() and Resource.copyWithoutInternalAcl(). No action if _acsToCopy is _acs.

Parameters:
_acsToCopy - is the source
_acs - is the copied instance
Returns:
_acs

copyDirectoriesAndActorsWithoutInternalAcl

public static Directory copyDirectoriesAndActorsWithoutInternalAcl(Directory _dirToCopy,
                                                                   Directory _dir)
Copies all the actors and all the subdirectories without internal acl copy. Called by copyDirectoryChildrenForACS() and copyDirectoryChildren().

Parameters:
_dirToCopy - is the source
_dir - is the copied instance
Returns:
Directory _dir

copyDirectoriesAndResources

public static Directory copyDirectoriesAndResources(Directory _dirToCopy,
                                                    Directory _dir)
Applies ((ResourceImpl)child).copyOwnAcl() to each element under _dir. Called from copyDirectoryChildrenForACS(), and copyDirectoryChildren(). Must be called AFTER copyDirectoriesAndActorsWithoutInternalAcl().

Parameters:
_dirToCopy - is the source
_dir - is the copied instance
Returns:
Directory _dir

copyOrAddGroupMembers

public static GroupID[] copyOrAddGroupMembers(GroupID _groupToCopy,
                                              GroupID _grp)
Copies or adds members to a GroupID from another one members. - if the ACS are the same, it adds the members without copy, - if the ACS are not the same, it searches the relevant members in the _grp ACS, and it adds them to _grp. If it does not exist, it creates the copy, it adds the copy as member, then it adds the copy to the returned array. Generally, _grp is a copy of _groupToCopy but it is not mandatory. Called from ActionCopy.handleNewBaseObject(). Caution: if the ACS is already displayed in the explorer before the calling of this method, each calling method must register the Gui2.ACSTreeBaseListeners to listen the 'l_Members' events from _grp, and after the calling, must use the returned array to register the new returned groupIDs.

Parameters:
_groupToCopy - is the GroupID to copy, which has non-null members.
_grp - is the instance which has been created
Returns:
array of the new goupIDs which may be processed then for Gui2.ACSTreeBaseListeners 'l_Members' registering. The array structure is a list of couples (groupToCopy, copiedGroup), so the lenght is always a pair number. For a copy within an ACS, groupToCopy is equal to copiedGroup. May be empty but not null, and does not contain null element.

copyGroupsTree

public static GroupID[] copyGroupsTree(GroupID _groupToCopy,
                                       GroupID _grp)
UNUSED - copies a GroupID tree with all members, to register in _grp (not copied) all the _groupToCopy members. - if the ACS are the same, it adds the members without copy, - if the ACS are not the same, it searches the relevant members in the _grp ACS, and it adds them to _grp. If it does not exist, it creates the copy, it adds the copy as member, then it add it to the returned array. Caution: if a _groupToCopy member is also member of another groupID which is not in the groupID tree, then the member link is not created. Called from ActionCopy.handleNewBaseObject(). If the ACS is already displayed in the explorer before the calling of this method, each calling method must register the Gui2.ACSTreeBaseListeners to listen the 'l_Members' events from _grp, and after the calling, must use the returned array to register the new groupIDs for the same reason.

Parameters:
_groupToCopy - is the GroupID to copy, which has non-null members.
_grp - is the instance which has been created
Returns:
array of the new goupIDs which may be processed then for Gui2.ACSTreeBaseListeners 'l_Members' registering, and for copying their members through the call to this method. May be empty but not null, and do not contain null element.

getBeanInfoNameForISnode

public static final java.lang.String getBeanInfoNameForISnode(java.lang.String _text)
Gets the name of the BeanInfo class from the ISNodeImpl type. For instance, with the ISFactoryUtilityImpl.INFORMATION_SYSTEM_NODE argument, it returns the value 'ARoad0.gBaseBeanInfo.ISComponentBeanInfo'. Called by ActionOpenGlobalStructure.getISnodePropertyDescriptors().

Parameters:
_text - a node type in ISFactoryUtilityImpl
Returns:
the right BeanInfo class name

addRightInDecreasingSort

public static final StringRight[] addRightInDecreasingSort(StringRight[] _l_currentRights,
                                                           StringRight _newRight)
Adds a right, and sort the resulting set with StringRightImpl.compareTo() to put the right in a decreasing order. If the current array is not ordered, the right is added before the first occurence which is lesser than the right. Called by ACS_Facade, RightsFactory_Facade and ACSFactoryImpl.

Parameters:
_l_currentRights - sorted set. May be null or empty.
_newRight - to add. May be null.
Returns:
_l_currentRights containing _newRight if not null nor empty

addObjectInDecreasingSort

public static java.util.List addObjectInDecreasingSort(java.util.List _l_current,
                                                       java.lang.Comparable _newObject)
Adds a comparable object, and sort the resulting set with compareTo() to put the object in a decreasing order. If the current array is not ordered, the object is added before the first occurence which is lesser than the object.

Parameters:
_l_current - sorted list of java.lang.Comparable to update. Never null.
_newObject - to add. Never null.
Returns:
updated _l_current with _newObject at the right place

withAcrossToDirectoryAGRights

public static boolean withAcrossToDirectoryAGRights(StringRight[] _l_rights)
Analyzes the directory rights to say if the AG inherited rights which are derived from the directory rights allow some access to the child. Return true if the Directory AG rights contain an equivalent to the metarights 'gothrough_for_directory', 'read_for_directory' or 'full_control'. On the contrary of ACL and PRI inherited rights, the AG rights inheritance requires that each parent node allows the go accross it, to have an access. Called by the Resource constructor, Directory.setL_ownerRights() and setL_groupRights().

Parameters:
_l_rights - rights of a Directory
Returns:
true if the rights allow an access to the Directory children

getAllIndirectGroupMembers

public static java.util.Set<ImmutableGroupIDMember> getAllIndirectGroupMembers(GroupID _grp)
Gets all the direct and all the indirect members of a group. No use in the core classes.

Parameters:
_grp - group to analyse
Returns:
set of the direct and indirect GroupIDmembers. May be empty but not null, and does not contain null element.
See Also:
getAllIndirectGroupMembersAndRunningUnderActors

getAllIndirectGroupMembersAndRunningUnderActors

public static java.util.Set<ImmutableEligibleParty> getAllIndirectGroupMembersAndRunningUnderActors(GroupID _grp)
Gets all the direct and indirect members of a group, and all the running-under actors for which this group is a primary or a secondary group. Called by NoThanViewInBaseImpl.setUpContextLists().

Parameters:
_grp - is the group to analyze
Returns:
set of groupIDmembers or Actors. May be empty but not null, and does not contain null element.
See Also:
getAllIndirectGroupMembers(ARoad0.gBaseInterface.GroupID)

getChildRightsFromParentAGRights

protected static StringRight[] getChildRightsFromParentAGRights(StringRight[] _l_parentRights,
                                                                ImmutableACS _acs)
Gets the child inherited rights from the AG directory rights, for the children. This is a wrapper for getChildRightsSetFromParentAGRights(). It is protected to be reserved to the gBase classes, from the generic gBase or the AcsAddon gBases. Called by ResourceImpl.getL_inheritedOwnerRights() and getL_inheritedGroupRights(), and the subclasses.

Parameters:
_l_parentRights - acsrights or metarights of a directory. Never null.
_acs - of the Resource calling this method. Never null.
Returns:
the child rights, without the rights in _l_parentRights which are not directory rights. May be a null-length array but not null.

getChildRightsSetFromParentAGRights

protected static java.util.Set<StringRight> getChildRightsSetFromParentAGRights(StringRight[] _l_parentRights,
                                                                                ImmutableACS _acs)
Gets the child inherited rights from the AG directory rights, for the children. It is protected to be reserved to the gBase classes, from the generic gBase or the AcsAddon gBases. Uses the pattern 'directory/child' in the metaright names. For instance, the metaright 'write_for_nxdirectory' has the image 'write_for_nxchild' which has the lower rights 'createchild' and 'deletechild', and these rights as arguments produce, through this method, the children rights 'create' and 'delete'. There is no way to use 'xxxchild' metarights as effective rights. They are just the intermediate values for the processing, and they are desactivated. The metaright 'full_control' has a dedicated processing since it has two images 'full_controlchild' and 'full_controlnxchild', which works as the sum of the images 'read_for_child' and 'write_for_child' for the first image, and 'read_for_child', 'write_for_nxchild' and 'execute_for_nxchild' for the second image. The argument _acs is used then for choosing the relevant rights. It is the same way for 'deny_all' and its two images 'deny_allchild' and 'deny_allnxchild'. Called by getChildRightsFromParentAGRights() and the subclasses.

Parameters:
_l_parentRights - acsrights or metarights of a directory. Never null.
_acs - of the Resource calling this method. Never null.
Returns:
the child rights, without the rights in _l_parentRights which are not directory rights. May be an empty set but not null.

getRightFromNameAsString

public static final StringRight getRightFromNameAsString(java.lang.String _text,
                                                         ACSRun _acs)
                                                  throws BaseError
Get the right from the string returned by getName().toString(), both for StringRightImpl and StringMetaRightImpl instances. Do not handle names from StringRightImpl.getFullName(), but it operates on StringMetaRightImpl.getFullName() since the full name is the name in metarights. If _acs is null for an acsright, the ACS is searching through the open ACS. So, if it is an acsright during the creation of the ACS, the ACSFactory has to be get to found the right. Called by ActionBeamer, SimplePropertyEditor, BaseObjectHandler.

Parameters:
_text - is the name, as get through getName().toString()
_acs - is the ACSFactory or the ACS which may own the right if it is an ascright. May be null.
Returns:
the right. May be null.
Throws:
BaseError - if the string argument is not from a name, or if it is not a known right in an open ACS, or from NameImpl.getNameFromString(_text).

getAcsNameFromName

public static final ImmutableName getAcsNameFromName(ImmutableName _rightName)
                                              throws BaseError
Get the ACS name from the acsright name. Not applicable to metarights. Called by ActionOpenBeamer and BeamerManager.

Parameters:
_rightName - name of an acsright
Returns:
the ACS name. Never null.
Throws:
BaseError - if it is not an acsright name.

isAcsRightName

public static final boolean isAcsRightName(ImmutableName _rightName)
Called by BeamerManager. Do not check the presence of the acsright in its ACS.

Parameters:
_rightName - name
Returns:
true if it is an acsright name

isExternalACSobject

public static final boolean isExternalACSobject(ACSImpl _acs,
                                                ImmutableName _objName,
                                                boolean _forSource)
Called by ACSImpl and PrivilegeForLinksImpl.finalizeForBase(), to check the presence of the ACSObject named _objName as a source of an external AclEntry or an external Linked Privilege, if _forSource is true, or as a target, also for an external AclEntry or an external linked Privilege. For an Actor, this method may be called twice to get a complete result. Caution: this method does not check if _objName is an _acs object, while it is forbidden.

Parameters:
_acs - ACS to analyze
_objName - name of the ACSObject to search
_forSource - true to search an EligibleParty, and false to search an ImmutableTarget
Returns:
true if _objName is the name of an external ACSObject in _acs