Package org.ametys.plugins.workspaces
Class PagePopulator
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workspaces.PagePopulator
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Component allowing to create and fill a page from a configuration file
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
the content type extension pointprotected CurrentUserProvider
the current user providerprotected I18nUtils
the i18n utils componentprotected ObservationManager
the observation managerprotected PageDAO
the page daoprotected ProfileAssignmentStorageExtensionPoint
the profile assignment storage extension pointprotected SAXParser
Excalibur SaxParserprotected ServiceExtensionPoint
the service extension pointprotected SkinsManager
the skins managerprotected SourceResolver
the source resolverprotected ContentWorkflowHelper
the workflow helperstatic final String
The avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_notifyACLChange
(Object context, Set<String> profilesId) Utility method to notify a change of ACL on a contextprotected void
configurePage
(ModifiablePage newPage, Configuration configuration) Use a configuration to edit a page.protected void
createAndConfigureContentItem
(ModifiableZone zone, Configuration contentCfg) Create a new content based on configuration and add it to a new zone itemprotected void
createAndConfigureServiceItem
(ModifiableZone zone, Configuration serviceCfg) Create and configure a zone item based on a service configurationprotected void
createAndConfigureZone
(ModifiablePage newPage, Configuration zoneCfg) Create and configure a zone based on configurationprotected Optional<ModifiablePage>
createPage
(ModifiableSitemapElement parent, Configuration configuration) Create a new page based on a configuration.initPage
(ModifiableSitemapElement parent, String path) Create a new page based on a configuration file.initPage
(ModifiableSitemapElement parent, Configuration configuration) Create and configure a new page based on a configuration.void
service
(ServiceManager manager) protected void
setReaderAccess
(ModifiablePage newPage, Configuration configuration) Set page reader access based on configurationMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The avalon role -
_sourceResolver
the source resolver -
_i18nUtils
the i18n utils component -
_serviceEP
the service extension point -
_observationManager
the observation manager -
_workflowHelper
the workflow helper -
_currentUserProvider
the current user provider -
_pageDAO
the page dao -
_profileAssignementStorageEP
the profile assignment storage extension point -
_skinsManager
the skins manager -
_contentTypeEP
the content type extension point -
_saxParser
Excalibur SaxParser
-
-
Constructor Details
-
PagePopulator
public PagePopulator()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initPage
public Optional<ModifiablePage> initPage(ModifiableSitemapElement parent, String path) throws IOException, SAXException, ConfigurationException Create a new page based on a configuration file.- Parameters:
parent
- the parent where the page should be insertedpath
- the path where the configuration can be found- Returns:
- the newly created page or
Optional#empty()
if no page was created. - Throws:
IOException
- if an error occurred while reading the fileSAXException
- if an error occurred while parsing the configuration fileConfigurationException
- if the configuration is not valid; A required info is missing.
-
initPage
public Optional<ModifiablePage> initPage(ModifiableSitemapElement parent, Configuration configuration) throws ConfigurationException Create and configure a new page based on a configuration.- Parameters:
parent
- the parent where the page should be addedconfiguration
- the page configuration- Returns:
- the newly created page or
Optional#empty()
if no page was created. - Throws:
ConfigurationException
- if the configuration is not valid; A required info is missing.
-
createPage
protected Optional<ModifiablePage> createPage(ModifiableSitemapElement parent, Configuration configuration) throws ConfigurationException Create a new page based on a configuration.- Parameters:
parent
- the sitemap element where the page should be addedconfiguration
- the page configuration- Returns:
- the newly created page or
Optional#empty()
if the page already exist. - Throws:
ConfigurationException
- if the configuration is not valid; A required info is missing.
-
configurePage
protected void configurePage(ModifiablePage newPage, Configuration configuration) throws ConfigurationException Use a configuration to edit a page. Via configuration, it's possible to define the page tags, template and zone items (service or content)- Parameters:
newPage
- the page that needs configurationconfiguration
- the configuration describing the expected page- Throws:
ConfigurationException
- if the configuration is not valid
-
createAndConfigureZone
protected void createAndConfigureZone(ModifiablePage newPage, Configuration zoneCfg) throws ConfigurationException Create and configure a zone based on configuration- Parameters:
newPage
- the new page where the zone should be addedzoneCfg
- the configuration to use- Throws:
ConfigurationException
- if the configuration is invalid
-
createAndConfigureServiceItem
protected void createAndConfigureServiceItem(ModifiableZone zone, Configuration serviceCfg) throws ConfigurationException Create and configure a zone item based on a service configuration- Parameters:
zone
- the zone where the zone item should be addedserviceCfg
- the configuration to use- Throws:
ConfigurationException
- if the configuration is invalid
-
createAndConfigureContentItem
protected void createAndConfigureContentItem(ModifiableZone zone, Configuration contentCfg) throws ConfigurationException Create a new content based on configuration and add it to a new zone item- Parameters:
zone
- the zone where the zone item should be addedcontentCfg
- the configuration to use- Throws:
ConfigurationException
- if the configuration is invalid
-
setReaderAccess
protected void setReaderAccess(ModifiablePage newPage, Configuration configuration) throws ConfigurationException Set page reader access based on configuration- Parameters:
newPage
- the newly created pageconfiguration
- the page configuration- Throws:
ConfigurationException
- if an unrecognized group is present in configuration
-
_notifyACLChange
Utility method to notify a change of ACL on a context- Parameters:
context
- the impacted contextprofilesId
- the assigned or removed profiles
-