You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Description

  • org.joget.apps.datalist.service.JsonUtil
  • Under wflow-core module
  • Utility class containing methods to create datalist from JSON
  • This Utility class should not use directly. Please use DataListService instead.

Code Sample

import org.joget.apps.app.dao.DatalistDefinitionDao;
import org.joget.apps.app.model.AppDefinition;
import org.joget.apps.app.model.DatalistDefinition;
import org.joget.apps.app.service.AppUtil;
import org.joget.apps.datalist.model.DataList;

AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService");
DatalistDefinitionDao datalistDefinitionDao = (DatalistDefinitionDao) AppUtil.getApplicationContext().getBean("datalistDefinitionDao");
 
String id = "crm_account";
String appId = "crm";
Long appVersion = appService.getPublishedVersion(appId);
 
AppDefinition appDef = appService.getAppDefinition(appId, appVersion.toString());
DatalistDefinition datalistDefinition = datalistDefinitionDao.loadById(id, appDef);
 
DataList dataList = JsonUtil.fromJson(datalistDefinition.getJson(), DataList.class);

Fields

PROPERTY_ACTION
public static final java.lang.String PROPERTY_ACTION = "action";

Key to retrieve the action value from JSON Object properties

PROPERTY_ACTIONS
public static final java.lang.String PROPERTY_ACTIONS = "actions";

Key to retrieve the actions from JSON Object properties

PROPERTY_BINDER
public static final java.lang.String PROPERTY_BINDER = "binder";

Key to retrieve the binder from JSON Object properties

PROPERTY_CLASS_NAME
public static final java.lang.String PROPERTY_CLASS_NAME = "className";

Key to retrieve the class name value from JSON Object properties

PROPERTY_COLUMNS
public static final java.lang.String PROPERTY_COLUMNS = "columns";

Key to retrieve the columns from JSON Object properties

PROPERTY_DESC
public static final java.lang.String PROPERTY_DESC = "description";

Key to retrieve the description value from JSON Object properties

PROPERTY_FILTER_TYPE
public static final java.lang.String PROPERTY_FILTER_TYPE = "type";

Key to retrieve the type value from JSON Object properties

PROPERTY_FILTERS
public static final java.lang.String PROPERTY_FILTERS = "filters";

Key to retrieve the filter value from JSON Object properties

PROPERTY_FORMAT
public static final java.lang.String PROPERTY_FORMAT = "format";

Key to retrieve the format value from JSON Object properties

PROPERTY_HIDDEN
public static final java.lang.String PROPERTY_HIDDEN = "hidden";

Key to retrieve the hidden value from JSON Object properties

PROPERTY_HIDE_PAGE_SIZE
public static final java.lang.String PROPERTY_HIDE_PAGE_SIZE = "hidePageSize";

Key to retrieve the Id value from JSON Object properties

PROPERTY_ID
public static final java.lang.String PROPERTY_ID = "id";

Key to retrieve the Id value from JSON Object properties

PROPERTY_LABEL
public static final java.lang.String PROPERTY_LABEL = "label";

Key to retrieve the label value from JSON Object properties

PROPERTY_NAME
public static final java.lang.String PROPERTY_NAME = "name";

Key to retrieve the name value from JSON Object properties

PROPERTY_OPERATOR
public static final java.lang.String PROPERTY_OPERATOR = "operator";

Key to retrieve the operator value from JSON Object properties

PROPERTY_ORDER
public static final java.lang.String PROPERTY_ORDER = "order";

Key to retrieve the order value from JSON Object properties

PROPERTY_ORDER_BY
public static final java.lang.String PROPERTY_ORDER_BY = "orderBy";

Key to retrieve the order by value from JSON Object properties

PROPERTY_PAGE_SIZE
public static final java.lang.String PROPERTY_PAGE_SIZE = "pageSize";

Key to retrieve the page size value from JSON Object properties

PROPERTY_PROPERTIES
public static final java.lang.String PROPERTY_PROPERTIES = "properties";

Key to retrieve the properties values from JSON Object properties

PROPERTY_RENDER_HTML
public static final java.lang.String PROPERTY_RENDER_HTML = "renderHtml";

