Search in sources :

Example 56 with RuleChainId

use of org.thingsboard.server.common.data.id.RuleChainId in project thingsboard by thingsboard.

the class TbAlarmNodeTest method testCreateAlarmsWithPropagationToTenantWithDynamicTypes.

@Test
public void testCreateAlarmsWithPropagationToTenantWithDynamicTypes() throws Exception {
    for (int i = 0; i < 10; i++) {
        var config = new TbCreateAlarmNodeConfiguration();
        config.setPropagateToTenant(true);
        config.setSeverity(CRITICAL.name());
        config.setAlarmType("SomeType" + i);
        config.setAlarmDetailsBuildJs("DETAILS");
        config.setDynamicSeverity(true);
        ObjectMapper mapper = new ObjectMapper();
        TbNodeConfiguration nodeConfiguration = new TbNodeConfiguration(mapper.valueToTree(config));
        when(ctx.createJsScriptEngine("DETAILS")).thenReturn(detailsJs);
        when(ctx.getTenantId()).thenReturn(tenantId);
        when(ctx.getAlarmService()).thenReturn(alarmService);
        when(ctx.getDbCallbackExecutor()).thenReturn(dbExecutor);
        node = new TbCreateAlarmNode();
        node.init(ctx, nodeConfiguration);
        metaData.putValue("key", "value");
        TbMsg msg = TbMsg.newMsg("USER", originator, metaData, TbMsgDataType.JSON, rawJson, ruleChainId, ruleNodeId);
        when(detailsJs.executeJsonAsync(msg)).thenReturn(Futures.immediateFuture(null));
        when(alarmService.findLatestByOriginatorAndType(tenantId, originator, "SomeType" + i)).thenReturn(Futures.immediateFuture(null));
        doAnswer((Answer<Alarm>) invocationOnMock -> (Alarm) (invocationOnMock.getArguments())[0]).when(alarmService).createOrUpdateAlarm(any(Alarm.class));
        long ts = msg.getTs();
        node.onMsg(ctx, msg);
        verify(ctx, atMost(10)).enqueue(any(), successCaptor.capture(), failureCaptor.capture());
        successCaptor.getValue().run();
        verify(ctx, atMost(10)).tellNext(any(), eq("Created"));
        ArgumentCaptor<TbMsg> msgCaptor = ArgumentCaptor.forClass(TbMsg.class);
        ArgumentCaptor<String> typeCaptor = ArgumentCaptor.forClass(String.class);
        ArgumentCaptor<EntityId> originatorCaptor = ArgumentCaptor.forClass(EntityId.class);
        ArgumentCaptor<TbMsgMetaData> metadataCaptor = ArgumentCaptor.forClass(TbMsgMetaData.class);
        ArgumentCaptor<String> dataCaptor = ArgumentCaptor.forClass(String.class);
        verify(ctx, atMost(10)).transformMsg(msgCaptor.capture(), typeCaptor.capture(), originatorCaptor.capture(), metadataCaptor.capture(), dataCaptor.capture());
        assertEquals("ALARM", typeCaptor.getValue());
        assertEquals(originator, originatorCaptor.getValue());
        assertEquals("value", metadataCaptor.getValue().getValue("key"));
        assertEquals(Boolean.TRUE.toString(), metadataCaptor.getValue().getValue(IS_NEW_ALARM));
        assertNotSame(metaData, metadataCaptor.getValue());
        Alarm actualAlarm = new ObjectMapper().readValue(dataCaptor.getValue().getBytes(), Alarm.class);
        Alarm expectedAlarm = Alarm.builder().startTs(ts).endTs(ts).tenantId(tenantId).originator(originator).status(ACTIVE_UNACK).severity(CRITICAL).propagateToTenant(true).type("SomeType" + i).details(null).build();
        assertEquals(expectedAlarm, actualAlarm);
    }
}
Also used : CRITICAL(org.thingsboard.server.common.data.alarm.AlarmSeverity.CRITICAL) RuleEngineAlarmService(org.thingsboard.rule.engine.api.RuleEngineAlarmService) ArgumentMatchers.nullable(org.mockito.ArgumentMatchers.nullable) Assert.assertNotSame(org.junit.Assert.assertNotSame) RuleNodeId(org.thingsboard.server.common.data.id.RuleNodeId) TenantId(org.thingsboard.server.common.data.id.TenantId) TbMsgMetaData(org.thingsboard.server.common.msg.TbMsgMetaData) ACTIVE_UNACK(org.thingsboard.server.common.data.alarm.AlarmStatus.ACTIVE_UNACK) TbNodeException(org.thingsboard.rule.engine.api.TbNodeException) Mockito.verifyNoMoreInteractions(org.mockito.Mockito.verifyNoMoreInteractions) Uuids(com.datastax.oss.driver.api.core.uuid.Uuids) Mockito.doAnswer(org.mockito.Mockito.doAnswer) JsonNode(com.fasterxml.jackson.databind.JsonNode) ScriptException(javax.script.ScriptException) DeviceId(org.thingsboard.server.common.data.id.DeviceId) IS_NEW_ALARM(org.thingsboard.server.common.data.DataConstants.IS_NEW_ALARM) Alarm(org.thingsboard.server.common.data.alarm.Alarm) TbNodeConfiguration(org.thingsboard.rule.engine.api.TbNodeConfiguration) Mockito.atMost(org.mockito.Mockito.atMost) WARNING(org.thingsboard.server.common.data.alarm.AlarmSeverity.WARNING) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Mockito.eq(org.mockito.Mockito.eq) NotImplementedException(org.apache.commons.lang3.NotImplementedException) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) TbMsg(org.thingsboard.server.common.msg.TbMsg) Mock(org.mockito.Mock) IS_CLEARED_ALARM(org.thingsboard.server.common.data.DataConstants.IS_CLEARED_ALARM) RunWith(org.junit.runner.RunWith) Callable(java.util.concurrent.Callable) TbContext(org.thingsboard.rule.engine.api.TbContext) Captor(org.mockito.Captor) Answer(org.mockito.stubbing.Answer) ArgumentCaptor(org.mockito.ArgumentCaptor) ListeningExecutor(org.thingsboard.common.util.ListeningExecutor) EntityId(org.thingsboard.server.common.data.id.EntityId) ScriptEngine(org.thingsboard.rule.engine.api.ScriptEngine) CLEARED_UNACK(org.thingsboard.server.common.data.alarm.AlarmStatus.CLEARED_UNACK) Mockito.anyLong(org.mockito.Mockito.anyLong) Mockito.same(org.mockito.Mockito.same) IS_EXISTING_ALARM(org.thingsboard.server.common.data.DataConstants.IS_EXISTING_ALARM) Before(org.junit.Before) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) CLEARED_ACK(org.thingsboard.server.common.data.alarm.AlarmStatus.CLEARED_ACK) Consumer(java.util.function.Consumer) Futures(com.google.common.util.concurrent.Futures) AlarmId(org.thingsboard.server.common.data.id.AlarmId) TbMsgDataType(org.thingsboard.server.common.msg.TbMsgDataType) Assert.assertEquals(org.junit.Assert.assertEquals) TbMsgMetaData(org.thingsboard.server.common.msg.TbMsgMetaData) TbNodeConfiguration(org.thingsboard.rule.engine.api.TbNodeConfiguration) EntityId(org.thingsboard.server.common.data.id.EntityId) Alarm(org.thingsboard.server.common.data.alarm.Alarm) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TbMsg(org.thingsboard.server.common.msg.TbMsg) Test(org.junit.Test)

