Class PortalFunctionMapper

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterEvaluation()
      Performs any needed operations after the evaluation happens.
      void beforeEvaluation()
      Performs any initialization needed before the evaluation is performed.
      static java.lang.String concat​(java.lang.Object[] objects)
      Concatenates the strings.
      static java.lang.String encodeURL​(java.lang.String[] args)
      Encodes the given string to be used in URLs.
      static java.lang.String escapeJs​(java.lang.String stringToEscape)
      Escape a string to be used in JavaScript.
      static java.lang.String escapeXml​(java.lang.String stringToEscape)
      Escape a string to be used in XML
      static java.lang.String localize​(java.lang.String[] args)
      Resolves the string.
      protected static java.lang.String localize​(IResource baseResource, java.lang.String[] args)
      Resolves the string.
      protected static java.lang.String localize​(IResource baseResource, PageWebResource pwr, java.lang.String[] args)
      Resolves the string.
      protected static java.lang.String processLocalizationParameters​(java.lang.String[] args)
      Adds all parameters to the localization string
      java.lang.reflect.Method resolveFunction​(java.lang.String prefix, java.lang.String methodName)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PortalFunctionMapper

        public PortalFunctionMapper()
    • Method Detail

      • localize

        public static java.lang.String localize​(java.lang.String[] args)
                                         throws PortalException
        Resolves the string.
        Parameters:
        args - the localize function parameters.
        1. First argument is the identifier of the string to be localized.
        2. Second argument is optional, and is a list of resource paths separated by ';' to be included in the localization.
        3+. Any extra argument will be considered a localization parameter.
        Returns:
        localized string.
        Throws:
        PortalException - if an error occur localizing the string.
        Since:
        5.6.0
      • localize

        protected static java.lang.String localize​(IResource baseResource,
                                                   java.lang.String[] args)
                                            throws PortalException
        Resolves the string.
        Parameters:
        baseResource - The IResource to use
        args - the localize function parameters.
        1. First argument is the identifier of the string to be localized.
        2. Second argument is optional, and is a list of resource paths separated by ';' to be included in the localization.
        3+. Any extra argument will be considered a localization parameter.
        Returns:
        localized string.
        Throws:
        PortalException - if an error occur localizing the string.
        Since:
        9.0.0
      • localize

        protected static java.lang.String localize​(IResource baseResource,
                                                   PageWebResource pwr,
                                                   java.lang.String[] args)
                                            throws PortalException
        Resolves the string.
        Parameters:
        baseResource - The IResource to use
        args - the localize function parameters.
        1. First argument is the identifier of the string to be localized.
        2. Second argument is the web resource to be considered for localization (theme localization requires this).
        3. Third argument is optional, and is a list of resource paths separated by ';' to be included in the localization.
        4+. Any extra argument will be considered a localization parameter.
        Returns:
        localized string.
        Throws:
        PortalException - if an error occur localizing the string.
        Since:
        11.0.0
      • processLocalizationParameters

        protected static java.lang.String processLocalizationParameters​(java.lang.String[] args)
        Adds all parameters to the localization string
        Parameters:
        args - the array with the localization string, resource and parameters
        Returns:
        the localization string with all parameters, ready to be sent to the ILocalizationManager.localize(String, IResource)
        Since:
        9.0.0
      • resolveFunction

        public java.lang.reflect.Method resolveFunction​(java.lang.String prefix,
                                                        java.lang.String methodName)
        Specified by:
        resolveFunction in interface FunctionMapper
      • beforeEvaluation

        public void beforeEvaluation()
        Performs any initialization needed before the evaluation is performed.
        Since:
        7.0.0
      • afterEvaluation

        public void afterEvaluation()
        Performs any needed operations after the evaluation happens. It should be called in finally.
        Since:
        7.0.0
      • escapeJs

        public static java.lang.String escapeJs​(java.lang.String stringToEscape)
        Escape a string to be used in JavaScript.
        Parameters:
        stringToEscape - The string to escape.
        Returns:
        The escaped string
        Since:
        8.1.0
      • escapeXml

        public static java.lang.String escapeXml​(java.lang.String stringToEscape)
        Escape a string to be used in XML
        Parameters:
        stringToEscape - The string to escape.
        Returns:
        The escaped string
        Since:
        8.1.0
      • concat

        public static java.lang.String concat​(java.lang.Object[] objects)
                                       throws PortalException
        Concatenates the strings.
        Parameters:
        objects - the objects to get the string value and concatenate, in order.
        Returns:
        The strings concatenated.
        Throws:
        PortalException
        Since:
        8.2.0
      • encodeURL

        public static java.lang.String encodeURL​(java.lang.String[] args)
                                          throws java.io.UnsupportedEncodingException
        Encodes the given string to be used in URLs. The String to be encoded is the first position of args. The parameter args must have one or two positions. If it has one position, then UTF-8 will be used as the charset when encoding. If it has two positions, then the string in the second position will be used as charset when encoding.
        Parameters:
        args - the arguments.
        Returns:
        the encoded String
        Throws:
        java.io.UnsupportedEncodingException
        Since:
        9.0.0