public class CasePlanModelData extends Object
A class to represent the state of a case (the state of the case’s casePlanModel
). This class is serialized/deserialized to/from JSON
in order to persist the state of a case.
Modifier and Type | Field and Description |
---|---|
static int |
CURRENT_VERSION
<p>The latest, currently supported version of the data.
|
Constructor and Description |
---|
CasePlanModelData() |
Modifier and Type | Method and Description |
---|---|
void |
addCaseFileItemState(String id,
CaseFileItemData caseFileItemData)
Put a
caseFileItemData into the internal caseFileItemStates map by the provided ID. |
void |
addPlanItemState(String id,
PlanItemData planItemData)
Put a
planItemData into the internal planItemStates map by the provided ID. |
boolean |
containsPlanItemData(String id)
Check if a
PlanItemData object key (Id) exists. |
static CasePlanModelData |
createFromJson(String json)
De-serialize a JSON string into an object of this class.
|
Map<String,CaseFileItemData> |
getCaseFileItemStates() |
HashMap<String,String> |
getClientProperties() |
Integer |
getDataVersion() |
String |
getParentClientId() |
PlanItemData |
getPlanItemData(String id)
Get a
PlanItemData object by key (Id). |
Map<String,PlanItemData> |
getPlanItemStates() |
static Map<String,List<PlanItemData>> |
getPlanItemStatesByPlanItemId(List<PlanItemData> stageChildren)
Organize (group) a list of stage children by their respective plan Item Ids.
|
List<PlanItemData> |
getStageChildren(String stageInstanceId)
<p>Get a stage’s immediate children.
|
void |
setClientProperties(HashMap<String,String> clientProperties) |
void |
setDataVersion(Integer dataVersion) |
void |
setParentClientId(String parentClientId) |
static String |
writeToJson(CasePlanModelData casePlanModelData)
Serialize an instance of this class to a JSON string.
|
public static final int CURRENT_VERSION
<p>The latest, currently supported version of the data. Used during de-serialization of a JSON string to an object of this class.</p>
<p>Increment this version if there is a breaking change in the JSON representation of this class/object. Note, supporting new fields in this class or nested types is not a breaking change provided the added property is nullable and the implementation handles null values for the property gracefully.</p>
<ul> <li>Changes of field dataVersion up to version 6: various changes to member fields (pre-production releases).</li> <li>Change from version 6 to 7: changed instanceId delimiter from '' to '~'. </li> <li>Change from version 7 to 8: removed required property. The required property is now evaluated on demand.</li> <li>Change from version 8 to 9: renamed parentCaseId in CasePlanModelData to parentClientId</li> </ul>
public void addPlanItemState(String id, PlanItemData planItemData)
Put a planItemData
into the internal planItemStates
map by the provided ID.
id
- the idplanItemData
- the plan item datapublic void addCaseFileItemState(String id, CaseFileItemData caseFileItemData)
Put a caseFileItemData
into the internal caseFileItemStates
map by the provided ID.
id
- the idcaseFileItemData
- the case item datapublic List<PlanItemData> getStageChildren(String stageInstanceId)
<p>Get a stage’s immediate children.</p>
<p>Consider re-write if we run into a mode of operation where we’re dealing with cases that have a lot of stages. The whole stage children initialization could be done with one loop over the plan item states. The current implementation runs the same loop once per stage.</p>
stageInstanceId
- the stage instance idpublic static Map<String,List<PlanItemData>> getPlanItemStatesByPlanItemId(List<PlanItemData> stageChildren)
Organize (group) a list of stage children by their respective plan Item Ids.
stageChildren
- the stage children (plan item data objects) to work on.public Integer getDataVersion()
public void setDataVersion(Integer dataVersion)
dataVersion
- the dataVersionpublic String getParentClientId()
public void setParentClientId(String parentClientId)
parentClientId
- the parent case idpublic PlanItemData getPlanItemData(String id)
Get a PlanItemData
object by key (Id).
id
- the idpublic boolean containsPlanItemData(String id)
Check if a PlanItemData
object key (Id) exists.
id
- the idpublic Map<String,PlanItemData> getPlanItemStates()
public Map<String,CaseFileItemData> getCaseFileItemStates()
public static CasePlanModelData createFromJson(String json) throws IOException
De-serialize a JSON string into an object of this class.
json
- the JSON stringIOException
- if the passed JSON string could not be de-serialized.public static String writeToJson(CasePlanModelData casePlanModelData) throws IOException
Serialize an instance of this class to a JSON string.
casePlanModelData
- the case plan model dataIOException
- if the passed casePlanModelData
could not be serialized to a JSON string.Copyright © 2010 - 2019 edorasware ag. All Rights Reserved.