Class InitializeBlogSiteObserver

java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.blog.InitializeBlogSiteObserver
All Implemented Interfaces:
Observer, PluginAware, LogEnabled, Serviceable

Initializes all blog pages when a site is created.
  • Field Details

  • Constructor Details

  • Method Details

    • setPluginInfo

      public void setPluginInfo(String pluginName, String featureName, String id)
      Description copied from interface: PluginAware
      Sets the plugin info relative to the current component.
      Note : The feature name may be null if the targeted component in declared at plugin level.
      Specified by:
      setPluginInfo in interface PluginAware
      Parameters:
      pluginName - Unique identifier for the plugin hosting the extension
      featureName - Unique feature identifier (unique for a given pluginName)
      id - Unique identifier of this component
    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • supports

      public boolean supports(Event event)
      Description copied from interface: Observer
      Checks if the event is supported. If true, the observe(Event) method will be called.
      Specified by:
      supports in interface Observer
      Parameters:
      event - the event.
      Returns:
      true for observing this event, false otherwise.
    • getPriority

      public int getPriority(Event event)
      Description copied from interface: Observer
      Retrieves the priority to observe this event.
      This can be used to process a supported event before others observers.
      Specified by:
      getPriority in interface Observer
      Parameters:
      event - the event.
      Returns:
      the priority where 0 the max priority and Integer.MAX_VALUE the min priority.
    • observe

      public void observe(Event event, Map<String,Object> transientVars) throws Exception
      Description copied from interface: Observer
      Observes an event.
      Specified by:
      observe in interface Observer
      Parameters:
      event - the event.
      transientVars - transientVars passed from one Observer to another when processing a single Event. This may allow optimizations between observers.
      Throws:
      Exception - if an error occurs. All exceptions will be logged but not propagated, as the observation mechanism should never fail.
    • initializeSite

      protected void initializeSite(Site site)
      Initialize the given site.
      Parameters:
      site - the Site object.
    • initializeSitemap

      protected void initializeSitemap(Sitemap sitemap)
      Initialize the given sitemap.
      Parameters:
      sitemap - the Sitemap object.
    • createPage

      protected ModifiablePage createPage(Sitemap sitemap, String name, String title)
      Create the blog root page.
      Parameters:
      sitemap - The sitemap
      name - The page's name
      title - The page's title
      Returns:
      the root page.
    • initializeIndexPage

      protected void initializeIndexPage(ModifiablePage indexPage, Content profileContent)
      Initialize the blog index page.
      Parameters:
      indexPage - the blog index page.
      profileContent - the profile Content.
    • initializeSearchPage

      protected void initializeSearchPage(ModifiablePage page, Content profileContent)
      Initialize the search page.
      Parameters:
      page - the search page.
      profileContent - the profile Content.
    • initializeSearchDefaultZone

      Initialize the search page's default zone.
      Parameters:
      page - the search page.
    • initializeProfilePage

      Initialize the blog profile page.
      Parameters:
      page - the blog profile page.
      Returns:
      the profile content.
    • initializeProfileDefaultZone

      Initialize the profile page's default zone.
      Parameters:
      page - the profile page.
      Returns:
      the profile content.
    • initializeDefaultZone

      protected void initializeDefaultZone(ModifiablePage page)
      Initialize the default zone.
      Parameters:
      page - The page
    • initializeIndexAboutZone

      protected void initializeIndexAboutZone(ModifiablePage indexPage, Content profileContent)
      Initialize the index page's "about" zone.
      Parameters:
      indexPage - the index Page.
      profileContent - the profile content.
    • initializeAsideZone

      protected void initializeAsideZone(ModifiablePage page)
      Initialize the "aside" zone.
      Parameters:
      page - the page on which to initialize the aside zone.
    • createProfileContent

      protected Content createProfileContent(String workflowName, String siteName, String lang, String title) throws com.opensymphony.workflow.WorkflowException
      Create a profile content.
      Parameters:
      workflowName - The workflow name
      siteName - the site name.
      lang - the language.
      title - The content's title
      Returns:
      the created person content.
      Throws:
      com.opensymphony.workflow.WorkflowException - if an error occurs
    • getDefaultXslt

      protected String getDefaultXslt(String serviceId)
      Get the default value of the XSLT parameter of the given service.
      Parameters:
      serviceId - the service ID.
      Returns:
      the default XSLT parameter value.
    • translate

      protected String translate(String key, String language)
      Translate the key in the plugin's catalogue.
      Parameters:
      key - the i18n key.
      language - the language.
      Returns:
      the translated value.