activiti 更新act_hi_taskinst表DELETE_REASON_

 

因爲activiti對於act_hi_taskinst表中的DELETE_REASON_列值是有限的,DELETE_REASON_類表明任務的完成緣由,好比completed或者delete,所以咱們在任意節點跳轉或者撤銷的時候,必須標記該字段,好比撤銷能夠標記能夠定義爲Revoke、跳轉能夠標記爲jump等等。數據庫

寫一個命令類以下:緩存

public class UpdateHiTaskReasonCommand implements Command {
	protected String taskId;
	protected String deleteReason;

	public UpdateHiTaskReasonCommand(String taskId, String deleteReason) {
		this.taskId = taskId;
		this.deleteReason = deleteReason;
	}
	@Override
	public Void execute(CommandContext commandContext) {
		HistoricTaskInstanceEntity historicTaskInstance = commandContext
				.getDbSqlSession().selectById(HistoricTaskInstanceEntity.class,taskId);
		if (historicTaskInstance != null) {
			historicTaskInstance.markEnded(deleteReason);
		}
		return null;
	}
}

關於historicTaskInstance.markEnded(deleteReason)操做以後數據庫的數據就會更新,能夠參考Activiti權威指南一書中的會話緩存章節ide

相關文章
相關標籤/搜索