ARoad0.gWork
Class ACS_Facade

java.lang.Object
  extended by ARoad0.gWork.ACS_Facade
All Implemented Interfaces:
StaticClass

public class ACS_Facade
extends java.lang.Object
implements StaticClass

This class is the "facade" (GoF pattern) for some operations about ACS that are called by Gui1, Gui2 and gDMak objects. It contains only static methods.


Constructor Summary
private ACS_Facade()
          only one private constructor
 
Method Summary
static void closeDefaultBase()
          Close the base without savings, with all the open ACS and all the open views first.
static void closeOpenACS(ACSImpl _acs)
          Close any open ACS without save it.
static ImmutableAclEntry getAclEntry(ImmutableName _name)
          Gets the AclEntry from its base object name, with a format like ACS:: acsName:: ELIGIBLEPARTY:: epName:: >> RESOURCE:: resName || positiveRight Called by ActionOpenBeamer.openSelection().
static ACSObject getACSObjectFromDetailledName(ACS _acs, java.lang.String _detailledName)
          Gets the ACSObject from its detailled name.
static StringRight[] getAcsRightArray(ACSRun _acs)
          Build up an ordered array of decreasing references to the acsrights, after a filtering of the metarights.
static java.util.List getClosedACSnames()
          Called by ActionOpenACS.
static BaseObject getEorBaseObject(ImmutableName _name)
          Gets the BaseObject object.
static Actor[] getExtControlledActorArray(ImmutableACS _acs)
          Builds up an array of references to the ACS external controlled actors (not eligible ones) for which an aclEntry in this ACS apply some rights, seeing the actor as a resource belonged by an another ACS.
static Resource[] getExtControlledNonActorResourceArray(ImmutableACS _acs)
          Build up an array of references to the ACS external controlled resources that are NOT actors and for which an external-oriented aclEntry, in this ACS, applies some rights.
static Actor[] getExtEligibleActorArray(ImmutableACS _acs)
          Builds up an array of references to the ACS external actors (not controlled!)
static GroupID[] getExtEligibleGroupArray(ImmutableACS _acs)
          Builds up an ordered array of references to the ACS external eligible GroupIDs, without duplicates.
static UserID[] getExtEligibleUserArray(ImmutableACS _acs)
          Build up an ordered array of references to the ACS external eligible UserIDs, without duplicates.
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> getImportedACS(ImmutableName _name)
          Imports an ACS, opens and saves it.
static java.util.Set getL_IS()
          Return the names of the registered IS, which are also the IS nametree names.
static Name getNameFromString(java.lang.String _text)
          Get the name from the string returned by toString().
static java.util.Map getOpenACS()
           
static ImmutableAclEntry[] getOwnAclEntryArray(ACS _acs)
          Returns up an ordered array of references to the ACS own AclEntries.
static Actor[] getOwnActorArray(ACS _acs)
          Builds up an array of references to the ACS own actors.
static java.util.List<VirtualFolder> getOwnEPVirtualFolderList(ACS _acs)
          Builds up an ordered array of references to the ACS own Eligible Party VirtualFolders.
static GroupID[] getOwnGroupArray(ACS _acs)
          Builds up an ordered array of references to the ACS own groupIDs.
static java.util.List<Privilege> getOwnPrivilegeList(ACS _acs)
          Builds up an ordered array of references to the ACS own Privileges.
static java.util.List<VirtualFolder> getOwnResourceVirtualFolderList(ACS _acs)
          Builds up an ordered array of references to the ACS own Resource VirtualFolders.
static UserID[] getOwnUserArray(ACS _acs)
          Builds up an ordered array of references to the ACS own userIDs.
static ImmutablePrivilege getPrivilege(ImmutableName _name)
          Gets the Privilege from its base object name.
static boolean isOpenACS(ImmutableName _name)
           
static boolean knowsACS(ImmutableName _name)
           
static ACSImpl openOrGetACS(ImmutableName _name)
          Get the open ACS, and before open it if it is closed.
static void removeACS(ImmutableName _name)
          Removes any ACS, close and save it before if necessary.
static void saveACS(ImmutableName _name)
          Save the ACS on a file..
static void saveAndCloseDefaultBase()
          Save and close the base with the ACS and view lists, even if it is empty.
