/** * Give a list of job to register when the tenant is activated * * @return */ public List<JobRegister> getJobsToRegister() { return CollectionUtil.emptyOrUnmodifiable(jobsToRegister); }
/** * @param humanTaskInstanceId * @param queryOptions * @return */ @Override public List<SPendingActivityMapping> getPendingMappings(final long humanTaskInstanceId, final QueryOptions queryOptions) throws SBonitaReadException { final Map<String, Object> parameters = CollectionUtil.buildSimpleMap("activityId", humanTaskInstanceId); return getPersistenceService().selectList( new SelectListDescriptor<SPendingActivityMapping>("getPendingMappingsOfTask", parameters, SPendingActivityMapping.class, queryOptions)); }
/** * @param humanTaskInstanceId * @param queryOptions * @return */ @Override public List<SPendingActivityMapping> getPendingMappings(final long humanTaskInstanceId, final QueryOptions queryOptions) throws SBonitaReadException { final Map<String, Object> parameters = CollectionUtil.buildSimpleMap("activityId", humanTaskInstanceId); return getPersistenceService().selectList( new SelectListDescriptor<SPendingActivityMapping>("getPendingMappingsOfTask", parameters, SPendingActivityMapping.class, queryOptions)); }
@Override public List<STenant> getTenants(final Collection<Long> ids, final QueryOptions queryOptions) throws STenantNotFoundException, STenantException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_GET_TENANTS)); } List<STenant> tenants; try { final Map<String, Object> parameters = CollectionUtil.buildSimpleMap("ids", ids); tenants = platformPersistenceService .selectList(new SelectListDescriptor<STenant>(QUERY_GET_TENANTS_BY_IDS, parameters, STenant.class, queryOptions)); if (tenants.size() != ids.size()) { throw new STenantNotFoundException("Unable to retrieve all tenants by ids. Expected: " + ids + ", retrieved: " + tenants); } } catch (final SBonitaReadException e) { throw new STenantException("Problem getting list of tenants: " + e.getMessage(), e); } if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), LOG_GET_TENANTS)); } return tenants; }
@Override public List<RestartHandler> getRestartHandlers() { return CollectionUtil.emptyOrUnmodifiable(restartHandlers); }
@Override public List<STenant> getTenants(final Collection<Long> ids, final QueryOptions queryOptions) throws STenantNotFoundException, STenantException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_GET_TENANTS)); } List<STenant> tenants; try { final Map<String, Object> parameters = CollectionUtil.buildSimpleMap("ids", ids); tenants = platformPersistenceService .selectList(new SelectListDescriptor<STenant>(QUERY_GET_TENANTS_BY_IDS, parameters, STenant.class, queryOptions)); if (tenants.size() != ids.size()) { throw new STenantNotFoundException("Unable to retrieve all tenants by ids. Expected: " + ids + ", retrieved: " + tenants); } } catch (final SBonitaReadException e) { throw new STenantException("Problem getting list of tenants: " + e.getMessage(), e); } if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), LOG_GET_TENANTS)); } return tenants; }
/** * Give a list of job to register when the tenant is activated * * @return */ public List<JobRegister> getJobsToRegister() { return CollectionUtil.emptyOrUnmodifiable(jobsToRegister); }
@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 List<TenantRestartHandler> getTenantRestartHandlers() { return CollectionUtil.emptyOrUnmodifiable(tenantRestartHandlers); }
@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 List<RestartHandler> getRestartHandlers() { return CollectionUtil.emptyOrUnmodifiable(restartHandlers); }
private SDataInstance internalGetLocalDataInstance(final String dataName, final long containerId, final String containerType) throws SDataInstanceReadException { NullCheckingUtil.checkArgsNotNull(dataName, containerType); final SDataInstanceBuilderFactory fact = BuilderFactory.get(SDataInstanceBuilderFactory.class); final Map<String, Object> paraMap = CollectionUtil.buildSimpleMap(fact.getNameKey(), dataName); paraMap.put(fact.getContainerIdKey(), containerId); paraMap.put(fact.getContainerTypeKey(), containerType); try { return persistenceService.selectOne(new SelectOneDescriptor<SDataInstance>("getDataInstancesByNameAndContainer", paraMap, SDataInstance.class, SDataInstance.class)); } catch (final SBonitaReadException e) { throw new SDataInstanceReadException("Unable to check if a data instance already exists: " + e.getMessage(), e); } }
@Override public List<TenantRestartHandler> getTenantRestartHandlers() { return CollectionUtil.emptyOrUnmodifiable(tenantRestartHandlers); }
private SDataInstance internalGetLocalDataInstance(final String dataName, final long containerId, final String containerType) throws SDataInstanceReadException { NullCheckingUtil.checkArgsNotNull(dataName, containerType); final SDataInstanceBuilderFactory fact = BuilderFactory.get(SDataInstanceBuilderFactory.class); final Map<String, Object> paraMap = CollectionUtil.buildSimpleMap(fact.getNameKey(), dataName); paraMap.put(fact.getContainerIdKey(), containerId); paraMap.put(fact.getContainerTypeKey(), containerType); try { return persistenceService.selectOne(new SelectOneDescriptor<SDataInstance>("getDataInstancesByNameAndContainer", paraMap, SDataInstance.class, SDataInstance.class)); } catch (final SBonitaReadException e) { throw new SDataInstanceReadException("Unable to check if a data instance already exists: " + e.getMessage(), e); } }
@Override public STenant getTenantByName(final String name) throws STenantNotFoundException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), QUERY_GET_TENANT_BY_NAME)); } STenant tenant; try { final Map<String, Object> parameters = CollectionUtil.buildSimpleMap(BuilderFactory.get(STenantBuilderFactory.class).getNameKey(), name); tenant = platformPersistenceService.selectOne(new SelectOneDescriptor<STenant>(QUERY_GET_TENANT_BY_NAME, parameters, STenant.class)); if (tenant == null) { throw new STenantNotFoundException("No tenant found with name: " + name); } } catch (final SBonitaReadException e) { throw new STenantNotFoundException("Unable to check if a tenant already exists: " + e.getMessage(), e); } if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), QUERY_GET_TENANT_BY_NAME)); } return tenant; }
@Override public STenant getTenantByName(final String name) throws STenantNotFoundException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), QUERY_GET_TENANT_BY_NAME)); } STenant tenant; try { final Map<String, Object> parameters = CollectionUtil.buildSimpleMap(BuilderFactory.get(STenantBuilderFactory.class).getNameKey(), name); tenant = platformPersistenceService.selectOne(new SelectOneDescriptor<STenant>(QUERY_GET_TENANT_BY_NAME, parameters, STenant.class)); if (tenant == null) { throw new STenantNotFoundException("No tenant found with name: " + name); } } catch (final SBonitaReadException e) { throw new STenantNotFoundException("Unable to check if a tenant already exists: " + e.getMessage(), e); } if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogAfterMethod(this.getClass(), QUERY_GET_TENANT_BY_NAME)); } return tenant; }
@Override public List<SDataInstance> getLocalDataInstances(final long containerId, final String containerType, final int fromIndex, final int numberOfResults) throws SDataInstanceReadException { NullCheckingUtil.checkArgsNotNull(containerType); final SDataInstanceBuilderFactory fact = BuilderFactory.get(SDataInstanceBuilderFactory.class); final Map<String, Object> paraMap = CollectionUtil.buildSimpleMap(fact.getContainerIdKey(), containerId); final OrderByOption orderByOption = new OrderByOption(SDataInstance.class, fact.getIdKey(), OrderByType.ASC); paraMap.put(fact.getContainerTypeKey(), containerType); try { return persistenceService.selectList(new SelectListDescriptor<SDataInstance>("getDataInstancesByContainer", paraMap, SDataInstance.class, SDataInstance.class, new QueryOptions(fromIndex, numberOfResults, Arrays.asList(orderByOption)))); } catch (final SBonitaReadException e) { throw new SDataInstanceReadException("Unable to check if a data instance already exists for the data container of type " + containerType + " with id " + containerId + " for reason: " + e.getMessage(), e); } }
@Override public List<SDataInstance> getLocalDataInstances(final long containerId, final String containerType, final int fromIndex, final int numberOfResults) throws SDataInstanceReadException { NullCheckingUtil.checkArgsNotNull(containerType); final SDataInstanceBuilderFactory fact = BuilderFactory.get(SDataInstanceBuilderFactory.class); final Map<String, Object> paraMap = CollectionUtil.buildSimpleMap(fact.getContainerIdKey(), containerId); final OrderByOption orderByOption = new OrderByOption(SDataInstance.class, fact.getIdKey(), OrderByType.ASC); paraMap.put(fact.getContainerTypeKey(), containerType); try { return persistenceService.selectList(new SelectListDescriptor<SDataInstance>("getDataInstancesByContainer", paraMap, SDataInstance.class, SDataInstance.class, new QueryOptions(fromIndex, numberOfResults, Arrays.asList(orderByOption)))); } catch (final SBonitaReadException e) { throw new SDataInstanceReadException("Unable to check if a data instance already exists for the data container of type " + containerType + " with id " + containerId + " for reason: " + e.getMessage(), e); } }