Search in sources :

Example 1 with SORT_ORDER_ALLOWABLE_VALUES

use of org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES in project thingsboard by thingsboard.

the class TelemetryController method getTimeseries.

@ApiOperation(value = "Get time-series data (getTimeseries)", notes = "Returns a range of time-series values for specified entity. " + "Returns not aggregated data by default. " + "Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. " + "The aggregation is generally more efficient then fetching all records. \n\n" + MARKDOWN_CODE_BLOCK_START + TS_STRICT_DATA_EXAMPLE + MARKDOWN_CODE_BLOCK_END + "\n\n" + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/{entityType}/{entityId}/values/timeseries", method = RequestMethod.GET, params = { "keys", "startTs", "endTs" })
@ResponseBody
public DeferredResult<ResponseEntity> getTimeseries(@ApiParam(value = ENTITY_TYPE_PARAM_DESCRIPTION, required = true, defaultValue = "DEVICE") @PathVariable("entityType") String entityType, @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @PathVariable("entityId") String entityIdStr, @ApiParam(value = TELEMETRY_KEYS_BASE_DESCRIPTION, required = true) @RequestParam(name = "keys") String keys, @ApiParam(value = "A long value representing the start timestamp of the time range in milliseconds, UTC.") @RequestParam(name = "startTs") Long startTs, @ApiParam(value = "A long value representing the end timestamp of the time range in milliseconds, UTC.") @RequestParam(name = "endTs") Long endTs, @ApiParam(value = "A long value representing the aggregation interval range in milliseconds.") @RequestParam(name = "interval", defaultValue = "0") Long interval, @ApiParam(value = "An integer value that represents a max number of timeseries data points to fetch." + " This parameter is used only in the case if 'agg' parameter is set to 'NONE'.", defaultValue = "100") @RequestParam(name = "limit", defaultValue = "100") Integer limit, @ApiParam(value = "A string value representing the aggregation function. " + "If the interval is not specified, 'agg' parameter will use 'NONE' value.", allowableValues = "MIN, MAX, AVG, SUM, COUNT, NONE") @RequestParam(name = "agg", defaultValue = "NONE") String aggStr, @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) @RequestParam(name = "orderBy", defaultValue = "DESC") String orderBy, @ApiParam(value = STRICT_DATA_TYPES_DESCRIPTION) @RequestParam(name = "useStrictDataTypes", required = false, defaultValue = "false") Boolean useStrictDataTypes) throws ThingsboardException {
    try {
        return accessValidator.validateEntityAndCallback(getCurrentUser(), Operation.READ_TELEMETRY, entityType, entityIdStr, (result, tenantId, entityId) -> {
            // If interval is 0, convert this to a NONE aggregation, which is probably what the user really wanted
            Aggregation agg = interval == 0L ? Aggregation.valueOf(Aggregation.NONE.name()) : Aggregation.valueOf(aggStr);
            List<ReadTsKvQuery> queries = toKeysList(keys).stream().map(key -> new BaseReadTsKvQuery(key, startTs, endTs, interval, limit, agg, orderBy)).collect(Collectors.toList());
            Futures.addCallback(tsService.findAll(tenantId, entityId, queries), getTsKvListCallback(result, useStrictDataTypes), MoreExecutors.directExecutor());
        });
    } catch (Exception e) {
        throw handleException(e);
    }
}
Also used : Aggregation(org.thingsboard.server.common.data.kv.Aggregation) TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH) RequestParam(org.springframework.web.bind.annotation.RequestParam) Arrays(java.util.Arrays) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) BaseDeleteTsKvQuery(org.thingsboard.server.common.data.kv.BaseDeleteTsKvQuery) TsData(org.thingsboard.server.service.telemetry.TsData) ENTITY_TYPE_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ENTITY_TYPE_PARAM_DESCRIPTION) SORT_ORDER_ALLOWABLE_VALUES(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES) ApiParam(io.swagger.annotations.ApiParam) Autowired(org.springframework.beans.factory.annotation.Autowired) STRICT_DATA_TYPES_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.STRICT_DATA_TYPES_DESCRIPTION) TenantId(org.thingsboard.server.common.data.id.TenantId) Map(java.util.Map) SAVE_ENTITY_TIMESERIES_STATUS_UNAUTHORIZED(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_TIMESERIES_STATUS_UNAUTHORIZED) SAVE_ATTIRIBUTES_STATUS_OK(org.thingsboard.server.controller.ControllerConstants.SAVE_ATTIRIBUTES_STATUS_OK) JsonConverter(org.thingsboard.server.common.transport.adaptor.JsonConverter) INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION) JsonNode(com.fasterxml.jackson.databind.JsonNode) ATTRIBUTES_KEYS_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_KEYS_DESCRIPTION) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) Set(java.util.Set) RestController(org.springframework.web.bind.annotation.RestController) DeleteTsKvQuery(org.thingsboard.server.common.data.kv.DeleteTsKvQuery) Executors(java.util.concurrent.Executors) TsKvEntry(org.thingsboard.server.common.data.kv.TsKvEntry) Slf4j(lombok.extern.slf4j.Slf4j) Operation(org.thingsboard.server.service.security.permission.Operation) BooleanDataEntry(org.thingsboard.server.common.data.kv.BooleanDataEntry) DeferredResult(org.springframework.web.context.request.async.DeferredResult) TELEMETRY_KEYS_BASE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TELEMETRY_KEYS_BASE_DESCRIPTION) JsonParser(com.google.gson.JsonParser) DEVICE_ID(org.thingsboard.server.controller.ControllerConstants.DEVICE_ID) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) RequestBody(org.springframework.web.bind.annotation.RequestBody) LinkedHashMap(java.util.LinkedHashMap) EntityIdFactory(org.thingsboard.server.common.data.id.EntityIdFactory) DEVICE_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DEVICE_ID_PARAM_DESCRIPTION) DataType(org.thingsboard.server.common.data.kv.DataType) SAVE_ATTRIBUTES_REQUEST_PAYLOAD(org.thingsboard.server.controller.ControllerConstants.SAVE_ATTRIBUTES_REQUEST_PAYLOAD) Nullable(javax.annotation.Nullable) DataConstants(org.thingsboard.server.common.data.DataConstants) ATTRIBUTES_JSON_REQUEST_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_JSON_REQUEST_DESCRIPTION) ConstraintValidator(org.thingsboard.server.dao.service.ConstraintValidator) ATTRIBUTES_SCOPE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_SCOPE_DESCRIPTION) BaseAttributeKvEntry(org.thingsboard.server.common.data.kv.BaseAttributeKvEntry) FutureCallback(com.google.common.util.concurrent.FutureCallback) HttpStatus(org.springframework.http.HttpStatus) Futures(com.google.common.util.concurrent.Futures) SAVE_ENTITY_ATTRIBUTES_STATUS_UNAUTHORIZED(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_ATTRIBUTES_STATUS_UNAUTHORIZED) ApiResponse(io.swagger.annotations.ApiResponse) MARKDOWN_CODE_BLOCK_START(org.thingsboard.server.controller.ControllerConstants.MARKDOWN_CODE_BLOCK_START) ReadTsKvQuery(org.thingsboard.server.common.data.kv.ReadTsKvQuery) ENTITY_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ENTITY_ID_PARAM_DESCRIPTION) StringDataEntry(org.thingsboard.server.common.data.kv.StringDataEntry) PathVariable(org.springframework.web.bind.annotation.PathVariable) SAVE_ENTITY_ATTRIBUTES_STATUS_INTERNAL_SERVER_ERROR(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_ATTRIBUTES_STATUS_INTERNAL_SERVER_ERROR) SAVE_ENTITY_TIMESERIES_STATUS_INTERNAL_SERVER_ERROR(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_TIMESERIES_STATUS_INTERNAL_SERVER_ERROR) DefaultTenantProfileConfiguration(org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration) BasicTsKvEntry(org.thingsboard.server.common.data.kv.BasicTsKvEntry) ApiOperation(io.swagger.annotations.ApiOperation) AttributeKvEntry(org.thingsboard.server.common.data.kv.AttributeKvEntry) PreDestroy(javax.annotation.PreDestroy) INVALID_STRUCTURE_OF_THE_REQUEST(org.thingsboard.server.controller.ControllerConstants.INVALID_STRUCTURE_OF_THE_REQUEST) EntityType(org.thingsboard.server.common.data.EntityType) TS_STRICT_DATA_EXAMPLE(org.thingsboard.server.controller.ControllerConstants.TS_STRICT_DATA_EXAMPLE) DeviceAttributesEventNotificationMsg(org.thingsboard.rule.engine.api.msg.DeviceAttributesEventNotificationMsg) BaseReadTsKvQuery(org.thingsboard.server.common.data.kv.BaseReadTsKvQuery) DeviceId(org.thingsboard.server.common.data.id.DeviceId) Function(com.google.common.base.Function) MARKDOWN_CODE_BLOCK_END(org.thingsboard.server.controller.ControllerConstants.MARKDOWN_CODE_BLOCK_END) AttributeData(org.thingsboard.server.service.telemetry.AttributeData) MediaType(org.springframework.http.MediaType) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) TimeseriesService(org.thingsboard.server.dao.timeseries.TimeseriesService) ThingsBoardThreadFactory(org.thingsboard.common.util.ThingsBoardThreadFactory) UncheckedApiException(org.thingsboard.server.service.telemetry.exception.UncheckedApiException) LATEST_TS_NON_STRICT_DATA_EXAMPLE(org.thingsboard.server.controller.ControllerConstants.LATEST_TS_NON_STRICT_DATA_EXAMPLE) Collectors(java.util.stream.Collectors) TELEMETRY_KEYS_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TELEMETRY_KEYS_DESCRIPTION) TELEMETRY_JSON_REQUEST_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TELEMETRY_JSON_REQUEST_DESCRIPTION) List(java.util.List) KvEntry(org.thingsboard.server.common.data.kv.KvEntry) PostConstruct(javax.annotation.PostConstruct) TELEMETRY_SCOPE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TELEMETRY_SCOPE_DESCRIPTION) SAVE_ATTIRIBUTES_STATUS_BAD_REQUEST(org.thingsboard.server.controller.ControllerConstants.SAVE_ATTIRIBUTES_STATUS_BAD_REQUEST) SORT_ORDER_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_DESCRIPTION) LongDataEntry(org.thingsboard.server.common.data.kv.LongDataEntry) JsonParseException(com.google.gson.JsonParseException) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) ATTRIBUTE_DATA_EXAMPLE(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTE_DATA_EXAMPLE) SAVE_TIMESERIES_REQUEST_PAYLOAD(org.thingsboard.server.controller.ControllerConstants.SAVE_TIMESERIES_REQUEST_PAYLOAD) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) SAVE_ENTITY_ATTRIBUTES_STATUS_OK(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_ATTRIBUTES_STATUS_OK) JacksonUtil(org.thingsboard.common.util.JacksonUtil) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ApiResponses(io.swagger.annotations.ApiResponses) JsonElement(com.google.gson.JsonElement) HashSet(java.util.HashSet) TenantProfile(org.thingsboard.server.common.data.TenantProfile) ActionType(org.thingsboard.server.common.data.audit.ActionType) TbCoreComponent(org.thingsboard.server.queue.util.TbCoreComponent) EntityId(org.thingsboard.server.common.data.id.EntityId) UUIDBased(org.thingsboard.server.common.data.id.UUIDBased) DoubleDataEntry(org.thingsboard.server.common.data.kv.DoubleDataEntry) ExecutorService(java.util.concurrent.ExecutorService) AttributeKey(org.thingsboard.server.common.data.kv.AttributeKey) ATTRIBUTES_SCOPE_ALLOWED_VALUES(org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_SCOPE_ALLOWED_VALUES) AccessValidator(org.thingsboard.server.service.security.AccessValidator) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) Aggregation(org.thingsboard.server.common.data.kv.Aggregation) LATEST_TS_STRICT_DATA_EXAMPLE(org.thingsboard.server.controller.ControllerConstants.LATEST_TS_STRICT_DATA_EXAMPLE) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) SAVE_ENTITY_TIMESERIES_STATUS_OK(org.thingsboard.server.controller.ControllerConstants.SAVE_ENTITY_TIMESERIES_STATUS_OK) InvalidParametersException(org.thingsboard.server.service.telemetry.exception.InvalidParametersException) TimeUnit(java.util.concurrent.TimeUnit) JsonDataEntry(org.thingsboard.server.common.data.kv.JsonDataEntry) ResponseEntity(org.springframework.http.ResponseEntity) ENTITY_ATTRIBUTE_SCOPES(org.thingsboard.server.controller.ControllerConstants.ENTITY_ATTRIBUTE_SCOPES) StringUtils(org.springframework.util.StringUtils) ReadTsKvQuery(org.thingsboard.server.common.data.kv.ReadTsKvQuery) BaseReadTsKvQuery(org.thingsboard.server.common.data.kv.BaseReadTsKvQuery) BaseReadTsKvQuery(org.thingsboard.server.common.data.kv.BaseReadTsKvQuery) UncheckedApiException(org.thingsboard.server.service.telemetry.exception.UncheckedApiException) JsonParseException(com.google.gson.JsonParseException) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) InvalidParametersException(org.thingsboard.server.service.telemetry.exception.InvalidParametersException) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with SORT_ORDER_ALLOWABLE_VALUES