Example 57 with RuleChainId

use of org.thingsboard.server.common.data.id.RuleChainId in project thingsboard by thingsboard.

the class TbAlarmNodeTest method newAlarmCanBeCreated.

@Test
public void newAlarmCanBeCreated() throws ScriptException, IOException {
    initWithCreateAlarmScript();
    metaData.putValue("key", "value");
    TbMsg msg = TbMsg.newMsg("USER", originator, metaData, TbMsgDataType.JSON, rawJson, ruleChainId, ruleNodeId);
    when(detailsJs.executeJsonAsync(msg)).thenReturn(Futures.immediateFuture(null));
    when(alarmService.findLatestByOriginatorAndType(tenantId, originator, "SomeType")).thenReturn(Futures.immediateFuture(null));
    doAnswer((Answer<Alarm>) invocationOnMock -> (Alarm) (invocationOnMock.getArguments())[0]).when(alarmService).createOrUpdateAlarm(any(Alarm.class));
    long ts = msg.getTs();
    node.onMsg(ctx, msg);
    verify(ctx).enqueue(any(), successCaptor.capture(), failureCaptor.capture());
    successCaptor.getValue().run();
    verify(ctx).tellNext(any(), eq("Created"));
    ArgumentCaptor<TbMsg> msgCaptor = ArgumentCaptor.forClass(TbMsg.class);
    ArgumentCaptor<String> typeCaptor = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<EntityId> originatorCaptor = ArgumentCaptor.forClass(EntityId.class);
    ArgumentCaptor<TbMsgMetaData> metadataCaptor = ArgumentCaptor.forClass(TbMsgMetaData.class);
    ArgumentCaptor<String> dataCaptor = ArgumentCaptor.forClass(String.class);
    verify(ctx).transformMsg(msgCaptor.capture(), typeCaptor.capture(), originatorCaptor.capture(), metadataCaptor.capture(), dataCaptor.capture());
    assertEquals("ALARM", typeCaptor.getValue());
    assertEquals(originator, originatorCaptor.getValue());
    assertEquals("value", metadataCaptor.getValue().getValue("key"));
    assertEquals(Boolean.TRUE.toString(), metadataCaptor.getValue().getValue(IS_NEW_ALARM));
    assertNotSame(metaData, metadataCaptor.getValue());
    Alarm actualAlarm = new ObjectMapper().readValue(dataCaptor.getValue().getBytes(), Alarm.class);
    Alarm expectedAlarm = Alarm.builder().startTs(ts).endTs(ts).tenantId(tenantId).originator(originator).status(ACTIVE_UNACK).severity(CRITICAL).propagate(true).type("SomeType").details(null).build();
    assertEquals(expectedAlarm, actualAlarm);
}
Also used : CRITICAL(org.thingsboard.server.common.data.alarm.AlarmSeverity.CRITICAL) RuleEngineAlarmService(org.thingsboard.rule.engine.api.RuleEngineAlarmService) ArgumentMatchers.nullable(org.mockito.ArgumentMatchers.nullable) Assert.assertNotSame(org.junit.Assert.assertNotSame) RuleNodeId(org.thingsboard.server.common.data.id.RuleNodeId) TenantId(org.thingsboard.server.common.data.id.TenantId) TbMsgMetaData(org.thingsboard.server.common.msg.TbMsgMetaData) ACTIVE_UNACK(org.thingsboard.server.common.data.alarm.AlarmStatus.ACTIVE_UNACK) TbNodeException(org.thingsboard.rule.engine.api.TbNodeException) Mockito.verifyNoMoreInteractions(org.mockito.Mockito.verifyNoMoreInteractions) Uuids(com.datastax.oss.driver.api.core.uuid.Uuids) Mockito.doAnswer(org.mockito.Mockito.doAnswer) JsonNode(com.fasterxml.jackson.databind.JsonNode) ScriptException(javax.script.ScriptException) DeviceId(org.thingsboard.server.common.data.id.DeviceId) IS_NEW_ALARM(org.thingsboard.server.common.data.DataConstants.IS_NEW_ALARM) Alarm(org.thingsboard.server.common.data.alarm.Alarm) TbNodeConfiguration(org.thingsboard.rule.engine.api.TbNodeConfiguration) Mockito.atMost(org.mockito.Mockito.atMost) WARNING(org.thingsboard.server.common.data.alarm.AlarmSeverity.WARNING) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Mockito.eq(org.mockito.Mockito.eq) NotImplementedException(org.apache.commons.lang3.NotImplementedException) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) TbMsg(org.thingsboard.server.common.msg.TbMsg) Mock(org.mockito.Mock) IS_CLEARED_ALARM(org.thingsboard.server.common.data.DataConstants.IS_CLEARED_ALARM) RunWith(org.junit.runner.RunWith) Callable(java.util.concurrent.Callable) TbContext(org.thingsboard.rule.engine.api.TbContext) Captor(org.mockito.Captor) Answer(org.mockito.stubbing.Answer) ArgumentCaptor(org.mockito.ArgumentCaptor) ListeningExecutor(org.thingsboard.common.util.ListeningExecutor) EntityId(org.thingsboard.server.common.data.id.EntityId) ScriptEngine(org.thingsboard.rule.engine.api.ScriptEngine) CLEARED_UNACK(org.thingsboard.server.common.data.alarm.AlarmStatus.CLEARED_UNACK) Mockito.anyLong(org.mockito.Mockito.anyLong) Mockito.same(org.mockito.Mockito.same) IS_EXISTING_ALARM(org.thingsboard.server.common.data.DataConstants.IS_EXISTING_ALARM) Before(org.junit.Before) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) CLEARED_ACK(org.thingsboard.server.common.data.alarm.AlarmStatus.CLEARED_ACK) Consumer(java.util.function.Consumer) Futures(com.google.common.util.concurrent.Futures) AlarmId(org.thingsboard.server.common.data.id.AlarmId) TbMsgDataType(org.thingsboard.server.common.msg.TbMsgDataType) Assert.assertEquals(org.junit.Assert.assertEquals) EntityId(org.thingsboard.server.common.data.id.EntityId) Alarm(org.thingsboard.server.common.data.alarm.Alarm) TbMsgMetaData(org.thingsboard.server.common.msg.TbMsgMetaData) TbMsg(org.thingsboard.server.common.msg.TbMsg) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 58 with RuleChainId