static void saveAndCloseOpenACS(ACSImpl _acs)
          Closes any open ACS and saves it before.
static void saveDefaultBase()
          Save the base with the ACS and view lists, even if it is empty.
static boolean validateFrameName(ImmutableName _name)
          Validate a name, mainly as a title of an internal frame, as without ' ::' nor ' >>', nor '<>' or ViewInBase_Facade.NOTHAN_VIEW_INDICATOR, nor non-null and not empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ACS_Facade

private ACS_Facade()
only one private constructor

Method Detail

getL_IS

public static java.util.Set getL_IS()
Return the names of the registered IS, which are also the IS nametree names. An IS may contains opened and closed ACS.

Returns:
cloned set of IS names. Never null.

knowsACS

public static boolean knowsACS(ImmutableName _name)
Parameters:
_name - of an ACS
Returns:
true if _name is known as an ACS name. The ACS may be opened or closed.

isOpenACS

public static boolean isOpenACS(ImmutableName _name)
Parameters:
_name - of an ACS
Returns:
boolean true if _name is known as an ACS name and the ACS is open.

getClosedACSnames

public static java.util.List getClosedACSnames()
Called by ActionOpenACS.

Returns:
unmodifiable List of the closed ACS names.

getOpenACS

public static java.util.Map getOpenACS()
Returns:
unmodifiable Map of the non-null open ACS instances, where the ACS name is the key. Never null.

saveDefaultBase

public static void saveDefaultBase()
                            throws BaseError
Save the base with the ACS and view lists, even if it is empty. All open ACS and views, but not the closed ones, are saved in some files (one per opened ACS and view) in the default directory. Caution: the references between the ACS are broken then restored. So, all aclEntries must be restored in gWork and the GUI.

Throws:
BaseError - if an acs is not open, ACSname.lastComponent() is null, FileNotFoundException or IOException.

closeDefaultBase

public static void closeDefaultBase()
                             throws BaseError
Close the base without savings, with all the open ACS and all the open views first.

Throws:
BaseError - if an acs is not opened.

saveAndCloseDefaultBase

public static void saveAndCloseDefaultBase()
                                    throws BaseError
Save and close the base with the ACS and view lists, even if it is empty. All open ACS and views, but not the closed ones, are saved then closed in some files (one per opened ACS and view) in the default directory.

Throws:
BaseError - if an acs is not open, ACSname.lastComponent() is null, FileNotFoundException or IOException.

saveACS

public static void saveACS(ImmutableName _name)
Save the ACS on a file..

Parameters:
_name - ImmutableName of the ACS to save

openOrGetACS

public static ACSImpl openOrGetACS(ImmutableName _name)
                            throws BaseError
Get the open ACS, and before open it if it is closed. Does not open the tied child ACS, and this has to be done by the calling method if it is an opening. Called by ActionOpenACSyst.openACS() for the ACS opening.

Parameters:
_name - of the ACS to get or open. No test of null nor empty. Used only to open an ACS.
Returns:
the requested ACS or an empty acs
Throws:
BaseError - if the ACS is not known, the ACS is open, the open ACS has not the same name, or ClassNotFoundException, IOException with invalidClassException if the code of ACS has changed.

saveAndCloseOpenACS

public static void saveAndCloseOpenACS(ACSImpl _acs)
Closes any open ACS and saves it before.

Parameters:
_acs - is an ACS to close

closeOpenACS

public static void closeOpenACS(ACSImpl _acs)
                         throws BaseError
Close any open ACS without save it. The open views that contains some objects from this ACS are also closed without user message.

Parameters:
_acs - to close
Throws:
BaseError - if _acs is not open, ACSname.lastComponent() is null, or FileNotFoundException, IOException.

removeACS

public static void removeACS(ImmutableName _name)
                      throws BaseError
Removes any ACS, close and save it before if necessary. Removes its node and all the children nodes in the IS nametree. Removes the IS if it is the last ACS in it. Removes the children ACS.

Parameters:
_name - of the ACS to remove from the base
Throws:
BaseError - if the ACS is unknown, ACSname.lastComponent() is null, or FileNotFoundException, IOException.

getOwnGroupArray

public static GroupID[] getOwnGroupArray(ACS _acs)
Builds up an ordered array of references to the ACS own groupIDs.

