Search in sources :

Example 91 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class AbstractBulkImportService method saveTelemetry.

@SneakyThrows
private void saveTelemetry(SecurityUser user, E entity, Map.Entry<BulkImportColumnType, JsonObject> kvsEntry) {
    List<TsKvEntry> timeseries = JsonConverter.convertToTelemetry(kvsEntry.getValue(), System.currentTimeMillis()).entrySet().stream().flatMap(entry -> entry.getValue().stream().map(kvEntry -> new BasicTsKvEntry(entry.getKey(), kvEntry))).collect(Collectors.toList());
    accessValidator.validateEntityAndCallback(user, Operation.WRITE_TELEMETRY, entity.getId(), (result, tenantId, entityId) -> {
        TenantProfile tenantProfile = tenantProfileCache.get(tenantId);
        long tenantTtl = TimeUnit.DAYS.toSeconds(((DefaultTenantProfileConfiguration) tenantProfile.getProfileData().getConfiguration()).getDefaultStorageTtlDays());
        tsSubscriptionService.saveAndNotify(tenantId, user.getCustomerId(), entityId, timeseries, tenantTtl, new FutureCallback<Void>() {

            @Override
            public void onSuccess(@Nullable Void tmp) {
                entityActionService.logEntityAction(user, (UUIDBased & EntityId) entityId, null, null, ActionType.TIMESERIES_UPDATED, null, timeseries);
            }

            @Override
            public void onFailure(Throwable t) {
                entityActionService.logEntityAction(user, (UUIDBased & EntityId) entityId, null, null, ActionType.TIMESERIES_UPDATED, BaseController.toException(t), timeseries);
                throw new RuntimeException(t);
            }
        });
    });
}
Also used : JsonObject(com.google.gson.JsonObject) Arrays(java.util.Arrays) CsvUtils(org.thingsboard.server.utils.CsvUtils) SneakyThrows(lombok.SneakyThrows) DonAsynchron(org.thingsboard.common.util.DonAsynchron) Autowired(org.springframework.beans.factory.annotation.Autowired) DefaultTenantProfileConfiguration(org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration) TelemetrySubscriptionService(org.thingsboard.server.service.telemetry.TelemetrySubscriptionService) StringUtils(org.apache.commons.lang3.StringUtils) TenantId(org.thingsboard.server.common.data.id.TenantId) BasicTsKvEntry(org.thingsboard.server.common.data.kv.BasicTsKvEntry) AttributeKvEntry(org.thingsboard.server.common.data.kv.AttributeKvEntry) PreDestroy(javax.annotation.PreDestroy) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) EntityType(org.thingsboard.server.common.data.EntityType) JsonConverter(org.thingsboard.server.common.transport.adaptor.JsonConverter) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) TypeCastUtil(org.thingsboard.server.utils.TypeCastUtil) HasTenantId(org.thingsboard.server.common.data.HasTenantId) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) ThingsBoardThreadFactory(org.thingsboard.common.util.ThingsBoardThreadFactory) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) Collectors(java.util.stream.Collectors) TsKvEntry(org.thingsboard.server.common.data.kv.TsKvEntry) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) Stream(java.util.stream.Stream) SecurityContext(org.springframework.security.core.context.SecurityContext) PostConstruct(javax.annotation.PostConstruct) HasId(org.thingsboard.server.common.data.id.HasId) Operation(org.thingsboard.server.service.security.permission.Operation) TbTenantProfileCache(org.thingsboard.server.dao.tenant.TbTenantProfileCache) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) TenantProfile(org.thingsboard.server.common.data.TenantProfile) ActionType(org.thingsboard.server.common.data.audit.ActionType) DataType(org.thingsboard.server.common.data.kv.DataType) EntityId(org.thingsboard.server.common.data.id.EntityId) BaseController(org.thingsboard.server.controller.BaseController) JsonPrimitive(com.google.gson.JsonPrimitive) UUIDBased(org.thingsboard.server.common.data.id.UUIDBased) Nullable(javax.annotation.Nullable) AccessValidator(org.thingsboard.server.service.security.AccessValidator) FutureCallback(com.google.common.util.concurrent.FutureCallback) ColumnMapping(org.thingsboard.server.service.importing.BulkImportRequest.ColumnMapping) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) EntityActionService(org.thingsboard.server.service.action.EntityActionService) Data(lombok.Data) Resource(org.thingsboard.server.service.security.permission.Resource) AccessControlService(org.thingsboard.server.service.security.permission.AccessControlService) BasicTsKvEntry(org.thingsboard.server.common.data.kv.BasicTsKvEntry) TsKvEntry(org.thingsboard.server.common.data.kv.TsKvEntry) BasicTsKvEntry(org.thingsboard.server.common.data.kv.BasicTsKvEntry) TenantProfile(org.thingsboard.server.common.data.TenantProfile) SneakyThrows(lombok.SneakyThrows)

