ARoad0.gWork
Class FactoryUtilities

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

public class FactoryUtilities
extends java.lang.Object
implements CoreAlgorithm

This class provides some core algorithms about the rights and the 'See why' texts. It consists exclusively of final methods, and most of them are static. This class is stateless, and RightsMediatorImpl at its creation setups an instance for its ViewInBase. No direct call to the ACS methods. It is used by gWork and Gui2 classes.

See Also:
AccessControlLinkImpl

Field Summary
private  UtilityImpl baseUtil_
           
private  AlgorithmInterpreter interpreter_
           
private  java.util.Set<StringRight> l_rights_
           
private static java.lang.String lineSepar__
           
private  DisplayableLinkUtilities linkUtil_
           
private static java.util.Map M_RIGHTS_ACRONYMS
           
 
Fields inherited from interface ARoad0.gWorkInterface.CoreAlgorithm
INITIAL_CAPACITY
 
Constructor Summary
protected FactoryUtilities(AlgorithmInterpreter _interpreter)
          only one protected constructor
 
Method Summary
static void appendText(javax.swing.JTextPane _textPane, java.lang.String _text, javax.swing.text.SimpleAttributeSet _attributes)
          Adds a text at the end of a JTextPane.
 void finalizeForProcess()
          Finalizes the instance.
 javax.swing.JTextPane getEPRWhyText(GraphicEPRView _gview, java.util.Map _m_l_DisplayableLinks, EPRViewInBase _view)
          Construct a JTextPane with the tree of all DisplayableLinks and AccessControlLinks, to be displayed as a text comment for a GraphicView.
 javax.swing.JTextPane getNoThanWhyText(GraphicNoThanView _gview, java.util.Map _m_l_DisplayableLinks, NoThanViewInBase _view)
          Get a JTextPane with the tree of all DisplayableLinks and AccessControlLinks, to be displayed as a text comment for a GraphicNoThanView.
 java.lang.String getRightAcronym(StringRight _st)
          Gets the standardized acronym of a right, if it exists for its metaright.
static javax.swing.JTextPane getWhyText(GraphicView _gview, java.util.Map _m_l_DisplayableLinks, ViewInBase _view)
          Construct a JTextPane with the tree of all DisplayableLinks and AccessControlLinks, to be displayed as a comment for the GraphicView associated to _m_l_DisplayableLinks.
 boolean isActivePath(DisplayableLinkImpl _dLink)
          Returns true if each node pair in the DisplayableLink is activated, that is each AccessControlLink contains one pseudo-structural link or non-null rights.
 java.util.Set<StringRight> substractNegativeFromPositiveRights(java.util.Set<StringRight> _l_upd_rights)
          Wrapper and caller of gBase.UtilityImpl.subtractNegativeNotRemovingInOneACS().
 StringRight withSomeAccess(java.util.Set<StringRight> _l_rights)
          Called by RightsFactory_Facade.getEffectiveRightsForPair().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineSepar__

private static java.lang.String lineSepar__

M_RIGHTS_ACRONYMS

private static java.util.Map M_RIGHTS_ACRONYMS

interpreter_

private AlgorithmInterpreter interpreter_

baseUtil_

private UtilityImpl baseUtil_

linkUtil_

private DisplayableLinkUtilities linkUtil_

l_rights_

private java.util.Set<StringRight> l_rights_
Constructor Detail

FactoryUtilities

protected FactoryUtilities(AlgorithmInterpreter _interpreter)
only one protected constructor

Parameters:
_interpreter - algorithm interpreter
Method Detail

isActivePath

public final boolean isActivePath(DisplayableLinkImpl _dLink)
Returns true if each node pair in the DisplayableLink is activated, that is each AccessControlLink contains one pseudo-structural link or non-null rights. This method is used to verify that the negative rights in an AccessControlLink have not deleted the positive rights which exist in the same AccessControlLink. Following the AGO right priorities, it is also used to remove an 'owner' path without active rights, which is there to show the need to remove all the similar 'group' and 'other' paths. An active path may provide no rights at all, when there is a pseudo-structural link. All the _dLink nodes have to be ACSObject to get an optimized result using the selection of the ACS rights, but otherwise, the result is still provided. Called by RightsFactory_Facade.getEffectiveRightsForPair(). Calls AccessControlLinkImpl.getRights(), isTrueForOnePseudoStructuralLinkType() and subtractNegativeNotRemovingInOneACS().

