Package de.xima.fc.mdl.form
Class FormPersist
- java.lang.Object
-
- de.xima.fc.mdl.form.FormPersist
-
- All Implemented Interfaces:
Serializable
public final class FormPersist extends Object implements Serializable
POJO model for storing the current form persist JSON, with a few utility methods.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FormPersist()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FormPersistempty()com.alibaba.fastjson.JSONObjectgetFormJson()Map<String,XItem>getXItems()Map<String,com.alibaba.fastjson.JSONObject>getXItemsJson()List<String>getXItemsOrder()booleanisEmpty()Iterable<XItem>orderedItems()Convenience method for retrieving the items in order.Iterable<com.alibaba.fastjson.JSONObject>orderedItemsJson()Convenience method for retrieving the items in order, as raw JSON.com.alibaba.fastjson.JSONObjectreconstructPersistJson()voidsetFormJson(com.alibaba.fastjson.JSONObject formJson)voidsetXItems(Map<String,XItem> xItems)voidsetXItemsJson(Map<String,com.alibaba.fastjson.JSONObject> xItemsJson)voidsetXItemsOrder(List<String> xItemsOrder)
-
-
-
Method Detail
-
getFormJson
public com.alibaba.fastjson.JSONObject getFormJson()
- Returns:
- The raw JSON data of the form persist other than the items.
-
getXItems
public Map<String,XItem> getXItems()
- Returns:
- All available parsed items. Key is the
AXItemPropertiesData.getId()of the item.
-
getXItemsJson
public Map<String,com.alibaba.fastjson.JSONObject> getXItemsJson()
- Returns:
- Raw JSON data of all available items. Key is the
AXItemPropertiesData.getId()of the item.
-
getXItemsOrder
public List<String> getXItemsOrder()
- Returns:
- The order of the
getXItems(). Each item in this list is a key (form element ID) into thegetXItems()map.
-
isEmpty
public boolean isEmpty()
- Returns:
truewhen this persist is empty, i.e. has got not form data and no items.
-
orderedItems
public Iterable<XItem> orderedItems()
Convenience method for retrieving the items in order.- Returns:
- An iterable over the
getXItems()in the order specified bygetXItemsOrder().
-
orderedItemsJson
public Iterable<com.alibaba.fastjson.JSONObject> orderedItemsJson()
Convenience method for retrieving the items in order, as raw JSON.- Returns:
- An iterable over the
getXItemsJson()in the order specified bygetXItemsOrder().
-
reconstructPersistJson
public com.alibaba.fastjson.JSONObject reconstructPersistJson()
- Returns:
- The original persist JSON with the form persist and the items together.
-
setFormJson
public void setFormJson(com.alibaba.fastjson.JSONObject formJson)
- Parameters:
formJson- The raw JSON data of the form persist other than the items.
-
setXItems
public void setXItems(Map<String,XItem> xItems)
- Parameters:
xItems- A map between the ID of each item and the parsed item data.
-
setXItemsJson
public void setXItemsJson(Map<String,com.alibaba.fastjson.JSONObject> xItemsJson)
- Parameters:
xItemsJson- Raw JSON data of all available items. Key is theAXItemPropertiesData.getId()of the item.
-
setXItemsOrder
public void setXItemsOrder(List<String> xItemsOrder)
- Parameters:
xItemsOrder- The order of thegetXItems(). Each item in this list is a key (form element ID) into thegetXItems()map.
-
empty
public static FormPersist empty()
- Returns:
- A new empty form persist model with the defaults.
-
-