use of org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES in project thingsboard by thingsboard.

the class DashboardController method getEdgeDashboards.

@ApiOperation(value = "Get Edge Dashboards (getEdgeDashboards)", notes = "Returns a page of dashboard info objects assigned to the specified edge. " + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/edge/{edgeId}/dashboards", params = { "pageSize", "page" }, method = RequestMethod.GET)
@ResponseBody
public PageData<DashboardInfo> getEdgeDashboards(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) @PathVariable(EDGE_ID) String strEdgeId, @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) @RequestParam int pageSize, @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) @RequestParam int page, @ApiParam(value = DASHBOARD_TEXT_SEARCH_DESCRIPTION) @RequestParam(required = false) String textSearch, @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = DASHBOARD_SORT_PROPERTY_ALLOWABLE_VALUES) @RequestParam(required = false) String sortProperty, @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) @RequestParam(required = false) String sortOrder) throws ThingsboardException {
    checkParameter("edgeId", strEdgeId);
    try {
        TenantId tenantId = getCurrentUser().getTenantId();
        EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
        checkEdgeId(edgeId, Operation.READ);
        PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder);
        PageData<DashboardInfo> nonFilteredResult = dashboardService.findDashboardsByTenantIdAndEdgeId(tenantId, edgeId, pageLink);
        List<DashboardInfo> filteredDashboards = nonFilteredResult.getData().stream().filter(dashboardInfo -> {
            try {
                accessControlService.checkPermission(getCurrentUser(), Resource.DASHBOARD, Operation.READ, dashboardInfo.getId(), dashboardInfo);
                return true;
            } catch (ThingsboardException e) {
                return false;
            }
        }).collect(Collectors.toList());
        PageData<DashboardInfo> filteredResult = new PageData<>(filteredDashboards, nonFilteredResult.getTotalPages(), nonFilteredResult.getTotalElements(), nonFilteredResult.hasNext());
        return checkNotNull(filteredResult);
    } catch (Exception e) {
        throw handleException(e);
    }
}
Also used : TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH) PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) Edge(org.thingsboard.server.common.data.edge.Edge) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Customer(org.thingsboard.server.common.data.Customer) DASHBOARD_SORT_PROPERTY_ALLOWABLE_VALUES(org.thingsboard.server.controller.ControllerConstants.DASHBOARD_SORT_PROPERTY_ALLOWABLE_VALUES) SORT_ORDER_ALLOWABLE_VALUES(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES) ApiParam(io.swagger.annotations.ApiParam) CUSTOMER_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.CUSTOMER_ID_PARAM_DESCRIPTION) TenantId(org.thingsboard.server.common.data.id.TenantId) ApiOperation(io.swagger.annotations.ApiOperation) EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION) Example(io.swagger.annotations.Example) EntityType(org.thingsboard.server.common.data.EntityType) CUSTOMER_ID(org.thingsboard.server.controller.ControllerConstants.CUSTOMER_ID) JsonNode(com.fasterxml.jackson.databind.JsonNode) EdgeId(org.thingsboard.server.common.data.id.EdgeId) Dashboard(org.thingsboard.server.common.data.Dashboard) TENANT_ID(org.thingsboard.server.controller.ControllerConstants.TENANT_ID) PageLink(org.thingsboard.server.common.data.page.PageLink) DashboardInfo(org.thingsboard.server.common.data.DashboardInfo) TENANT_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.TENANT_AUTHORITY_PARAGRAPH) MediaType(org.springframework.http.MediaType) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) EDGE_ID(org.thingsboard.server.controller.ControllerConstants.EDGE_ID) PAGE_DATA_PARAMETERS(org.thingsboard.server.controller.ControllerConstants.PAGE_DATA_PARAMETERS) UUID_WIKI_LINK(org.thingsboard.server.controller.ControllerConstants.UUID_WIKI_LINK) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) Set(java.util.Set) RestController(org.springframework.web.bind.annotation.RestController) Collectors(java.util.stream.Collectors) EdgeEventActionType(org.thingsboard.server.common.data.edge.EdgeEventActionType) List(java.util.List) EDGE_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ID_PARAM_DESCRIPTION) Operation(org.thingsboard.server.service.security.permission.Operation) SORT_ORDER_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_DESCRIPTION) TENANT_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TENANT_ID_PARAM_DESCRIPTION) PAGE_NUMBER_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.PAGE_NUMBER_DESCRIPTION) CustomerId(org.thingsboard.server.common.data.id.CustomerId) SORT_PROPERTY_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.SORT_PROPERTY_DESCRIPTION) JacksonUtil(org.thingsboard.common.util.JacksonUtil) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ShortCustomerInfo(org.thingsboard.server.common.data.ShortCustomerInfo) Tenant(org.thingsboard.server.common.data.Tenant) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Value(org.springframework.beans.factory.annotation.Value) RequestBody(org.springframework.web.bind.annotation.RequestBody) HashSet(java.util.HashSet) DASHBOARD_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DASHBOARD_ID_PARAM_DESCRIPTION) User(org.thingsboard.server.common.data.User) HomeDashboard(org.thingsboard.server.common.data.HomeDashboard) ActionType(org.thingsboard.server.common.data.audit.ActionType) TbCoreComponent(org.thingsboard.server.queue.util.TbCoreComponent) PAGE_SIZE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.PAGE_SIZE_DESCRIPTION) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) HomeDashboardInfo(org.thingsboard.server.common.data.HomeDashboardInfo) DashboardId(org.thingsboard.server.common.data.id.DashboardId) DASHBOARD_TEXT_SEARCH_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DASHBOARD_TEXT_SEARCH_DESCRIPTION) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) SYSTEM_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.SYSTEM_AUTHORITY_PARAGRAPH) HttpStatus(org.springframework.http.HttpStatus) EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION) EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION) ApiResponse(io.swagger.annotations.ApiResponse) ExampleProperty(io.swagger.annotations.ExampleProperty) PageData(org.thingsboard.server.common.data.page.PageData) Resource(org.thingsboard.server.service.security.permission.Resource) TenantId(org.thingsboard.server.common.data.id.TenantId) PageData(org.thingsboard.server.common.data.page.PageData) EdgeId(org.thingsboard.server.common.data.id.EdgeId) PageLink(org.thingsboard.server.common.data.page.PageLink) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) DashboardInfo(org.thingsboard.server.common.data.DashboardInfo) HomeDashboardInfo(org.thingsboard.server.common.data.HomeDashboardInfo) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with SORT_ORDER_ALLOWABLE_VALUES