Example 92 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class AccessValidator method validateRule.

private void validateRule(final SecurityUser currentUser, Operation operation, EntityId entityId, FutureCallback<ValidationResult> callback) {
    if (currentUser.isCustomerUser()) {
        callback.onSuccess(ValidationResult.accessDenied(CUSTOMER_USER_IS_NOT_ALLOWED_TO_PERFORM_THIS_OPERATION));
    } else {
        ListenableFuture<RuleNode> ruleNodeFuture = ruleChainService.findRuleNodeByIdAsync(currentUser.getTenantId(), new RuleNodeId(entityId.getId()));
        Futures.addCallback(ruleNodeFuture, getCallback(callback, ruleNodeTmp -> {
            RuleNode ruleNode = ruleNodeTmp;
            if (ruleNode == null) {
                return ValidationResult.entityNotFound("Rule node with requested id wasn't found!");
            } else if (ruleNode.getRuleChainId() == null) {
                return ValidationResult.entityNotFound("Rule chain with requested node id wasn't found!");
            } else {
                // TODO: make async
                RuleChain ruleChain = ruleChainService.findRuleChainById(currentUser.getTenantId(), ruleNode.getRuleChainId());
                try {
                    accessControlService.checkPermission(currentUser, Resource.RULE_CHAIN, operation, ruleNode.getRuleChainId(), ruleChain);
                } catch (ThingsboardException e) {
                    return ValidationResult.accessDenied(e.getMessage());
                }
                return ValidationResult.ok(ruleNode);
            }
        }), executor);
    }
}
Also used : Edge(org.thingsboard.server.common.data.edge.Edge) HttpValidationCallback(org.thingsboard.server.controller.HttpValidationCallback) Customer(org.thingsboard.server.common.data.Customer) Autowired(org.springframework.beans.factory.annotation.Autowired) DeviceProfileId(org.thingsboard.server.common.data.id.DeviceProfileId) RuleNodeId(org.thingsboard.server.common.data.id.RuleNodeId) TenantId(org.thingsboard.server.common.data.id.TenantId) ToErrorResponseEntity(org.thingsboard.server.service.telemetry.exception.ToErrorResponseEntity) PreDestroy(javax.annotation.PreDestroy) TenantService(org.thingsboard.server.dao.tenant.TenantService) Rpc(org.thingsboard.server.common.data.rpc.Rpc) ResourceService(org.thingsboard.server.dao.resource.ResourceService) RpcService(org.thingsboard.server.dao.rpc.RpcService) ApiUsageStateService(org.thingsboard.server.dao.usagerecord.ApiUsageStateService) EntityViewService(org.thingsboard.server.dao.entityview.EntityViewService) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException) EdgeId(org.thingsboard.server.common.data.id.EdgeId) AssetService(org.thingsboard.server.dao.asset.AssetService) DeviceId(org.thingsboard.server.common.data.id.DeviceId) Function(com.google.common.base.Function) DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) EdgeService(org.thingsboard.server.dao.edge.EdgeService) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) ThingsBoardThreadFactory(org.thingsboard.common.util.ThingsBoardThreadFactory) ApiUsageStateId(org.thingsboard.server.common.data.id.ApiUsageStateId) OtaPackageId(org.thingsboard.server.common.data.id.OtaPackageId) Executors(java.util.concurrent.Executors) EntityView(org.thingsboard.server.common.data.EntityView) PostConstruct(javax.annotation.PostConstruct) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) Operation(org.thingsboard.server.service.security.permission.Operation) EntityViewId(org.thingsboard.server.common.data.id.EntityViewId) CustomerId(org.thingsboard.server.common.data.id.CustomerId) OtaPackageService(org.thingsboard.server.dao.ota.OtaPackageService) UserService(org.thingsboard.server.dao.user.UserService) OtaPackageInfo(org.thingsboard.server.common.data.OtaPackageInfo) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Device(org.thingsboard.server.common.data.Device) DeferredResult(org.springframework.web.context.request.async.DeferredResult) AssetId(org.thingsboard.server.common.data.id.AssetId) Tenant(org.thingsboard.server.common.data.Tenant) RuleChainService(org.thingsboard.server.dao.rule.RuleChainService) User(org.thingsboard.server.common.data.User) EntityIdFactory(org.thingsboard.server.common.data.id.EntityIdFactory) DeviceService(org.thingsboard.server.dao.device.DeviceService) AlarmService(org.thingsboard.server.dao.alarm.AlarmService) EntityId(org.thingsboard.server.common.data.id.EntityId) BiConsumer(java.util.function.BiConsumer) CustomerService(org.thingsboard.server.dao.customer.CustomerService) Nullable(javax.annotation.Nullable) ExecutorService(java.util.concurrent.ExecutorService) RpcId(org.thingsboard.server.common.data.id.RpcId) RuleNode(org.thingsboard.server.common.data.rule.RuleNode) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) TbResourceId(org.thingsboard.server.common.data.id.TbResourceId) FutureCallback(com.google.common.util.concurrent.FutureCallback) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) DeviceProfileService(org.thingsboard.server.dao.device.DeviceProfileService) HttpStatus(org.springframework.http.HttpStatus) Futures(com.google.common.util.concurrent.Futures) Component(org.springframework.stereotype.Component) UserId(org.thingsboard.server.common.data.id.UserId) TbResourceInfo(org.thingsboard.server.common.data.TbResourceInfo) RuleChain(org.thingsboard.server.common.data.rule.RuleChain) Resource(org.thingsboard.server.service.security.permission.Resource) ResponseEntity(org.springframework.http.ResponseEntity) Asset(org.thingsboard.server.common.data.asset.Asset) AccessControlService(org.thingsboard.server.service.security.permission.AccessControlService) RuleChain(org.thingsboard.server.common.data.rule.RuleChain) RuleNode(org.thingsboard.server.common.data.rule.RuleNode) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) RuleNodeId(org.thingsboard.server.common.data.id.RuleNodeId)

