Package de.xima.fc.workflow.converter
Class WorkflowPersistHelper
- java.lang.Object
 - 
- de.xima.fc.workflow.converter.WorkflowPersistHelper
 
 
- 
public final class WorkflowPersistHelper extends Object
Helper methods for serializing / deserializing a workflow version.- Since:
 - 7.0.0
 - Author:
 - XIMA MEDIA GmbH
 
 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcreateCustomBackupDataJson(List<WorkflowStateModel> states)static FlowchartSnapshotcreateFlowchartSnapshot(Mandant client, Locale locale, WorkflowVersion workflowVersion)Creates a flowchart snapshot that represents the given workflow version.static FlowchartSnapshotcreateFlowchartSnapshot(ProcessModel processModel, Map<ElementKey,com.alibaba.fastjson.JSONObject> customParamsMap, List<WorkflowStateModel> stateList)Creates a flowchart snapshot that represents the given process and state list.static voidcreateNewBackup(IEntityContext ec, Mandant client, Locale locale, WorkflowVersion workflowVersion)Creates and persist a new backup for the given workflow version.static FlowchartSnapshotloadSnapshotForBackup(IEntityContext ec, WorkflowVersionBackup backup)static FlowchartSnapshotloadSnapshotForPersisted(Mandant client, Locale locale, long workflowVersionId)Loads the given workflow version from the database and creates a snapshot for that version. 
 - 
 
- 
- 
Method Detail
- 
createCustomBackupDataJson
public static String createCustomBackupDataJson(List<WorkflowStateModel> states) throws FastJsonException
- Parameters:
 states- Workflow states for the custom backup data.- Returns:
 - The custom data for the 
FlowchartBase.getBackupCustomDataProvider() - Throws:
 FastJsonException- When the data could not be serialized into JSON.
 
- 
createFlowchartSnapshot
public static FlowchartSnapshot createFlowchartSnapshot(Mandant client, Locale locale, WorkflowVersion workflowVersion) throws FastJsonException
Creates a flowchart snapshot that represents the given workflow version. This snapshot can be used to load the workflow state later on.- Parameters:
 client- Current client of the version being edited.locale- Current locale of the logged in user.workflowVersion- Workflow version for which to create a backup.- Returns:
 - A new snapshot with the data from the given workflow version.
 - Throws:
 FastJsonException- When the workflow version could not be serialized.
 
- 
createFlowchartSnapshot
public static FlowchartSnapshot createFlowchartSnapshot(ProcessModel processModel, Map<ElementKey,com.alibaba.fastjson.JSONObject> customParamsMap, List<WorkflowStateModel> stateList) throws FastJsonException
Creates a flowchart snapshot that represents the given process and state list. This snapshot can be used to load the workflow state later on.- Parameters:
 processModel- Process model for the flowchart.customParamsMap- Map with the model data for the flowchart elements.stateList- List of workflow states to save.- Returns:
 - A new snapshot with the data from the given workflow version.
 - Throws:
 FastJsonException- When the workflow version could not be serialized.
 
- 
createNewBackup
public static void createNewBackup(IEntityContext ec, Mandant client, Locale locale, WorkflowVersion workflowVersion) throws FastJsonException
Creates and persist a new backup for the given workflow version.- Parameters:
 ec- Current entity context for accessing the database.client- Current client of the version being edited.locale- Current locale of the logged in user.workflowVersion- Workflow version for which to create a backup.- Throws:
 FastJsonException- When the workflow version could not be serialized.
 
- 
loadSnapshotForBackup
public static FlowchartSnapshot loadSnapshotForBackup(IEntityContext ec, WorkflowVersionBackup backup) throws FastJsonException
- Parameters:
 ec- Current entity context for accessing the database.backup- Backup to process- Returns:
 - The snapshot corresponding to the given backup, 
nullwhen not found. - Throws:
 FastJsonException- When the persist JSON could not be deserialized.
 
- 
loadSnapshotForPersisted
public static FlowchartSnapshot loadSnapshotForPersisted(Mandant client, Locale locale, long workflowVersionId) throws FastJsonException
Loads the given workflow version from the database and creates a snapshot for that version.- Parameters:
 client- Current client of the designer.locale- Current locale of the designer.workflowVersionId- ID of the workflow version to load.- Returns:
 - A newly created snapshot with the data of the given workflow version.
 - Throws:
 FastJsonException- When the JSON for the flowchart snapshot could not be created.
 
 - 
 
 -