use of org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES in project thingsboard by thingsboard.

the class DeviceController method getEdgeDevices.

@ApiOperation(value = "Get devices assigned to edge (getEdgeDevices)", notes = "Returns a page of devices assigned to edge. " + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/edge/{edgeId}/devices", params = { "pageSize", "page" }, method = RequestMethod.GET)
@ResponseBody
public PageData<Device> getEdgeDevices(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) @PathVariable(EDGE_ID) String strEdgeId, @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) @RequestParam int pageSize, @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) @RequestParam int page, @ApiParam(value = DEVICE_TYPE_DESCRIPTION) @RequestParam(required = false) String type, @ApiParam(value = DEVICE_TEXT_SEARCH_DESCRIPTION) @RequestParam(required = false) String textSearch, @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = DEVICE_SORT_PROPERTY_ALLOWABLE_VALUES) @RequestParam(required = false) String sortProperty, @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) @RequestParam(required = false) String sortOrder, @ApiParam(value = "Timestamp. Devices with creation time before it won't be queried") @RequestParam(required = false) Long startTime, @ApiParam(value = "Timestamp. Devices with creation time after it won't be queried") @RequestParam(required = false) Long endTime) throws ThingsboardException {
    checkParameter(EDGE_ID, strEdgeId);
    try {
        TenantId tenantId = getCurrentUser().getTenantId();
        EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
        checkEdgeId(edgeId, Operation.READ);
        TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime);
        PageData<Device> nonFilteredResult;
        if (type != null && type.trim().length() > 0) {
            nonFilteredResult = deviceService.findDevicesByTenantIdAndEdgeIdAndType(tenantId, edgeId, type, pageLink);
        } else {
            nonFilteredResult = deviceService.findDevicesByTenantIdAndEdgeId(tenantId, edgeId, pageLink);
        }
        List<Device> filteredDevices = nonFilteredResult.getData().stream().filter(device -> {
            try {
                accessControlService.checkPermission(getCurrentUser(), Resource.DEVICE, Operation.READ, device.getId(), device);
                return true;
            } catch (ThingsboardException e) {
                return false;
            }
        }).collect(Collectors.toList());
        PageData<Device> filteredResult = new PageData<>(filteredDevices, nonFilteredResult.getTotalPages(), nonFilteredResult.getTotalElements(), nonFilteredResult.hasNext());
        return checkNotNull(filteredResult);
    } catch (Exception e) {
        throw handleException(e);
    }
}
Also used : TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH) RequestParam(org.springframework.web.bind.annotation.RequestParam) DeviceInfo(org.thingsboard.server.common.data.DeviceInfo) DEVICE_INFO_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DEVICE_INFO_DESCRIPTION) Edge(org.thingsboard.server.common.data.edge.Edge) DEVICE_WITH_DEVICE_CREDENTIALS_PARAM_DESCRIPTION_MARKDOWN(org.thingsboard.server.controller.ControllerConstants.DEVICE_WITH_DEVICE_CREDENTIALS_PARAM_DESCRIPTION_MARKDOWN) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) SORT_ORDER_ALLOWABLE_VALUES(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES) ApiParam(io.swagger.annotations.ApiParam) CUSTOMER_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.CUSTOMER_ID_PARAM_DESCRIPTION) TenantId(org.thingsboard.server.common.data.id.TenantId) CUSTOMER_ID(org.thingsboard.server.controller.ControllerConstants.CUSTOMER_ID) DeviceCredentialsUpdateNotificationMsg(org.thingsboard.rule.engine.api.msg.DeviceCredentialsUpdateNotificationMsg) PostMapping(org.springframework.web.bind.annotation.PostMapping) PageLink(org.thingsboard.server.common.data.page.PageLink) TENANT_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.TENANT_AUTHORITY_PARAGRAPH) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) RestController(org.springframework.web.bind.annotation.RestController) EdgeEventActionType(org.thingsboard.server.common.data.edge.EdgeEventActionType) Slf4j(lombok.extern.slf4j.Slf4j) BulkImportResult(org.thingsboard.server.service.importing.BulkImportResult) GatewayNotificationsService(org.thingsboard.server.service.gateway_device.GatewayNotificationsService) Operation(org.thingsboard.server.service.security.permission.Operation) DeviceSearchQuery(org.thingsboard.server.common.data.device.DeviceSearchQuery) TENANT_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.TENANT_ID_PARAM_DESCRIPTION) TbMsg(org.thingsboard.server.common.msg.TbMsg) Device(org.thingsboard.server.common.data.Device) DEVICE_PROFILE_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DEVICE_PROFILE_ID_PARAM_DESCRIPTION) DeferredResult(org.springframework.web.context.request.async.DeferredResult) SaveDeviceWithCredentialsRequest(org.thingsboard.server.common.data.SaveDeviceWithCredentialsRequest) ArrayList(java.util.ArrayList) RequestBody(org.springframework.web.bind.annotation.RequestBody) DEVICE_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DEVICE_ID_PARAM_DESCRIPTION) DEVICE_TEXT_SEARCH_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DEVICE_TEXT_SEARCH_DESCRIPTION) Nullable(javax.annotation.Nullable) DataConstants(org.thingsboard.server.common.data.DataConstants) EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION) DeviceCredentials(org.thingsboard.server.common.data.security.DeviceCredentials) IOException(java.io.IOException) DEVICE_SORT_PROPERTY_ALLOWABLE_VALUES(org.thingsboard.server.controller.ControllerConstants.DEVICE_SORT_PROPERTY_ALLOWABLE_VALUES) FutureCallback(com.google.common.util.concurrent.FutureCallback) OtaPackageType(org.thingsboard.server.common.data.ota.OtaPackageType) DEVICE_TYPE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DEVICE_TYPE_DESCRIPTION) HttpStatus(org.springframework.http.HttpStatus) Futures(com.google.common.util.concurrent.Futures) EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION) PageData(org.thingsboard.server.common.data.page.PageData) Resource(org.thingsboard.server.service.security.permission.Resource) PathVariable(org.springframework.web.bind.annotation.PathVariable) TimePageLink(org.thingsboard.server.common.data.page.TimePageLink) CUSTOMER_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.CUSTOMER_AUTHORITY_PARAGRAPH) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Customer(org.thingsboard.server.common.data.Customer) DeviceProfileId(org.thingsboard.server.common.data.id.DeviceProfileId) TbMsgMetaData(org.thingsboard.server.common.msg.TbMsgMetaData) ClaimResponse(org.thingsboard.server.dao.device.claim.ClaimResponse) DeviceBulkImportService(org.thingsboard.server.service.device.DeviceBulkImportService) ApiOperation(io.swagger.annotations.ApiOperation) EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION) EntityType(org.thingsboard.server.common.data.EntityType) ReclaimResult(org.thingsboard.server.dao.device.claim.ReclaimResult) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException) EdgeId(org.thingsboard.server.common.data.id.EdgeId) ClaimRequest(org.thingsboard.server.common.data.ClaimRequest) DeviceId(org.thingsboard.server.common.data.id.DeviceId) MediaType(org.springframework.http.MediaType) PAGE_DATA_PARAMETERS(org.thingsboard.server.controller.ControllerConstants.PAGE_DATA_PARAMETERS) UUID_WIKI_LINK(org.thingsboard.server.controller.ControllerConstants.UUID_WIKI_LINK) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) List(java.util.List) ClaimResult(org.thingsboard.server.dao.device.claim.ClaimResult) DEVICE_NAME_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.DEVICE_NAME_DESCRIPTION) EDGE_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ID_PARAM_DESCRIPTION) EntitySubtype(org.thingsboard.server.common.data.EntitySubtype) SORT_ORDER_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_DESCRIPTION) PAGE_NUMBER_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.PAGE_NUMBER_DESCRIPTION) CustomerId(org.thingsboard.server.common.data.id.CustomerId) ModelConstants(org.thingsboard.server.dao.model.ModelConstants) SORT_PROPERTY_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.SORT_PROPERTY_DESCRIPTION) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) Tenant(org.thingsboard.server.common.data.Tenant) ActionType(org.thingsboard.server.common.data.audit.ActionType) TbCoreComponent(org.thingsboard.server.queue.util.TbCoreComponent) PAGE_SIZE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.PAGE_SIZE_DESCRIPTION) EDGE_ID(org.thingsboard.server.controller.EdgeController.EDGE_ID) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) BulkImportRequest(org.thingsboard.server.service.importing.BulkImportRequest) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION) TbMsgDataType(org.thingsboard.server.common.msg.TbMsgDataType) ThingsboardErrorCode(org.thingsboard.server.common.data.exception.ThingsboardErrorCode) ResponseEntity(org.springframework.http.ResponseEntity) TenantId(org.thingsboard.server.common.data.id.TenantId) PageData(org.thingsboard.server.common.data.page.PageData) Device(org.thingsboard.server.common.data.Device) EdgeId(org.thingsboard.server.common.data.id.EdgeId) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) TimePageLink(org.thingsboard.server.common.data.page.TimePageLink) IOException(java.io.IOException) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with SORT_ORDER_ALLOWABLE_VALUES

