天天看點

Flowable 6.6.0 BPMN使用者指南 - 12 曆史(History)- 12.4 用于審計的曆史、 12.5 曆史清理《Flowable 6.6.0 BPMN使用者指南》

Flowable 6.6.0 使用者指南相關文檔下載下傳

  • BPMN使用者指南 第一部分 - 中文PDF精編版
  • BPMN使用者指南 第二部分 - 中文PDF精編版
  • BPMN使用者指南 第三部分 - 中文PDF精編版
  • 應用程式指南 - 中文PDF精編版
  • 應用程式指南 - 中英對照PDF精編版
  • 應用程式指南 - Eclipse設計器中文PDF精編版
  • 表單使用者指南 - 中文PDF精編版
  • 事件系統資料庫使用者指南 - 中文PDF精編版

《Flowable 6.6.0 BPMN使用者指南》

1. 入門

2. 配置

3 The Flowable API

4 Flowable 6.6.0 BPMN使用者指南 - (4)Spring內建

5 Spring Boot

6 部署

7 BPMN 2.0簡介

8 BPMN 2.0的構造

9 表單(Forms)

10 流程執行個體遷移

11 JPA

12 曆史(History)

  • 12.1 查詢曆史
  • 12.2 曆史配置
  • 12.3 異步曆史配置
  • 12.4 用于審計的曆史
  • 12.5 曆史清理(History Cleaning)

有關Flowable的更多文檔,參見:

《Flowable文檔大全》

12.4 用于審計的曆史

When configuring at least audit level for configuration. Then all properties submitted through methods FormService.submitStartFormData(String processDefinitionId, Map<String, String> properties) and FormService.submitTaskFormData(String taskId, Map<String, String> properties) are recorded.

Form properties can be retrieved with the query API like this:

進行配置時,至少要配置稽核級别(audit level)。通過方法

FormService.submitStartFormData(String processDefinitionId, Map<String, String> properties) 和

FormService.submitTaskFormData(String taskId, Map<String, String> properties)送出的所有屬性将被記錄。

可以使用如下查詢API來檢索表單屬性:

historyService
      .createHistoricDetailQuery()
      .formProperties()
      ...
      .list();
           

In that case only historic details of type HistoricFormProperty are returned.

If you’ve set the authenticated user before calling the submit methods with IdentityService.setAuthenticatedUserId(String) then that authenticated user who submitted the form will be accessible in the history as well with HistoricProcessInstance.getStartUserId() for start forms and HistoricActivityInstance.getAssignee() for task forms.

在這種情況下,隻傳回HistoricFormProperty類型的曆史詳細資訊。

如果在調用IdentityService.setAuthenticatedUserId(String)的submit方法之前已經設定了身份驗證使用者,那麼,在曆史記錄中,可擷取送出表單的已認證使用者, 對啟動表單通過HistoricProcessInstance.getStartUserId()擷取啟動使用者Id,對任務表單通過HistoricActivityInstance.getAssignee()擷取受托人(Assignee)。

12.5 曆史清理(History Cleaning)

By default history data is stored forever, this can cause the history tables to grow very large and impact the performance of the HistoryService. History Cleaning has been introduced with 6.5.0 and allows the deletion of HistoricProcessInstances and their associated data. Once process data no longer needs to be retained it can be deleted to reduce the history database’s size.

預設情況下,曆史資料是永久存儲的,這會導緻曆史表變得非常大,并影響HistoryService的性能。曆史清理(History Cleaning)已在6.5.0中引入,允許删除HistoricProcessInstances及其關聯的資料。一旦流程資料不再需要保留,就可以删除它以減小曆史資料庫的大小。

12.5.1 曆史自動清理配置

Automatic cleanup of HistoricProcessInstances is disabled by default but can be enabled and configured programmatically. Once enabled the default is to run a cleanup job at 1 AM to delete all HistoricProcessInstances and associated data that have ended 365 days prior or older.

預設情況下,HistoricProcessInstances的自動清理處于禁用狀态,但可以通過程式設計方式啟用和配置。一旦啟用,在預設情況下,将在每天淩晨1點運作一個清理作業(cleanup job),删除365天之前的全部HistoricProcessInstances和關聯的資料。

ProcessEngine processEngine = ProcessEngineConfiguration
    .createProcessEngineConfigurationFromResourceDefault()
    .setEnableHistoryCleaning(true)
    .setHistoryCleaningTimeCycleConfig("0 0 1 * * ?")
    .setCleanInstancesEndedAfterNumberOfDays(365)
    .buildProcessEngine();
           

Spring properties set in an application.properties or externalized configuration are also available:

也可使用application.properties 中的設定Spring屬性或外部化配置:

flowable.enable-history-cleaning=true
     flowable.history-cleaning-after-days=365
     flowable.history-cleaning-cycle=0 0 1 * * ?
           

Additionally, History Cleanup can also be configured in flowable.cfg.xml or in a spring-context:

此外,還可以在flowable.cfg.xml或者spring-context中配置曆史清理(History Cleanup):

<bean id="processEngineConfiguration" class="org.flowable.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
   <property name="enableHistoryCleaning" value="true"/>
   <property name="historyCleaningTimeCycleConfig" value="0 0 1 * * ?"/>
   <property name="cleanInstancesEndedAfterNumberOfDays" value="365"/>
   ...
 </bean>
           

12.5.2 手工删除曆史

Manually cleaning history can accomplished by executing methods on the HistoryService query builders.

Delete all HistoricProcessInstances and their related data that are older than one year.

可以通過在HistoryService查詢生成器上執行方法來完成手動清理曆史記錄。

删除所有一年前的HistoricProcessInstances及其相關資料。

Calendar cal = new GregorianCalendar();
 cal.set(Calendar.YEAR, cal.get(Calendar.YEAR) - 1);
 historyService.createHistoricProcessInstanceQuery()
   .finishedBefore(cal.getTime())
   .deleteWithRelatedData();
           

Delete just HistoricProcessInstances older than one year.

隻删除超過一年的HistoricProcessInstances。

Calendar cal = new GregorianCalendar();
cal.set(Calendar.YEAR, cal.get(Calendar.YEAR) - 1);
historyService.createHistoricProcessInstanceQuery()
  .finishedBefore(cal.getTime())
  .delete();
           

Delete just HistoricActivityInstances older than one year.

隻删除超過一年的HistoricActivityInstances。

Calendar cal = new GregorianCalendar();
cal.set(Calendar.YEAR, cal.get(Calendar.YEAR) - 1);
historyService.createHistoricActivityInstanceQuery()
  .finishedBefore(cal.getTime())
  .delete();
           

Delete the task and activity data for deleted HistoricProcessInstances.

删除已删除的HistoricProcessInstances的任務和活動的資料。
           

繼續閱讀