Example 93 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class AccessValidator method validateRpc.

private void validateRpc(final SecurityUser currentUser, Operation operation, EntityId entityId, FutureCallback<ValidationResult> callback) {
    ListenableFuture<Rpc> rpcFurure = rpcService.findRpcByIdAsync(currentUser.getTenantId(), new RpcId(entityId.getId()));
    Futures.addCallback(rpcFurure, getCallback(callback, rpc -> {
        if (rpc == null) {
            return ValidationResult.entityNotFound("Rpc with requested id wasn't found!");
        } else {
            try {
                accessControlService.checkPermission(currentUser, Resource.RPC, operation, entityId, rpc);
            } catch (ThingsboardException e) {
                return ValidationResult.accessDenied(e.getMessage());
            }
            return ValidationResult.ok(rpc);
        }
    }), executor);
}
Also used : Edge(org.thingsboard.server.common.data.edge.Edge) HttpValidationCallback(org.thingsboard.server.controller.HttpValidationCallback) Customer(org.thingsboard.server.common.data.Customer) Autowired(org.springframework.beans.factory.annotation.Autowired) DeviceProfileId(org.thingsboard.server.common.data.id.DeviceProfileId) RuleNodeId(org.thingsboard.server.common.data.id.RuleNodeId) TenantId(org.thingsboard.server.common.data.id.TenantId) ToErrorResponseEntity(org.thingsboard.server.service.telemetry.exception.ToErrorResponseEntity) PreDestroy(javax.annotation.PreDestroy) TenantService(org.thingsboard.server.dao.tenant.TenantService) Rpc(org.thingsboard.server.common.data.rpc.Rpc) ResourceService(org.thingsboard.server.dao.resource.ResourceService) RpcService(org.thingsboard.server.dao.rpc.RpcService) ApiUsageStateService(org.thingsboard.server.dao.usagerecord.ApiUsageStateService) EntityViewService(org.thingsboard.server.dao.entityview.EntityViewService) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException) EdgeId(org.thingsboard.server.common.data.id.EdgeId) AssetService(org.thingsboard.server.dao.asset.AssetService) DeviceId(org.thingsboard.server.common.data.id.DeviceId) Function(com.google.common.base.Function) DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) EdgeService(org.thingsboard.server.dao.edge.EdgeService) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) ThingsBoardThreadFactory(org.thingsboard.common.util.ThingsBoardThreadFactory) ApiUsageStateId(org.thingsboard.server.common.data.id.ApiUsageStateId) OtaPackageId(org.thingsboard.server.common.data.id.OtaPackageId) Executors(java.util.concurrent.Executors) EntityView(org.thingsboard.server.common.data.EntityView) PostConstruct(javax.annotation.PostConstruct) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) Operation(org.thingsboard.server.service.security.permission.Operation) EntityViewId(org.thingsboard.server.common.data.id.EntityViewId) CustomerId(org.thingsboard.server.common.data.id.CustomerId) OtaPackageService(org.thingsboard.server.dao.ota.OtaPackageService) UserService(org.thingsboard.server.dao.user.UserService) OtaPackageInfo(org.thingsboard.server.common.data.OtaPackageInfo) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Device(org.thingsboard.server.common.data.Device) DeferredResult(org.springframework.web.context.request.async.DeferredResult) AssetId(org.thingsboard.server.common.data.id.AssetId) Tenant(org.thingsboard.server.common.data.Tenant) RuleChainService(org.thingsboard.server.dao.rule.RuleChainService) User(org.thingsboard.server.common.data.User) EntityIdFactory(org.thingsboard.server.common.data.id.EntityIdFactory) DeviceService(org.thingsboard.server.dao.device.DeviceService) AlarmService(org.thingsboard.server.dao.alarm.AlarmService) EntityId(org.thingsboard.server.common.data.id.EntityId) BiConsumer(java.util.function.BiConsumer) CustomerService(org.thingsboard.server.dao.customer.CustomerService) Nullable(javax.annotation.Nullable) ExecutorService(java.util.concurrent.ExecutorService) RpcId(org.thingsboard.server.common.data.id.RpcId) RuleNode(org.thingsboard.server.common.data.rule.RuleNode) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) TbResourceId(org.thingsboard.server.common.data.id.TbResourceId) FutureCallback(com.google.common.util.concurrent.FutureCallback) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) DeviceProfileService(org.thingsboard.server.dao.device.DeviceProfileService) HttpStatus(org.springframework.http.HttpStatus) Futures(com.google.common.util.concurrent.Futures) Component(org.springframework.stereotype.Component) UserId(org.thingsboard.server.common.data.id.UserId) TbResourceInfo(org.thingsboard.server.common.data.TbResourceInfo) RuleChain(org.thingsboard.server.common.data.rule.RuleChain) Resource(org.thingsboard.server.service.security.permission.Resource) ResponseEntity(org.springframework.http.ResponseEntity) Asset(org.thingsboard.server.common.data.asset.Asset) AccessControlService(org.thingsboard.server.service.security.permission.AccessControlService) Rpc(org.thingsboard.server.common.data.rpc.Rpc) RpcId(org.thingsboard.server.common.data.id.RpcId) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException)