Parameters:
_acs - is an ACS
Returns:
array of GroupID in _acs. it is "new GroupID[1]" if the array is empty.

getOwnUserArray

public static UserID[] getOwnUserArray(ACS _acs)
Builds up an ordered array of references to the ACS own userIDs.

Parameters:
_acs - is an ACS
Returns:
array of UserID in _acs. it is "new UserID[1]" if the array is empty.

getOwnActorArray

public static Actor[] getOwnActorArray(ACS _acs)
Builds up an array of references to the ACS own actors.

Parameters:
_acs - is an ACS
Returns:
array in _acs. it is "new Actor[1]" if the array is empty.

getOwnAclEntryArray

public static ImmutableAclEntry[] getOwnAclEntryArray(ACS _acs)
Returns up an ordered array of references to the ACS own AclEntries. The order criterion are, first, the EligibleParty class (UserID, then GroupID, then Actor), and, second, the EligibleParty name in its natural order. An AclEntry may include references to other-ACS objects. The access-target object may be an 'external controlled resource' (including actor) owned by another ACS. The right user may be an 'external eligible party' (an actor, user or group) owned by another ACS. The external AclEntries are added by ACSTreeBaseListenerImpl.changeOneAclEntry(). Called by Gui1.ACSTree.createOwnAclGraphicalTree().

Parameters:
_acs - ACS
Returns:
ImmutableAclEntry[] array in _acs. Never null. May be empty.

getExtControlledActorArray

public static Actor[] getExtControlledActorArray(ImmutableACS _acs)
Builds up an array of references to the ACS external controlled actors (not eligible ones) for which an aclEntry in this ACS apply some rights, seeing the actor as a resource belonged by an another ACS.

Parameters:
_acs - is an ACS
Returns:
array in _acs. it is "new Actor[1]" if the array is empty.

getExtEligibleActorArray

public static Actor[] getExtEligibleActorArray(ImmutableACS _acs)
Builds up an array of references to the ACS external actors (not controlled!) for which an external AclEntry or Linked Privilege in this ACS delivers a specific right. The array contains no duplicate elements. Called by ACSTree.getExtEligibleActorTree().

Parameters:
_acs - is an ACS
Returns:
array in _acs. May be null.

getExtEligibleGroupArray

public static GroupID[] getExtEligibleGroupArray(ImmutableACS _acs)
Builds up an ordered array of references to the ACS external eligible GroupIDs, without duplicates.

Parameters:
_acs - is an ACS
Returns:
array of external GroupID in _acs. May be null.

getExtEligibleUserArray

public static UserID[] getExtEligibleUserArray(ImmutableACS _acs)
Build up an ordered array of references to the ACS external eligible UserIDs, without duplicates.

Parameters:
_acs - is never null
Returns:
array of external UserID in _acs. May be null.

getExtControlledNonActorResourceArray

public static Resource[] getExtControlledNonActorResourceArray(ImmutableACS _acs)
Build up an array of references to the ACS external controlled resources that are NOT actors and for which an external-oriented aclEntry, in this ACS, applies some rights. Each external resource is belonged by an another ACS.

Parameters:
_acs - ACS
Returns:
Resource[] array in _acs. it is "new Resource[1]" if the array is empty.

getAcsRightArray

public static StringRight[] getAcsRightArray(ACSRun _acs)
Build up an ordered array of decreasing references to the acsrights, after a filtering of the metarights. Called by ACSTree.createAcsRightGraphicalTree() and so, the acsrights list in the explorer does not include the metarights used by the ACS. Called by ActionNewACSyst.selectACS().

Parameters:
_acs - is an ACS or an ACSFactoryImpl
Returns:
array of acsrights in _acs. May be null.

getEorBaseObject

public static BaseObject getEorBaseObject(ImmutableName _name)
                                   throws BaseError
Gets the BaseObject object. It may be an open ACS, an open ViewInBase, a metaright, or an ACSObject in an open ACS.

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

getACSObjectFromDetailledName

public static ACSObject getACSObjectFromDetailledName(ACS _acs,
                                                      java.lang.String _detailledName)
                                               throws BaseError
Gets the ACSObject from its detailled name. It must be an AclEntry or a Privilege. Calls the relevant ACS methods, first to try to get an AclEntry then to get a Privilege. Called by TreeManager.getTrueUserObjectInTreeExplorer().

