public class TaskPersistentStateMap implements BusinessRulesScript{
public Object execute(Object parameter, SqlCommand sqlCommand,
ProcessEngineConfigurationImpl processEngineConfiguration) {
TaskInstanceEntity taskInstance=(TaskInstanceEntity)parameter;
Map<String,Object> persistentState = new HashMap<String, Object>();
persistentState.put("taskInstanceId", taskInstance.getId());
persistentState.put("name", taskInstance.getName());
persistentState.put("description", taskInstance.getDescription());
persistentState.put("processInstanceId", taskInstance.getProcessInstanceId());
persistentState.put("processDefinitionId", taskInstance.getProcessDefinitionId());
persistentState.put("processDefinitionKey", taskInstance.getProcessDefinitionKey());
persistentState.put("processDefinitionName", taskInstance.getProcessDefinitionName());
persistentState.put("version", taskInstance.getVersion());
persistentState.put("tokenId", taskInstance.getTokenId());
persistentState.put("nodeId", taskInstance.getNodeId());
persistentState.put("nodeName", taskInstance.getNodeName());
persistentState.put("parentTaskInstanceId", taskInstance.getParentTaskInstanceId());
persistentState.put("assignee", taskInstance.getAssignee());
persistentState.put("claimTime", taskInstance.getClaimTime());
persistentState.put("createTime", taskInstance.getCreateTime());
persistentState.put("startTime", taskInstance.getStartTime());
persistentState.put("endTime", taskInstance.getEndTime());
persistentState.put("dueDate", taskInstance.getDueDate());
persistentState.put("priority", String.valueOf(taskInstance.getPriority()));
persistentState.put("category", String.valueOf(taskInstance.getCategory()));
persistentState.put("owner", taskInstance.getOwner());
persistentState.put("delegationState", StringUtil.getString(taskInstance.getDelegationState()));
persistentState.put("bizKey", taskInstance.getBizKey());
persistentState.put("taskComment", taskInstance.getTaskComment());
persistentState.put("formUri", taskInstance.getFormUri());
persistentState.put("formUriView", taskInstance.getFormUriView());
persistentState.put("taskGroup", taskInstance.getTaskGroup());
persistentState.put("taskInstanceType", StringUtil.getString(taskInstance.getTaskInstanceType()));
persistentState.put("isBlocking", String.valueOf(taskInstance.isBlocking()));
persistentState.put("isCancelled", String.valueOf(taskInstance.isCancelled()));
persistentState.put("isSuspended", String.valueOf(taskInstance.isSuspended()));
persistentState.put("isOpen", String.valueOf(taskInstance.isOpen()));
persistentState.put("isDraft", String.valueOf(taskInstance.isDraft()));
persistentState.put("expectedExecutionTime", String.valueOf(taskInstance.getExpectedExecutionTime()));
persistentState.put("agent", taskInstance.getAgent());
persistentState.put("admin", taskInstance.getAdmin());
persistentState.put("callActivityInstanceId", taskInstance.getCallActivityInstanceId());
persistentState.put("pendingTaskId", taskInstance.getPendingTaskId());
persistentState.put("archiveTime", taskInstance.getArchiveTime());
persistentState.put("commandId", taskInstance.getCommandId());
persistentState.put("commandType", taskInstance.getCommandType());
persistentState.put("commandMessage", taskInstance.getCommandMessage());
Map<String,Object> extensionFields=taskInstance.getExtensionFields();
for (String key : extensionFields.keySet()) {
persistentState.put(key, extensionFields.get(key));
}
return persistentState;