Example 94 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class AccessValidator method validateDevice.

private void validateDevice(final SecurityUser currentUser, Operation operation, EntityId entityId, FutureCallback<ValidationResult> callback) {
    if (currentUser.isSystemAdmin()) {
        callback.onSuccess(ValidationResult.accessDenied(SYSTEM_ADMINISTRATOR_IS_NOT_ALLOWED_TO_PERFORM_THIS_OPERATION));
    } else {
        ListenableFuture<Device> deviceFuture = deviceService.findDeviceByIdAsync(currentUser.getTenantId(), new DeviceId(entityId.getId()));
        Futures.addCallback(deviceFuture, getCallback(callback, device -> {
            if (device == null) {
                return ValidationResult.entityNotFound(DEVICE_WITH_REQUESTED_ID_NOT_FOUND);
            } else {
                try {
                    accessControlService.checkPermission(currentUser, Resource.DEVICE, operation, entityId, device);
                } catch (ThingsboardException e) {
                    return ValidationResult.accessDenied(e.getMessage());
                }
                return ValidationResult.ok(device);
            }
        }), executor);
    }
}
Also used : Edge(org.thingsboard.server.common.data.edge.Edge) HttpValidationCallback(org.thingsboard.server.controller.HttpValidationCallback) Customer(org.thingsboard.server.common.data.Customer) Autowired(org.springframework.beans.factory.annotation.Autowired) DeviceProfileId(org.thingsboard.server.common.data.id.DeviceProfileId) RuleNodeId(org.thingsboard.server.common.data.id.RuleNodeId) TenantId(org.thingsboard.server.common.data.id.TenantId) ToErrorResponseEntity(org.thingsboard.server.service.telemetry.exception.ToErrorResponseEntity) PreDestroy(javax.annotation.PreDestroy) TenantService(org.thingsboard.server.dao.tenant.TenantService) Rpc(org.thingsboard.server.common.data.rpc.Rpc) ResourceService(org.thingsboard.server.dao.resource.ResourceService) RpcService(org.thingsboard.server.dao.rpc.RpcService) ApiUsageStateService(org.thingsboard.server.dao.usagerecord.ApiUsageStateService) EntityViewService(org.thingsboard.server.dao.entityview.EntityViewService) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException) EdgeId(org.thingsboard.server.common.data.id.EdgeId) AssetService(org.thingsboard.server.dao.asset.AssetService) DeviceId(org.thingsboard.server.common.data.id.DeviceId) Function(com.google.common.base.Function) DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) EdgeService(org.thingsboard.server.dao.edge.EdgeService) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) ThingsBoardThreadFactory(org.thingsboard.common.util.ThingsBoardThreadFactory) ApiUsageStateId(org.thingsboard.server.common.data.id.ApiUsageStateId) OtaPackageId(org.thingsboard.server.common.data.id.OtaPackageId) Executors(java.util.concurrent.Executors) EntityView(org.thingsboard.server.common.data.EntityView) PostConstruct(javax.annotation.PostConstruct) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) Operation(org.thingsboard.server.service.security.permission.Operation) EntityViewId(org.thingsboard.server.common.data.id.EntityViewId) CustomerId(org.thingsboard.server.common.data.id.CustomerId) OtaPackageService(org.thingsboard.server.dao.ota.OtaPackageService) UserService(org.thingsboard.server.dao.user.UserService) OtaPackageInfo(org.thingsboard.server.common.data.OtaPackageInfo) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Device(org.thingsboard.server.common.data.Device) DeferredResult(org.springframework.web.context.request.async.DeferredResult) AssetId(org.thingsboard.server.common.data.id.AssetId) Tenant(org.thingsboard.server.common.data.Tenant) RuleChainService(org.thingsboard.server.dao.rule.RuleChainService) User(org.thingsboard.server.common.data.User) EntityIdFactory(org.thingsboard.server.common.data.id.EntityIdFactory) DeviceService(org.thingsboard.server.dao.device.DeviceService) AlarmService(org.thingsboard.server.dao.alarm.AlarmService) EntityId(org.thingsboard.server.common.data.id.EntityId) BiConsumer(java.util.function.BiConsumer) CustomerService(org.thingsboard.server.dao.customer.CustomerService) Nullable(javax.annotation.Nullable) ExecutorService(java.util.concurrent.ExecutorService) RpcId(org.thingsboard.server.common.data.id.RpcId) RuleNode(org.thingsboard.server.common.data.rule.RuleNode) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) TbResourceId(org.thingsboard.server.common.data.id.TbResourceId) FutureCallback(com.google.common.util.concurrent.FutureCallback) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) DeviceProfileService(org.thingsboard.server.dao.device.DeviceProfileService) HttpStatus(org.springframework.http.HttpStatus) Futures(com.google.common.util.concurrent.Futures) Component(org.springframework.stereotype.Component) UserId(org.thingsboard.server.common.data.id.UserId) TbResourceInfo(org.thingsboard.server.common.data.TbResourceInfo) RuleChain(org.thingsboard.server.common.data.rule.RuleChain) Resource(org.thingsboard.server.service.security.permission.Resource) ResponseEntity(org.springframework.http.ResponseEntity) Asset(org.thingsboard.server.common.data.asset.Asset) AccessControlService(org.thingsboard.server.service.security.permission.AccessControlService) Device(org.thingsboard.server.common.data.Device) DeviceId(org.thingsboard.server.common.data.id.DeviceId) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException)

