ARoad0.gWork
Class RightsFactory_Facade

java.lang.Object
  extended by ARoad0.gWork.RightsFactory_Facade
All Implemented Interfaces:
CoreAlgorithm

public class RightsFactory_Facade
extends java.lang.Object
implements CoreAlgorithm

This class is the "facade" (GoF design pattern) for all the core algorithms about the sequence of method calls in the access paths search. This work may be summarized as building up new CNot.DisplayableLinkImpls from the old ones, as the result of the analysis of rights and structures. The main parameter to handle is the map of all the current DisplayableLinkImpls, usually named _m_l_DisplayableLinks. At each method call, this map is filled with new DisplayableLinkImpls, and at the end, Gui2.GraphicView reads the map to display the view diagram and the view 'See why' text.

This class is stateless. For each ViewInBase, RightsMediatorImpl at its creation setups an instance of this class for its ViewInBase, to be processed in a worker thread. The architecture view and the sketch view are the two exceptions. They are not managed by RightsMediatorImpl. They use specific static methods and they are processed in the event dispatch thread or the main thread. No direct call to the ACS methods. Called by Gui1, Gui2 and gDMak objects. For the EPR and the NoThan ViewInBases, only Gui2.GraphicEPRView and Gui2.GraphiNoThanView are the consumers.


Field Summary
private  FactoryUtilities factoryUtil_
           
private static int INITIAL_CAPACITY
           
private  AlgorithmInterpreter interpreter_
           
private  java.util.Set<java.lang.String> l_lastLinkStringResult_
           
private  java.util.Set<StringRight> l_noActorResult_
           
private  java.util.Set<StringRight> l_result_
           
private  DisplayableLinkUtilities linkUtil_
           
private  UtilityImpl utility_
           
 
Constructor Summary
RightsFactory_Facade(AlgorithmInterpreter _interpreter)
          only one constructor
 
Method Summary
 java.util.Map detectEPRRights(GraphicEPRView _gview, EPRViewInBase _viewInBase, boolean _detectACL, boolean _detectAGO, boolean _detectPRI, boolean _detectLargeLinks)
          Detects the access paths between BaseObjects in an EPRViewInBase.
 java.util.Map detectNoThanRights(GraphicNoThanView _gview, NoThanViewInBase _viewInBase)
          Detects if the No-More-Than and No-Less-Than rights criteria are fulfilled or not.
static java.util.Map detectRights(GraphicView _gview, ViewInBase _viewInBase)
          Defines the BRIDGE and ACL relations between all the ACS which are in the view, that are Bridge links between actors, or AclEntries between EligibleParties and resources.
static java.util.Map detectSketchRights(EPRViewInBase _viewInBase, BaseObject _center, boolean _detectAcl, boolean _detectUserGroupLinks)
          Detects access-control links between BaseObjects in _viewModel, for a sketch view on a central object rights.
 void finalizeForProcess()
          Finalizes the instance.
 StringRight fulfilNoThanRightCriteria(java.util.Map _m_l_DisplayableLinks, StringRight _right, boolean _moreCriterion)
          Tests the rights in the last AccessControlLink of each DisplayableLink, to say if the criterion right is fulfilled or not.
 java.lang.String getEffectiveRightsForPair(BaseObject _so, BaseObject _tg, java.util.Map _m_l_DisplayableLinks)
          This important method selects the current effective rights from the DisplayableLinkImpls associated to each BaseObject pair, for an EPR ViewInBase.
 javax.swing.JTextPane getEPRWhyText(GraphicEPRView _gview, java.util.Map _m_l_DisplayableLinks, EPRViewInBase _view)
          Constructs a JTextPane with all the DisplayableLinks and AccessControlLinks, to be displayed as a comment for the GraphicView associated to _m_l_DisplayableLinks.
 java.util.Map<ImmutableName,java.util.Set<StringRight>> getFirstShapeEffectiveRights(java.util.Map _m_l_DisplayableLinks)
          Sets the current effective rights from the DisplayableLinks associated to each BaseObject pair in a view, after a parsing of all the direct and indirect paths from the first end to the second end of the pair.
 javax.swing.JTextPane getNoThanWhyText(GraphicNoThanView _gview, java.util.Map _m_l_DisplayableLinks, NoThanViewInBase _view)
          Constructs a JTextPane with all the DisplayableLinks and AccessControlLinks, to be displayed as a comment for the GraphicNoThanView associated to _m_l_DisplayableLinks.
static javax.swing.JTextPane getWhyText(GraphicView _gview, java.util.Map _m_l_DisplayableLinks, ViewInBase _view)
          Constructs a JTextPane with all the DisplayableLinks and AccessControlLinks, to be displayed as a comment for the GraphicView associated to _m_l_DisplayableLinks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

