コード例 #1
0
 private void deleteProcessInstanceElements(final SProcessInstance processInstance)
     throws SBonitaException {
   SProcessDefinition processDefinition = null;
   try {
     processDefinition =
         processDefinitionService.getProcessDefinition(processInstance.getProcessDefinitionId());
   } catch (final SProcessDefinitionNotFoundException e) {
     // delete anyway
   }
   try {
     tokenService.deleteTokens(processInstance.getId());
   } catch (final SObjectReadException e) {
     throw new SProcessInstanceModificationException(e);
   } catch (final SObjectModificationException e) {
     throw new SProcessInstanceModificationException(e);
   }
   deleteFlowNodeInstances(processInstance.getId(), processDefinition);
   deleteDataInstancesIfNecessary(processInstance, processDefinition);
   processDocumentService.deleteDocumentsFromProcessInstance(processInstance.getId());
   deleteConnectorInstancesIfNecessary(processInstance, processDefinition);
   commentService.deleteComments(processInstance.getId());
 }
コード例 #2
0
 @Override
 public void deleteArchivedProcessInstanceElements(
     final long processInstanceId, final long processDefinitionId)
     throws SProcessInstanceModificationException {
   final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
   try {
     final ClassLoader localClassLoader =
         classLoaderService.getLocalClassLoader("process", processDefinitionId);
     Thread.currentThread().setContextClassLoader(localClassLoader);
     deleteArchivedFlowNodeInstances(processInstanceId);
     dataInstanceService.deleteLocalArchivedDataInstances(
         processInstanceId, DataInstanceContainer.PROCESS_INSTANCE.toString());
     processDocumentService.deleteArchivedDocuments(processInstanceId);
     connectorInstanceService.deleteArchivedConnectorInstances(
         processInstanceId, SConnectorInstance.PROCESS_TYPE);
     transitionService.deleteArchivedTransitionsOfProcessInstance(processInstanceId);
     commentService.deleteArchivedComments(processInstanceId);
     deleteArchivedChidrenProcessInstanceElements(processInstanceId, processDefinitionId);
   } catch (final SBonitaException e) {
     throw new SProcessInstanceModificationException(e);
   } finally {
     Thread.currentThread().setContextClassLoader(contextClassLoader);
   }
 }