use of org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES in project thingsboard by thingsboard.

the class AssetController method getEdgeAssets.

@ApiOperation(value = "Get assets assigned to edge (getEdgeAssets)", notes = "Returns a page of assets assigned to edge. " + PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/edge/{edgeId}/assets", params = { "pageSize", "page" }, method = RequestMethod.GET)
@ResponseBody
public PageData<Asset> getEdgeAssets(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) @PathVariable(EDGE_ID) String strEdgeId, @ApiParam(value = PAGE_SIZE_DESCRIPTION) @RequestParam int pageSize, @ApiParam(value = PAGE_NUMBER_DESCRIPTION) @RequestParam int page, @ApiParam(value = ASSET_TYPE_DESCRIPTION) @RequestParam(required = false) String type, @ApiParam(value = ASSET_TEXT_SEARCH_DESCRIPTION) @RequestParam(required = false) String textSearch, @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = ASSET_SORT_PROPERTY_ALLOWABLE_VALUES) @RequestParam(required = false) String sortProperty, @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) @RequestParam(required = false) String sortOrder, @ApiParam(value = "Timestamp. Assets with creation time before it won't be queried") @RequestParam(required = false) Long startTime, @ApiParam(value = "Timestamp. Assets with creation time after it won't be queried") @RequestParam(required = false) Long endTime) throws ThingsboardException {
    checkParameter(EDGE_ID, strEdgeId);
    try {
        TenantId tenantId = getCurrentUser().getTenantId();
        EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
        checkEdgeId(edgeId, Operation.READ);
        TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime);
        PageData<Asset> nonFilteredResult;
        if (type != null && type.trim().length() > 0) {
            nonFilteredResult = assetService.findAssetsByTenantIdAndEdgeIdAndType(tenantId, edgeId, type, pageLink);
        } else {
            nonFilteredResult = assetService.findAssetsByTenantIdAndEdgeId(tenantId, edgeId, pageLink);
        }
        List<Asset> filteredAssets = nonFilteredResult.getData().stream().filter(asset -> {
            try {
                accessControlService.checkPermission(getCurrentUser(), Resource.ASSET, Operation.READ, asset.getId(), asset);
                return true;
            } catch (ThingsboardException e) {
                return false;
            }
        }).collect(Collectors.toList());
        PageData<Asset> filteredResult = new PageData<>(filteredAssets, nonFilteredResult.getTotalPages(), nonFilteredResult.getTotalElements(), nonFilteredResult.hasNext());
        return checkNotNull(filteredResult);
    } catch (Exception e) {
        throw handleException(e);
    }
}
Also used : TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH) PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) Edge(org.thingsboard.server.common.data.edge.Edge) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) TimePageLink(org.thingsboard.server.common.data.page.TimePageLink) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Customer(org.thingsboard.server.common.data.Customer) SORT_ORDER_ALLOWABLE_VALUES(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_ALLOWABLE_VALUES) ApiParam(io.swagger.annotations.ApiParam) CUSTOMER_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.CUSTOMER_ID_PARAM_DESCRIPTION) TenantId(org.thingsboard.server.common.data.id.TenantId) ApiOperation(io.swagger.annotations.ApiOperation) EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION) EntityType(org.thingsboard.server.common.data.EntityType) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException) EdgeId(org.thingsboard.server.common.data.id.EdgeId) PostMapping(org.springframework.web.bind.annotation.PostMapping) PageLink(org.thingsboard.server.common.data.page.PageLink) TENANT_AUTHORITY_PARAGRAPH(org.thingsboard.server.controller.ControllerConstants.TENANT_AUTHORITY_PARAGRAPH) TB_SERVICE_QUEUE(org.thingsboard.server.dao.asset.BaseAssetService.TB_SERVICE_QUEUE) MediaType(org.springframework.http.MediaType) SecurityUser(org.thingsboard.server.service.security.model.SecurityUser) PAGE_DATA_PARAMETERS(org.thingsboard.server.controller.ControllerConstants.PAGE_DATA_PARAMETERS) UUID_WIKI_LINK(org.thingsboard.server.controller.ControllerConstants.UUID_WIKI_LINK) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) RestController(org.springframework.web.bind.annotation.RestController) Collectors(java.util.stream.Collectors) EdgeEventActionType(org.thingsboard.server.common.data.edge.EdgeEventActionType) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) BulkImportResult(org.thingsboard.server.service.importing.BulkImportResult) ASSET_SORT_PROPERTY_ALLOWABLE_VALUES(org.thingsboard.server.controller.ControllerConstants.ASSET_SORT_PROPERTY_ALLOWABLE_VALUES) ASSET_TEXT_SEARCH_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ASSET_TEXT_SEARCH_DESCRIPTION) EDGE_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ID_PARAM_DESCRIPTION) Operation(org.thingsboard.server.service.security.permission.Operation) EntitySubtype(org.thingsboard.server.common.data.EntitySubtype) SORT_ORDER_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_DESCRIPTION) PAGE_NUMBER_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.PAGE_NUMBER_DESCRIPTION) CustomerId(org.thingsboard.server.common.data.id.CustomerId) ModelConstants(org.thingsboard.server.dao.model.ModelConstants) SORT_PROPERTY_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.SORT_PROPERTY_DESCRIPTION) ASSET_TYPE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ASSET_TYPE_DESCRIPTION) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) AssetId(org.thingsboard.server.common.data.id.AssetId) AssetBulkImportService(org.thingsboard.server.service.asset.AssetBulkImportService) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ASSET_ID_PARAM_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ASSET_ID_PARAM_DESCRIPTION) ArrayList(java.util.ArrayList) RequestBody(org.springframework.web.bind.annotation.RequestBody) ActionType(org.thingsboard.server.common.data.audit.ActionType) TbCoreComponent(org.thingsboard.server.queue.util.TbCoreComponent) PAGE_SIZE_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.PAGE_SIZE_DESCRIPTION) EDGE_ID(org.thingsboard.server.controller.EdgeController.EDGE_ID) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) BulkImportRequest(org.thingsboard.server.service.importing.BulkImportRequest) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) AssetSearchQuery(org.thingsboard.server.common.data.asset.AssetSearchQuery) HttpStatus(org.springframework.http.HttpStatus) ASSET_INFO_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ASSET_INFO_DESCRIPTION) EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION) EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION) AssetInfo(org.thingsboard.server.common.data.asset.AssetInfo) PageData(org.thingsboard.server.common.data.page.PageData) ASSET_NAME_DESCRIPTION(org.thingsboard.server.controller.ControllerConstants.ASSET_NAME_DESCRIPTION) ThingsboardErrorCode(org.thingsboard.server.common.data.exception.ThingsboardErrorCode) Resource(org.thingsboard.server.service.security.permission.Resource) Asset(org.thingsboard.server.common.data.asset.Asset) TenantId(org.thingsboard.server.common.data.id.TenantId) PageData(org.thingsboard.server.common.data.page.PageData) EdgeId(org.thingsboard.server.common.data.id.EdgeId) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) Asset(org.thingsboard.server.common.data.asset.Asset) TimePageLink(org.thingsboard.server.common.data.page.TimePageLink) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException) ThingsboardException(org.thingsboard.server.common.data.exception.ThingsboardException) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)4 ApiParam (io.swagger.annotations.ApiParam)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 HttpStatus (org.springframework.http.HttpStatus)4 MediaType (org.springframework.http.MediaType)4 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 PathVariable (org.springframework.web.bind.annotation.PathVariable)4 RequestBody (org.springframework.web.bind.annotation.RequestBody)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 RequestMethod (org.springframework.web.bind.annotation.RequestMethod)4 RequestParam (org.springframework.web.bind.annotation.RequestParam)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 RestController (org.springframework.web.bind.annotation.RestController)4 EntityType (org.thingsboard.server.common.data.EntityType)4 ActionType (org.thingsboard.server.common.data.audit.ActionType)4 ThingsboardException (org.thingsboard.server.common.data.exception.ThingsboardException)4 TenantId (org.thingsboard.server.common.data.id.TenantId)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2