Class PortletAbilitiesManager

java.lang.Object
com.jalios.jcms.portlet.PortletAbilitiesManager

public class PortletAbilitiesManager extends Object
  • Field Details

  • Method Details

    • getInstance

      public static PortletAbilitiesManager getInstance()
    • getAllAbilityMap

      public Map<String,Object> getAllAbilityMap()
      Returns a Map (key1/key2) of all available abilities declared.

      This method uses a cached Map of abilities.

      Return a map like this one :

        {
          "portlet.ability.virtualdesktop" : { 
            "service" : "PortletSkinable"
          },
          "portlet.ability.internal" : {
            "analytics" : "AbstractPortletAnalytics AbstractPortletAnalytics"
          },
          "portlet.ability.jcmsplugin" : {
             "foobar" : "Portlet"
             "collaborativespace.application" : "Portlet"
             "collaborativespace.dashboard" : "Portlet"
          } 
        }
        
      Returns:
      Map of abilities
    • getAllAbilityMapUI

      public Map<String,List<String>> getAllAbilityMapUI()
      Retrieve all abilities in map easy to use for User Interface listing of abilities.

      Help fix bug JCMS-2653 - Bad optgroup label in ability list.

      The map computed by getAllAbilityMap() matches a complex structure not suitable for presentation purpose.

      In order to properly and easily list abilities without losing backward compatibility, this method converts the map returned by getAllAbilityMap() into a simpler representation like this one :

       
        {
          "portlet.ability.virtualdesktop" : [ "service" ],
          "portlet.ability.internal" : [ "stat" ],
          "portlet.ability.jcmsplugin" : [ "foobar" ],
          "portlet.ability.jcmsplugin.collaborativespace" : [ "application", "dashboard" ]
        }
        
      The key match a "parent ability" suitable for use in a optgroup label.
      The values match the suffix to add to the key in order to get a full and valid ability.
      Returns:
      a Map
      Since:
      jcms-7.0.3 jcms-7.1
    • getAllAbilities

      public String[] getAllAbilities()
      Returns an Array of all available abilities declared for the given class. This methode use cached abilities.
      Returns:
      String[] an array of abilities
    • getAllAbilities

      public String[] getAllAbilities(Class clazz)
      Returns an Array of all available abilities declared for the given class
      Parameters:
      clazz - the class used to filter abilities
      Returns:
      String[] an array of abilities
    • getAbilityLabel

      public String getAbilityLabel(String userLang, String ability)
      Returns the label of a given ability
      Parameters:
      userLang - the user language
      ability - the ability
      Returns:
      String the I18N ability