Class WidgetPageMethods


  • public final class WidgetPageMethods
    extends Object
    A utility class containing for widget and page-related operations, containing one-liners for parsing widgets and pages.
    • Constructor Detail

      • WidgetPageMethods

        @Autowired
        WidgetPageMethods​(io.toro.cde.core.processor.CompilerManager compilerManager,
                          io.toro.cde.core.widget.WidgetService widgetService,
                          io.toro.cde.core.page.PageService pageService)
    • Method Detail

      • widget

        public static String widget​(String widgetName)
                             throws Exception

        Parse a widget.

        Example usage:

         println 'exampleWidget'.widget()
         

        Parameters:
        widgetName - the widget name
        Returns:
        parsed string from the widget
        Throws:
        Exception
        Since:
        1.0
      • widget

        public static String widget​(String widgetName,
                                    Map params)
                             throws Exception

        Parse a widget.

        Example usage:

         println 'exampleWidget'.widget( [ : ] )
         

        Parameters:
        widgetName - the widget name
        params - widget map parameters
        Returns:
        parsed string from the widget
        Throws:
        Exception
        Since:
        1.0
      • page

        public static String page​(String uri)
                           throws Exception

        Parse a page.

        Example usage:

         def pageData = '/page1'.page( )
         'smtp://esb.user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send([to: 'friend@gmail.com'],
                                                                                            pageData);
         

        Parameters:
        uri - URI of the page
        Returns:
        parsed content of the page
        Throws:
        Exception
        Since:
        1.0
      • page

        public static String page​(String uri,
                                  Map context)
                           throws Exception

        Parse a page.

        Example usage:

         def params = ['example' : 'exampleValue', 'example2' : 'exampleValue2' ]
         def pageData = '/page1'.page( params )
         'smtp://esb.user%40gmail.com:password@smtp.gmail.com:587/here%is%your%report'.send([to: 'friend@gmail.com'],
                                                                                            pageData);
         

        Parameters:
        uri - URI of the page
        context - a map containing the variables you want to pass to the page for parsing against
        Returns:
        parsed content of the page
        Throws:
        Exception
        Since:
        1.0