l_result_

private java.util.Set<StringRight> l_result_

l_noActorResult_

private java.util.Set<StringRight> l_noActorResult_

l_lastLinkStringResult_

private java.util.Set<java.lang.String> l_lastLinkStringResult_

interpreter_

private AlgorithmInterpreter interpreter_

factoryUtil_

private FactoryUtilities factoryUtil_

linkUtil_

private DisplayableLinkUtilities linkUtil_

utility_

private UtilityImpl utility_
Constructor Detail

RightsFactory_Facade

RightsFactory_Facade(AlgorithmInterpreter _interpreter)
only one constructor

Method Detail

detectEPRRights

public final java.util.Map detectEPRRights(GraphicEPRView _gview,
                                           EPRViewInBase _viewInBase,
                                           boolean _detectACL,
                                           boolean _detectAGO,
                                           boolean _detectPRI,
                                           boolean _detectLargeLinks)
                                    throws ProcessError,
                                           java.lang.InterruptedException
Detects the access paths between BaseObjects in an EPRViewInBase. Returns the DisplayableLinkImpls for every pair of BaseObjects in a view. Whatever the boolean arguments, calls CompoundRightsFactoryImpl.detectBridges() and ThreeNodesRightsFactoryImpl.detectOneHiddenNodeCompoundRights(). The calling of other methods in the gWork classes depends on the boolean arguments. The number of called methods may be up to 18. Calls Thread.interrupted() to test the working thread and stops it if necessary. Called by GraphicEPRView.initialize(), that synchronizes on the EPRViewInBase, and called by GraphicEPRView.resetRights(). Called by detectNoThanRights().

Parameters:
_gview - graphic view associated to the view
_viewInBase - the view to analyze
_detectACL - true for detecting the pure AclEntry access paths
_detectPRI - true for detecting the pure Privilege access paths
_detectAGO - true for detecting the AGO access paths
_detectLargeLinks - true for detecting the access paths having more than 3 nodes
Returns:
Map of DisplayableLinkImpls, structured as m_l_DisplayableLinks_, with one or several access control links associated to each pair (Source, Target). May be empty.
Throws:
ProcessError - if there is a loop in the rights search
java.lang.InterruptedException

detectRights

public static final java.util.Map detectRights(GraphicView _gview,
                                               ViewInBase _viewInBase)
                                        throws ProcessError,
                                               java.lang.InterruptedException
Defines the BRIDGE and ACL relations between all the ACS which are in the view, that are Bridge links between actors, or AclEntries between EligibleParties and resources. Calls CompoundRightsFactoryImpl.detectAcsLinks(). Called by GraphicView.initialize(), that synchronizes on _viewInBase, and resetRights(), for the architecture view only.

Parameters:
_gview - is the graphic view associated to the view
_viewInBase - is the view to analyze
Returns:
Map of DisplayableLinkImpls, structured as m_l_DisplayableLinks_, with one or several access control links associated to each node pair. May be empty.
Throws:
ProcessError - if
java.lang.InterruptedException

detectSketchRights

public static final java.util.Map detectSketchRights(EPRViewInBase _viewInBase,
                                                     BaseObject _center,
                                                     boolean _detectAcl,
                                                     boolean _detectUserGroupLinks)
                                              throws ProcessError,
                                                     java.lang.InterruptedException
Detects access-control links between BaseObjects in _viewModel, for a sketch view on a central object rights. Detects displayable links for every pair (BaseObject, _center). Does not detect running under currentUID/GID for an Actor. Does not throw any InterruptedException since this method is not called in a worker thread. Uses ViewInBase_Facade.SKETCH_MEDIATOR. Called by ViewInBase_Facade.populateSketchView() in the main thread, for the sketch view only.

Parameters:
_viewInBase - is the view to analyze
_center - is the central object of a sketch view
_detectAcl - true for detecting aclEntry links.
_detectUserGroupLinks - true for detecting userID and groupID ACS-specific access-control links.
Returns:
Map of DisplayableLinkImpls, structured as m_l_DisplayableLinks_, with one or several AccessControlLinks associated to each pair (BaseObject, _center). May be empty.
Throws:
ProcessError - if there is a loop in the rights search
java.lang.InterruptedException

detectNoThanRights

public final java.util.Map detectNoThanRights(GraphicNoThanView _gview,
                                              NoThanViewInBase _viewInBase)
                                       throws ProcessError,
                                              java.lang.InterruptedException
