Class RulesManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.odfpilotage.rule.RulesManager
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
The rules manager
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentWorkflowHelper
The content workflow helperprotected CopyContentComponent
The copy content componentprotected ContentTypeExtensionPoint
The content type extension pointprotected CurrentUserProvider
The current user providerprotected MCCWorkflowHelper
The MCC workflow helperprotected PilotageHelper
The pilotage helperprotected AmetysObjectResolver
The ametys object resolverprotected RightManager
The right managerprotected ThematicsHelper
The thematics helperstatic final String
The additional thematic prefixstatic final String
The name of the complementary rules viewstatic final String
The attribute name for the rules repeater in containerstatic final String
The attribute name for the thematics repeater in containerstatic final String
The handle rules rightstatic final String
Avalon ROLE.static final String
The attribute name for the rule codestatic final String
The attribute name for the rule derogablestatic final String
The attribute name for the rule help motivationstatic final String
The attribute name for the rule help textstatic final String
The attribute name for the rule motivationstatic final String
The attribute name for the rule statusstatic final String
The attribute name for the rule textstatic final String
The attribute name for the rule thematic codestatic final String
The name of the specific rules viewstatic final String
The attribute name for the thematic codestatic final String
The thematic content typestatic final String
The attribute name for the degree restriction in thematic contentstatic final String
The attribute name for the nb sessions restriction in thematic contentstatic final String
The attribute name for the regime restriction in thematic contentstatic final String
The attribute name for the rules repeater in thematic contentstatic final String
The thematic prefix -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_addAdditionalRule
(String containerId, String thematicCode, Object text, Object motivation, int actionId) Add an additional rule to the container for a given thematic_derogateRule
(String containerId, String thematicCode, String ruleCode, Object text, Object motivation, int actionId) Derogate a rule for a given containeraddAdditionalRule
(String containerId, String thematicCode, Object text, Object motivation) Add an additional rule to the container for a given thematicboolean
canEditRules
(Container container) true
if can edit rules for the given containercopyAllRules
(String srcContainerId, List<String> destContainerIds) Copy all rule of the source container to the dest containerscopyRule
(String srcContainerId, String thematicCode, String ruleCode, List<String> destContainerIds) Copy the rule to the given containerscopyRulesFromView
(String srcContainerId, List<String> destContainerIds, String viewName) Copy all rules from view of the source container to the dest containersdeleteRule
(String containerId, String ruleCode) Delete a container ruleboolean
deleteRules
(Container container, Set<Integer> rulePositions) Delete the rules of containerderogateRule
(String containerId, String thematicCode, String ruleCode, Object text, Object motivation) Derogate a rule for a given containereditAdditionalRule
(String containerId, String ruleCode, String text, String motivation) Edit a container additional rulegetAllowedContainers
(Map<String, Object> params) Get the containers matching the same thematic restriction of the given containergetRuleInfo
(String containerId, String thematicCode, String ruleCode) Get the information of given rule in the given containergetRuleValues
(String containerId, String ruleCode) Get the values of given rule in the given containerboolean
hasHandleRulesRight
(Container container) true
if has handle rules rightisMccCompatible
(String containerId) true
if the current user has right on the container and its nature equals to "annee"boolean
Determines if rules are enabledvoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon ROLE. -
THEMATIC_CONTENT_TYPE
The thematic content type- See Also:
-
CONTAINER_THEMATICS
The attribute name for the thematics repeater in container- See Also:
-
THEMATIC_DEGREE
The attribute name for the degree restriction in thematic content- See Also:
-
THEMATIC_REGIME
The attribute name for the regime restriction in thematic content- See Also:
-
THEMATIC_NB_SESSIONS
The attribute name for the nb sessions restriction in thematic content- See Also:
-
THEMATIC_RULES
The attribute name for the rules repeater in thematic content- See Also:
-
CONTAINER_RULES
The attribute name for the rules repeater in container- See Also:
-
THEMATIC_CODE
The attribute name for the thematic code- See Also:
-
RULE_THEMATIC_CODE
The attribute name for the rule thematic code- See Also:
-
RULE_CODE
The attribute name for the rule code- See Also:
-
RULE_HELP_TEXT
The attribute name for the rule help text- See Also:
-
RULE_TEXT
The attribute name for the rule text- See Also:
-
RULE_STATUS
The attribute name for the rule status- See Also:
-
RULE_DEROGABLE
The attribute name for the rule derogable- See Also:
-
RULE_HELP_MOTIVATION
The attribute name for the rule help motivation- See Also:
-
RULE_MOTIVATION
The attribute name for the rule motivation- See Also:
-
THEMATICS_PREFIX
The thematic prefix- See Also:
-
ADDITIONAL_THEMATICS_PREFIX
The additional thematic prefix- See Also:
-
HANDLE_RULES_RIGHT
The handle rules right- See Also:
-
SPECIFIC_RULE_VIEW
The name of the specific rules view- See Also:
-
COMPLEMENTARY_RULE_VIEW
The name of the complementary rules view- See Also:
-
_resolver
The ametys object resolver -
_contentWorkflowHelper
The content workflow helper -
_pilotageHelper
The pilotage helper -
_thematicsHelper
The thematics helper -
_rightManager
The right manager -
_currentUserProvider
The current user provider -
_mccWorkflowHelper
The MCC workflow helper -
_copyContentComponent
The copy content component -
_cTypeEP
The content type extension point
-
-
Constructor Details
-
RulesManager
public RulesManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
isRulesEnabled
Determines if rules are enabled- Returns:
true
if rules are enabled
-
canEditRules
true
if can edit rules for the given container- Parameters:
container
- the container- Returns:
true
if can edit rules
-
isMccCompatible
true
if the current user has right on the container and its nature equals to "annee"- Parameters:
containerId
- the container id- Returns:
- results
-
hasHandleRulesRight
true
if has handle rules right- Parameters:
container
- the container- Returns:
true
if has handle rules right
-
addAdditionalRule
public Map<String,Object> addAdditionalRule(String containerId, String thematicCode, Object text, Object motivation) Add an additional rule to the container for a given thematic- Parameters:
containerId
- the container idthematicCode
- the code of the thematictext
- the text rulemotivation
- the motivation rule- Returns:
- the map of results
-
_addAdditionalRule
protected Map<String,Object> _addAdditionalRule(String containerId, String thematicCode, Object text, Object motivation, int actionId) Add an additional rule to the container for a given thematic- Parameters:
containerId
- the container idthematicCode
- the code of the thematictext
- the text rulemotivation
- the motivation ruleactionId
- the action id- Returns:
- the map of results
-
editAdditionalRule
public Map<String,Object> editAdditionalRule(String containerId, String ruleCode, String text, String motivation) Edit a container additional rule- Parameters:
containerId
- the container idruleCode
- the code of the ruletext
- the text rulemotivation
- the motivation rule- Returns:
- the map of results
-
deleteRule
Delete a container rule- Parameters:
containerId
- the container idruleCode
- the code of the rule- Returns:
- the map of results
-
deleteRules
Delete the rules of container- Parameters:
container
- the containerrulePositions
- the rule positions- Returns:
true
if the deletion is a success
-
getRuleValues
Get the values of given rule in the given container- Parameters:
containerId
- the container idruleCode
- the rule code- Returns:
- the rule values
-
getRuleInfo
Get the information of given rule in the given container- Parameters:
containerId
- the container idthematicCode
- the thematic coderuleCode
- the rule code- Returns:
- the rule information
-
derogateRule
public Map<String,Object> derogateRule(String containerId, String thematicCode, String ruleCode, Object text, Object motivation) Derogate a rule for a given container- Parameters:
containerId
- the containerthematicCode
- the thematic coderuleCode
- the rule codetext
- the text of the derogationmotivation
- the motivation of the derogation- Returns:
- the rule information
-
_derogateRule
protected Map<String,Object> _derogateRule(String containerId, String thematicCode, String ruleCode, Object text, Object motivation, int actionId) Derogate a rule for a given container- Parameters:
containerId
- the containerthematicCode
- the thematic coderuleCode
- the rule codetext
- the text of the derogationmotivation
- the motivation of the derogationactionId
- the action id- Returns:
- the rule information
-
getAllowedContainers
Get the containers matching the same thematic restriction of the given container- Parameters:
params
- the given parameters- Returns:
- the allowed containers
-
copyRule
public Map<String,Object> copyRule(String srcContainerId, String thematicCode, String ruleCode, List<String> destContainerIds) Copy the rule to the given containers- Parameters:
srcContainerId
- the source container idthematicCode
- the thematic coderuleCode
- the rule codedestContainerIds
- the ids of dest container- Returns:
- the results
-
copyAllRules
Copy all rule of the source container to the dest containers- Parameters:
srcContainerId
- the source container iddestContainerIds
- the destination container ids- Returns:
- the copy result
-
copyRulesFromView
public Map<String,Object> copyRulesFromView(String srcContainerId, List<String> destContainerIds, String viewName) Copy all rules from view of the source container to the dest containers- Parameters:
srcContainerId
- the source container iddestContainerIds
- the destination container idsviewName
- the view name- Returns:
- the copy result
-