public void deleteHistoricTaskInstancesByProcessInstanceIds(List<String> processInstanceIds, boolean deleteVariableInstances) {

    CommandContext commandContext = Context.getCommandContext();

    if (deleteVariableInstances) {
      getHistoricVariableInstanceManager().deleteHistoricVariableInstancesByTaskProcessInstanceIds(processInstanceIds);
    }

    getHistoricDetailManager()
        .deleteHistoricDetailsByTaskProcessInstanceIds(processInstanceIds);

    commandContext
        .getCommentManager()
        .deleteCommentsByTaskProcessInstanceIds(processInstanceIds);

    getAttachmentManager()
        .deleteAttachmentsByTaskProcessInstanceIds(processInstanceIds);

    getHistoricIdentityLinkManager()
        .deleteHistoricIdentityLinksLogByTaskProcessInstanceIds(processInstanceIds);

    getDbEntityManager().deletePreserveOrder(HistoricTaskInstanceEntity.class, "deleteHistoricTaskInstanceByProcessInstanceIds", processInstanceIds);
  }
public void deleteHistoricTaskInstancesByProcessInstanceIds ( List < String > processInstanceIds , boolean deleteVariableInstances ) { CommandContext commandContext = Context . getCommandContext ( ) ; if ( deleteVariableInstances ) { getHistoricVariableInstanceManager ( ) . deleteHistoricVariableInstancesByTaskProcessInstanceIds ( processInstanceIds ) ; } getHistoricDetailManager ( ) . deleteHistoricDetailsByTaskProcessInstanceIds ( processInstanceIds ) ; commandContext . getCommentManager ( ) . deleteCommentsByTaskProcessInstanceIds ( processInstanceIds ) ; getAttachmentManager ( ) . deleteAttachmentsByTaskProcessInstanceIds ( processInstanceIds ) ; getHistoricIdentityLinkManager ( ) . deleteHistoricIdentityLinksLogByTaskProcessInstanceIds ( processInstanceIds ) ; getDbEntityManager ( ) . deletePreserveOrder ( HistoricTaskInstanceEntity . class , "deleteHistoricTaskInstanceByProcessInstanceIds" , processInstanceIds ) ; }
Deletes all data related with tasks, which belongs to specified process instance ids.
@param processInstanceIds
@param deleteVariableInstances when true, will also delete variable instances. Can be false when variable instances were deleted separately.