Parameters:
_acs - of the object
_detailledName - of the object
Returns:
the object
Throws:
BaseError - if there is no object with this name

getNameFromString

public static Name getNameFromString(java.lang.String _text)
                              throws BaseError
Get the name from the string returned by toString().

Parameters:
_text - the name, as get through toString()
Returns:
the name
Throws:
BaseError - if the string argument is null or empty, or if the string is not ended by ':: '.

getAclEntry

public static ImmutableAclEntry getAclEntry(ImmutableName _name)
                                     throws BaseError
Gets the AclEntry from its base object name, with a format like ACS:: acsName:: ELIGIBLEPARTY:: epName:: >> RESOURCE:: resName || positiveRight Called by ActionOpenBeamer.openSelection().

Parameters:
_name - name of the AclEntry
Returns:
the AclEntry
Throws:
BaseError - if the name has a wrong format, or if it is not a known AclEntry

getPrivilege

public static ImmutablePrivilege getPrivilege(ImmutableName _name)
                                       throws BaseError
Gets the Privilege from its base object name. The Privilege name is composed of:

ACS:: ACS name

:: || PRIV_TYPE:: type

:: || SHORT_NAME:: shortPrivilege

:: || FIRST_RIGHT:: right name

:: || XXXX:: xxxx value

:: >> YYYY:: yyyy value

where:

- ':: ' is added by gBase.NameImpl.toString(),

- the type is one of the types defined in the PrivilegeAbst class,

- XXXX and YYYY are implementation-dependant values (see the relevant subclasses of PrivilegeAbst).

Called by ActionOpenBeamer.openSelection().

Parameters:
_name - the name of the Privilege
Returns:
the Privilege
Throws:
BaseError - if the privilege name has a wrong format, or if it is an unknown privilege

validateFrameName

public static boolean validateFrameName(ImmutableName _name)
Validate a name, mainly as a title of an internal frame, as without ' ::' nor ' >>', nor '<>' or ViewInBase_Facade.NOTHAN_VIEW_INDICATOR, nor non-null and not empty. Display a warning message to user if _name contains a forbidden sequence.

Parameters:
_name - to validate
Returns:
boolean true if the name is good

getImportedACS

public static java.util.Map<java.lang.String,java.util.List<java.lang.String>> getImportedACS(ImmutableName _name)
                                                                                       throws BaseError,
                                                                                              DialogError
Imports an ACS, opens and saves it. Called by ActionImportACS. This is a wrapper to call BaseManagerImpl.importACS().

Parameters:
_name - ImmutableName of the ACS to import. Its file name is built with the two last components of the name, or with the single component
Returns:
the map of the closed external ACSObjects which have a Bridge, AclEntries or linked Privileges in this imported ACS. May be empty but not null.
Throws:
BaseError - if the ACS name is known or null argument, or SecurityException
DialogError - if the open ACS has not the same name, or ClassNotFoundException, IOException with invalidClassException, or wrong saving
See Also:
BaseManagerImpl.importACS(ARoad0.gBaseInterface.ImmutableName)

getOwnResourceVirtualFolderList

public static java.util.List<VirtualFolder> getOwnResourceVirtualFolderList(ACS _acs)
Builds up an ordered array of references to the ACS own Resource VirtualFolders.

Parameters:
_acs - is an ACS
Returns:
list of VirtualFolders in the ACS. May be empty but not null.

getOwnEPVirtualFolderList

public static java.util.List<VirtualFolder> getOwnEPVirtualFolderList(ACS _acs)
Builds up an ordered array of references to the ACS own Eligible Party VirtualFolders.

Parameters:
_acs - is an ACS
Returns:
list of VirtualFolders in the ACS. May be empty but not null.

getOwnPrivilegeList

public static java.util.List<Privilege> getOwnPrivilegeList(ACS _acs)
Builds up an ordered array of references to the ACS own Privileges. The typed privileges are listed first, then the linked privileges. The external AclEntries are added by ACSTreeBaseListenerImpl.changeOnePrivilege(). Called by Gui1.ACSTree.createOwnPrivilegeGraphicalTree().

Parameters:
_acs - is an ACS
Returns:
list of Privileges in the ACS. May be empty but not null.