historicTaskInstanceEntity.setEndTime(null);
historicTaskInstanceEntity.setDurationInMillis(null);
historicActivityInstanceEntity.setEndTime(null);
historicActivityInstanceEntity.setDurationInMillis(null);
TaskEntity task = TaskEntity.create(new Date());
task.setProcessDefinitionId(historicTaskInstanceEntity
.getProcessDefinitionId());
task.setId(historicTaskInstanceEntity.getId());
task.setAssigneeWithoutCascade(historicTaskInstanceEntity.getAssignee());
task.setParentTaskIdWithoutCascade(historicTaskInstanceEntity
.getParentTaskId());
task.setNameWithoutCascade(historicTaskInstanceEntity.getName());
task.setTaskDefinitionKey(historicTaskInstanceEntity
.getTaskDefinitionKey());
task.setExecutionId(historicTaskInstanceEntity.getExecutionId());
task.setPriority(historicTaskInstanceEntity.getPriority());
task.setProcessInstanceId(historicTaskInstanceEntity
.getProcessInstanceId());
task.setDescriptionWithoutCascade(historicTaskInstanceEntity
.getDescription());
Context.getCommandContext().getTaskEntityManager().insert(task);
ExecutionEntity executionEntity = Context.getCommandContext()