Example 95 with FutureCallback

use of com.google.common.util.concurrent.FutureCallback in project thingsboard by thingsboard.

the class AccessValidator method validateResource.

private void validateResource(SecurityUser currentUser, Operation operation, EntityId entityId, FutureCallback<ValidationResult> callback) {
    ListenableFuture<TbResourceInfo> resourceFuture = resourceService.findResourceInfoByIdAsync(currentUser.getTenantId(), new TbResourceId(entityId.getId()));
    Futures.addCallback(resourceFuture, getCallback(callback, resource -> {
        if (resource == null) {
            return ValidationResult.entityNotFound("Resource with requested id wasn't found!");
        } else {
            try {
                accessControlService.checkPermission(currentUser, Resource.TB_RESOURCE, operation, entityId, resource);
            } catch (ThingsboardException e) {
                return ValidationResult.accessDenied(e.getMessage());
            }
            return ValidationResult.ok(resource);
        }
    }), executor);
}
Also used : Edge(org.thingsboard.server.common.data.edge.Edge) HttpValidationCallback(org.thingsboard.server.controller.HttpValidationCallback) Customer(org.thingsboard.server.common.data.Customer) Autowired(org.springframework.beans.factory.annotation.Autowired) DeviceProfileId(org.thingsboard.server.common.data.id.DeviceProfileId) RuleNodeId(org.thingsboard.server.common.data.id.RuleNodeId) TenantId(org.thingsboard.server.common.data.id.TenantId) ToErrorResponseEntity(org.thingsboard.server.service.telemetry.exception.ToErrorResponseEntity) PreDestroy(javax.annotation.PreDestroy) TenantService(org.thingsboard.server.dao.tenant.TenantService) Rpc(org.thingsboard.server.common.data.rpc.Rpc) ResourceService(org.thingsboard.server.dao.resource.ResourceService) RpcService(org.thingsboard.server.dao.rpc.RpcService) ApiUsageStateService(org.thingsboard.server.dao.usagerecord.ApiUsageStateService) EntityViewService(org.thingsboard.server.dao.entityview.EntityViewService) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException) EdgeId(org.thingsboard.server.common.data.id.EdgeId) AssetService(org.thingsboard.server.dao.asset.AssetService) DeviceId(org.thingsboard.server.common.data.id.DeviceId) Function(com.google.common.base.Function) DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) EdgeService(org.thingsboard.server.dao.edge.EdgeService) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) ThingsBoardThreadFactory(org.thingsboard.common.util.ThingsBoardThreadFactory) ApiUsageStateId(org.thingsboard.server.common.data.id.ApiUsageStateId) OtaPackageId(org.thingsboard.server.common.data.id.OtaPackageId) Executors(java.util.concurrent.Executors) EntityView(org.thingsboard.server.common.data.EntityView) PostConstruct(javax.annotation.PostConstruct) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) Operation(org.thingsboard.server.service.security.permission.Operation) EntityViewId(org.thingsboard.server.common.data.id.EntityViewId) CustomerId(org.thingsboard.server.common.data.id.CustomerId) OtaPackageService(org.thingsboard.server.dao.ota.OtaPackageService) UserService(org.thingsboard.server.dao.user.UserService) OtaPackageInfo(org.thingsboard.server.common.data.OtaPackageInfo) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Device(org.thingsboard.server.common.data.Device) DeferredResult(org.springframework.web.context.request.async.DeferredResult) AssetId(org.thingsboard.server.common.data.id.AssetId) Tenant(org.thingsboard.server.common.data.Tenant) RuleChainService(org.thingsboard.server.dao.rule.RuleChainService) User(org.thingsboard.server.common.data.User) EntityIdFactory(org.thingsboard.server.common.data.id.EntityIdFactory) DeviceService(org.thingsboard.server.dao.device.DeviceService) AlarmService(org.thingsboard.server.dao.alarm.AlarmService) EntityId(org.thingsboard.server.common.data.id.EntityId) BiConsumer(java.util.function.BiConsumer) CustomerService(org.thingsboard.server.dao.customer.CustomerService) Nullable(javax.annotation.Nullable) ExecutorService(java.util.concurrent.ExecutorService) RpcId(org.thingsboard.server.common.data.id.RpcId) RuleNode(org.thingsboard.server.common.data.rule.RuleNode) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) TbResourceId(org.thingsboard.server.common.data.id.TbResourceId) FutureCallback(com.google.common.util.concurrent.FutureCallback) ApiUsageState(org.thingsboard.server.common.data.ApiUsageState) DeviceProfileService(org.thingsboard.server.dao.device.DeviceProfileService) HttpStatus(org.springframework.http.HttpStatus) Futures(com.google.common.util.concurrent.Futures) Component(org.springframework.stereotype.Component) UserId(org.thingsboard.server.common.data.id.UserId) TbResourceInfo(org.thingsboard.server.common.data.TbResourceInfo) RuleChain(org.thingsboard.server.common.data.rule.RuleChain) Resource(org.thingsboard.server.service.security.permission.Resource) ResponseEntity(org.springframework.http.ResponseEntity) Asset(org.thingsboard.server.common.data.asset.Asset) AccessControlService(org.thingsboard.server.service.security.permission.AccessControlService) TbResourceInfo(org.thingsboard.server.common.data.TbResourceInfo) TbResourceId(org.thingsboard.server.common.data.id.TbResourceId) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException)

Aggregations

FutureCallback (com.google.common.util.concurrent.FutureCallback)98 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)56 List (java.util.List)48 Futures (com.google.common.util.concurrent.Futures)43 ArrayList (java.util.ArrayList)41 Nullable (javax.annotation.Nullable)38 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)26 Map (java.util.Map)25 Set (java.util.Set)25 TimeUnit (java.util.concurrent.TimeUnit)24 IOException (java.io.IOException)23 Collectors (java.util.stream.Collectors)23 PostConstruct (javax.annotation.PostConstruct)23 ExecutorService (java.util.concurrent.ExecutorService)22 Function (com.google.common.base.Function)21 Collections (java.util.Collections)21 TenantId (org.thingsboard.server.common.data.id.TenantId)21 PreDestroy (javax.annotation.PreDestroy)20 Logger (org.slf4j.Logger)19 LoggerFactory (org.slf4j.LoggerFactory)19