ARoad0.gWorkInterface
Interface AlgorithmInterpreter

All Known Subinterfaces:
RightsMediator
All Known Implementing Classes:
RightsMediatorImpl

public interface AlgorithmInterpreter

This interface is an implementation of the design pattern Interpreter in the GoF collection, to store the paths search algorithms of an EPR view, a NoThan view or the sketch view. For the core algorithms, each view uses a dedicated instance of the 8 gWork classes and 1 gBase class. For the NodeRight and LinkRight classes, each view includes one instance for each node of the view. Each AcsAddon may provide a subclass of NodeRightsImpl or LinkRightsImpl. They have to be used when a node from this AcsAddon is in the view. All the instances in the gBase, gWork and AcsAddon.gWork packages that are necessary in the access paths search are get through this interface.

See Also:
RightsMediatorImpl

Field Summary
static java.util.List L_CORE_ALGORITHMS_KEYS
          The keys of the 9 core algorithm classes in gWork, to use in getCoreAlgorithm().
 
Method Summary
 NodeRights addInstancesForNode(BaseObject _node)
          Creates a new NodeRights and a new LinkRights instances for a view node or an intermediate node.
 java.util.Collection<LinkRights> getAllLinkRights(java.util.Collection<DisplayableLinkImpl> _l_dLinks)
          Gets all the LinkRights associated to the nodes in the DisplayableLinkImpls of a collection.
 CoreAlgorithm getCoreAlgorithm(java.lang.String _key)
          Gets the instance to use for this view for a given core algorithm, as instance of one of the 9 classes RightsFactory_Facade, AclRightsFactoryImpl, AgoRightsFactoryImpl, CompoundRightsFactoryImpl, DisplayableLinkUtilities, PrivilegeRightsFactoryImpl, FactoryUtilities, ThreeNodesRightsFactoryImpl and gBase.UtilityImpl.
 java.util.Map<ImmutableName,LinkRights> getLinkRightsInstances()
          Gets the map of the LinkRights instances to use for each view node or intermediate node.
 java.util.Map<ImmutableName,NodeRights> getNodeRightsInstances()
          Gets the map of the NodeRights instances to use for each view node or intermediate node.
 BaseObject getSource()
           
 void removeInstancesForNode(ImmutableName _name)
          Removes the NodeRights and the LinkRights instances for a view node or an intermediate node.
 void updateNonCoreAlgorithmsForViewNodes(boolean _clearIntermediateNodes)
          When the view nodes have changed, this method updates the NodeRights and the LinkRights instances of each node.
 

Field Detail

L_CORE_ALGORITHMS_KEYS

static final java.util.List L_CORE_ALGORITHMS_KEYS
The keys of the 9 core algorithm classes in gWork, to use in getCoreAlgorithm().

Method Detail

getSource

BaseObject getSource()
Returns:
the view for which the algorithms are used

getCoreAlgorithm

CoreAlgorithm getCoreAlgorithm(java.lang.String _key)
Gets the instance to use for this view for a given core algorithm, as instance of one of the 9 classes RightsFactory_Facade, AclRightsFactoryImpl, AgoRightsFactoryImpl, CompoundRightsFactoryImpl, DisplayableLinkUtilities, PrivilegeRightsFactoryImpl, FactoryUtilities, ThreeNodesRightsFactoryImpl and gBase.UtilityImpl. Theses algorithms are also used for the sketch view.

Parameters:
_key - belongs to L_CORE_ALGORITHMS_KEYS
Returns:
the core algorithm for the view, or null

getNodeRightsInstances

java.util.Map<ImmutableName,NodeRights> getNodeRightsInstances()
Gets the map of the NodeRights instances to use for each view node or intermediate node. The term of 'intermediate' is here applicable for a node that is analyzed, even if it is not detected as a node to put in an effective DiaplayableLinkImpl of the view.

Returns:
unmodifiable map of NodeRights instances, where the node names are the keys

getLinkRightsInstances

java.util.Map<ImmutableName,LinkRights> getLinkRightsInstances()
Gets the map of the LinkRights instances to use for each view node or intermediate node. The term of 'intermediate' is here applicable for a node that is analyzed, even if it is not detected as a node to put in an effective DiaplayableLinkImpl of the view.

Returns:
unmodifiable map of LinkRights instances, where the node names are the keys

updateNonCoreAlgorithmsForViewNodes

void updateNonCoreAlgorithmsForViewNodes(boolean _clearIntermediateNodes)
When the view nodes have changed, this method updates the NodeRights and the LinkRights instances of each node. When the parameter is false, the previous intermediate nodes keep their NodeRights and LinkRights instances to speed up the processing.

Parameters:
_clearIntermediateNodes - true only for the sketch view, to finalize the NodeRights and linkRights instances of all the nodes that are not in the view, including all the previous intermediate nodes

addInstancesForNode

NodeRights addInstancesForNode(BaseObject _node)
Creates a new NodeRights and a new LinkRights instances for a view node or an intermediate node. Updates the maps m_LinkRights_ and m_NodeRights_.

Parameters:
_node - node of the view or intermediate node
Returns:
a NodeRights instance

removeInstancesForNode

void removeInstancesForNode(ImmutableName _name)
Removes the NodeRights and the LinkRights instances for a view node or an intermediate node. Updates the maps m_LinkRights_ and m_NodeRights_. Finalizes the NodeRights instance.

Parameters:
_name - name of the view node or the intermediate node

getAllLinkRights

java.util.Collection<LinkRights> getAllLinkRights(java.util.Collection<DisplayableLinkImpl> _l_dLinks)
Gets all the LinkRights associated to the nodes in the DisplayableLinkImpls of a collection. Called by CompoundRightsFactoryImpl.detectHiddenCompoundEpRights().

Parameters:
_l_dLinks - DisplayableLinkImpls to analyze, all with the same two ends or not. Not null.
Returns:
the LinkRights instances. Never null.