public void deleteOrganization() throws DeletionException { final ProcessInstanceService processInstanceService = tenantAccessor.getProcessInstanceService(); final SCommentService commentService = tenantAccessor.getCommentService(); final ActivityInstanceService activityInstanceService = tenantAccessor.getActivityInstanceService(); try { final QueryOptions queryOptions = new QueryOptions(0, 1); boolean canDeleteOrganization = processInstanceService.getNumberOfProcessInstances(queryOptions) == 0 && activityInstanceService.getNumberOfHumanTasks(queryOptions) == 0 && commentService.getNumberOfComments(queryOptions) == 0; if (canDeleteOrganization) { deleteOrganizationElements(activityInstanceService); updateActorProcessDependenciesForAllActors(tenantAccessor); } else { throw new DeletionException("Can't delete a organization when a process, a human tasks, or a comment is active !!."); } } catch (final SBonitaException e) { throw new DeletionException(e); } }
public void deleteOrganization() throws DeletionException { final ProcessInstanceService processInstanceService = tenantAccessor.getProcessInstanceService(); final SCommentService commentService = tenantAccessor.getCommentService(); final ActivityInstanceService activityInstanceService = tenantAccessor.getActivityInstanceService(); try { final QueryOptions queryOptions = new QueryOptions(0, 1); boolean canDeleteOrganization = processInstanceService.getNumberOfProcessInstances(queryOptions) == 0 && activityInstanceService.getNumberOfHumanTasks(queryOptions) == 0 && commentService.getNumberOfComments(queryOptions) == 0; if (canDeleteOrganization) { deleteOrganizationElements(activityInstanceService); updateActorProcessDependenciesForAllActors(tenantAccessor); } else { throw new DeletionException("Can't delete a organization when a process, a human tasks, or a comment is active !!."); } } catch (final SBonitaException e) { throw new DeletionException(e); } }