Class TemplateUtil


  • public class TemplateUtil
    extends Object
    • Constructor Detail

      • TemplateUtil

        public TemplateUtil()
    • Method Detail

      • getSystemInput

        public static String getSystemInput​(String inputName,
                                            org.pentaho.platform.api.engine.IRuntimeContext context)
      • applyTemplate

        public static String applyTemplate​(String template,
                                           org.pentaho.platform.api.engine.IRuntimeContext context,
                                           org.pentaho.platform.api.engine.IParameterResolver resolver)
      • applyTemplate

        public static String applyTemplate​(String template,
                                           org.pentaho.platform.api.engine.IRuntimeContext context)
      • applyTemplate

        public static String applyTemplate​(String template,
                                           org.pentaho.platform.api.engine.IRuntimeContext context,
                                           String parameterPatternStr)
      • applyTemplate

        public static String applyTemplate​(String template,
                                           Properties inputs,
                                           org.pentaho.platform.api.engine.IParameterResolver resolver)
      • applyTemplate

        public static String applyTemplate​(String template,
                                           Properties inputs,
                                           Pattern parameterPattern,
                                           org.pentaho.platform.api.engine.IParameterResolver resolver)
        Processes a template by processing the parameters declared in the template. The parameters to be replaced are enclosed in curly brackets. Parameters can be the input values (as specified by the name of the input value) or date expressions. Parameters that can not be processed are left in the template.
        Parameters:
        template - the template specification.
        input - the input values communicated as a Properties.
        locale - the locale to use for the formatting of date expression. If null, the locale for the thread is used. If no locale for the thread, then the default locale is used.
        Throws:
        IllegalArgumentException - if a date expression is illegal
        See Also:
        DateMath.calculateDateString(Calendar, String), PentahoSystem#getLocale(), PentahoSystem#getDefaultLocale()
      • matchDateRegex

        public static String matchDateRegex​(String parameter)
        Uses regex matching to see if the input parameter appears to be a date expression
        Parameters:
        parameter -
        Returns:
        the value of the calculated date
      • matchDateRegex

        public static String matchDateRegex​(String parameter,
                                            Properties inputs)
        Uses regex matching to see if the input parameter appears to be a date expression
        Parameters:
        parameter -
        Returns:
        the value of the calculated date
      • parametersToProperties

        public static Properties parametersToProperties​(org.pentaho.platform.api.engine.IParameterProvider parameterProvider)