Class ProjectXsltHelper

java.lang.Object
org.ametys.plugins.workspaces.project.helper.ProjectXsltHelper
All Implemented Interfaces:
Contextualizable, LogEnabled, Serviceable

Helper component to be used from XSL stylesheets to get info related to projects.
  • Constructor Details

  • Method Details

    • contextualize

      public void contextualize(Context context) throws ContextException
      Specified by:
      contextualize in interface Contextualizable
      Throws:
      ContextException
    • enableLogging

      public void enableLogging(Logger logger)
      Specified by:
      enableLogging in interface LogEnabled
    • service

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

      public static String project()
      Returns the current project
      Returns:
      the current project
    • projectInfo

      public static MapElement projectInfo()
      Returns the information of current project
      Returns:
      the information of current project
    • projectInfo

      public static MapElement projectInfo(String projectName)
      Returns the project information
      Parameters:
      projectName - The project name
      Returns:
      the project information
    • projectTitle

      public static String projectTitle()
      Returns the title of the current project
      Returns:
      the title of the current project
    • projectTitle

      public static String projectTitle(String projectName)
      Returns the title of the given project
      Parameters:
      projectName - The project to consider
      Returns:
      the title of the given project or empty otherwise
    • projectDescription

      public static String projectDescription()
      Returns the description of the current project
      Returns:
      the description of the current project
    • projectDescription

      public static String projectDescription(String projectName)
      Returns the description of the given project
      Parameters:
      projectName - The project to consider
      Returns:
      the description of the given project or empty otherwise
    • projectKeywords

      public static NodeList projectKeywords()
      Returns the keywords of the current project
      Returns:
      keywords of the current project
    • projectKeywords

      public static NodeList projectKeywords(String projectName)
      Returns the project keywords
      Parameters:
      projectName - the project name
      Returns:
      the project keywords
    • projectCreationDate

      public static String projectCreationDate()
      Returns the creation date of the current project
      Returns:
      the creation date of the current project at the ISO format or empty otherwise
    • projectCreationDate

      public static String projectCreationDate(String projectName)
      Returns the creation date of the given project
      Parameters:
      projectName - The project to consider
      Returns:
      the creation date of the given project at the ISO format or empty otherwise
    • projectCategoryColor

      Return the color associated to the first category associated to the current project
      Returns:
      the hexa code color or the default color if no color is associated to the first category or if not category is associated. <color> <main>#FFFFFF</main> <text>#000000</text> </color>
    • projectCategoryColor

      public static MapElement projectCategoryColor(String projectName)
      Return the color associated to the first category associated to the given project
      Parameters:
      projectName - The project to consider
      Returns:
      the hexa code color or the default color if no color is associated to the first category or if not category is associated <color> <main>#FFFFFF</main> <text>#000000</text> </color>
    • categoryColor

      public static MapElement categoryColor(String categoryId)
      Return the color associated to the category
      Parameters:
      categoryId - category id
      Returns:
      the hexa code color or the default color if no color is associated to the category or if null <color> <main>#FFFFFF</main> <text>#000000</text> </color>
    • categoryColor

      public static MapElement categoryColor(Category category)
      Return the color associated to the category
      Parameters:
      category - category
      Returns:
      the hexa code color or the default color if no color is associated to the category or if null <color> <main>#FFFFFF</main> <text>#000000</text> </color>
    • projectCategoryLabel

      public static String projectCategoryLabel()
      Return the color associated to the first category associated to the current project
      Returns:
      the hexa code color or the default color if no color is associated to the first category or if not category is associated
    • projectCategoryLabel

      public static String projectCategoryLabel(String projectName)
      Return the color associated to the first category associated to the given project
      Parameters:
      projectName - The project to consider
      Returns:
      the label or empty if no category
    • projectLastActivityDate

      Get the date of last activity for current project
      Returns:
      the formatted date of last activity or creation date if there is no activity yet
    • projectLastActivityDate

      public static String projectLastActivityDate(String projectName)
      Get the date of last activity for a given project
      Parameters:
      projectName - the project's name
      Returns:
      the formatted date of last activity or creation date if there is no activity yet
    • isResourceFromWorkspace

      public static boolean isResourceFromWorkspace(String resourceId)
      True if the resource comes from workspaces
      Parameters:
      resourceId - the resource id
      Returns:
      true if the resource comes from workspaces
    • resourceSite

      public static Node resourceSite(String projectResourceId)
      Get the site of a project's resource
      Parameters:
      projectResourceId - The resource id
      Returns:
      The site <site id="site://xxx" name="siteName"><title>Site's titleX</title><url>http://...</url>/site>
    • getNewsRootPageId

      public static String getNewsRootPageId()
      Get the id of news root's page
      Returns:
      the id of news root's page or null if not exists
    • getAlertsRootPageId

      public static String getAlertsRootPageId()
      Get the id of alerts root's page
      Returns:
      the id of alerts root's page or null if not exists
    • getModulePage

      public static String getModulePage(String moduleId)
      Get the module page. Be careful, the read access is not check !
      Parameters:
      moduleId - the module id
      Returns:
      the module page
    • getLanguageLabel

      public static String getLanguageLabel(String code, String language)
      Get the translated label associated to the code
      Parameters:
      code - The language code
      language - The language in which translate the label
      Returns:
      The label associated to the code
    • computeDefaultLanguage

      public static String computeDefaultLanguage(String language)
      Get the language that will be the default value of the available values. First choice will be the page language, 'en' otherwise, first available language otherwise.
      Parameters:
      language - The current page language
      Returns:
      A language code
    • isManager

      public static boolean isManager()
      Determines if the current user is a manager of current project
      Returns:
      true if the current user is manager
    • isManager

      public static boolean isManager(String login, String populationId)
      Determines if a user is a manager
      Parameters:
      login - the user's login
      populationId - the user's population
      Returns:
      true if the user is manager
    • isManager

      public static boolean isManager(String projectName)
      Determines if the current user is a manager for the project
      Parameters:
      projectName - the project's name
      Returns:
      true if the current user is manager
    • isManager

      public static boolean isManager(String projectName, String login, String populationId)
      Determines if the given user is a manager for the project
      Parameters:
      projectName - the project's name
      login - the user's login
      populationId - the user's population
      Returns:
      true if the user is manager
    • hasRightOnModule

      public static boolean hasRightOnModule(String rightId, String moduleId)
      Returns true if the current user has the specified right on the specified workspace module
      Parameters:
      rightId - Right Id
      moduleId - Module Id
      Returns:
      true if the current user has the specified right on the specified module
    • canAccessBO

      public static boolean canAccessBO()
      Returns true if current user can access to the back-office
      Returns:
      true if current user can access to the back-office