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 FormPersist
empty()
com.alibaba.fastjson.JSONObject
getFormJson()
Map<String,XItem>
getXItems()
Map<String,com.alibaba.fastjson.JSONObject>
getXItemsJson()
List<String>
getXItemsOrder()
boolean
isEmpty()
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.JSONObject
reconstructPersistJson()
void
setFormJson(com.alibaba.fastjson.JSONObject formJson)
void
setXItems(Map<String,XItem> xItems)
void
setXItemsJson(Map<String,com.alibaba.fastjson.JSONObject> xItemsJson)
void
setXItemsOrder(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:
true
when 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.
-
-