|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectARoad0.gWork.RightsMediatorImpl
public class RightsMediatorImpl
This class is a change event adaptor for all the BaseObjects associated to a view, and it is responsible to manage the paths search algorithms for each view. It takes account of the AcsAddons.
This is a component of the event management pattern for the views. This class informs the view GraphicViewBaselistenerImpl when the rights may have changed. It is independant to the graphic view, which may be deleted and created several times by GraphicViewBaselistenerImpl. This responsability implies, for each view-related object and through the method setRightsNetwork(), to follow:
- every ACS bridge change,
- every bound property change, including the AclEntry rights,
- every deleted BaseObject which is in an AccessControlLink,
- every new ACS userID with 'root' rights,
- every new ACS actor belonging to its userID, its groupID,
or to a groupID which contains its userID, its groupID,
- every new ACS userID belonging to its groupID,
or to a groupID which contains its userID, its groupID,
- every new ACS actor executed through 'other' rights with a current account or group,
- every PrivilegeForLinks change in the sources and the targets,
- every specific property change from an AcsAddon object,
but to not follow a view-related object when it is a new element of the view, since it is handled directly by the BaseListener. The AclEntries and external linked Privileges are switched when their ACS is saved (see gBase.BaseManagerImpl). To avoid useless right analysis, ActionSave and ActionSaveAll unregister this class before any ACS saving, to not process the property changes from the AclEntries and Privileges. The Gui2.GraphicViewBaseListenerImpl instance that works with the RightsMediatorImpl instance must register itself as a PropertyChangeListener of this instance. It must have a ViewInBase as main event source. The interface methods ACSObjectAddon.getAddonInnerPropertiesToListen() and getAddonParentPropertiesToListen() are used to handle the AcsAddon property change events. The aim is to update any view which contains a node from such an AcsAddon. These methods are ridden by ARoad0.UtilityImpl that is invoked by RightsMediatorImpl.
The second responsibility of this class is the selection of algorithms. Following the design pattern Interpreter in the GoF collection, this class manages the path search algorithms of EPRViewInBase, NoThanViewInBase and SketchViewInBase. Each view uses dedicated instances of 8 generic gWork classes and 1 generic gBase class that implement the core algorithms. Each view uses, for each view node and each intermediate node in an access path, one instance of NodeRights and one instance of LinkRights. All these objects are created and managed by this RightsMediatorImpl class. For an EPRViewInBase and a NoThanViewInBase, the instances for the old view nodes are never removed, including the NoThanViewInBase first target, nor the instances for the old intermediate nodes. This is to be ready to the changes in the access paths.
An AcsAddon may include some subclasses of NodeRightsImpl and LinkRightsImpl, and they are selected by RightsMediatorImpl when a node from this AcsAddon is implied. The detection of the AcsAddon packages follows the name pattern of these packages. If there is no NodeRights or LinkRights implementation in the AcsAddon gWork package, the generic class is selected.
All the algorithm class instances in the gWork and AcsAddon.gWork packages that are necessary in the access paths search are stored in 3 dedicated maps in RightsMediatorImpl. They are called by RightsFactory_Facade - which calls the core algorithm classes - and by the core algorithm classes themself.
The instances of this class are created by Gui2.ViewModel and ViewInBase_Facade.createSketchView(). Gui2.GraphicViewBaseListenerImpl is the single listener of an instance.
Field Summary | |
---|---|
private int |
count_
|
private static int |
INITIAL_CAPACITY
|
private java.util.Set |
l_RightsChangeSupport_
list of PropertyChangeListeners. |
protected java.util.Set |
l_RightsNetwork_
Set of hidden BaseObjects which are implied in the rights analysis for the view |
private java.beans.PropertyChangeEvent |
lastEvent_
last property change event received by propertyChange() |
private java.util.Map |
m_CoreAlgorithms_
Map of the one instance for each of the 5 classes gWork.xxxRightsFactoryImpl, the 2 gWork.yyyUtilities and gWork.UtilityImpl. |
private java.util.Map<ImmutableName,LinkRights> |
m_LinkRights_
Map of the instances of the LinkRights or its subclasses for the view nodes and the analyzed or intermediate nodes. |
private java.util.Map<ImmutableName,NodeRights> |
m_NodeRights_
Map of the instances of the NodeRights or its subclasses for the view nodes and the analyzed or intermediate nodes. |
private static int |
PRIME
|
protected ViewInBase |
view_
The BaseListener main event source which defines the rights network is a ViewInBase |
Fields inherited from interface ARoad0.gWorkInterface.AlgorithmInterpreter |
---|
L_CORE_ALGORITHMS_KEYS |
Constructor Summary | |
---|---|
RightsMediatorImpl(ViewInBase _view)
The view GraphicViewBaseListener must register itself as a PropertyChangeListener of this RightsNetworkObserver instance. |
Method Summary | |
---|---|
NodeRights |
addInstancesForNode(BaseObject _node)
Creates a new NodeRights and a new LinkRights instances for a view node, an analyzed or an intermediate node. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener _l)
Registers a listener for the PropertyChange event The class will fire a PropertyChange value whenever the rights have to be updated. |
void |
finalizeForProcess()
Finalizes the instance. |
private void |
firePropertyChange()
Fires an event without name to every registered listener, in any order, with null old and null new properties. |
java.util.Collection<LinkRights> |
getAllLinkRights(java.util.Collection<DisplayableLinkImpl> _l_dLinks)
Gets the collection of 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, analyzed or intermediate node. |
java.util.Map<ImmutableName,NodeRights> |
getNodeRightsInstances()
Gets the map of the NodeRights instances to use for each view node, analyzed or intermediate node. |
BaseObject |
getSource()
Gets the ViewInBase. |
void |
propertyChange(java.beans.PropertyChangeEvent _evt)
Manages the events fired by the base objects of the rights network, to update the rights while there is no updating of the view base objects. |
void |
removeInstancesForNode(ImmutableName _name)
Removes the NodeRights and the LinkRights instances for a view node, an analyzed or intermediate node. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener _l)
Removes a listener for the PropertyChange event Called by ActionSave.save(). |
void |
setRightsNetwork(java.util.Set _l_baseObjects)
When the view nodes network has changed, registers the instance, as a RightsNetworkObserver to listen the bound property changes in the network of ACSObjects and properties which are implied in the view. |
java.lang.String |
toString()
Get the values of the view. |
void |
updateNonCoreAlgorithmsForViewNodes(boolean _clearIntermediateNodes)
When the view nodes have changed, this method updates the NodeRightsImpl and the LinkRights instances of the view nodes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int PRIME
private static final int INITIAL_CAPACITY
private int count_
protected ViewInBase view_
protected java.util.Set l_RightsNetwork_
private final java.util.Set l_RightsChangeSupport_
private java.beans.PropertyChangeEvent lastEvent_
private java.util.Map m_CoreAlgorithms_
private java.util.Map<ImmutableName,NodeRights> m_NodeRights_
private java.util.Map<ImmutableName,LinkRights> m_LinkRights_
Constructor Detail |
---|
public RightsMediatorImpl(ViewInBase _view)
_view
- is the source for which the rights network is definedViewModel.createViewRightsMediator(ARoad0.gBaseInterface.ViewInBase)
Method Detail |
---|
public BaseObject getSource()
getSource
in interface AlgorithmInterpreter
getSource
in interface RightsNetworkObserver
public CoreAlgorithm getCoreAlgorithm(java.lang.String _key)
getCoreAlgorithm
in interface AlgorithmInterpreter
_key
- belongs to AlgorithmInterpreter.L_CORE_ALGORITHMS_KEYS
public java.util.Map<ImmutableName,NodeRights> getNodeRightsInstances()
getNodeRightsInstances
in interface AlgorithmInterpreter
public java.util.Map<ImmutableName,LinkRights> getLinkRightsInstances()
getLinkRightsInstances
in interface AlgorithmInterpreter
public void updateNonCoreAlgorithmsForViewNodes(boolean _clearIntermediateNodes)
On the other hand, the analyzed nodes and the intermediate nodes of the view are not processed there. The term of 'analyzed' is here applicable to a node that is processed by the gWork classes in the paths search, even if it is not finally detected as an intermediate node to put in a stable DiaplayableLinkImpl. For an EPRViewInBase and a NoThanViewInBase, the old view nodes are never removed, including the NoThanViewInBase first target, nor the old intermediate nodes. This is to be ready to the possible future changes in the access paths.
Called by the constructor, Gui2.ViewModel.changeNonCoreAlgorithms() and ViewInBase_Facade.populateSketchView(). When the parameter is false, the previous view nodes and the intermediate nodes keep their NodeRights and LinkRights instances to speed up the processing.
updateNonCoreAlgorithmsForViewNodes
in interface AlgorithmInterpreter
_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 nodespublic NodeRights addInstancesForNode(BaseObject _node)
The detection of the AcsAddon packages follows the name pattern of these packages, and does not use the method ACS.getM_AcsVocabulary() to get the AcsAddon name. If there is no NodeRights or LinkRights implementation in the AcsAddon gWork package, the generic class is selected. Updates the maps m_LinkRights_ and m_NodeRights_.
Called by updateNonCoreAlgorithmsForViewNodes() and by several methods of ThreeNodesRightsFactoryImpl and CompoundRightsFactoryImpl, each time the instances do not exist for a new processed object. The Gui2.GraphicViewBaseListenerImpl method propertyChange() calls directly this method when it receives a 'FirstAccessTarget' event from a NoThanViewInBase.
addInstancesForNode
in interface AlgorithmInterpreter
_node
- node of the view (including the first target of a NoThanViewInBase)
or intermediate node. Never null. It may be already known.
public void removeInstancesForNode(ImmutableName _name)
Updates the maps m_LinkRights_ and m_NodeRights_. Finalizes the NodeRightsImpl instance. Called by updateNonCoreAlgorithmsForViewNodes() only for the intermediate nodes of a sketch view.
removeInstancesForNode
in interface AlgorithmInterpreter
_name
- name of the view node, the analyzed or intermediate nodepublic final java.util.Collection<LinkRights> getAllLinkRights(java.util.Collection<DisplayableLinkImpl> _l_dLinks)
getAllLinkRights
in interface AlgorithmInterpreter
_l_dLinks
- DisplayableLinkImpls to analyze, all with the same two ends or not.
Not null.
public void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
addPropertyChangeListener
in interface RightsNetworkObserver
_l
- An object to be invoked when a PropertyChange
event is fired.public void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
removePropertyChangeListener
in interface RightsNetworkObserver
_l
- the PropertyChange listener to be removed.public void setRightsNetwork(java.util.Set _l_baseObjects)
This method registers for the listening of the intermediate nodes for each access path, and also for the analyzed, non-intermediate nodes which should become intermediates in the future, after a property change.
This listening includes the AclEntries and the PrivilegeForLinks, respectively for their rights/conditional groups and their sources/targets. It includes the listening of the specific events from any AcsAddon ACS, or any of its objects, for which the methods BaseUtilityImpl.add/removeAddonInner/ParentPropertyChangeListener() are called. This implies to follow, for each view-related object:
- every ACS bridge change,
- every bound property change, including the AclEntry rights,
- every deleted BaseObject which is in an AccessControlLink,
- every new ACS userID with 'root' rights,
- every new ACS actor belonging to its userID, its groupID,
or to a groupID which contains its userID, its groupID,
- every new ACS userID belonging to its groupID,
or to a groupID which contains its userID, its groupID,
- every new ACS actor executed through 'other' rights with a current account or group,
- every PrivilegeForLinks change in the sources and the targets,
- every specific property change from an AcsAddon object.
The previous listened objects that are not implied in the view are unregistered. This is the most complex method of the class, and it has to follow the evolutions of the properties in the generic gBase ACSObject classes. Calls AclEntryImpl.getIntermediateGroupsToConditionalGroups(). Called by Gui2.ViewModel.
setRightsNetwork
in interface RightsNetworkObserver
_l_baseObjects
- the BaseObjects which are intermediate nodes in
the detected access paths of the view, or an intermediate-node AclEntrypublic void propertyChange(java.beans.PropertyChangeEvent _evt)
To avoid the processing of events from a closing ACS during the closing of its child ACS, this method uses TreeManager.haveAtLeastOneTreeBaseListener() to see if ActionClose.closeInGUI() has already closed the parent ACS tree in the explorer.
propertyChange
in interface RightsNetworkObserver
propertyChange
in interface java.beans.PropertyChangeListener
_evt
- is the event from the gBase objectspublic void finalizeForProcess()
finalizeForProcess
in interface RightsNetworkObserver
public java.lang.String toString()
toString
in interface RightsNetworkObserver
toString
in class java.lang.Object
private void firePropertyChange()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |