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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations