@Override public void deleteArchivedDocuments(List<Long> processInstanceIds) throws SBonitaReadException, SRecorderException { List<SAMappedDocument> archivedMappedDocuments = persistenceService.selectList(new SelectListDescriptor<>("getArchiveMappingsOfProcessInstances", Collections.singletonMap("processInstanceIds", processInstanceIds), SAMappedDocument.class, QueryOptions.countQueryOptions())); if (archivedMappedDocuments.isEmpty()) { //no documents to delete return; } List<Long> documentIds = new ArrayList<>(); List<Long> documentMappingIds = new ArrayList<>(); for (SAMappedDocument mappedDocument : archivedMappedDocuments) { documentIds.add(mappedDocument.getDocumentId()); documentMappingIds.add(mappedDocument.getId()); } archiveService.deleteFromQuery("deleteArchiveDocumentsByIds", Collections.singletonMap("ids", documentIds)); archiveService.deleteFromQuery("deleteArchiveMappingsByIds", Collections.singletonMap("ids", documentMappingIds)); }
@Override public void deleteArchivedDocuments(List<Long> processInstanceIds) throws SBonitaReadException, SRecorderException { List<SAMappedDocument> archivedMappedDocuments = persistenceService.selectList(new SelectListDescriptor<>("getArchiveMappingsOfProcessInstances", Collections.singletonMap("processInstanceIds", processInstanceIds), SAMappedDocument.class, QueryOptions.countQueryOptions())); if (archivedMappedDocuments.isEmpty()) { //no documents to delete return; } List<Long> documentIds = new ArrayList<>(); List<Long> documentMappingIds = new ArrayList<>(); for (SAMappedDocument mappedDocument : archivedMappedDocuments) { documentIds.add(mappedDocument.getDocumentId()); documentMappingIds.add(mappedDocument.getId()); } archiveService.deleteFromQuery("deleteArchiveDocumentsByIds", Collections.singletonMap("ids", documentIds)); archiveService.deleteFromQuery("deleteArchiveMappingsByIds", Collections.singletonMap("ids", documentMappingIds)); }
@Override public Set<Long> getSourceObjectIdsOfArchivedFlowNodeInstances(List<Long> sourceProcessInstanceIds) throws SBonitaReadException { return new HashSet<>(getPersistenceService().selectList(new SelectListDescriptor<Long>("getSourceObjectIdsOfArchivedFlowNodeInstances", Collections.<String, Object>singletonMap("sourceProcessInstanceIds", sourceProcessInstanceIds), SAFlowNodeInstance.class, QueryOptions.countQueryOptions()))); }
@Override public Set<Long> getSourceObjectIdsOfArchivedFlowNodeInstances(List<Long> sourceProcessInstanceIds) throws SBonitaReadException { return new HashSet<>(getPersistenceService().selectList(new SelectListDescriptor<Long>("getSourceObjectIdsOfArchivedFlowNodeInstances", Collections.<String, Object>singletonMap("sourceProcessInstanceIds", sourceProcessInstanceIds), SAFlowNodeInstance.class, QueryOptions.countQueryOptions()))); }
@Override public List<SAProcessInstance> getArchivedProcessInstancesInAllStates(final List<Long> processInstanceIds) throws SProcessInstanceReadException { final ReadPersistenceService persistenceService = archiveService.getDefinitiveArchiveReadPersistenceService(); try { final Map<String, Object> parameters = Collections.singletonMap("sourceObjectIds", (Object) processInstanceIds); final SelectListDescriptor<SAProcessInstance> saProcessInstances = new SelectListDescriptor<>( "getArchivedProcessInstancesInAllStates", parameters, SAProcessInstance.class, QueryOptions.countQueryOptions()); return persistenceService.selectList(saProcessInstances); } catch (final SBonitaReadException e) { throw new SProcessInstanceReadException(e); } }
@Override public List<SAProcessInstance> getArchivedProcessInstancesInAllStates(final List<Long> processInstanceIds) throws SProcessInstanceReadException { final ReadPersistenceService persistenceService = archiveService.getDefinitiveArchiveReadPersistenceService(); try { final Map<String, Object> parameters = Collections.singletonMap("sourceObjectIds", (Object) processInstanceIds); final SelectListDescriptor<SAProcessInstance> saProcessInstances = new SelectListDescriptor<>( "getArchivedProcessInstancesInAllStates", parameters, SAProcessInstance.class, QueryOptions.countQueryOptions()); return persistenceService.selectList(saProcessInstances); } catch (final SBonitaReadException e) { throw new SProcessInstanceReadException(e); } }
@Override public List<SDependency> getDependencies(final Collection<Long> ids) throws SDependencyException { NullCheckingUtil.checkArgsNotNull(ids); try { final SelectListDescriptor<SDependency> desc = new SelectListDescriptor<>("getDependenciesByIds", CollectionUtil.buildSimpleMap("ids", ids), SDependency.class, QueryOptions.countQueryOptions()); return persistenceService.selectList(desc); } catch (final SBonitaReadException e) { throw new SDependencyException("Can't get dependencies", e); } }
@Override public Map<Long, Map<String, byte[]>> getClientTenantConfigurations() { try { PlatformService platformService = getPlatformAccessor().getPlatformService(); List<STenant> tenants = platformService.getTenants(QueryOptions.countQueryOptions()); HashMap<Long, Map<String, byte[]>> conf = new HashMap<>(); for (STenant tenant : tenants) { conf.put(tenant.getId(), getBonitaHomeServerInstance().getClientTenantConfigurations(tenant.getId())); } return conf; } catch (BonitaException | IOException | IllegalAccessException | ClassNotFoundException | InstantiationException | STenantException e) { throw new RetrieveException(e); } }
@Override public List<SDependency> getDependencies(final Collection<Long> ids) throws SDependencyException { NullCheckingUtil.checkArgsNotNull(ids); try { final SelectListDescriptor<SDependency> desc = new SelectListDescriptor<>("getDependenciesByIds", CollectionUtil.buildSimpleMap("ids", ids), SDependency.class, QueryOptions.countQueryOptions()); return persistenceService.selectList(desc); } catch (final SBonitaReadException e) { throw new SDependencyException("Can't get dependencies", e); } }
@Override public Map<Long, Map<String, byte[]>> getClientTenantConfigurations() { try { PlatformService platformService = getPlatformAccessor().getPlatformService(); List<STenant> tenants = platformService.getTenants(QueryOptions.countQueryOptions()); HashMap<Long, Map<String, byte[]>> conf = new HashMap<>(); for (STenant tenant : tenants) { conf.put(tenant.getId(), getBonitaHomeServerInstance().getClientTenantConfigurations(tenant.getId())); } return conf; } catch (BonitaException | IOException | IllegalAccessException | ClassNotFoundException | InstantiationException | STenantException e) { throw new RetrieveException(e); } }
@Override public long getNumberOfPendingHumanTaskInstances(final long userId) { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); final ActivityInstanceService activityInstanceService = tenantAccessor.getActivityInstanceService(); final ProcessDefinitionService processDefService = tenantAccessor.getProcessDefinitionService(); try { final Set<Long> actorIds = getActorsForUser(userId, actorMappingService, processDefService); if (actorIds.isEmpty()) { return 0L; } return activityInstanceService.getNumberOfPendingTasksForUser(userId, QueryOptions.countQueryOptions()); } catch (final SBonitaException e) { throw new RetrieveException(e); } }
@Override public long getNumberOfPendingHumanTaskInstances(final long userId) { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); final ActivityInstanceService activityInstanceService = tenantAccessor.getActivityInstanceService(); final ProcessDefinitionService processDefService = tenantAccessor.getProcessDefinitionService(); try { final Set<Long> actorIds = getActorsForUser(userId, actorMappingService, processDefService); if (actorIds.isEmpty()) { return 0L; } return activityInstanceService.getNumberOfPendingTasksForUser(userId, QueryOptions.countQueryOptions()); } catch (final SBonitaException e) { throw new RetrieveException(e); } }