@Override public List<STenant> getTenants(final QueryOptions queryOptions) throws STenantException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_GET_TENANTS)); } List<STenant> tenants; try { tenants = platformPersistenceService.selectList(new SelectListDescriptor<STenant>(LOG_GET_TENANTS, null, STenant.class, queryOptions)); } 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<STenant> getTenants(final QueryOptions queryOptions) throws STenantException { if (isTraced) { logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogBeforeMethod(this.getClass(), LOG_GET_TENANTS)); } List<STenant> tenants; try { tenants = platformPersistenceService.selectList(new SelectListDescriptor<STenant>(LOG_GET_TENANTS, null, STenant.class, queryOptions)); } 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 STenant getDefaultTenant() throws STenantNotFoundException { try { STenant tenant = platformPersistenceService.selectOne(new SelectOneDescriptor<STenant>(QUERY_GET_DEFAULT_TENANT, null, STenant.class)); if (tenant == null) { throw new STenantNotFoundException("No default tenant found"); } return tenant; } catch (final SBonitaReadException e) { throw new STenantNotFoundException("Unable to check if a default tenant already exists: " + e.getMessage(), e); } }
@Override public SPlatform getPlatform() throws SPlatformNotFoundException { try { SPlatform platform = platformPersistenceService.selectOne(new SelectOneDescriptor<SPlatform>(QUERY_GET_PLATFORM, null, SPlatform.class)); if (platform == null) { throw new SPlatformNotFoundException("No platform found"); } return platform; } catch (final SBonitaReadException e) { throw new SPlatformNotFoundException("Unable to check if a platform already exists : " + e.getMessage(), e); } }
@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<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 STenant getDefaultTenant() throws STenantNotFoundException { try { STenant tenant = platformPersistenceService.selectOne(new SelectOneDescriptor<STenant>(QUERY_GET_DEFAULT_TENANT, null, STenant.class)); if (tenant == null) { throw new STenantNotFoundException("No default tenant found"); } return tenant; } catch (final SBonitaReadException e) { throw new STenantNotFoundException("Unable to check if a default tenant already exists: " + e.getMessage(), e); } }
@Override public SPlatform getPlatform() throws SPlatformNotFoundException { try { SPlatform platform = platformPersistenceService.selectOne(new SelectOneDescriptor<SPlatform>(QUERY_GET_PLATFORM, null, SPlatform.class)); if (platform == null) { throw new SPlatformNotFoundException("No platform found"); } return platform; } catch (final SBonitaReadException e) { throw new SPlatformNotFoundException("Unable to check if a platform already exists : " + e.getMessage(), e); } }
inputParameters, SDataInstance.class, new QueryOptions(0, QueryOptions.UNLIMITED_NUMBER_OF_RESULTS))); } catch (final SBonitaReadException e) { throw new SDataInstanceReadException("Unable to check if a data instance already exists: " + e.getMessage(), e);
inputParameters, SDataInstance.class, new QueryOptions(0, QueryOptions.UNLIMITED_NUMBER_OF_RESULTS))); } catch (final SBonitaReadException e) { throw new SDataInstanceReadException("Unable to check if a data instance already exists: " + e.getMessage(), e);
@Override public SHumanTaskInstance getHumanTaskInstance(final long activityInstanceId) throws SActivityInstanceNotFoundException, SActivityReadException { final SelectByIdDescriptor<SHumanTaskInstance> descriptor = SelectDescriptorBuilder.getElementById(SHumanTaskInstance.class, "SHumanTaskInstance", activityInstanceId); SHumanTaskInstance humanTask; try { humanTask = getPersistenceService().selectById(descriptor); if (humanTask == null) { throw new SActivityInstanceNotFoundException(activityInstanceId); } return humanTask; } catch (final SBonitaReadException e) { throw new SActivityReadException(e.getMessage()); } }
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); } }
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 SHumanTaskInstance getHumanTaskInstance(final long activityInstanceId) throws SActivityInstanceNotFoundException, SActivityReadException { final SelectByIdDescriptor<SHumanTaskInstance> descriptor = SelectDescriptorBuilder.getElementById(SHumanTaskInstance.class, "SHumanTaskInstance", activityInstanceId); SHumanTaskInstance humanTask; try { humanTask = getPersistenceService().selectById(descriptor); if (humanTask == null) { throw new SActivityInstanceNotFoundException(activityInstanceId); } return humanTask; } catch (final SBonitaReadException e) { throw new SActivityReadException(e.getMessage()); } }
@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); } }