Package com.simplicite.util.tools
Class MustacheTool
- java.lang.Object
-
- com.simplicite.util.tools.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 resourcestatic java.lang.String
apply(Grant g, java.lang.String code, java.lang.Object data)
Apply Mustache template from a disposition HTML resourcestatic 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 resourcestatic 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 recordstatic java.lang.String
apply(PrintTemplate pt, java.lang.Object data)
Apply Mustache template from print templatestatic 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 recordsstatic java.lang.String
apply(java.lang.String template, java.lang.Object data)
Apply Mustache templatestatic org.json.JSONObject
getRecord(ObjectDB obj, boolean display)
Get JSON object with the values for current object recordstatic org.json.JSONObject
getRecord(ObjectDB obj, java.lang.String[] row, boolean display)
Get JSON object with the values for specified row recordstatic 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
-
-
-
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
- Objectdisplay
- 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
- Objectrow
- Rowdisplay
- 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
- Objectrows
- Rowsdisplay
- 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
- Grantcode
- Dispsition HTML resource codedata
- 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 objectcode
- 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 objectcode
- Object HTML resource coderows
- 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 objectcode
- object HTML resource codedata
- 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 objectcode
- HTML resource codedata
- 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 templaterows
- 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 templatedata
- 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 templatedata
- Data (JSON String or JSONObject)- Returns:
- Template execution result
-
-