private void deleteConnectorInstancesIfNecessary( final SFlowNodeInstance flowNodeInstance, final SProcessDefinition processDefinition) throws SConnectorInstanceReadException, SConnectorInstanceDeletionException { if (hasConnectors(flowNodeInstance, processDefinition)) { connectorInstanceService.deleteConnectors( flowNodeInstance.getId(), SConnectorInstance.FLOWNODE_TYPE); } }
private void deleteConnectorInstancesIfNecessary( final SProcessInstance processInstance, final SProcessDefinition processDefinition) throws SConnectorInstanceReadException, SConnectorInstanceDeletionException { if (processDefinition != null && processDefinition.hasConnectors()) { connectorInstanceService.deleteConnectors( processInstance.getId(), SConnectorInstance.PROCESS_TYPE); } }
private void deleteArchivedFlowNodeInstanceElements(final SAFlowNodeInstance activityInstance) throws SFlowNodeReadException, SBonitaSearchException, SConnectorInstanceDeletionException, SDataInstanceException { if (activityInstance instanceof SAActivityInstance) { dataInstanceService.deleteLocalArchivedDataInstances( activityInstance.getSourceObjectId(), DataInstanceContainer.ACTIVITY_INSTANCE.toString()); connectorInstanceService.deleteArchivedConnectorInstances( activityInstance.getSourceObjectId(), SConnectorInstance.FLOWNODE_TYPE); if (SFlowNodeType.USER_TASK.equals(activityInstance.getType()) || SFlowNodeType.MANUAL_TASK.equals(activityInstance.getType())) { try { activityService.deleteArchivedPendingMappings(activityInstance.getSourceObjectId()); } catch (final SActivityModificationException e) { throw new SFlowNodeReadException(e); } } } }
@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); } }