use of org.thingsboard.server.common.data.id.RuleChainId in project thingsboard by thingsboard.

the class BaseRuleChainService method setRandomRuleChainIds.

private void setRandomRuleChainIds(RuleChainData ruleChainData) {
    for (RuleChain ruleChain : ruleChainData.getRuleChains()) {
        RuleChainId oldRuleChainId = ruleChain.getId();
        RuleChainId newRuleChainId = new RuleChainId(Uuids.timeBased());
        setNewRuleChainId(ruleChain, ruleChainData.getMetadata(), oldRuleChainId, newRuleChainId);
        ruleChain.setTenantId(null);
    }
}
Also used : RuleChain(org.thingsboard.server.common.data.rule.RuleChain) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId)

Example 59 with RuleChainId

use of org.thingsboard.server.common.data.id.RuleChainId in project thingsboard by thingsboard.

the class BaseRuleChainService method saveRuleChainMetaData.

@Override
@Transactional
public RuleChainUpdateResult saveRuleChainMetaData(TenantId tenantId, RuleChainMetaData ruleChainMetaData) {
    Validator.validateId(ruleChainMetaData.getRuleChainId(), "Incorrect rule chain id.");
    RuleChain ruleChain = findRuleChainById(tenantId, ruleChainMetaData.getRuleChainId());
    if (ruleChain == null) {
        return RuleChainUpdateResult.failed();
    }
    ConstraintValidator.validateFields(ruleChainMetaData);
    List<RuleNodeUpdateResult> updatedRuleNodes = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(ruleChainMetaData.getConnections())) {
        validateCircles(ruleChainMetaData.getConnections());
    }
    List<RuleNode> nodes = ruleChainMetaData.getNodes();
    List<RuleNode> toAddOrUpdate = new ArrayList<>();
    List<RuleNode> toDelete = new ArrayList<>();
    Map<RuleNodeId, Integer> ruleNodeIndexMap = new HashMap<>();
    if (nodes != null) {
        for (RuleNode node : nodes) {
            if (node.getId() != null) {
                ruleNodeIndexMap.put(node.getId(), nodes.indexOf(node));
            } else {
                toAddOrUpdate.add(node);
            }
        }
    }
    List<RuleNode> existingRuleNodes = getRuleChainNodes(tenantId, ruleChainMetaData.getRuleChainId());
    for (RuleNode existingNode : existingRuleNodes) {
        deleteEntityRelations(tenantId, existingNode.getId());
        Integer index = ruleNodeIndexMap.get(existingNode.getId());
        RuleNode newRuleNode = null;
        if (index != null) {
            newRuleNode = ruleChainMetaData.getNodes().get(index);
            toAddOrUpdate.add(newRuleNode);
        } else {
            updatedRuleNodes.add(new RuleNodeUpdateResult(existingNode, null));
            toDelete.add(existingNode);
        }
        updatedRuleNodes.add(new RuleNodeUpdateResult(existingNode, newRuleNode));
    }
    if (nodes != null) {
        for (RuleNode node : toAddOrUpdate) {
            node.setRuleChainId(ruleChain.getId());
            RuleNode savedNode = ruleNodeDao.save(tenantId, node);
            createRelation(tenantId, new EntityRelation(ruleChainMetaData.getRuleChainId(), savedNode.getId(), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN));
            int index = nodes.indexOf(node);
            nodes.set(index, savedNode);
            ruleNodeIndexMap.put(savedNode.getId(), index);
        }
    }
    for (RuleNode node : toDelete) {
        deleteRuleNode(tenantId, node.getId());
    }
    RuleNodeId firstRuleNodeId = null;
    if (nodes != null) {
        if (ruleChainMetaData.getFirstNodeIndex() != null) {
            firstRuleNodeId = nodes.get(ruleChainMetaData.getFirstNodeIndex()).getId();
        }
        if ((ruleChain.getFirstRuleNodeId() != null && !ruleChain.getFirstRuleNodeId().equals(firstRuleNodeId)) || (ruleChain.getFirstRuleNodeId() == null && firstRuleNodeId != null)) {
            ruleChain.setFirstRuleNodeId(firstRuleNodeId);
            ruleChainDao.save(tenantId, ruleChain);
        }
        if (ruleChainMetaData.getConnections() != null) {
            for (NodeConnectionInfo nodeConnection : ruleChainMetaData.getConnections()) {
                EntityId from = nodes.get(nodeConnection.getFromIndex()).getId();
                EntityId to = nodes.get(nodeConnection.getToIndex()).getId();
                String type = nodeConnection.getType();
                createRelation(tenantId, new EntityRelation(from, to, type, RelationTypeGroup.RULE_NODE));
            }
        }
        if (ruleChainMetaData.getRuleChainConnections() != null) {
            for (RuleChainConnectionInfo nodeToRuleChainConnection : ruleChainMetaData.getRuleChainConnections()) {
                RuleChainId targetRuleChainId = nodeToRuleChainConnection.getTargetRuleChainId();
                RuleChain targetRuleChain = findRuleChainById(TenantId.SYS_TENANT_ID, targetRuleChainId);
                RuleNode targetNode = new RuleNode();
                targetNode.setName(targetRuleChain != null ? targetRuleChain.getName() : "Rule Chain Input");
                targetNode.setRuleChainId(ruleChain.getId());
                targetNode.setType("org.thingsboard.rule.engine.flow.TbRuleChainInputNode");
                var configuration = JacksonUtil.newObjectNode();
                configuration.put("ruleChainId", targetRuleChainId.getId().toString());
                targetNode.setConfiguration(configuration);
                ObjectNode layout = (ObjectNode) nodeToRuleChainConnection.getAdditionalInfo();
                layout.remove("description");
                layout.remove("ruleChainNodeId");
                targetNode.setAdditionalInfo(layout);
                targetNode.setDebugMode(false);
                targetNode = ruleNodeDao.save(tenantId, targetNode);
                EntityRelation sourceRuleChainToRuleNode = new EntityRelation();
                sourceRuleChainToRuleNode.setFrom(ruleChain.getId());
                sourceRuleChainToRuleNode.setTo(targetNode.getId());
                sourceRuleChainToRuleNode.setType(EntityRelation.CONTAINS_TYPE);
                sourceRuleChainToRuleNode.setTypeGroup(RelationTypeGroup.RULE_CHAIN);
                relationService.saveRelation(tenantId, sourceRuleChainToRuleNode);
                EntityRelation sourceRuleNodeToTargetRuleNode = new EntityRelation();
                EntityId from = nodes.get(nodeToRuleChainConnection.getFromIndex()).getId();
                sourceRuleNodeToTargetRuleNode.setFrom(from);
                sourceRuleNodeToTargetRuleNode.setTo(targetNode.getId());
                sourceRuleNodeToTargetRuleNode.setType(nodeToRuleChainConnection.getType());
                sourceRuleNodeToTargetRuleNode.setTypeGroup(RelationTypeGroup.RULE_NODE);
                relationService.saveRelation(tenantId, sourceRuleNodeToTargetRuleNode);
            }
        }
    }
    return RuleChainUpdateResult.successful(updatedRuleNodes);
}
Also used : RuleNodeUpdateResult(org.thingsboard.server.common.data.rule.RuleNodeUpdateResult) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) HashMap(java.util.HashMap) RuleNode(org.thingsboard.server.common.data.rule.RuleNode) ArrayList(java.util.ArrayList) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) Validator.validateString(org.thingsboard.server.dao.service.Validator.validateString) EntityId(org.thingsboard.server.common.data.id.EntityId) EntityRelation(org.thingsboard.server.common.data.relation.EntityRelation) NodeConnectionInfo(org.thingsboard.server.common.data.rule.NodeConnectionInfo) RuleChain(org.thingsboard.server.common.data.rule.RuleChain) RuleNodeId(org.thingsboard.server.common.data.id.RuleNodeId) RuleChainConnectionInfo(org.thingsboard.server.common.data.rule.RuleChainConnectionInfo) Transactional(org.springframework.transaction.annotation.Transactional)

