|
|
@ -85,6 +85,7 @@ import org.thingsboard.server.common.data.tenant.profile.TenantProfileData; |
|
|
import org.thingsboard.server.common.data.tenant.profile.TenantProfileQueueConfiguration; |
|
|
import org.thingsboard.server.common.data.tenant.profile.TenantProfileQueueConfiguration; |
|
|
import org.thingsboard.server.dao.attributes.AttributesService; |
|
|
import org.thingsboard.server.dao.attributes.AttributesService; |
|
|
import org.thingsboard.server.dao.customer.CustomerService; |
|
|
import org.thingsboard.server.dao.customer.CustomerService; |
|
|
|
|
|
import org.thingsboard.server.dao.device.DeviceConnectivityConfiguration; |
|
|
import org.thingsboard.server.dao.device.DeviceCredentialsService; |
|
|
import org.thingsboard.server.dao.device.DeviceCredentialsService; |
|
|
import org.thingsboard.server.dao.device.DeviceProfileService; |
|
|
import org.thingsboard.server.dao.device.DeviceProfileService; |
|
|
import org.thingsboard.server.dao.device.DeviceService; |
|
|
import org.thingsboard.server.dao.device.DeviceService; |
|
|
@ -169,6 +170,9 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private TimeseriesService tsService; |
|
|
private TimeseriesService tsService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private DeviceConnectivityConfiguration connectivityConfiguration; |
|
|
|
|
|
|
|
|
@Value("${state.persistToTelemetry:false}") |
|
|
@Value("${state.persistToTelemetry:false}") |
|
|
@Getter |
|
|
@Getter |
|
|
private boolean persistActivityToTelemetry; |
|
|
private boolean persistActivityToTelemetry; |
|
|
@ -260,7 +264,6 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { |
|
|
ObjectNode node = JacksonUtil.newObjectNode(); |
|
|
ObjectNode node = JacksonUtil.newObjectNode(); |
|
|
node.put("baseUrl", "http://localhost:8080"); |
|
|
node.put("baseUrl", "http://localhost:8080"); |
|
|
node.put("prohibitDifferentUrl", false); |
|
|
node.put("prohibitDifferentUrl", false); |
|
|
node.set("connectivity", createDeviceConnectivityConfiguration()); |
|
|
|
|
|
generalSettings.setJsonValue(node); |
|
|
generalSettings.setJsonValue(node); |
|
|
adminSettingsService.saveAdminSettings(TenantId.SYS_TENANT_ID, generalSettings); |
|
|
adminSettingsService.saveAdminSettings(TenantId.SYS_TENANT_ID, generalSettings); |
|
|
|
|
|
|
|
|
@ -285,51 +288,10 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { |
|
|
AdminSettings connectivitySettings = new AdminSettings(); |
|
|
AdminSettings connectivitySettings = new AdminSettings(); |
|
|
connectivitySettings.setTenantId(TenantId.SYS_TENANT_ID); |
|
|
connectivitySettings.setTenantId(TenantId.SYS_TENANT_ID); |
|
|
connectivitySettings.setKey("connectivity"); |
|
|
connectivitySettings.setKey("connectivity"); |
|
|
connectivitySettings.setJsonValue(createDeviceConnectivityConfiguration()); |
|
|
connectivitySettings.setJsonValue(JacksonUtil.valueToTree(connectivityConfiguration.getConnectivity())); |
|
|
adminSettingsService.saveAdminSettings(TenantId.SYS_TENANT_ID, connectivitySettings); |
|
|
adminSettingsService.saveAdminSettings(TenantId.SYS_TENANT_ID, connectivitySettings); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private ObjectNode createDeviceConnectivityConfiguration() { |
|
|
|
|
|
ObjectNode config = JacksonUtil.newObjectNode(); |
|
|
|
|
|
|
|
|
|
|
|
ObjectNode http = JacksonUtil.newObjectNode(); |
|
|
|
|
|
http.put("enabled", true); |
|
|
|
|
|
http.put("host", ""); |
|
|
|
|
|
http.put("port", 8080); |
|
|
|
|
|
config.set("http", http); |
|
|
|
|
|
|
|
|
|
|
|
ObjectNode https = JacksonUtil.newObjectNode(); |
|
|
|
|
|
https.put("enabled", false); |
|
|
|
|
|
https.put("host", ""); |
|
|
|
|
|
https.put("port", 443); |
|
|
|
|
|
config.set("https", https); |
|
|
|
|
|
|
|
|
|
|
|
ObjectNode mqtt = JacksonUtil.newObjectNode(); |
|
|
|
|
|
mqtt.put("enabled", true); |
|
|
|
|
|
mqtt.put("host", ""); |
|
|
|
|
|
mqtt.put("port", 1883); |
|
|
|
|
|
config.set("mqtt", mqtt); |
|
|
|
|
|
|
|
|
|
|
|
ObjectNode mqtts = JacksonUtil.newObjectNode(); |
|
|
|
|
|
mqtts.put("enabled", false); |
|
|
|
|
|
mqtts.put("host", ""); |
|
|
|
|
|
mqtts.put("port", 8883); |
|
|
|
|
|
config.set("mqtts", mqtts); |
|
|
|
|
|
|
|
|
|
|
|
ObjectNode coap = JacksonUtil.newObjectNode(); |
|
|
|
|
|
coap.put("enabled", true); |
|
|
|
|
|
coap.put("host", ""); |
|
|
|
|
|
coap.put("port", 5683); |
|
|
|
|
|
config.set("coap", coap); |
|
|
|
|
|
|
|
|
|
|
|
ObjectNode coaps = JacksonUtil.newObjectNode(); |
|
|
|
|
|
coaps.put("enabled", false); |
|
|
|
|
|
coaps.put("host", ""); |
|
|
|
|
|
coaps.put("port", 5684); |
|
|
|
|
|
config.set("coaps", coaps); |
|
|
|
|
|
return config; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void createRandomJwtSettings() throws Exception { |
|
|
public void createRandomJwtSettings() throws Exception { |
|
|
jwtSettingsService.createRandomJwtSettings(); |
|
|
jwtSettingsService.createRandomJwtSettings(); |
|
|
|