Class AdvancedActionsRegistry
- java.lang.Object
-
- org.neotropic.kuwaiba.core.apis.integration.modules.actions.AdvancedActionsRegistry
-
@Service public class AdvancedActionsRegistry extends Object
All inventory-object related actions from all modules must be registered here at module startup. Then, the menus will be built using the registered actions and what kind of inventory actions they are applicable to.- Author:
- Charles Edward Bedon Cortazar <charles.bedon@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description AdvancedActionsRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<AbstractVisualAdvancedAction>
getActionsApplicableTo(String filter, boolean includeNonReusable)
Checks what actions are associated to a given inventory class.For example, NewCustomer and DeleteCustomer are part of the returned list iffilter
is GenericCustomer.List<AbstractVisualAdvancedAction>
getActionsApplicableToRecursive(String filter, boolean includeNonReusable)
Checks what actions are associated to a given inventory class.List<AbstractVisualAdvancedAction>
getActionsForModule(String moduleId, boolean includeNonReusable)
Returns all actions registered by a particular module.List<AbstractVisualAdvancedAction>
getAllActions()
Returns all registered actions.List<AbstractRelationshipManagementAction>
getRelationshipManagementActions()
Returns all registered relationship management actions.List<AbstractRelationshipManagementAction>
getRelationshipManagementActionsApplicableTo(String filter)
Checks what relationship management actions are associated to a given inventory class.List<AbstractRelationshipManagementAction>
getRelationshipManagementActionsApplicableToRecursive(String filter)
Checks recursively in the class hierarchy what relationship management actions are associated to a given inventory class.void
registerAction(String moduleId, AbstractVisualAdvancedAction action)
Adds an action to the registry.This method also feeds the action map cache structure, which is a hash map whose keys are all the possible super classes the actions are applicable to and the keys are the corresponding actions.
-
-
-
Method Detail
-
getActionsApplicableTo
public List<AbstractVisualAdvancedAction> getActionsApplicableTo(String filter, boolean includeNonReusable)
Checks what actions are associated to a given inventory class.For example, NewCustomer and DeleteCustomer are part of the returned list iffilter
is GenericCustomer. Note that the difference between this method and#getActionsApplicableToRecursive(java.lang.String)
is that this method will return the actions whose appliesTo matches exactly with the provided filter, while the latter might match even subclasses of the appliesTo return value.- Parameters:
filter
- The class to be evaluated.includeNonReusable
- Should the method include the reusable actions? SeeAbstractVisualAdvancedAction.isReusable()
. for more details on reusable actions.- Returns:
- The actions that can be executed from an instance of the given class or superclass.
-
getActionsApplicableToRecursive
public List<AbstractVisualAdvancedAction> getActionsApplicableToRecursive(String filter, boolean includeNonReusable)
Checks what actions are associated to a given inventory class. For example, NewCustomer and DeleteCustomer are part of the returned list iffilter
is CorporateCustomer.- Parameters:
filter
- The class to be evaluated.includeNonReusable
- Should the method include the reusable actions? SeeAbstractVisualAdvancedAction.isReusable()
.- Returns:
- The actions that can be executed from an instance of the given class or superclass.
-
registerAction
public void registerAction(String moduleId, AbstractVisualAdvancedAction action)
Adds an action to the registry.This method also feeds the action map cache structure, which is a hash map whose keys are all the possible super classes the actions are applicable to and the keys are the corresponding actions.- Parameters:
moduleId
- The id of the module this action is provided by. The id is returned by AbstractModule.getId().action
- The action to be added. Duplicated action ids are allowed, as long as the duplicate can be used to overwrite default behaviors, for example, if an object (say a connection) has a specific delete routine that should be executed instead of the general purpose delete action, both actions should have the same id, and the renderer should override the default action with the specific one.
-
getAllActions
public List<AbstractVisualAdvancedAction> getAllActions()
Returns all registered actions.- Returns:
- All registered actions.
-
getActionsForModule
public List<AbstractVisualAdvancedAction> getActionsForModule(String moduleId, boolean includeNonReusable)
Returns all actions registered by a particular module.- Parameters:
moduleId
- The id of the module. Usually the strings that comes from calling AbstractModule.getId().includeNonReusable
- Should the method include the reusable actions? SeeAbstractVisualAdvancedAction.isReusable()
.- Returns:
- The list of actions, even if none registered for the given module (in that case, an empty array will be returned).
-
getRelationshipManagementActionsApplicableTo
public List<AbstractRelationshipManagementAction> getRelationshipManagementActionsApplicableTo(String filter)
Checks what relationship management actions are associated to a given inventory class. See#getMiscActionsApplicableTo(java.lang.String)
for more details on its behavior.- Parameters:
filter
- The class to be evaluated.- Returns:
- The relationship management actions that can be executed from an instance of the given class or superclass.
-
getRelationshipManagementActionsApplicableToRecursive
public List<AbstractRelationshipManagementAction> getRelationshipManagementActionsApplicableToRecursive(String filter)
Checks recursively in the class hierarchy what relationship management actions are associated to a given inventory class. See#getActionsApplicableToRecursive(java.lang.String)
for more details on its behavior.- Parameters:
filter
- The class to be evaluated.- Returns:
- The relationship management actions that can be executed from an instance of the given class or superclass.
-
getRelationshipManagementActions
public List<AbstractRelationshipManagementAction> getRelationshipManagementActions()
Returns all registered relationship management actions.- Returns:
- All registered relationship management actions.
-
-