Key to retrieve the render html value from JSON Object properties

PROPERTY_ROW_ACTIONS
public static final java.lang.String PROPERTY_ROW_ACTIONS = "rowActions";

Key to retrieve the row actions from JSON Object properties

PROPERTY_SORTABLE
public static final java.lang.String PROPERTY_SORTABLE = "sortable";

Key to retrieve the sortable value from JSON Object properties

PROPERTY_STYLE
public static final java.lang.String PROPERTY_STYLE = "style";

Key to retrieve the style value from JSON Object properties

PROPERTY_WIDTH
public static final java.lang.String PROPERTY_WIDTH = "width";

Key to retrieve the width value from JSON Object properties

Methods

fromJson
public static <T extends java.lang.Object> T fromJson(java.lang.String json, java.lang.Class<T> classOfT)

Converts from JSON string into an object. Specifically to support data list model classes.

generateDefaultList
public static java.lang.String generateDefaultList(java.lang.String listId, org.joget.apps.app.model.DatalistDefinition datalistDef)

Used to generate a datalist definition JSON

generateDefaultList
public static java.lang.String generateDefaultList(java.lang.String listId, org.joget.apps.app.model.DatalistDefinition datalistDef, org.joget.apps.app.model.DatalistDefinition copyDatalistDef)

Used to generate a datalist definition JSON based on another datalist definition

parseActionFromJsonObject
public static org.joget.apps.datalist.model.DataListAction parseActionFromJsonObject(org.json.JSONObject obj) throws org.json.JSONException, java.lang.InstantiationException, java.lang.IllegalAccessException

Used to retrieves datalist action from JSON Object 

parseActionsFromJsonObject
public static java.util.Collection<org.joget.apps.datalist.model.DataListAction> parseActionsFromJsonObject(org.json.JSONObject obj) throws org.json.JSONException, java.lang.InstantiationException, java.lang.IllegalAccessException

Used to retrieves datalist actions from JSON Object

parseBinderFromJsonObject
public static org.joget.apps.datalist.model.DataListBinder parseBinderFromJsonObject(org.json.JSONObject obj) throws org.json.JSONException, java.lang.InstantiationException, java.lang.IllegalAccessException

Used to retrieves datalist binder from JSON Object

parseColumnsFromJsonObject
public static java.util.Collection<org.joget.apps.datalist.model.DataListColumn> parseColumnsFromJsonObject(org.json.JSONObject obj) throws org.json.JSONException, java.lang.InstantiationException, java.lang.IllegalAccessException

Used to retrieves datalist column from JSON Object

parseElementFromJson
public static java.lang.Object parseElementFromJson(java.lang.String json)

Converts from JSON java.lang.String into an object. Specifically to support data list model classes.

parseElementFromJsonObject
public static java.lang.Object parseElementFromJsonObject(org.json.JSONObject obj) throws java.lang.Exception

Used to creates Datalist object from JSON Object

parseFiltersFromJsonObject
public static java.util.Collection<org.joget.apps.datalist.model.DataListFilter> parseFiltersFromJsonObject(org.json.JSONObject obj) throws org.json.JSONException, java.lang.InstantiationException, java.lang.IllegalAccessException

Used to retrieves datalist filters from JSON Object

parseFilterTypeFromJsonObject
public static org.joget.apps.datalist.model.DataListFilterType parseFilterTypeFromJsonObject(org.json.JSONObject obj) throws org.json.JSONException, java.lang.InstantiationException, java.lang.IllegalAccessException

Used to retrieves datalist filter type from JSON Object

parseFormatterFromJsonObject
public static org.joget.apps.datalist.model.DataListColumnFormat parseFormatterFromJsonObject(org.json.JSONObject obj) throws org.json.JSONException, java.lang.InstantiationException, java.lang.IllegalAccessException

Used to retrieves datalist formatter from JSON Object

parseRowActionsFromJsonObject
public static java.util.Collection<org.joget.apps.datalist.model.DataListAction> parseRowActionsFromJsonObject(org.json.JSONObject obj) throws org.json.JSONException, java.lang.InstantiationException, java.lang.IllegalAccessException

Used to retrieves datalist row actions from JSON Object

  • No labels