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_cocoonContextCocoon contextprivate Context_contextprotected ContentTypeExtensionPoint_cTypeEPThe content type extension point.protected AmetysObjectResolver_resolverAmetys object resolverprotected Map<String,OdfProgramRestriction>_restrictionsThe available odf restrictionsprotected RootOrgUnitProvider_rootOrgUnitProviderRoot orgunit providerprotected SiteManager_siteManagerSite Managerstatic StringROLEThe 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 filevoidcontextualize(Context context)voiddispose()OdfProgramRestrictiongetRestriction(Page odfRootPage)Get the ODF restriction for the given ODF root pageStringgetRestrictionRootOrgUnitId(String siteName)Get the id of the restriction root orgunitMap<String,OdfProgramRestriction>getRestrictions()Retrieves the available restrictionsbooleanhasOrgunitRestrictions(Page rootPage)Indicate is there is any restriction related to orgunit for this root pagebooleanhasRestrictions(Page rootPage)Indicate is there is any restriction for this root pagevoidservice(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:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
dispose
public void dispose()
- Specified by:
disposein 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()
-
-