Example 60 with RuleChainId

use of org.thingsboard.server.common.data.id.RuleChainId in project thingsboard by thingsboard.

the class BaseRuleChainServiceTest method setEdgeTemplateRootRuleChain.

@Test
public void setEdgeTemplateRootRuleChain() throws Exception {
    RuleChainId ruleChainId1 = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 1");
    RuleChainId ruleChainId2 = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 2");
    ruleChainService.setEdgeTemplateRootRuleChain(tenantId, ruleChainId1);
    ruleChainService.setEdgeTemplateRootRuleChain(tenantId, ruleChainId2);
    RuleChain ruleChainById = ruleChainService.findRuleChainById(tenantId, ruleChainId1);
    Assert.assertFalse(ruleChainById.isRoot());
    ruleChainById = ruleChainService.findRuleChainById(tenantId, ruleChainId2);
    Assert.assertTrue(ruleChainById.isRoot());
}
Also used : RuleChain(org.thingsboard.server.common.data.rule.RuleChain) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) Test(org.junit.Test)

Aggregations

RuleChainId (org.thingsboard.server.common.data.id.RuleChainId)60 RuleChain (org.thingsboard.server.common.data.rule.RuleChain)22 RuleNodeId (org.thingsboard.server.common.data.id.RuleNodeId)20 Test (org.junit.Test)17 TbMsg (org.thingsboard.server.common.msg.TbMsg)16 ThingsboardException (org.thingsboard.server.common.data.exception.ThingsboardException)12 EntityId (org.thingsboard.server.common.data.id.EntityId)12 ApiOperation (io.swagger.annotations.ApiOperation)11 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)11 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 TenantId (org.thingsboard.server.common.data.id.TenantId)11 TbMsgMetaData (org.thingsboard.server.common.msg.TbMsgMetaData)11 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)10 DeviceId (org.thingsboard.server.common.data.id.DeviceId)9 RuleNode (org.thingsboard.server.common.data.rule.RuleNode)8 Futures (com.google.common.util.concurrent.Futures)7 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)7 IOException (java.io.IOException)7 Uuids (com.datastax.oss.driver.api.core.uuid.Uuids)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)6