Parameters:
_dLink - to analyze
Returns:
false if _dLink is not active.

getWhyText

public static final javax.swing.JTextPane getWhyText(GraphicView _gview,
                                                     java.util.Map _m_l_DisplayableLinks,
                                                     ViewInBase _view)
Construct a JTextPane with the tree of all DisplayableLinks and AccessControlLinks, to be displayed as a comment for the GraphicView associated to _m_l_DisplayableLinks. NO USE. The 'Serif' font is used with the size 12, and 14 for the title. Do not define the size of the pane.

Parameters:
_gview - is the graphic view associated to the view
_m_l_DisplayableLinks - immutable Map of DisplayableLinks lists.
_view - associated to _m_l_DisplayableLinks
Returns:
JTextPane 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)
Construct a JTextPane with the tree of all DisplayableLinks and AccessControlLinks, to be displayed as a text comment for a GraphicView. Display first the paths RIGHTS USER/ACCESS TARGET, then the paths RIGHTS USER/GROUPMEMBER, and finally the paths GROUPIDMEMBER/GROUPID. Does not display the DisplayableLinks which contain a sequence of 3 nodes which are there 5 times in the previous DisplayableLinks having the same ends, and add a note to say what nodes sequence has been filtered. Note that this processing has no influence on the paths search in Access Road, since it is done only for the displaying of the result. The 'Serif' font is used with the size 12, and 14 for the title. Does not define the size of the pane. Called by RightsFactory_Facade.getEPRWhyText(). Calls linkUtil_.removeTooNumerous3NodesSequence().

Parameters:
_gview - is the graphic view associated to the view
_m_l_DisplayableLinks - immutable Map of DisplayableLinks lists.
_view - associated to _m_l_DisplayableLinks
Returns:
JTextPane 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)
Get a JTextPane with the tree of all DisplayableLinks and AccessControlLinks, to be displayed as a text comment for a GraphicNoThanView. The 'Serif' font is used with the size 12, and 14 for the title. Do not define the size of the pane. Called by RightsFactory_Facade.getNoThanWhyText().

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

appendText

public static final void appendText(javax.swing.JTextPane _textPane,
                                    java.lang.String _text,
                                    javax.swing.text.SimpleAttributeSet _attributes)
Adds a text at the end of a JTextPane. Called in the generic access paths search, then may be called from a view worker thread.

Parameters:
_textPane - to update
_text - to add
_attributes - associated to _text

withSomeAccess

public final StringRight withSomeAccess(java.util.Set<StringRight> _l_rights)
Called by RightsFactory_Facade.getEffectiveRightsForPair().

Parameters:
_l_rights - to analyze
Returns:
the first accessing granting or denying right, or null if all the rights are null or empty.

getRightAcronym

public final java.lang.String getRightAcronym(StringRight _st)
Gets the standardized acronym of a right, if it exists for its metaright. There are acronyms for the metarights '|unknown_rights|', '|modify_from_parent_acs|', '|modify_owner|', '|modify_security_descriptor|', '|is_superadmin|', '|read_from_parent_acs|', '|get_target_rights|', '|unverified_rights|', '|transfer_all_rights_to_third_party|', '|transfer_limited_rights_to_third_party|', '|transfer_all_rights|' and '|transfer_limited_rights|'. For these rights, the acronym is displayed in the GraphicView. The 'SeeWhy' text uses the effective right which may be different if it is an ACS right.

Parameters:
_st - ACS right or metaright
Returns:
the acronym. May be null.

substractNegativeFromPositiveRights

public final java.util.Set<StringRight> substractNegativeFromPositiveRights(java.util.Set<StringRight> _l_upd_rights)
Wrapper and caller of gBase.UtilityImpl.subtractNegativeNotRemovingInOneACS(). Called by RightsFactory_Facade.getEffectiveRightsForPair() and getFirstShapeEffectiveRights(), DisplayablelinkUtilities.getDLinksFromNegativePaths(), AclRightsFactoryImpl.getL_aclEntryRights().

Parameters:
_l_upd_rights - to analyze. Not null. Updated by the method.
Returns:
an all-positive or all-negative rights set. May be empty but not null.

finalizeForProcess

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