Commit 770d3f91f204d91440d81b7c92ad190f516973ea

Authored by Volodymyr Babak
1 parent df6f4c99

Code review changes

... ... @@ -209,12 +209,6 @@ public class PsqlTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgradeSe
209 209 executeQuery(conn, "DROP FUNCTION IF EXISTS delete_customer_records_from_ts_kv(character varying, character varying, bigint);");
210 210 }
211 211 break;
212   - case "3.2.2":
213   - try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
214   - log.info("Load Edge TTL functions ...");
215   - loadSql(conn, LOAD_TTL_FUNCTIONS_SQL, "3.2.2");
216   - }
217   - break;
218 212 default:
219 213 throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
220 214 }
... ...
... ... @@ -471,6 +471,12 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
471 471 try {
472 472 conn.createStatement().execute("ALTER TABLE rule_chain ADD COLUMN type varchar(255) DEFAULT 'CORE'"); //NOSONAR, ignoring because method used to execute thingsboard database upgrade script
473 473 } catch (Exception ignored) {}
  474 +
  475 + log.info("Load Edge TTL functions ...");
  476 + schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "3.2.2", "schema_update_ttl.sql");
  477 + loadSql(schemaUpdateFile, conn);
  478 + log.info("Edge TTL functions successfully loaded!");
  479 +
474 480 } catch (Exception e) {
475 481 log.error("Failed updating schema!!!", e);
476 482 }
... ...
... ... @@ -87,8 +87,8 @@ public class DefaultDataUpdateService implements DataUpdateService {
87 87 log.info("Updating data from version 3.1.1 to 3.2.0 ...");
88 88 tenantsRootRuleChainUpdater.updateEntities(null);
89 89 break;
90   - case "3.2.1":
91   - log.info("Updating data from version 3.2.1 to 3.3.0 ...");
  90 + case "3.2.2":
  91 + log.info("Updating data from version 3.2.2 to 3.3.0 ...");
92 92 tenantsDefaultEdgeRuleChainUpdater.updateEntities(null);
93 93 break;
94 94 default:
... ...
... ... @@ -334,7 +334,7 @@ public class DefaultTbClusterService implements TbClusterService {
334 334 || entityType.equals(EntityType.DEVICE_PROFILE)
335 335 || entityType.equals(EntityType.API_USAGE_STATE)
336 336 || (entityType.equals(EntityType.DEVICE) && msg.getEvent() == ComponentLifecycleEvent.UPDATED)
337   - || msg.getEntityId().getEntityType().equals(EntityType.EDGE)) {
  337 + || entityType.equals(EntityType.EDGE)) {
338 338 TbQueueProducer<TbProtoQueueMsg<ToCoreNotificationMsg>> toCoreNfProducer = producerProvider.getTbCoreNotificationsMsgProducer();
339 339 Set<String> tbCoreServices = partitionService.getAllServiceIds(ServiceType.TB_CORE);
340 340 for (String serviceId : tbCoreServices) {
... ...
... ... @@ -39,8 +39,6 @@
39 39
40 40 <logger name="com.microsoft.azure.servicebus.primitives.CoreMessageReceiver" level="OFF" />
41 41
42   - <logger name="org.thingsboard.server.service.edge" level="INFO" />
43   -
44 42 <root level="INFO">
45 43 <appender-ref ref="STDOUT"/>
46 44 </root>
... ...
... ... @@ -20,4 +20,4 @@ import org.thingsboard.server.dao.service.DaoSqlTest;
20 20
21 21 @DaoSqlTest
22 22 public class EdgeControllerSqlTest extends BaseEdgeControllerTest {
23   -}
\ No newline at end of file
  23 +}
... ...
... ... @@ -19,8 +19,6 @@ import lombok.extern.slf4j.Slf4j;
19 19 import org.eclipse.californium.core.CoapResource;
20 20 import org.eclipse.californium.core.CoapServer;
21 21
22   -import org.eclipse.californium.core.network.CoapEndpoint;
23   -import org.eclipse.californium.core.server.resources.Resource;
24 22 import org.springframework.beans.factory.annotation.Autowired;
25 23 import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
26 24 import org.springframework.stereotype.Service;
... ... @@ -52,7 +50,6 @@ public class CoapTransportService {
52 50 @PostConstruct
53 51 public void init() throws UnknownHostException {
54 52 log.info("Starting CoAP transport...");
55   -
56 53 coapServer = coapServerService.getCoapServer();
57 54 CoapResource api = new CoapResource(API);
58 55 api.add(new CoapTransportResource(coapTransportContext, coapServerService, V1));
... ...
... ... @@ -45,4 +45,4 @@ public class EdgeEntity extends AbstractEdgeEntity<Edge> {
45 45 public Edge toData() {
46 46 return super.toEdge();
47 47 }
48   -}
\ No newline at end of file
  48 +}
... ...
... ... @@ -31,7 +31,6 @@ import org.thingsboard.server.dao.DaoUtil;
31 31 import org.thingsboard.server.dao.entityview.EntityViewDao;
32 32 import org.thingsboard.server.dao.model.sql.EntityViewEntity;
33 33 import org.thingsboard.server.dao.model.sql.EntityViewInfoEntity;
34   -import org.thingsboard.server.dao.relation.RelationDao;
35 34 import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao;
36 35
37 36 import java.util.ArrayList;
... ... @@ -52,9 +51,6 @@ public class JpaEntityViewDao extends JpaAbstractSearchTextDao<EntityViewEntity,
52 51 @Autowired
53 52 private EntityViewRepository entityViewRepository;
54 53
55   - @Autowired
56   - private RelationDao relationDao;
57   -
58 54 @Override
59 55 protected Class<EntityViewEntity> getEntityClass() {
60 56 return EntityViewEntity.class;
... ...
... ... @@ -31,4 +31,4 @@ DROP TABLE IF EXISTS oauth2_client_registration_template;
31 31 DROP TABLE IF EXISTS api_usage_state;
32 32 DROP TABLE IF EXISTS resource;
33 33 DROP TABLE IF EXISTS edge;
34   -DROP TABLE IF EXISTS edge_event;
\ No newline at end of file
  34 +DROP TABLE IF EXISTS edge_event;
... ...
... ... @@ -17,7 +17,7 @@ package org.thingsboard.rule.engine.telemetry;
17 17
18 18 import com.google.gson.JsonParser;
19 19 import lombok.extern.slf4j.Slf4j;
20   -import org.springframework.util.StringUtils;
  20 +import org.apache.commons.lang3.StringUtils;
21 21 import org.thingsboard.rule.engine.api.RuleNode;
22 22 import org.thingsboard.rule.engine.api.TbContext;
23 23 import org.thingsboard.rule.engine.api.TbNode;
... ...