Class UserPortalConfigService

java.lang.Object
org.exoplatform.portal.config.UserPortalConfigService
All Implemented Interfaces:
org.picocontainer.Startable

public class UserPortalConfigService extends Object implements org.picocontainer.Startable
Created by The eXo Platform SAS Apr 19, 2007 This service is used to load the PortalConfig, Page config and Navigation config for a given user.
  • Field Details

    • DEFAULT_GLOBAL_PORTAL

      public static final String DEFAULT_GLOBAL_PORTAL
      See Also:
    • DEFAULT_GROUP_SITE_TEMPLATE

      public static final String DEFAULT_GROUP_SITE_TEMPLATE
      See Also:
    • DEFAULT_USER_SITE_TEMPLATE

      public static final String DEFAULT_USER_SITE_TEMPLATE
      See Also:
    • siteFilter

      protected final org.exoplatform.portal.mop.SiteFilter siteFilter
  • Constructor Details

    • UserPortalConfigService

      public UserPortalConfigService(UserACL userACL, org.exoplatform.portal.mop.service.LayoutService storage, org.exoplatform.services.organization.OrganizationService orgService, org.exoplatform.portal.mop.service.NavigationService navService, org.exoplatform.portal.mop.storage.DescriptionStorage descriptionService, org.exoplatform.portal.mop.storage.PageStorage pageStorage, org.exoplatform.commons.api.settings.SettingService settingService, org.exoplatform.container.xml.InitParams params)
  • Method Details

    • getPageService

      public org.exoplatform.portal.mop.storage.PageStorage getPageService()
    • getDataStorage

      public org.exoplatform.portal.mop.service.LayoutService getDataStorage()
    • getDefaultImportMode

      public org.exoplatform.portal.mop.importer.ImportMode getDefaultImportMode()
    • getCreateUserPortal

      public boolean getCreateUserPortal()
    • setCreateUserPortal

      public void setCreateUserPortal(boolean createUserPortal)
    • getDestroyUserPortal

      public boolean getDestroyUserPortal()
    • setDestroyUserPortal

      public void setDestroyUserPortal(boolean destroyUserPortal)
    • getDefaultGroupSiteTemplate

      public String getDefaultGroupSiteTemplate()
    • setDefaultGroupSiteTemplate

      public void setDefaultGroupSiteTemplate(String defaultGroupSiteTemplate)
    • getDefaultUserSiteTemplate

      public String getDefaultUserSiteTemplate()
    • setDefaultUserSiteTemplate

      public void setDefaultUserSiteTemplate(String defaultUserSiteTemplate)
    • getNavigationService

      public org.exoplatform.portal.mop.service.NavigationService getNavigationService()
      Returns the navigation service associated with this service.
      Returns:
      the navigation service;
    • getDescriptionService

      public org.exoplatform.portal.mop.storage.DescriptionStorage getDescriptionService()
    • getUserACL

      public UserACL getUserACL()
    • getOrganizationService

      public org.exoplatform.services.organization.OrganizationService getOrganizationService()
    • getUserPortalConfig

      public UserPortalConfig getUserPortalConfig(String portalName, String username)

      Build and returns an instance of UserPortalConfig.


      To return a valid config, the current thread must be associated with an identity that will grant him access to the portal as returned by the UserACL.hasAccessPermission(org.exoplatform.portal.config.model.PortalConfig, Identity) method.


      The navigation loaded on the UserPortalConfig object are obtained according to the specified user argument. The portal navigation is always loaded. If the specified user is null then the navigation of the guest group as configured by UserACL#getGuestsGroup is also loaded, otherwise the navigations are loaded according to the following rules:
      • The navigation corresponding to the user is loaded.
      • When the user is root according to the value returned by UserACL#getSuperUser then the navigation of all groups are loaded.
      • When the user is not root, then all its groups are added except the guest group as configued per UserACL#getGuestsGroup.

      All the navigations are sorted using the value returned by PageNavigation.getPriority().
      Parameters:
      portalName - the portal name
      username - the user name
      Returns:
      the config
    • getUserPortalConfig

      public UserPortalConfig getUserPortalConfig(String portalName, String accessUser, Locale locale)
    • getUserPortalConfig

      @Deprecated(forRemoval=true, since="7.0") public UserPortalConfig getUserPortalConfig(String portalName, String accessUser, UserPortalContext userPortalContext)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      portalName - the portal name
      accessUser - the user name
      userPortalContext -
      Returns:
      the config
    • getMakableNavigations

      public List<String> getMakableNavigations(String remoteUser, boolean withSite) throws Exception
      Compute and returns the list that the specified user can manage. If the user is root then all existing groups are returned otherwise the list is computed from the groups in which the user has a configured membership. The membership is configured from the value returned by UserACL#getMakableMT
      Parameters:
      remoteUser - the user to get the makable navigations
      withSite - true if a site must exist
      Returns:
      the list of groups
      Throws:
      Exception - any exception
    • hasMakableNavigations

      public boolean hasMakableNavigations(String remoteUser, boolean withSite) throws Exception
      Returns a boolean hasNav according to if the user has at least one makable navigation i.e if he belongs to at least one group
      Parameters:
      remoteUser - the user to get the makable navigations
      withSite - whether or not check if siteConfig exists.
      Returns:
      true or false
      Throws:
      Exception - any exception
    • createUserSite

      public void createUserSite(String userName) throws Exception
      Create a user site for the specified user. It will perform the following:
      • create the user site by calling createUserPortalConfig(String, String, String) which may create a site or not according to the default configuration
      • if not site exists then it creates a site then it creates an empty site
      • if not navigation exists for the user site then it creates an empty navigation
      Parameters:
      userName - the user name
      Throws:
      Exception - a nasty exception
    • createGroupSite

      public void createGroupSite(String groupId) throws Exception
      Create a group site for the specified group. It will perform the following:
      Parameters:
      groupId - the group id
      Throws:
      Exception - a nasty exception
    • createUserPortalConfig

      public void createUserPortalConfig(String siteType, String siteName, String template) throws Exception
      This method should create a the portal config, pages and navigation according to the template name.
      Parameters:
      siteType - the site type
      siteName - the Site name
      template - the template to use
      Throws:
      Exception - any exception
    • removeUserPortalConfig

      public void removeUserPortalConfig(String portalName) throws Exception
      This method removes the PortalConfig, Page and PageNavigation that belong to the portal in the database.
      Parameters:
      portalName - the portal name
      Throws:
      Exception - any exception
    • removeUserPortalConfig

      public void removeUserPortalConfig(String ownerType, String ownerId) throws Exception
      This method removes the PortalConfig, Page and PageNavigation that belong to the portal in the database.
      Parameters:
      ownerType - the owner type
      ownerId - the portal name
      Throws:
      Exception - any exception
    • getPage

      public org.exoplatform.portal.mop.page.PageContext getPage(org.exoplatform.portal.mop.page.PageKey pageRef)
      Load metadata of specify page
      Parameters:
      pageRef - the PageKey
      Returns:
      the PageContext
    • createPageTemplate

      public org.exoplatform.portal.config.model.Page createPageTemplate(String temp, String ownerType, String ownerId) throws Exception
      Creates a page from an existing template.
      Parameters:
      temp - the template name
      ownerType - the new owner type
      ownerId - the new owner id
      Returns:
      the page
      Throws:
      Exception - any exception
    • getGlobalPortal

      public String getGlobalPortal()
    • getSiteNames

      public List<String> getSiteNames(org.exoplatform.portal.mop.SiteType siteType, int offset, int limit)
    • getUserPortalSites

      public List<org.exoplatform.portal.config.model.PortalConfig> getUserPortalSites()
    • computePortalSitePath

      public String computePortalSitePath(String portalName, jakarta.servlet.http.HttpServletRequest context)
    • computePortalPath

      public String computePortalPath(jakarta.servlet.http.HttpServletRequest context)
    • getPortalSiteNavigations

      public Collection<UserNode> getPortalSiteNavigations(String siteName, String portalType, jakarta.servlet.http.HttpServletRequest context)
    • getPortalSiteRootNode

      public UserNode getPortalSiteRootNode(String siteName, String siteType, jakarta.servlet.http.HttpServletRequest context) throws Exception
      Throws:
      Exception
    • getFirstAllowedPageNode

      public UserNode getFirstAllowedPageNode(Collection<UserNode> userNodes)
    • getFirstAllowedPageNode

      public String getFirstAllowedPageNode(String portalName, String portalType, String nodePath, jakarta.servlet.http.HttpServletRequest context) throws Exception
      Throws:
      Exception
    • initListener

      public void initListener(org.exoplatform.container.component.ComponentPlugin listener)
    • deleteListenerElements

      public void deleteListenerElements(org.exoplatform.container.component.ComponentPlugin listener)
    • start

      public void start()
      Specified by:
      start in interface org.picocontainer.Startable
    • stop

      public void stop()
      Specified by:
      stop in interface org.picocontainer.Startable
    • getDefaultPortal

      @Deprecated(forRemoval=true, since="1.5.0") public String getDefaultPortal()
      Deprecated, for removal: This API element is subject to removal in a future version.
      notion of 'default' portal doesn't exist anymore
      Returns:
      configured default portal
    • getMetaPortal

      public String getMetaPortal()
    • getUserHomePage

      public String getUserHomePage(String username)
      Parameters:
      username - user name
      Returns:
      User home page uri preference
    • saveUserHomePage

      public void saveUserHomePage(String username, String uri)
      Stores user default home page
      Parameters:
      username - user name
      uri - URI to consider as default page of user
    • getDefaultPortalTemplate

      public String getDefaultPortalTemplate()
      Returns the default portal template to be used when creating a site
      Returns:
      the default portal template name
    • getPortalTemplates

      public Set<String> getPortalTemplates()
    • getPortalConfigFromTemplate

      public org.exoplatform.portal.config.model.PortalConfig getPortalConfigFromTemplate(String templateName)
    • getConfig

      public <T> T getConfig(String portalType, String portalName, Class<T> objectType, String parentLocation)
    • getDefaultPortalSkinName

      @Deprecated(forRemoval=true, since="1.5.0") public String getDefaultPortalSkinName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      notion of 'default' portal doesn't exist anymore
      Get the skin name of the default portal
      Returns:
      Skin name of the default portal
    • getMetaPortalSkinName

      public String getMetaPortalSkinName()
      Get the skin name of the default portal
      Returns:
      Skin name of the default portal
    • getDefaultPortalConfig

      @Deprecated(forRemoval=true, since="1.5.0") public org.exoplatform.portal.config.model.PortalConfig getDefaultPortalConfig()
      Deprecated, for removal: This API element is subject to removal in a future version.
      the default portal has been deprecated in favor of a meta site that aggregate other sites into it and which shares the same Shared Layout and Portal layout with aggregated sites. The notion of default portal doesn't exist anymore, since the default displayed portal/page will be the first portal + navigation determined switch 'display-order' of portal (portal.xml) and 'node' order definition (navigation.xml)
      Get the PortalConfig object of the default portal
      Returns:
      PortalConfig object of the default portal
    • getMetaPortalConfig

      public org.exoplatform.portal.config.model.PortalConfig getMetaPortalConfig()
      Get the PortalConfig object of the default portal
      Returns:
      PortalConfig object of the default portal
    • setMetaPortalConfig

      public void setMetaPortalConfig(org.exoplatform.portal.config.model.PortalConfig metaPortalConfig)
      Set the PortalConfig object of the default portal
      Parameters:
      metaPortalConfig - PortalConfig object of the default portal
    • reloadConfig

      public void reloadConfig(String ownerType, String predefinedOwner, String location, String importMode, boolean overrideMode)