add rpcStatus:deleted, add throwing bad_request when getting the rpc entity with status:deleted
This commit is contained in:
parent
45d4a8b453
commit
045fbf5b5e
@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
||||||
import org.thingsboard.server.common.data.id.DeviceId;
|
import org.thingsboard.server.common.data.id.DeviceId;
|
||||||
@ -187,10 +188,15 @@ public class RpcV2Controller extends AbstractRpcController {
|
|||||||
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
||||||
checkParameter("DeviceId", strDeviceId);
|
checkParameter("DeviceId", strDeviceId);
|
||||||
try {
|
try {
|
||||||
|
if (rpcStatus.equals(RpcStatus.DELETED)) {
|
||||||
|
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "RpcStatus: DELETED");
|
||||||
|
}
|
||||||
|
|
||||||
TenantId tenantId = getCurrentUser().getTenantId();
|
TenantId tenantId = getCurrentUser().getTenantId();
|
||||||
PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder);
|
PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder);
|
||||||
DeviceId deviceId = new DeviceId(UUID.fromString(strDeviceId));
|
DeviceId deviceId = new DeviceId(UUID.fromString(strDeviceId));
|
||||||
final DeferredResult<ResponseEntity> response = new DeferredResult<>();
|
final DeferredResult<ResponseEntity> response = new DeferredResult<>();
|
||||||
|
|
||||||
accessValidator.validate(getCurrentUser(), Operation.RPC_CALL, deviceId, new HttpValidationCallback(response, new FutureCallback<>() {
|
accessValidator.validate(getCurrentUser(), Operation.RPC_CALL, deviceId, new HttpValidationCallback(response, new FutureCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(@Nullable DeferredResult<ResponseEntity> result) {
|
public void onSuccess(@Nullable DeferredResult<ResponseEntity> result) {
|
||||||
|
|||||||
@ -16,5 +16,5 @@
|
|||||||
package org.thingsboard.server.common.data.rpc;
|
package org.thingsboard.server.common.data.rpc;
|
||||||
|
|
||||||
public enum RpcStatus {
|
public enum RpcStatus {
|
||||||
QUEUED, SENT, DELIVERED, SUCCESSFUL, TIMEOUT, EXPIRED, FAILED
|
QUEUED, SENT, DELIVERED, SUCCESSFUL, TIMEOUT, EXPIRED, FAILED, DELETED
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user