Queue ID and Queue Name
This commit is contained in:
parent
f8fd258567
commit
488e05ac6c
@ -70,3 +70,4 @@ CREATE TABLE IF NOT EXISTS user_auth_settings (
|
|||||||
two_fa_settings varchar
|
two_fa_settings varchar
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_api_usage_state_entity_id ON api_usage_state(entity_id);
|
||||||
|
|||||||
@ -75,6 +75,14 @@ public class QueueController extends BaseController {
|
|||||||
return checkNotNull(queueService.findQueueById(getTenantId(), queueId));
|
return checkNotNull(queueService.findQueueById(getTenantId(), queueId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
|
||||||
|
@RequestMapping(value = "/queues/name/{queueName}", method = RequestMethod.GET)
|
||||||
|
@ResponseBody
|
||||||
|
public Queue getQueueByName(@PathVariable("queueName") String queueName) throws ThingsboardException {
|
||||||
|
checkParameter("queueName", queueName);
|
||||||
|
return checkNotNull(queueService.findQueueByTenantIdAndName(getTenantId(), queueName));
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_ADMIN')")
|
@PreAuthorize("hasAnyAuthority('SYS_ADMIN')")
|
||||||
@RequestMapping(value = "/queues", params = {"serviceType"}, method = RequestMethod.POST)
|
@RequestMapping(value = "/queues", params = {"serviceType"}, method = RequestMethod.POST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|||||||
@ -74,12 +74,13 @@ public class DeviceProfile extends SearchTextBased<DeviceProfileId> implements H
|
|||||||
private RuleChainId defaultRuleChainId;
|
private RuleChainId defaultRuleChainId;
|
||||||
@ApiModelProperty(position = 6, value = "Reference to the dashboard. Used in the mobile application to open the default dashboard when user navigates to device details.")
|
@ApiModelProperty(position = 6, value = "Reference to the dashboard. Used in the mobile application to open the default dashboard when user navigates to device details.")
|
||||||
private DashboardId defaultDashboardId;
|
private DashboardId defaultDashboardId;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private QueueId defaultQueueId;
|
||||||
@NoXss
|
@NoXss
|
||||||
@ApiModelProperty(position = 8, value = "Reference to the rule engine queue. " +
|
@ApiModelProperty(position = 8, value = "Rule engine queue name. " +
|
||||||
"If present, the specified queue will be used to store all unprocessed messages related to device, including telemetry, attribute updates, etc. " +
|
"If present, the specified queue will be used to store all unprocessed messages related to device, including telemetry, attribute updates, etc. " +
|
||||||
"Otherwise, the 'Main' queue will be used to store those messages.")
|
"Otherwise, the 'Main' queue will be used to store those messages.")
|
||||||
private QueueId defaultQueueId;
|
|
||||||
|
|
||||||
private String defaultQueueName;
|
private String defaultQueueName;
|
||||||
@Valid
|
@Valid
|
||||||
private transient DeviceProfileData profileData;
|
private transient DeviceProfileData profileData;
|
||||||
@ -114,6 +115,7 @@ public class DeviceProfile extends SearchTextBased<DeviceProfileId> implements H
|
|||||||
this.defaultRuleChainId = deviceProfile.getDefaultRuleChainId();
|
this.defaultRuleChainId = deviceProfile.getDefaultRuleChainId();
|
||||||
this.defaultDashboardId = deviceProfile.getDefaultDashboardId();
|
this.defaultDashboardId = deviceProfile.getDefaultDashboardId();
|
||||||
this.defaultQueueId = deviceProfile.getDefaultQueueId();
|
this.defaultQueueId = deviceProfile.getDefaultQueueId();
|
||||||
|
this.defaultQueueName = deviceProfile.getDefaultQueueName();
|
||||||
this.setProfileData(deviceProfile.getProfileData());
|
this.setProfileData(deviceProfile.getProfileData());
|
||||||
this.provisionDeviceKey = deviceProfile.getProvisionDeviceKey();
|
this.provisionDeviceKey = deviceProfile.getProvisionDeviceKey();
|
||||||
this.firmwareId = deviceProfile.getFirmwareId();
|
this.firmwareId = deviceProfile.getFirmwareId();
|
||||||
@ -174,13 +176,4 @@ public class DeviceProfile extends SearchTextBased<DeviceProfileId> implements H
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
public String getDefaultQueueName() {
|
|
||||||
return defaultQueueName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonProperty
|
|
||||||
public void setDefaultQueueName(String defaultQueueName) {
|
|
||||||
this.defaultQueueName = defaultQueueName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public class DeviceProfileServiceImpl extends AbstractCachedEntityService<Device
|
|||||||
DeviceProfile oldDeviceProfile = deviceProfileValidator.validate(deviceProfile, DeviceProfile::getTenantId);
|
DeviceProfile oldDeviceProfile = deviceProfileValidator.validate(deviceProfile, DeviceProfile::getTenantId);
|
||||||
DeviceProfile savedDeviceProfile;
|
DeviceProfile savedDeviceProfile;
|
||||||
try {
|
try {
|
||||||
if (deviceProfile.getDefaultQueueId() == null && StringUtils.isNotEmpty(deviceProfile.getDefaultQueueName())) {
|
if (StringUtils.isNotEmpty(deviceProfile.getDefaultQueueName())) {
|
||||||
Queue existing = queueService.findQueueByTenantIdAndName(deviceProfile.getTenantId(), deviceProfile.getDefaultQueueName());
|
Queue existing = queueService.findQueueByTenantIdAndName(deviceProfile.getTenantId(), deviceProfile.getDefaultQueueName());
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
deviceProfile.setDefaultQueueId(existing.getId());
|
deviceProfile.setDefaultQueueId(existing.getId());
|
||||||
|
|||||||
@ -181,6 +181,7 @@ public class ModelConstants {
|
|||||||
public static final String DEVICE_PROFILE_DEFAULT_RULE_CHAIN_ID_PROPERTY = "default_rule_chain_id";
|
public static final String DEVICE_PROFILE_DEFAULT_RULE_CHAIN_ID_PROPERTY = "default_rule_chain_id";
|
||||||
public static final String DEVICE_PROFILE_DEFAULT_DASHBOARD_ID_PROPERTY = "default_dashboard_id";
|
public static final String DEVICE_PROFILE_DEFAULT_DASHBOARD_ID_PROPERTY = "default_dashboard_id";
|
||||||
public static final String DEVICE_PROFILE_DEFAULT_QUEUE_ID_PROPERTY = "default_queue_id";
|
public static final String DEVICE_PROFILE_DEFAULT_QUEUE_ID_PROPERTY = "default_queue_id";
|
||||||
|
public static final String DEVICE_PROFILE_DEFAULT_QUEUE_NAME_PROPERTY = "default_queue_name";
|
||||||
public static final String DEVICE_PROFILE_PROVISION_DEVICE_KEY = "provision_device_key";
|
public static final String DEVICE_PROFILE_PROVISION_DEVICE_KEY = "provision_device_key";
|
||||||
public static final String DEVICE_PROFILE_FIRMWARE_ID_PROPERTY = "firmware_id";
|
public static final String DEVICE_PROFILE_FIRMWARE_ID_PROPERTY = "firmware_id";
|
||||||
public static final String DEVICE_PROFILE_SOFTWARE_ID_PROPERTY = "software_id";
|
public static final String DEVICE_PROFILE_SOFTWARE_ID_PROPERTY = "software_id";
|
||||||
|
|||||||
@ -91,6 +91,9 @@ public final class DeviceProfileEntity extends BaseSqlEntity<DeviceProfile> impl
|
|||||||
@Column(name = ModelConstants.DEVICE_PROFILE_DEFAULT_QUEUE_ID_PROPERTY)
|
@Column(name = ModelConstants.DEVICE_PROFILE_DEFAULT_QUEUE_ID_PROPERTY)
|
||||||
private UUID defaultQueueId;
|
private UUID defaultQueueId;
|
||||||
|
|
||||||
|
@Column(name = ModelConstants.DEVICE_PROFILE_DEFAULT_QUEUE_NAME_PROPERTY)
|
||||||
|
private String defaultQueueName;
|
||||||
|
|
||||||
@Type(type = "jsonb")
|
@Type(type = "jsonb")
|
||||||
@Column(name = ModelConstants.DEVICE_PROFILE_PROFILE_DATA_PROPERTY, columnDefinition = "jsonb")
|
@Column(name = ModelConstants.DEVICE_PROFILE_PROFILE_DATA_PROPERTY, columnDefinition = "jsonb")
|
||||||
private JsonNode profileData;
|
private JsonNode profileData;
|
||||||
@ -133,6 +136,7 @@ public final class DeviceProfileEntity extends BaseSqlEntity<DeviceProfile> impl
|
|||||||
if (deviceProfile.getDefaultDashboardId() != null) {
|
if (deviceProfile.getDefaultDashboardId() != null) {
|
||||||
this.defaultDashboardId = deviceProfile.getDefaultDashboardId().getId();
|
this.defaultDashboardId = deviceProfile.getDefaultDashboardId().getId();
|
||||||
}
|
}
|
||||||
|
this.defaultQueueName = deviceProfile.getDefaultQueueName();
|
||||||
if (deviceProfile.getDefaultQueueId() != null) {
|
if (deviceProfile.getDefaultQueueId() != null) {
|
||||||
this.defaultQueueId = deviceProfile.getDefaultQueueId().getId();
|
this.defaultQueueId = deviceProfile.getDefaultQueueId().getId();
|
||||||
}
|
}
|
||||||
@ -176,6 +180,7 @@ public final class DeviceProfileEntity extends BaseSqlEntity<DeviceProfile> impl
|
|||||||
deviceProfile.setProvisionType(provisionType);
|
deviceProfile.setProvisionType(provisionType);
|
||||||
deviceProfile.setDescription(description);
|
deviceProfile.setDescription(description);
|
||||||
deviceProfile.setDefault(isDefault);
|
deviceProfile.setDefault(isDefault);
|
||||||
|
deviceProfile.setDefaultQueueName(defaultQueueName);
|
||||||
deviceProfile.setProfileData(JacksonUtil.convertValue(profileData, DeviceProfileData.class));
|
deviceProfile.setProfileData(JacksonUtil.convertValue(profileData, DeviceProfileData.class));
|
||||||
if (defaultRuleChainId != null) {
|
if (defaultRuleChainId != null) {
|
||||||
deviceProfile.setDefaultRuleChainId(new RuleChainId(defaultRuleChainId));
|
deviceProfile.setDefaultRuleChainId(new RuleChainId(defaultRuleChainId));
|
||||||
@ -191,7 +196,6 @@ public final class DeviceProfileEntity extends BaseSqlEntity<DeviceProfile> impl
|
|||||||
if (firmwareId != null) {
|
if (firmwareId != null) {
|
||||||
deviceProfile.setFirmwareId(new OtaPackageId(firmwareId));
|
deviceProfile.setFirmwareId(new OtaPackageId(firmwareId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (softwareId != null) {
|
if (softwareId != null) {
|
||||||
deviceProfile.setSoftwareId(new OtaPackageId(softwareId));
|
deviceProfile.setSoftwareId(new OtaPackageId(softwareId));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,4 +70,6 @@ CREATE INDEX IF NOT EXISTS idx_widgets_bundle_external_id ON widgets_bundle(tena
|
|||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_rule_node_external_id ON rule_node(rule_chain_id, external_id);
|
CREATE INDEX IF NOT EXISTS idx_rule_node_external_id ON rule_node(rule_chain_id, external_id);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_rule_node_type ON rule_node(type);
|
CREATE INDEX IF NOT EXISTS idx_rule_node_type ON rule_node(type);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_api_usage_state_entity_id ON api_usage_state(entity_id);
|
||||||
|
|||||||
@ -254,6 +254,7 @@ CREATE TABLE IF NOT EXISTS device_profile (
|
|||||||
default_rule_chain_id uuid,
|
default_rule_chain_id uuid,
|
||||||
default_dashboard_id uuid,
|
default_dashboard_id uuid,
|
||||||
default_queue_id uuid,
|
default_queue_id uuid,
|
||||||
|
default_queue_name varchar(255),
|
||||||
provision_device_key varchar,
|
provision_device_key varchar,
|
||||||
external_id uuid,
|
external_id uuid,
|
||||||
CONSTRAINT device_profile_name_unq_key UNIQUE (tenant_id, name),
|
CONSTRAINT device_profile_name_unq_key UNIQUE (tenant_id, name),
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import org.thingsboard.server.common.data.id.QueueId;
|
|||||||
@Data
|
@Data
|
||||||
public class TbCheckpointNodeConfiguration implements NodeConfiguration<TbCheckpointNodeConfiguration> {
|
public class TbCheckpointNodeConfiguration implements NodeConfiguration<TbCheckpointNodeConfiguration> {
|
||||||
|
|
||||||
private String queueId;
|
private String queueName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TbCheckpointNodeConfiguration defaultConfiguration() {
|
public TbCheckpointNodeConfiguration defaultConfiguration() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user