Merge remote-tracking branch 'origin/develop/2.6-edge' into develop/3.3-edge
This commit is contained in:
commit
78a4710c66
@ -1,126 +0,0 @@
|
|||||||
--
|
|
||||||
-- Copyright © 2016-2020 The Thingsboard Authors
|
|
||||||
--
|
|
||||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
-- you may not use this file except in compliance with the License.
|
|
||||||
-- You may obtain a copy of the License at
|
|
||||||
--
|
|
||||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
--
|
|
||||||
-- Unless required by applicable law or agreed to in writing, software
|
|
||||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
-- See the License for the specific language governing permissions and
|
|
||||||
-- limitations under the License.
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP MATERIALIZED VIEW IF EXISTS thingsboard.rule_chain_by_tenant_and_search_text;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS thingsboard.rule_chain;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS thingsboard.rule_chain (
|
|
||||||
id uuid,
|
|
||||||
tenant_id uuid,
|
|
||||||
name text,
|
|
||||||
type text,
|
|
||||||
search_text text,
|
|
||||||
first_rule_node_id uuid,
|
|
||||||
root boolean,
|
|
||||||
debug_mode boolean,
|
|
||||||
configuration text,
|
|
||||||
additional_info text,
|
|
||||||
PRIMARY KEY (id, tenant_id, type)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.rule_chain_by_tenant_and_search_text AS
|
|
||||||
SELECT *
|
|
||||||
from thingsboard.rule_chain
|
|
||||||
WHERE tenant_id IS NOT NULL AND search_text IS NOT NULL AND id IS NOT NULL AND type IS NOT NULL
|
|
||||||
PRIMARY KEY ( tenant_id, search_text, id, type )
|
|
||||||
WITH CLUSTERING ORDER BY ( search_text ASC, id DESC );
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.rule_chain_by_tenant_by_type_and_search_text AS
|
|
||||||
SELECT *
|
|
||||||
from thingsboard.rule_chain
|
|
||||||
WHERE tenant_id IS NOT NULL AND search_text IS NOT NULL AND id IS NOT NULL AND type IS NOT NULL
|
|
||||||
PRIMARY KEY ( tenant_id, type, search_text, id )
|
|
||||||
WITH CLUSTERING ORDER BY ( type ASC, search_text ASC, id DESC );
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS thingsboard.edge (
|
|
||||||
id timeuuid,
|
|
||||||
tenant_id timeuuid,
|
|
||||||
customer_id timeuuid,
|
|
||||||
root_rule_chain_id timeuuid,
|
|
||||||
type text,
|
|
||||||
name text,
|
|
||||||
label text,
|
|
||||||
search_text text,
|
|
||||||
routing_key text,
|
|
||||||
secret text,
|
|
||||||
edge_license_key text,
|
|
||||||
cloud_endpoint text,
|
|
||||||
additional_info text,
|
|
||||||
PRIMARY KEY (id, tenant_id, customer_id, type)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.edge_by_tenant_and_name AS
|
|
||||||
SELECT *
|
|
||||||
from thingsboard.edge
|
|
||||||
WHERE tenant_id IS NOT NULL AND customer_id IS NOT NULL AND type IS NOT NULL AND name IS NOT NULL AND id IS NOT NULL
|
|
||||||
PRIMARY KEY ( tenant_id, name, id, customer_id, type)
|
|
||||||
WITH CLUSTERING ORDER BY ( name ASC, id DESC, customer_id DESC);
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.edge_by_routing_key AS
|
|
||||||
SELECT *
|
|
||||||
from thingsboard.edge
|
|
||||||
WHERE tenant_id IS NOT NULL AND customer_id IS NOT NULL AND type IS NOT NULL AND routing_key IS NOT NULL AND id IS NOT NULL
|
|
||||||
PRIMARY KEY ( routing_key, tenant_id, id, customer_id, type)
|
|
||||||
WITH CLUSTERING ORDER BY ( tenant_id DESC, id DESC, customer_id DESC);
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.edge_by_tenant_and_search_text AS
|
|
||||||
SELECT *
|
|
||||||
from thingsboard.edge
|
|
||||||
WHERE tenant_id IS NOT NULL AND customer_id IS NOT NULL AND type IS NOT NULL AND search_text IS NOT NULL AND id IS NOT NULL
|
|
||||||
PRIMARY KEY ( tenant_id, search_text, id, customer_id, type)
|
|
||||||
WITH CLUSTERING ORDER BY ( search_text ASC, id DESC, customer_id DESC);
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.edge_by_tenant_by_type_and_search_text AS
|
|
||||||
SELECT *
|
|
||||||
from thingsboard.edge
|
|
||||||
WHERE tenant_id IS NOT NULL AND customer_id IS NOT NULL AND type IS NOT NULL AND search_text IS NOT NULL AND id IS NOT NULL
|
|
||||||
PRIMARY KEY ( tenant_id, type, search_text, id, customer_id)
|
|
||||||
WITH CLUSTERING ORDER BY ( type ASC, search_text ASC, id DESC, customer_id DESC);
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.edge_by_customer_and_search_text AS
|
|
||||||
SELECT *
|
|
||||||
from thingsboard.edge
|
|
||||||
WHERE tenant_id IS NOT NULL AND customer_id IS NOT NULL AND type IS NOT NULL AND search_text IS NOT NULL AND id IS NOT NULL
|
|
||||||
PRIMARY KEY ( customer_id, tenant_id, search_text, id, type )
|
|
||||||
WITH CLUSTERING ORDER BY ( tenant_id DESC, search_text ASC, id DESC );
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.edge_by_customer_by_type_and_search_text AS
|
|
||||||
SELECT *
|
|
||||||
from thingsboard.edge
|
|
||||||
WHERE tenant_id IS NOT NULL AND customer_id IS NOT NULL AND type IS NOT NULL AND search_text IS NOT NULL AND id IS NOT NULL
|
|
||||||
PRIMARY KEY ( customer_id, tenant_id, type, search_text, id )
|
|
||||||
WITH CLUSTERING ORDER BY ( tenant_id DESC, type ASC, search_text ASC, id DESC );
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS thingsboard.edge_event (
|
|
||||||
id timeuuid,
|
|
||||||
tenant_id timeuuid,
|
|
||||||
edge_id timeuuid,
|
|
||||||
edge_event_type text,
|
|
||||||
edge_event_action text,
|
|
||||||
edge_event_uid text,
|
|
||||||
entity_id timeuuid,
|
|
||||||
body text,
|
|
||||||
PRIMARY KEY ((tenant_id, edge_id), edge_event_type, edge_event_uid)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW IF NOT EXISTS thingsboard.edge_event_by_id AS
|
|
||||||
SELECT *
|
|
||||||
FROM thingsboard.edge_event
|
|
||||||
WHERE tenant_id IS NOT NULL AND edge_id IS NOT NULL AND edge_event_type IS NOT NULL
|
|
||||||
AND id IS NOT NULL AND edge_event_uid IS NOT NULL
|
|
||||||
PRIMARY KEY ((tenant_id, edge_id), id, edge_event_type, edge_event_uid)
|
|
||||||
WITH CLUSTERING ORDER BY (id ASC);
|
|
||||||
@ -15,10 +15,11 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS edge (
|
CREATE TABLE IF NOT EXISTS edge (
|
||||||
id varchar(31) NOT NULL CONSTRAINT edge_pkey PRIMARY KEY,
|
id uuid NOT NULL CONSTRAINT edge_pkey PRIMARY KEY,
|
||||||
|
created_time bigint NOT NULL,
|
||||||
additional_info varchar,
|
additional_info varchar,
|
||||||
customer_id varchar(31),
|
customer_id uuid,
|
||||||
root_rule_chain_id varchar(31),
|
root_rule_chain_id uuid,
|
||||||
type varchar(255),
|
type varchar(255),
|
||||||
name varchar(255),
|
name varchar(255),
|
||||||
label varchar(255),
|
label varchar(255),
|
||||||
@ -27,19 +28,20 @@ CREATE TABLE IF NOT EXISTS edge (
|
|||||||
edge_license_key varchar(30),
|
edge_license_key varchar(30),
|
||||||
cloud_endpoint varchar(255),
|
cloud_endpoint varchar(255),
|
||||||
search_text varchar(255),
|
search_text varchar(255),
|
||||||
tenant_id varchar(31),
|
tenant_id uuid,
|
||||||
CONSTRAINT edge_name_unq_key UNIQUE (tenant_id, name),
|
CONSTRAINT edge_name_unq_key UNIQUE (tenant_id, name),
|
||||||
CONSTRAINT edge_routing_key_unq_key UNIQUE (routing_key)
|
CONSTRAINT edge_routing_key_unq_key UNIQUE (routing_key)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS edge_event (
|
CREATE TABLE IF NOT EXISTS edge_event (
|
||||||
id varchar(31) NOT NULL CONSTRAINT edge_event_pkey PRIMARY KEY,
|
id uuid NOT NULL CONSTRAINT edge_event_pkey PRIMARY KEY,
|
||||||
edge_id varchar(31),
|
created_time bigint NOT NULL,
|
||||||
|
edge_id uuid,
|
||||||
edge_event_type varchar(255),
|
edge_event_type varchar(255),
|
||||||
edge_event_uid varchar(255),
|
edge_event_uid varchar(255),
|
||||||
entity_id varchar(31),
|
entity_id uuid,
|
||||||
edge_event_action varchar(255),
|
edge_event_action varchar(255),
|
||||||
body varchar(10000000),
|
body varchar(10000000),
|
||||||
tenant_id varchar(31),
|
tenant_id uuid,
|
||||||
ts bigint NOT NULL
|
ts bigint NOT NULL
|
||||||
);
|
);
|
||||||
@ -106,10 +106,10 @@ public class EdgeController extends BaseController {
|
|||||||
edge.setTenantId(tenantId);
|
edge.setTenantId(tenantId);
|
||||||
boolean created = edge.getId() == null;
|
boolean created = edge.getId() == null;
|
||||||
|
|
||||||
RuleChain defaultRootEdgeRuleChain = null;
|
RuleChain edgeTemplateRootRuleChain = null;
|
||||||
if (created) {
|
if (created) {
|
||||||
defaultRootEdgeRuleChain = ruleChainService.getEdgeTemplateRootRuleChain(tenantId);
|
edgeTemplateRootRuleChain = ruleChainService.getEdgeTemplateRootRuleChain(tenantId);
|
||||||
if (defaultRootEdgeRuleChain == null) {
|
if (edgeTemplateRootRuleChain == null) {
|
||||||
throw new DataValidationException("Root edge rule chain is not available!");
|
throw new DataValidationException("Root edge rule chain is not available!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,8 +122,8 @@ public class EdgeController extends BaseController {
|
|||||||
Edge savedEdge = checkNotNull(edgeService.saveEdge(edge));
|
Edge savedEdge = checkNotNull(edgeService.saveEdge(edge));
|
||||||
|
|
||||||
if (created) {
|
if (created) {
|
||||||
ruleChainService.assignRuleChainToEdge(tenantId, defaultRootEdgeRuleChain.getId(), savedEdge.getId());
|
ruleChainService.assignRuleChainToEdge(tenantId, edgeTemplateRootRuleChain.getId(), savedEdge.getId());
|
||||||
edgeNotificationService.setEdgeRootRuleChain(tenantId, savedEdge, defaultRootEdgeRuleChain.getId());
|
edgeNotificationService.setEdgeRootRuleChain(tenantId, savedEdge, edgeTemplateRootRuleChain.getId());
|
||||||
edgeService.assignDefaultRuleChainsToEdge(tenantId, savedEdge.getId());
|
edgeService.assignDefaultRuleChainsToEdge(tenantId, savedEdge.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,10 +456,12 @@ public class EdgeController extends BaseController {
|
|||||||
checkNotNull(query.getEdgeTypes());
|
checkNotNull(query.getEdgeTypes());
|
||||||
checkEntityId(query.getParameters().getEntityId(), Operation.READ);
|
checkEntityId(query.getParameters().getEntityId(), Operation.READ);
|
||||||
try {
|
try {
|
||||||
List<Edge> edges = checkNotNull(edgeService.findEdgesByQuery(getCurrentUser().getTenantId(), query).get());
|
SecurityUser user = getCurrentUser();
|
||||||
|
TenantId tenantId = user.getTenantId();
|
||||||
|
List<Edge> edges = checkNotNull(edgeService.findEdgesByQuery(tenantId, query).get());
|
||||||
edges = edges.stream().filter(edge -> {
|
edges = edges.stream().filter(edge -> {
|
||||||
try {
|
try {
|
||||||
accessControlService.checkPermission(getCurrentUser(), Resource.EDGE, Operation.READ, edge.getId(), edge);
|
accessControlService.checkPermission(user, Resource.EDGE, Operation.READ, edge.getId(), edge);
|
||||||
return true;
|
return true;
|
||||||
} catch (ThingsboardException e) {
|
} catch (ThingsboardException e) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -90,6 +90,9 @@ public class TenantController extends BaseController {
|
|||||||
tenant = checkNotNull(tenantService.saveTenant(tenant));
|
tenant = checkNotNull(tenantService.saveTenant(tenant));
|
||||||
if (newTenant) {
|
if (newTenant) {
|
||||||
installScripts.createDefaultRuleChains(tenant.getId());
|
installScripts.createDefaultRuleChains(tenant.getId());
|
||||||
|
if (edgesEnabled) {
|
||||||
|
installScripts.createDefaultEdgeRuleChains(tenant.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tenantProfileCache.evict(tenant.getId());
|
tenantProfileCache.evict(tenant.getId());
|
||||||
tbClusterService.onTenantChange(tenant, null);
|
tbClusterService.onTenantChange(tenant, null);
|
||||||
|
|||||||
@ -192,6 +192,13 @@ public class ThingsboardInstallService {
|
|||||||
}
|
}
|
||||||
databaseEntitiesUpgradeService.upgradeDatabase("3.1.1");
|
databaseEntitiesUpgradeService.upgradeDatabase("3.1.1");
|
||||||
dataUpdateService.updateData("3.1.1");
|
dataUpdateService.updateData("3.1.1");
|
||||||
|
case "3.2.0":
|
||||||
|
log.info("Upgrading ThingsBoard from version 3.2.0 to 3.3.0 ...");
|
||||||
|
if (databaseTsUpgradeService != null) {
|
||||||
|
databaseTsUpgradeService.upgradeDatabase("3.2.0");
|
||||||
|
}
|
||||||
|
databaseEntitiesUpgradeService.upgradeDatabase("3.2.0");
|
||||||
|
dataUpdateService.updateData("3.2.0");
|
||||||
log.info("Updating system data...");
|
log.info("Updating system data...");
|
||||||
systemDataLoaderService.updateSystemWidgets();
|
systemDataLoaderService.updateSystemWidgets();
|
||||||
systemDataLoaderService.createOAuth2Templates();
|
systemDataLoaderService.createOAuth2Templates();
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.thingsboard.common.util.ThingsBoardThreadFactory;
|
import org.thingsboard.common.util.ThingsBoardThreadFactory;
|
||||||
import org.thingsboard.server.common.data.DataConstants;
|
import org.thingsboard.server.common.data.DataConstants;
|
||||||
|
import org.thingsboard.server.common.data.Tenant;
|
||||||
import org.thingsboard.server.common.data.edge.Edge;
|
import org.thingsboard.server.common.data.edge.Edge;
|
||||||
import org.thingsboard.server.common.data.id.EdgeId;
|
import org.thingsboard.server.common.data.id.EdgeId;
|
||||||
import org.thingsboard.server.common.data.id.TenantId;
|
import org.thingsboard.server.common.data.id.TenantId;
|
||||||
|
|||||||
@ -52,6 +52,7 @@ public class CassandraTsDatabaseUpgradeService extends AbstractCassandraDatabase
|
|||||||
case "2.5.4":
|
case "2.5.4":
|
||||||
case "2.5.5":
|
case "2.5.5":
|
||||||
case "3.1.1":
|
case "3.1.1":
|
||||||
|
case "3.2.0":
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unable to upgrade Cassandra database, unsupported fromVersion: " + fromVersion);
|
throw new RuntimeException("Unable to upgrade Cassandra database, unsupported fromVersion: " + fromVersion);
|
||||||
|
|||||||
@ -67,6 +67,8 @@ public class InstallScripts {
|
|||||||
public static final String OAUTH2_CONFIG_TEMPLATES_DIR = "oauth2_config_templates";
|
public static final String OAUTH2_CONFIG_TEMPLATES_DIR = "oauth2_config_templates";
|
||||||
public static final String DASHBOARDS_DIR = "dashboards";
|
public static final String DASHBOARDS_DIR = "dashboards";
|
||||||
|
|
||||||
|
public static final String EDGE_MANAGEMENT = "edge_management";
|
||||||
|
|
||||||
public static final String JSON_EXT = ".json";
|
public static final String JSON_EXT = ".json";
|
||||||
|
|
||||||
@Value("${install.data_dir:}")
|
@Value("${install.data_dir:}")
|
||||||
@ -87,14 +89,18 @@ public class InstallScripts {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OAuth2ConfigTemplateService oAuth2TemplateService;
|
private OAuth2ConfigTemplateService oAuth2TemplateService;
|
||||||
|
|
||||||
public Path getTenantRuleChainsDir() {
|
private Path getTenantRuleChainsDir() {
|
||||||
return Paths.get(getDataDir(), JSON_DIR, TENANT_DIR, RULE_CHAINS_DIR);
|
return Paths.get(getDataDir(), JSON_DIR, TENANT_DIR, RULE_CHAINS_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Path getDeviceProfileDefaultRuleChainTemplateFilePath() {
|
private Path getDeviceProfileDefaultRuleChainTemplateFilePath() {
|
||||||
return Paths.get(getDataDir(), JSON_DIR, TENANT_DIR, DEVICE_PROFILE_DIR, "rule_chain_template.json");
|
return Paths.get(getDataDir(), JSON_DIR, TENANT_DIR, DEVICE_PROFILE_DIR, "rule_chain_template.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Path getEdgeRuleChainsDir() {
|
||||||
|
return Paths.get(getDataDir(), JSON_DIR, TENANT_DIR, EDGE_MANAGEMENT, RULE_CHAINS_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
public String getDataDir() {
|
public String getDataDir() {
|
||||||
if (!StringUtils.isEmpty(dataDir)) {
|
if (!StringUtils.isEmpty(dataDir)) {
|
||||||
if (!Paths.get(this.dataDir).toFile().isDirectory()) {
|
if (!Paths.get(this.dataDir).toFile().isDirectory()) {
|
||||||
@ -118,7 +124,16 @@ public class InstallScripts {
|
|||||||
|
|
||||||
public void createDefaultRuleChains(TenantId tenantId) throws IOException {
|
public void createDefaultRuleChains(TenantId tenantId) throws IOException {
|
||||||
Path tenantChainsDir = getTenantRuleChainsDir();
|
Path tenantChainsDir = getTenantRuleChainsDir();
|
||||||
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(tenantChainsDir, path -> path.toString().endsWith(InstallScripts.JSON_EXT))) {
|
loadRuleChainsFromPath(tenantId, tenantChainsDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createDefaultEdgeRuleChains(TenantId tenantId) throws IOException {
|
||||||
|
Path edgeChainsDir = getEdgeRuleChainsDir();
|
||||||
|
loadRuleChainsFromPath(tenantId, edgeChainsDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadRuleChainsFromPath(TenantId tenantId, Path ruleChainsPath) throws IOException {
|
||||||
|
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(ruleChainsPath, path -> path.toString().endsWith(InstallScripts.JSON_EXT))) {
|
||||||
dirStream.forEach(
|
dirStream.forEach(
|
||||||
path -> {
|
path -> {
|
||||||
try {
|
try {
|
||||||
@ -211,15 +226,16 @@ public class InstallScripts {
|
|||||||
try {
|
try {
|
||||||
createDefaultRuleChains(tenantId);
|
createDefaultRuleChains(tenantId);
|
||||||
createDefaultRuleChain(tenantId, "Thermostat");
|
createDefaultRuleChain(tenantId, "Thermostat");
|
||||||
|
loadEdgeDemoRuleChains(tenantId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unable to load dashboard from json", e);
|
log.error("Unable to load dashboard from json", e);
|
||||||
throw new RuntimeException("Unable to load dashboard from json", e);
|
throw new RuntimeException("Unable to load dashboard from json", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createDefaultEdgeRuleChains(TenantId tenantId) throws IOException {
|
private void loadEdgeDemoRuleChains(TenantId tenantId) throws Exception {
|
||||||
Path tenantChainsDir = getTenantRuleChainsDir();
|
Path edgeDemoRuleChainsDir = Paths.get(getDataDir(), JSON_DIR, DEMO_DIR, EDGE_MANAGEMENT, RULE_CHAINS_DIR);
|
||||||
createRuleChainFromFile(tenantId, tenantChainsDir.resolve("edge_root_rule_chain.json"), null);
|
loadRuleChainsFromPath(tenantId, edgeDemoRuleChainsDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createOAuth2Templates() throws Exception {
|
public void createOAuth2Templates() throws Exception {
|
||||||
|
|||||||
@ -195,12 +195,6 @@ public class PsqlTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgradeSe
|
|||||||
executeQuery(conn, "UPDATE tb_schema_settings SET schema_version = 2005001");
|
executeQuery(conn, "UPDATE tb_schema_settings SET schema_version = 2005001");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "2.5.5":
|
|
||||||
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
|
||||||
log.info("Load TTL functions ...");
|
|
||||||
loadSql(conn, "2.6.0", LOAD_TTL_FUNCTIONS_SQL);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "3.1.1":
|
case "3.1.1":
|
||||||
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
||||||
log.info("Load TTL functions ...");
|
log.info("Load TTL functions ...");
|
||||||
@ -209,6 +203,12 @@ public class PsqlTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgradeSe
|
|||||||
loadSql(conn, "2.4.3", LOAD_DROP_PARTITIONS_FUNCTIONS_SQL);
|
loadSql(conn, "2.4.3", LOAD_DROP_PARTITIONS_FUNCTIONS_SQL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "3.2.0":
|
||||||
|
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
||||||
|
log.info("Load Edge TTL functions ...");
|
||||||
|
loadSql(conn, "3.2.0", LOAD_TTL_FUNCTIONS_SQL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
|
throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -264,19 +264,6 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
|
|||||||
log.info("Schema updated.");
|
log.info("Schema updated.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "2.5.5":
|
|
||||||
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
|
||||||
log.info("Updating schema ...");
|
|
||||||
// TODO: voba - should be 2.6.0
|
|
||||||
schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "2.5.0", SCHEMA_UPDATE_SQL);
|
|
||||||
loadSql(schemaUpdateFile, conn);
|
|
||||||
|
|
||||||
try {
|
|
||||||
conn.createStatement().execute("ALTER TABLE rule_chain ADD type varchar(255) DEFAULT 'CORE'"); //NOSONAR, ignoring because method used to execute thingsboard database upgrade script
|
|
||||||
} catch (Exception e) {}
|
|
||||||
log.info("Schema updated.");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "3.0.1":
|
case "3.0.1":
|
||||||
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
||||||
log.info("Updating schema ...");
|
log.info("Updating schema ...");
|
||||||
@ -434,7 +421,17 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
|
|||||||
log.error("Failed updating schema!!!", e);
|
log.error("Failed updating schema!!!", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "3.2.0":
|
||||||
|
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
||||||
|
log.info("Updating schema ...");
|
||||||
|
schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "3.2.0", SCHEMA_UPDATE_SQL);
|
||||||
|
loadSql(schemaUpdateFile, conn);
|
||||||
|
try {
|
||||||
|
conn.createStatement().execute("ALTER TABLE rule_chain ADD type varchar(255) DEFAULT 'CORE'"); //NOSONAR, ignoring because method used to execute thingsboard database upgrade script
|
||||||
|
} catch (Exception e) {}
|
||||||
|
log.info("Schema updated.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
|
throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,7 +179,7 @@ public class TimescaleTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgr
|
|||||||
break;
|
break;
|
||||||
case "3.1.1":
|
case "3.1.1":
|
||||||
break;
|
break;
|
||||||
case "2.5.5":
|
case "3.2.0":
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
|
throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
|
||||||
|
|||||||
@ -79,10 +79,6 @@ public class DefaultDataUpdateService implements DataUpdateService {
|
|||||||
log.info("Updating data from version 1.4.0 to 2.0.0 ...");
|
log.info("Updating data from version 1.4.0 to 2.0.0 ...");
|
||||||
tenantsDefaultRuleChainUpdater.updateEntities(null);
|
tenantsDefaultRuleChainUpdater.updateEntities(null);
|
||||||
break;
|
break;
|
||||||
case "2.5.5":
|
|
||||||
log.info("Updating data from version 2.5.5 to 2.6.0 ...");
|
|
||||||
tenantsDefaultEdgeRuleChainUpdater.updateEntities(null);
|
|
||||||
break;
|
|
||||||
case "3.0.1":
|
case "3.0.1":
|
||||||
log.info("Updating data from version 3.0.1 to 3.1.0 ...");
|
log.info("Updating data from version 3.0.1 to 3.1.0 ...");
|
||||||
tenantsEntityViewsUpdater.updateEntities(null);
|
tenantsEntityViewsUpdater.updateEntities(null);
|
||||||
@ -91,6 +87,10 @@ public class DefaultDataUpdateService implements DataUpdateService {
|
|||||||
log.info("Updating data from version 3.1.1 to 3.2.0 ...");
|
log.info("Updating data from version 3.1.1 to 3.2.0 ...");
|
||||||
tenantsRootRuleChainUpdater.updateEntities(null);
|
tenantsRootRuleChainUpdater.updateEntities(null);
|
||||||
break;
|
break;
|
||||||
|
case "3.2.0":
|
||||||
|
log.info("Updating data from version 3.2.0 to 3.3.0 ...");
|
||||||
|
tenantsDefaultEdgeRuleChainUpdater.updateEntities(null);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unable to update data, unsupported fromVersion: " + fromVersion);
|
throw new RuntimeException("Unable to update data, unsupported fromVersion: " + fromVersion);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,8 +46,6 @@ import org.thingsboard.server.common.data.EntityType;
|
|||||||
import org.thingsboard.server.common.data.Tenant;
|
import org.thingsboard.server.common.data.Tenant;
|
||||||
import org.thingsboard.server.common.data.User;
|
import org.thingsboard.server.common.data.User;
|
||||||
import org.thingsboard.server.common.data.edge.Edge;
|
import org.thingsboard.server.common.data.edge.Edge;
|
||||||
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
|
||||||
import org.thingsboard.server.common.data.edge.EdgeEventType;
|
|
||||||
import org.thingsboard.server.common.data.edge.EdgeInfo;
|
import org.thingsboard.server.common.data.edge.EdgeInfo;
|
||||||
import org.thingsboard.server.common.data.edge.EdgeSearchQuery;
|
import org.thingsboard.server.common.data.edge.EdgeSearchQuery;
|
||||||
import org.thingsboard.server.common.data.id.CustomerId;
|
import org.thingsboard.server.common.data.id.CustomerId;
|
||||||
|
|||||||
@ -105,7 +105,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
|
|||||||
EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN));
|
EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("[{}] Failed to create tenant to root rule chain relation. from: [{}], to: [{}]",
|
log.warn("[{}] Failed to create tenant to root rule chain relation. from: [{}], to: [{}]",
|
||||||
savedRuleChain.getTenantId(), savedRuleChain.getId());
|
savedRuleChain.getTenantId(), savedRuleChain.getTenantId(), savedRuleChain.getId(), e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2798,7 +2798,9 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void syncEdge(EdgeId edgeId) {
|
public void syncEdge(EdgeId edgeId) {
|
||||||
restTemplate.postForEntity(baseURL + "/api/edge/sync", edgeId, EdgeId.class);
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("edgeId", edgeId.toString());
|
||||||
|
restTemplate.postForEntity(baseURL + "/api/edge/sync/{edgeId}", null, EdgeId.class, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|||||||
@ -431,7 +431,7 @@
|
|||||||
"customer-required": "Kunde ist erforderlich",
|
"customer-required": "Kunde ist erforderlich",
|
||||||
"select-default-customer": "Wählen Sie den Standardkunden aus.",
|
"select-default-customer": "Wählen Sie den Standardkunden aus.",
|
||||||
"default-customer": "Standardkunde",
|
"default-customer": "Standardkunde",
|
||||||
"edges": "Kunden Rand",
|
"edge-instances": "Kunden Rand",
|
||||||
"default-customer-required": "Ein Standardkunde ist erforderlich, um das Dashboard auf Mandantenebene zu testen."
|
"default-customer-required": "Ein Standardkunde ist erforderlich, um das Dashboard auf Mandantenebene zu testen."
|
||||||
},
|
},
|
||||||
"datetime": {
|
"datetime": {
|
||||||
@ -1404,7 +1404,8 @@
|
|||||||
"set-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung automatisch den Kanten zugewiesen.",
|
"set-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung automatisch den Kanten zugewiesen.",
|
||||||
"unset-auto-assign-to-edge": "Deaktiviert die Zuordnung der Regelkette zu Kanten bei der Erstellung",
|
"unset-auto-assign-to-edge": "Deaktiviert die Zuordnung der Regelkette zu Kanten bei der Erstellung",
|
||||||
"unset-auto-assign-to-edge-title": "Möchten Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung unbedingt den Kanten zuweisen?",
|
"unset-auto-assign-to-edge-title": "Möchten Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung unbedingt den Kanten zuweisen?",
|
||||||
"unset-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung nicht mehr automatisch den Kanten zugewiesen."
|
"unset-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung nicht mehr automatisch den Kanten zugewiesen.",
|
||||||
|
"edge-template-root": "Vorlagenstamm"
|
||||||
},
|
},
|
||||||
"rulenode": {
|
"rulenode": {
|
||||||
"details": "Details",
|
"details": "Details",
|
||||||
|
|||||||
@ -584,7 +584,6 @@
|
|||||||
"devices": "Customer Devices",
|
"devices": "Customer Devices",
|
||||||
"entity-views": "Customer Entity Views",
|
"entity-views": "Customer Entity Views",
|
||||||
"assets": "Customer Assets",
|
"assets": "Customer Assets",
|
||||||
"edges": "Customer Edges",
|
|
||||||
"public-dashboards": "Public Dashboards",
|
"public-dashboards": "Public Dashboards",
|
||||||
"public-devices": "Public Devices",
|
"public-devices": "Public Devices",
|
||||||
"public-assets": "Public Assets",
|
"public-assets": "Public Assets",
|
||||||
@ -627,7 +626,8 @@
|
|||||||
"default-customer": "Default customer",
|
"default-customer": "Default customer",
|
||||||
"default-customer-required": "Default customer is required in order to debug dashboard on Tenant level",
|
"default-customer-required": "Default customer is required in order to debug dashboard on Tenant level",
|
||||||
"search": "Search customers",
|
"search": "Search customers",
|
||||||
"selected-customers": "{ count, plural, 1 {1 customer} other {# customers} } selected"
|
"selected-customers": "{ count, plural, 1 {1 customer} other {# customers} } selected",
|
||||||
|
"edges": "Customer edge instances"
|
||||||
},
|
},
|
||||||
"datetime": {
|
"datetime": {
|
||||||
"date-from": "Date from",
|
"date-from": "Date from",
|
||||||
|
|||||||
@ -1575,7 +1575,8 @@
|
|||||||
"set-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde se asignará automáticamente a los bordes en la creación.",
|
"set-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde se asignará automáticamente a los bordes en la creación.",
|
||||||
"unset-auto-assign-to-edge": "Desmarcar asignar cadena de reglas a los bordes en la creación",
|
"unset-auto-assign-to-edge": "Desmarcar asignar cadena de reglas a los bordes en la creación",
|
||||||
"unset-auto-assign-to-edge-title": "¿Está seguro de que desea anular la asignación de la cadena de reglas de borde '{{ruleChainName}}' a los bordes en la creación?",
|
"unset-auto-assign-to-edge-title": "¿Está seguro de que desea anular la asignación de la cadena de reglas de borde '{{ruleChainName}}' a los bordes en la creación?",
|
||||||
"unset-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde ya no se asignará automáticamente a los bordes en la creación."
|
"unset-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde ya no se asignará automáticamente a los bordes en la creación.",
|
||||||
|
"edge-template-root": "Raíz de plantilla"
|
||||||
},
|
},
|
||||||
"rulenode": {
|
"rulenode": {
|
||||||
"details": "Detalles",
|
"details": "Detalles",
|
||||||
|
|||||||
@ -1449,7 +1449,8 @@
|
|||||||
"set-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arête sera automatiquement affectée à l'arête (s) lors de la création.",
|
"set-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arête sera automatiquement affectée à l'arête (s) lors de la création.",
|
||||||
"unset-auto-assign-to-edge": "Non défini, attribuer une chaîne de règles aux arêtes lors de la création",
|
"unset-auto-assign-to-edge": "Non défini, attribuer une chaîne de règles aux arêtes lors de la création",
|
||||||
"unset-auto-assign-to-edge-title": "Voulez-vous vraiment annuler l'attribution de la chaîne de règles d'arête \"{{ruleChainName}}\" aux arêtes lors de la création?",
|
"unset-auto-assign-to-edge-title": "Voulez-vous vraiment annuler l'attribution de la chaîne de règles d'arête \"{{ruleChainName}}\" aux arêtes lors de la création?",
|
||||||
"unset-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arêtes ne sera plus automatiquement affectée aux arêtes lors de la création."
|
"unset-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arêtes ne sera plus automatiquement affectée aux arêtes lors de la création.",
|
||||||
|
"edge-template-root": "Racine du modèle"
|
||||||
},
|
},
|
||||||
"rulenode": {
|
"rulenode": {
|
||||||
"add": "Ajouter un noeud de règle",
|
"add": "Ajouter un noeud de règle",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user