Detects if the No-More-Than and No-Less-Than rights criteria are fulfilled or not. If true, or if the view target is null, or if the two criteria are null, return an empty map. Else, it returns simple DisplayableLinkImpls where each one which demonstrates the break for one criterion. These links includes for the type GLOBAL in their AccesControlLink, the comment AccessControlLink.NO_MORE_COMPLIANCE or AccessControlLink.NO_LESS_COMPLIANCE.

At most, there are two DisplayableLinks in the returned map, where the second end is the view target, and the first end is one of view EPs, or one of the members, or one of the running-under actors.

This method calls all the methods used by detectEPRRights() for the paths search, excepted for the method CompoundRightsFactoryImpl.detectLastSimpleSoftRunUnderDisplayableLinks(). For each elementary pair (EP of the checking perimeter, first target), it searches the rights in creating a dedicated EPRViewInBase with a constant name. If the resulting rights do not comply with the two criterion during the iteration on all the tested EP, the general search is ended. The transient EPRViewInBases are usable because the RightsMediator of the NoThanViewInBase manages all the BaseObjects of the view checking perimeter. They works also because, when some methods find access paths through hidden intermediate nodes which are in the NoThanViewInBase, this simply accelerates the final result and does not change it.

This method is called from several worker threads. Called by GraphicNoThanView.initialize(), that synchronizes on _viewInBase, and called by resetRights(), but the result is indeed processed by GraphicNoThanView.resetCriteria(). Calls NoThanViewInBase.getCheckingPerimeter(), getMoreCriterion(), getLessCriterion() and all the methods called by detectEPRrights().

Parameters:
_gview - the graphic view associated to the view
_viewInBase - view to analyze
Returns:
Map of DisplayableLinkImpls, structured as m_l_DisplayableLinks_ with lists as values, with one or several access control links associated to each pair (EP, Resource). Empty.
Throws:
ProcessError - if there is a loop in the rights search
java.lang.InterruptedException

getEffectiveRightsForPair

public final java.lang.String getEffectiveRightsForPair(BaseObject _so,
                                                        BaseObject _tg,
                                                        java.util.Map _m_l_DisplayableLinks)
This important method selects the current effective rights from the DisplayableLinkImpls associated to each BaseObject pair, for an EPR ViewInBase. Puts in each last AccessControlLink the rights synthesis for the 'See why' text. The pair may be:

- (EligibleParty, Basic or VirtualFolder),

- (GroupIDMember, GroupIDMember),

- (Actor, GroupIDMember), for actors with currentUID/GID,

- (VirtualFolder, Basic),

in an EPRViewInBase, and :

- by the way of a simple 'add' operation, plus some indicators as 'acl', for positive rights.

- by the way of 'remove' operations when a negative acl forbids a right, or when 'no rights' forbids all rights.

The negative-right types are displayed only if the link is simple. These negative rights are then subtracted from the positive rights in the other links.

If a DisplayableLinkImpl contain an Actor, adds '' in the result to separate the rights through an actor from the other rights, but this is true only if there is no negative rights in one DisplayableLinkImpl. The SPREAD comments in the last AccessControlLinkImpl of each DisplayableLinkImpl are reserved to the list of all the effective rights, for the SeeWhy text. Called by GraphicEPRView.buildUpArrowsAndRights(). The DisplayableLinks must have been set in _m_l_DisplayableLinks. Calls FactoryUtilities.withSomeAccess(), isActivePath(), getRightAcronym(), DisplayableLinkUtilities.getEffectiveRightsAndCommentOnRights(), UtilityImpl.selectHeaders().

Parameters:
_so - BaseObject of the view
_tg - BaseObject of the view
_m_l_DisplayableLinks - immutable Map of DisplayableLinks lists. May update the last AccessControlLink of each DisplayableLink.
Returns:
String rights in DisplayableLinks having _ep and _res as ends, and having non-null rights. May be empty or null. May contain '' to indicate the given rights through actors acting as proxies in the paths.
See Also:
AccessControlLink, UtilityImpl.subtractNegativeNotRemovingInOneACS(java.util.Set, java.util.Set, ARoad0.gBaseInterface.ImmutableACS, boolean), DisplayableLinkUtilities.getEffectiveRightsAndCommentOnRights(ARoad0.CNot.DisplayableLinkImpl, boolean)

getWhyText

public static final javax.swing.JTextPane getWhyText(GraphicView _gview,
                                                     java.util.Map _m_l_DisplayableLinks,
                                                     ViewInBase _view)
Constructs a JTextPane with all the DisplayableLinks and AccessControlLinks, to be displayed as a comment for the GraphicView associated to _m_l_DisplayableLinks. NO USE.

