edge profile processors - added tenant id to abstact methods
This commit is contained in:
parent
c6bba789a4
commit
2a3fa05915
@ -133,18 +133,18 @@ public class AssetProfileEdgeProcessor extends BaseAssetProfileProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDefaultRuleChainId(AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) {
|
protected void setDefaultRuleChainId(TenantId tenantId, AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) {
|
||||||
// do nothing on cloud
|
// do nothing on cloud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDefaultEdgeRuleChainId(AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) {
|
protected void setDefaultEdgeRuleChainId(TenantId tenantId,AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) {
|
||||||
UUID defaultEdgeRuleChainUUID = safeGetUUID(assetProfileUpdateMsg.getDefaultRuleChainIdMSB(), assetProfileUpdateMsg.getDefaultRuleChainIdLSB());
|
UUID defaultEdgeRuleChainUUID = safeGetUUID(assetProfileUpdateMsg.getDefaultRuleChainIdMSB(), assetProfileUpdateMsg.getDefaultRuleChainIdLSB());
|
||||||
assetProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : null);
|
assetProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDefaultDashboardId(AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) {
|
protected void setDefaultDashboardId(TenantId tenantId, AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) {
|
||||||
UUID defaultDashboardUUID = safeGetUUID(assetProfileUpdateMsg.getDefaultDashboardIdMSB(), assetProfileUpdateMsg.getDefaultDashboardIdLSB());
|
UUID defaultDashboardUUID = safeGetUUID(assetProfileUpdateMsg.getDefaultDashboardIdMSB(), assetProfileUpdateMsg.getDefaultDashboardIdLSB());
|
||||||
assetProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null);
|
assetProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,14 +19,11 @@ import com.datastax.oss.driver.api.core.uuid.Uuids;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.thingsboard.server.common.data.asset.AssetProfile;
|
import org.thingsboard.server.common.data.asset.AssetProfile;
|
||||||
import org.thingsboard.server.common.data.id.AssetProfileId;
|
import org.thingsboard.server.common.data.id.AssetProfileId;
|
||||||
import org.thingsboard.server.common.data.id.DashboardId;
|
|
||||||
import org.thingsboard.server.common.data.id.RuleChainId;
|
|
||||||
import org.thingsboard.server.common.data.id.TenantId;
|
import org.thingsboard.server.common.data.id.TenantId;
|
||||||
import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg;
|
||||||
import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor;
|
import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class BaseAssetProfileProcessor extends BaseEdgeProcessor {
|
public abstract class BaseAssetProfileProcessor extends BaseEdgeProcessor {
|
||||||
@ -50,9 +47,9 @@ public abstract class BaseAssetProfileProcessor extends BaseEdgeProcessor {
|
|||||||
assetProfile.setImage(assetProfileUpdateMsg.hasImage()
|
assetProfile.setImage(assetProfileUpdateMsg.hasImage()
|
||||||
? new String(assetProfileUpdateMsg.getImage().toByteArray(), StandardCharsets.UTF_8) : null);
|
? new String(assetProfileUpdateMsg.getImage().toByteArray(), StandardCharsets.UTF_8) : null);
|
||||||
|
|
||||||
setDefaultRuleChainId(assetProfile, assetProfileUpdateMsg);
|
setDefaultRuleChainId(tenantId, assetProfile, assetProfileUpdateMsg);
|
||||||
setDefaultEdgeRuleChainId(assetProfile, assetProfileUpdateMsg);
|
setDefaultEdgeRuleChainId(tenantId, assetProfile, assetProfileUpdateMsg);
|
||||||
setDefaultDashboardId(assetProfile, assetProfileUpdateMsg);
|
setDefaultDashboardId(tenantId, assetProfile, assetProfileUpdateMsg);
|
||||||
|
|
||||||
assetProfileValidator.validate(assetProfile, AssetProfile::getTenantId);
|
assetProfileValidator.validate(assetProfile, AssetProfile::getTenantId);
|
||||||
if (created) {
|
if (created) {
|
||||||
@ -65,9 +62,9 @@ public abstract class BaseAssetProfileProcessor extends BaseEdgeProcessor {
|
|||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void setDefaultRuleChainId(AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg);
|
protected abstract void setDefaultRuleChainId(TenantId tenantId, AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg);
|
||||||
|
|
||||||
protected abstract void setDefaultEdgeRuleChainId(AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg);
|
protected abstract void setDefaultEdgeRuleChainId(TenantId tenantId, AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg);
|
||||||
|
|
||||||
protected abstract void setDefaultDashboardId(AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg);
|
protected abstract void setDefaultDashboardId(TenantId tenantId, AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,9 +70,9 @@ public abstract class BaseDeviceProfileProcessor extends BaseEdgeProcessor {
|
|||||||
dataDecodingEncodingService.decode(deviceProfileUpdateMsg.getProfileDataBytes().toByteArray());
|
dataDecodingEncodingService.decode(deviceProfileUpdateMsg.getProfileDataBytes().toByteArray());
|
||||||
deviceProfile.setProfileData(profileDataOpt.orElse(null));
|
deviceProfile.setProfileData(profileDataOpt.orElse(null));
|
||||||
|
|
||||||
setDefaultRuleChainId(deviceProfile, deviceProfileUpdateMsg);
|
setDefaultRuleChainId(tenantId, deviceProfile, deviceProfileUpdateMsg);
|
||||||
setDefaultEdgeRuleChainId(deviceProfile, deviceProfileUpdateMsg);
|
setDefaultEdgeRuleChainId(tenantId, deviceProfile, deviceProfileUpdateMsg);
|
||||||
setDefaultDashboardId(deviceProfile, deviceProfileUpdateMsg);
|
setDefaultDashboardId(tenantId, deviceProfile, deviceProfileUpdateMsg);
|
||||||
|
|
||||||
String defaultQueueName = StringUtils.isNotBlank(deviceProfileUpdateMsg.getDefaultQueueName())
|
String defaultQueueName = StringUtils.isNotBlank(deviceProfileUpdateMsg.getDefaultQueueName())
|
||||||
? deviceProfileUpdateMsg.getDefaultQueueName() : null;
|
? deviceProfileUpdateMsg.getDefaultQueueName() : null;
|
||||||
@ -95,9 +95,9 @@ public abstract class BaseDeviceProfileProcessor extends BaseEdgeProcessor {
|
|||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void setDefaultRuleChainId(DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg);
|
protected abstract void setDefaultRuleChainId(TenantId tenantId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg);
|
||||||
|
|
||||||
protected abstract void setDefaultEdgeRuleChainId(DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg);
|
protected abstract void setDefaultEdgeRuleChainId(TenantId tenantId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg);
|
||||||
|
|
||||||
protected abstract void setDefaultDashboardId(DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg);
|
protected abstract void setDefaultDashboardId(TenantId tenantId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,18 +134,18 @@ public class DeviceProfileEdgeProcessor extends BaseDeviceProfileProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDefaultRuleChainId(DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) {
|
protected void setDefaultRuleChainId(TenantId tenantId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) {
|
||||||
// do nothing on cloud
|
// do nothing on cloud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDefaultEdgeRuleChainId(DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) {
|
protected void setDefaultEdgeRuleChainId(TenantId tenantId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) {
|
||||||
UUID defaultEdgeRuleChainUUID = safeGetUUID(deviceProfileUpdateMsg.getDefaultRuleChainIdMSB(), deviceProfileUpdateMsg.getDefaultRuleChainIdLSB());
|
UUID defaultEdgeRuleChainUUID = safeGetUUID(deviceProfileUpdateMsg.getDefaultRuleChainIdMSB(), deviceProfileUpdateMsg.getDefaultRuleChainIdLSB());
|
||||||
deviceProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : null);
|
deviceProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDefaultDashboardId(DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) {
|
protected void setDefaultDashboardId(TenantId tenantId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) {
|
||||||
UUID defaultDashboardUUID = safeGetUUID(deviceProfileUpdateMsg.getDefaultDashboardIdMSB(), deviceProfileUpdateMsg.getDefaultDashboardIdLSB());
|
UUID defaultDashboardUUID = safeGetUUID(deviceProfileUpdateMsg.getDefaultDashboardIdMSB(), deviceProfileUpdateMsg.getDefaultDashboardIdLSB());
|
||||||
deviceProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null);
|
deviceProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user