Class PortalFunctionMapper

    • Constructor Detail

      • PortalFunctionMapper

        public PortalFunctionMapper()
    • Method Detail

      • localize

        public static String localize​(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 String localize​(IResource baseResource,
                                         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 String localize​(IResource baseResource,
                                         PageWebResource pwr,
                                         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 String processLocalizationParameters​(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
      • 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 String escapeJs​(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 String escapeXml​(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 String concat​(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 String encodeURL​(String[] args)
                                throws 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:
        UnsupportedEncodingException
        Since:
        9.0.0