Search in sources :

Example 71 with TenantId

use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.

the class AlarmEntity method toData.

@Override
public Alarm toData() {
    Alarm alarm = new Alarm(new AlarmId(UUIDConverter.fromString(id)));
    alarm.setCreatedTime(UUIDs.unixTimestamp(UUIDConverter.fromString(id)));
    if (tenantId != null) {
        alarm.setTenantId(new TenantId(UUIDConverter.fromString(tenantId)));
    }
    alarm.setOriginator(EntityIdFactory.getByTypeAndUuid(originatorType, UUIDConverter.fromString(originatorId)));
    alarm.setType(type);
    alarm.setSeverity(severity);
    alarm.setStatus(status);
    alarm.setPropagate(propagate);
    alarm.setStartTs(startTs);
    alarm.setEndTs(endTs);
    alarm.setAckTs(ackTs);
    alarm.setClearTs(clearTs);
    alarm.setDetails(details);
    return alarm;
}
Also used : AlarmId(org.thingsboard.server.common.data.alarm.AlarmId) TenantId(org.thingsboard.server.common.data.id.TenantId) Alarm(org.thingsboard.server.common.data.alarm.Alarm)

Example 72 with TenantId

use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.

the class AssetEntity method toData.

@Override
public Asset toData() {
    Asset asset = new Asset(new AssetId(UUIDConverter.fromString(id)));
    asset.setCreatedTime(UUIDs.unixTimestamp(UUIDConverter.fromString(id)));
    if (tenantId != null) {
        asset.setTenantId(new TenantId(UUIDConverter.fromString(tenantId)));
    }
    if (customerId != null) {
        asset.setCustomerId(new CustomerId(UUIDConverter.fromString(customerId)));
    }
    asset.setName(name);
    asset.setType(type);
    asset.setAdditionalInfo(additionalInfo);
    return asset;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) Asset(org.thingsboard.server.common.data.asset.Asset) CustomerId(org.thingsboard.server.common.data.id.CustomerId) AssetId(org.thingsboard.server.common.data.id.AssetId)

Example 73 with TenantId

use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.

the class DashboardEntity method toData.

@Override
public Dashboard toData() {
    Dashboard dashboard = new Dashboard(new DashboardId(this.getId()));
    dashboard.setCreatedTime(UUIDs.unixTimestamp(this.getId()));
    if (tenantId != null) {
        dashboard.setTenantId(new TenantId(toUUID(tenantId)));
    }
    dashboard.setTitle(title);
    if (!StringUtils.isEmpty(assignedCustomers)) {
        try {
            dashboard.setAssignedCustomers(objectMapper.readValue(assignedCustomers, assignedCustomersType));
        } catch (IOException e) {
            log.warn("Unable to parse assigned customers!", e);
        }
    }
    dashboard.setConfiguration(configuration);
    return dashboard;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) Dashboard(org.thingsboard.server.common.data.Dashboard) DashboardId(org.thingsboard.server.common.data.id.DashboardId) IOException(java.io.IOException)

Example 74 with TenantId

use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.

the class AlarmEntity method toData.

@Override
public Alarm toData() {
    Alarm alarm = new Alarm(new AlarmId(id));
    alarm.setCreatedTime(UUIDs.unixTimestamp(id));
    if (tenantId != null) {
        alarm.setTenantId(new TenantId(tenantId));
    }
    alarm.setOriginator(EntityIdFactory.getByTypeAndUuid(originatorType, originatorId));
    alarm.setType(type);
    alarm.setSeverity(severity);
    alarm.setStatus(status);
    alarm.setPropagate(propagate);
    alarm.setStartTs(startTs);
    alarm.setEndTs(endTs);
    alarm.setAckTs(ackTs);
    alarm.setClearTs(clearTs);
    alarm.setDetails(details);
    return alarm;
}
Also used : AlarmId(org.thingsboard.server.common.data.alarm.AlarmId) TenantId(org.thingsboard.server.common.data.id.TenantId) Alarm(org.thingsboard.server.common.data.alarm.Alarm)

Example 75 with TenantId

use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.

the class AssetEntity method toData.

@Override
public Asset toData() {
    Asset asset = new Asset(new AssetId(id));
    asset.setCreatedTime(UUIDs.unixTimestamp(id));
    if (tenantId != null) {
        asset.setTenantId(new TenantId(tenantId));
    }
    if (customerId != null) {
        asset.setCustomerId(new CustomerId(customerId));
    }
    asset.setName(name);
    asset.setType(type);
    asset.setAdditionalInfo(additionalInfo);
    return asset;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) Asset(org.thingsboard.server.common.data.asset.Asset) CustomerId(org.thingsboard.server.common.data.id.CustomerId) AssetId(org.thingsboard.server.common.data.id.AssetId)

Aggregations

TenantId (org.thingsboard.server.common.data.id.TenantId)119 Test (org.junit.Test)44 TextPageLink (org.thingsboard.server.common.data.page.TextPageLink)38 CustomerId (org.thingsboard.server.common.data.id.CustomerId)30 ArrayList (java.util.ArrayList)26 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)24 Tenant (org.thingsboard.server.common.data.Tenant)23 ThingsboardException (org.thingsboard.server.exception.ThingsboardException)23 PluginMetaData (org.thingsboard.server.common.data.plugin.PluginMetaData)16 Customer (org.thingsboard.server.common.data.Customer)14 User (org.thingsboard.server.common.data.User)14 WidgetsBundle (org.thingsboard.server.common.data.widget.WidgetsBundle)13 DeviceId (org.thingsboard.server.common.data.id.DeviceId)10 RuleMetaData (org.thingsboard.server.common.data.rule.RuleMetaData)10 IncorrectParameterException (org.thingsboard.server.dao.exception.IncorrectParameterException)10 AbstractServiceTest (org.thingsboard.server.dao.service.AbstractServiceTest)10 UserId (org.thingsboard.server.common.data.id.UserId)8 TimePageLink (org.thingsboard.server.common.data.page.TimePageLink)8 IOException (java.io.IOException)7 PluginId (org.thingsboard.server.common.data.id.PluginId)7