Class OdfProgramRestrictionManager
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.odfweb.restrictions.OdfProgramRestrictionManager
-
- All Implemented Interfaces:
LogEnabled
,Disposable
,Component
,Contextualizable
,Serviceable
public class OdfProgramRestrictionManager extends AbstractLogEnabled implements Component, Serviceable, Contextualizable, Disposable
Component able to handle program restrictions related to the "odf-restrictions" site parameter.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_cocoonContext
Cocoon contextprivate Context
_context
protected ContentTypeExtensionPoint
_cTypeEP
The content type extension point.protected AmetysObjectResolver
_resolver
Ametys object resolverprotected Map<String,OdfProgramRestriction>
_restrictions
The available odf restrictionsprotected RootOrgUnitProvider
_rootOrgUnitProvider
Root orgunit providerprotected SiteManager
_siteManager
Site Managerstatic String
ROLE
The avalon role.
-
Constructor Summary
Constructors Constructor Description OdfProgramRestrictionManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_addDefaultOrgunitRestrictions()
private I18nizableText
_configureI18nizableText(Configuration config, String name, String defaultValue, String defaultCatalog)
protected OdfRestrictionRule
_configureRestrictionRule(Configuration ruleConf)
Configure a restriction rule from a configuration nodeprotected List<OdfRestrictionRule>
_configureRestrictionRules(Configuration rulesConf)
Create a list of rules from configuration nodesprotected void
_readRestrictionConfigurationFile()
Configured the restrictions from the XML configuration filevoid
contextualize(Context context)
void
dispose()
OdfProgramRestriction
getRestriction(Page odfRootPage)
Get the ODF restriction for the given ODF root pageString
getRestrictionRootOrgUnitId(String siteName)
Get the id of the restriction root orgunitMap<String,OdfProgramRestriction>
getRestrictions()
Retrieves the available restrictionsboolean
hasOrgunitRestrictions(Page rootPage)
Indicate is there is any restriction related to orgunit for this root pageboolean
hasRestrictions(Page rootPage)
Indicate is there is any restriction for this root pagevoid
service(ServiceManager serviceManager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_siteManager
protected SiteManager _siteManager
Site Manager
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point.
-
_resolver
protected AmetysObjectResolver _resolver
Ametys object resolver
-
_rootOrgUnitProvider
protected RootOrgUnitProvider _rootOrgUnitProvider
Root orgunit provider
-
_cocoonContext
protected Context _cocoonContext
Cocoon context
-
_restrictions
protected Map<String,OdfProgramRestriction> _restrictions
The available odf restrictions
-
-
Constructor Detail
-
OdfProgramRestrictionManager
public OdfProgramRestrictionManager()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceDisposable
-
getRestrictions
public Map<String,OdfProgramRestriction> getRestrictions()
Retrieves the available restrictions- Returns:
- The map of restriction, where keys are restriction ids.
-
getRestriction
public OdfProgramRestriction getRestriction(Page odfRootPage)
Get the ODF restriction for the given ODF root page- Parameters:
odfRootPage
- The ODF root page- Returns:
- The restriction or
null
-
hasRestrictions
public boolean hasRestrictions(Page rootPage)
Indicate is there is any restriction for this root page- Parameters:
rootPage
- odf root page- Returns:
- true if it is the case
-
hasOrgunitRestrictions
public boolean hasOrgunitRestrictions(Page rootPage)
Indicate is there is any restriction related to orgunit for this root page- Parameters:
rootPage
- odf root page- Returns:
- true if it is the case
-
getRestrictionRootOrgUnitId
public String getRestrictionRootOrgUnitId(String siteName)
Get the id of the restriction root orgunit- Parameters:
siteName
- the site name- Returns:
- the id of the restriction root orgunit
-
_readRestrictionConfigurationFile
protected void _readRestrictionConfigurationFile()
Configured the restrictions from the XML configuration file
-
_configureI18nizableText
private I18nizableText _configureI18nizableText(Configuration config, String name, String defaultValue, String defaultCatalog)
-
_configureRestrictionRules
protected List<OdfRestrictionRule> _configureRestrictionRules(Configuration rulesConf) throws ConfigurationException
Create a list of rules from configuration nodes- Parameters:
rulesConf
- Array of configuration node that represents the set of rules- Returns:
- list of rules
- Throws:
ConfigurationException
- if a configuration error is encountered
-
_configureRestrictionRule
protected OdfRestrictionRule _configureRestrictionRule(Configuration ruleConf) throws ConfigurationException
Configure a restriction rule from a configuration node- Parameters:
ruleConf
- The configuration node representing the rule- Returns:
- The odf restriction rule
- Throws:
ConfigurationException
- if a configuration error is encountered
-
_addDefaultOrgunitRestrictions
private void _addDefaultOrgunitRestrictions()
-
-