Class MustacheTool


  • public class MustacheTool
    extends java.lang.Object
    Mustache templating toolbox
    This class only provides static variables and methods
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String apply​(ExternalObject ext, java.lang.String code, java.lang.Object data)
      Apply Mustache template from external object HTML resource
      static java.lang.String apply​(Grant g, java.lang.String code, java.lang.Object data)
      Apply Mustache template from a disposition HTML resource
      static java.lang.String apply​(ObjectDB obj, java.lang.String code)
      Apply Mustache template from an object HTML resource with current records.
      static java.lang.String apply​(ObjectDB obj, java.lang.String code, java.lang.Object data)
      Apply Mustache template from an object HTML object resource
      static java.lang.String apply​(ObjectDB obj, java.lang.String code, java.util.List<java.lang.String[]> rows)
      Apply Mustache template from an object HTML resource with a list of records.
      static java.lang.String apply​(PrintTemplate pt)
      Apply Mustache template from an object print template with current record
      static java.lang.String apply​(PrintTemplate pt, java.lang.Object data)
      Apply Mustache template from print template
      static java.lang.String apply​(PrintTemplate pt, java.util.List<java.lang.String[]> rows)
      Apply Mustache template from an object print template with a list of records
      static java.lang.String apply​(java.lang.String template, java.lang.Object data)
      Apply Mustache template
      static org.json.JSONObject getRecord​(ObjectDB obj, boolean display)
      Get JSON object with the values for current object record
      static org.json.JSONObject getRecord​(ObjectDB obj, java.lang.String[] row, boolean display)
      Get JSON object with the values for specified row record
      static org.json.JSONArray getRecords​(ObjectDB obj, java.util.List<java.lang.String[]> rows, boolean display)
      Get an array of JSON objects with the values for the specified row records
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getRecord

        public static org.json.JSONObject getRecord​(ObjectDB obj,
                                                    boolean display)
        Get JSON object with the values for current object record
        Parameters:
        obj - Object
        display - Displayable values?
        Returns:
        JSON object
      • getRecord

        public static org.json.JSONObject getRecord​(ObjectDB obj,
                                                    java.lang.String[] row,
                                                    boolean display)
        Get JSON object with the values for specified row record
        Parameters:
        obj - Object
        row - Row
        display - Displayable values?
        Returns:
        JSON object
      • getRecords

        public static org.json.JSONArray getRecords​(ObjectDB obj,
                                                    java.util.List<java.lang.String[]> rows,
                                                    boolean display)
        Get an array of JSON objects with the values for the specified row records
        Parameters:
        obj - Object
        rows - Rows
        display - Displayable values?
        Returns:
        JSON object
      • apply

        public static java.lang.String apply​(Grant g,
                                             java.lang.String code,
                                             java.lang.Object data)
        Apply Mustache template from a disposition HTML resource
        Parameters:
        g - Grant
        code - Dispsition HTML resource code
        data - Data (JSON String or JSONObject)
        Returns:
        Template execution result
      • apply

        public static java.lang.String apply​(ObjectDB obj,
                                             java.lang.String code)
        Apply Mustache template from an object HTML resource with current records. Passed data is the plain JSON representation of the record: { "name": value, ...})
        Parameters:
        obj - Business object
        code - Object HTML resource code
        Returns:
        Template execution result
      • apply

        public static java.lang.String apply​(ObjectDB obj,
                                             java.lang.String code,
                                             java.util.List<java.lang.String[]> rows)
        Apply Mustache template from an object HTML resource with a list of records. Passed data is an object with a list of plain JSON representations: { "list": [ { "name": value, ... }, { "name": value, ... } ] }
        Parameters:
        obj - Business object
        code - Object HTML resource code
        rows - Rows
        Returns:
        Template execution result
      • apply

        public static java.lang.String apply​(ObjectDB obj,
                                             java.lang.String code,
                                             java.lang.Object data)
        Apply Mustache template from an object HTML object resource
        Parameters:
        obj - Business object
        code - object HTML resource code
        data - Data (JSON String or JSONObject, if null a JSON representation of the object's current record is used)
        Returns:
        Template execution result
      • apply

        public static java.lang.String apply​(ExternalObject ext,
                                             java.lang.String code,
                                             java.lang.Object data)
        Apply Mustache template from external object HTML resource
        Parameters:
        ext - External object
        code - HTML resource code
        data - Data (JSON String or JSONObject)
        Returns:
        Template execution result
      • apply

        public static java.lang.String apply​(PrintTemplate pt)
        Apply Mustache template from an object print template with current record
        Parameters:
        pt - Publication template
        Returns:
        Template execution result
      • apply

        public static java.lang.String apply​(PrintTemplate pt,
                                             java.util.List<java.lang.String[]> rows)
        Apply Mustache template from an object print template with a list of records
        Parameters:
        pt - Publication template
        rows - Rows
        Returns:
        Template execution result
      • apply

        public static java.lang.String apply​(PrintTemplate pt,
                                             java.lang.Object data)
        Apply Mustache template from print template
        Parameters:
        pt - Publication template
        data - Data (JSON String or JSONObject, if null a JSON representation of the object's current record is used)
        Returns:
        Template execution result
      • apply

        public static java.lang.String apply​(java.lang.String template,
                                             java.lang.Object data)
        Apply Mustache template
        Parameters:
        template - Mustache template
        data - Data (JSON String or JSONObject)
        Returns:
        Template execution result