Parameters:
_gview - is the graphic view associated to the view
_m_l_DisplayableLinks - is an immutable Map of DisplayableLinks lists.
_view - associated to _m_l_DisplayableLinks
Returns:
JTextPane with text, as a comment for the GraphicView associated to _m_l_DisplayableLinks.

getEPRWhyText

public final javax.swing.JTextPane getEPRWhyText(GraphicEPRView _gview,
                                                 java.util.Map _m_l_DisplayableLinks,
                                                 EPRViewInBase _view)
Constructs a JTextPane with all the DisplayableLinks and AccessControlLinks, to be displayed as a comment for the GraphicView associated to _m_l_DisplayableLinks. Called by GraphicView.setWhyText() and GraphicEPRView.setWhyText(). Calls directly FactoryUtilities.getEPRWhyText().

Parameters:
_gview - is the graphic view associated to the view
_m_l_DisplayableLinks - is an immutable Map of DisplayableLinks lists.
_view - associated to _m_l_DisplayableLinks
Returns:
JTextPane with text, as a comment for the GraphicView associated to _m_l_DisplayableLinks.

getNoThanWhyText

public final javax.swing.JTextPane getNoThanWhyText(GraphicNoThanView _gview,
                                                    java.util.Map _m_l_DisplayableLinks,
                                                    NoThanViewInBase _view)
Constructs a JTextPane with all the DisplayableLinks and AccessControlLinks, to be displayed as a comment for the GraphicNoThanView associated to _m_l_DisplayableLinks. Called by GraphicView.getNoThanWhyText(). Calls directly FactoryUtilities.getNoThanWhyText().

Parameters:
_gview - is the graphic view associated to the view
_m_l_DisplayableLinks - is an immutable Map of DisplayableLinks lists.
_view - associated to _m_l_DisplayableLinks
Returns:
JTextPane with text, as a comment for the GraphicView associated to _m_l_DisplayableLinks.

getFirstShapeEffectiveRights

public final java.util.Map<ImmutableName,java.util.Set<StringRight>> getFirstShapeEffectiveRights(java.util.Map _m_l_DisplayableLinks)
Sets the current effective rights from the DisplayableLinks associated to each BaseObject pair in a view, after a parsing of all the direct and indirect paths from the first end to the second end of the pair.

This method is a simplified form of getEffectiveRightsForPair() with a different return. The negative types in the last access control link are processed. Each key into the argument _m_l_DisplayableLinks has to produce a key in the result, and an empty set for a key means it is a structural link.

. Called by detectEPRRights(), detectNoThanrights(), and by CompoundRightsFactoryImpl.addPathFromNegativeRightsInOneACS(), by fulfilNoThanRightCriteria() for the NoThan ViewInBases. Calls FactoryUtilities.isActivePath(), UtilityImpl.selectHeaders() and DisplayableLinkUtilities.getEffectiveRightsAndComment().

Parameters:
_m_l_DisplayableLinks - Map of DisplayableLinks lists (one per pair) associated to the view. No update.
Returns:
map where the keys are the _m_l_DisplayableLinks keys where rights are activated, and the value is a set of StringRights (may be an empty set, never null).

fulfilNoThanRightCriteria

public final StringRight fulfilNoThanRightCriteria(java.util.Map _m_l_DisplayableLinks,
                                                   StringRight _right,
                                                   boolean _moreCriterion)
Tests the rights in the last AccessControlLink of each DisplayableLink, to say if the criterion right is fulfilled or not. Uses StringRight.compareTo() between the rights, through their metarights if at least one right is a metaright. If _moreCriterion is false and there is an empty _m_l_DisplayableLinks, the returned right is StringRightImpl.EMPTY_INSTANCE. Using StringRight.compareTo(), the right internal key is the first compared property. Thus, this method may detect the criterion right is not fulfilled while the effective right has no direct path to the criterion right, in the network of rights. This is a defensive behavior, which may be considered too restrictive in some cases. On the other hand, the Access Road user gets the effective right in the 'See why' text. He may so decide the gravity to get no fulfillment. Called by detectNoThanRights().

Parameters:
_m_l_DisplayableLinks - is an immutable Map of DisplayableLinks lists for one couple of BaseObjects in a view
_right - is the more or less criterion
_moreCriterion - true for checking a more criterion, and false for a less criterion
Returns:
null if the criterion is fulfilled, or a non-null right if, when _moreCriterion is true, _right is strictly lesser than the returned value, that is one of the effective global rights for the couple of BaseObjects, and also return a non-null right if, when _moreCriterion is false, _right is strictly greater than the returned value, that is a right for the couple of BaseObjects.

finalizeForProcess

public void finalizeForProcess()
Finalizes the instance. Called by RightsMediatorImpl.finalizeForProcess().