Search in sources :

Example 76 with TenantId

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

the class CustomerEntity method toData.

@Override
public Customer toData() {
    Customer customer = new Customer(new CustomerId(id));
    customer.setCreatedTime(UUIDs.unixTimestamp(id));
    customer.setTenantId(new TenantId(tenantId));
    customer.setTitle(title);
    customer.setCountry(country);
    customer.setState(state);
    customer.setCity(city);
    customer.setAddress(address);
    customer.setAddress2(address2);
    customer.setZip(zip);
    customer.setPhone(phone);
    customer.setEmail(email);
    customer.setAdditionalInfo(additionalInfo);
    return customer;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) Customer(org.thingsboard.server.common.data.Customer) CustomerId(org.thingsboard.server.common.data.id.CustomerId)

Example 77 with TenantId

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

the class DeviceEntity method toData.

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

Example 78 with TenantId

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

the class EventEntity method toData.

@Override
public Event toData() {
    Event event = new Event(new EventId(getId()));
    event.setCreatedTime(UUIDs.unixTimestamp(getId()));
    event.setTenantId(new TenantId(toUUID(tenantId)));
    event.setEntityId(EntityIdFactory.getByTypeAndUuid(entityType, toUUID(entityId)));
    event.setBody(body);
    event.setType(eventType);
    event.setUid(eventUid);
    return event;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) Event(org.thingsboard.server.common.data.Event) EventId(org.thingsboard.server.common.data.id.EventId)

Example 79 with TenantId

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

the class RuleMetaDataEntity method toData.

@Override
public RuleMetaData toData() {
    RuleMetaData rule = new RuleMetaData(new RuleId(getId()));
    rule.setTenantId(new TenantId(toUUID(tenantId)));
    rule.setName(name);
    rule.setState(state);
    rule.setWeight(weight);
    rule.setCreatedTime(UUIDs.unixTimestamp(getId()));
    rule.setPluginToken(pluginToken);
    rule.setFilters(filters);
    rule.setProcessor(processor);
    rule.setAction(action);
    rule.setAdditionalInfo(additionalInfo);
    return rule;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) RuleId(org.thingsboard.server.common.data.id.RuleId) RuleMetaData(org.thingsboard.server.common.data.rule.RuleMetaData)

Example 80 with TenantId

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

the class TenantEntity method toData.

@Override
public Tenant toData() {
    Tenant tenant = new Tenant(new TenantId(getId()));
    tenant.setCreatedTime(UUIDs.unixTimestamp(getId()));
    tenant.setTitle(title);
    tenant.setRegion(region);
    tenant.setCountry(country);
    tenant.setState(state);
    tenant.setCity(city);
    tenant.setAddress(address);
    tenant.setAddress2(address2);
    tenant.setZip(zip);
    tenant.setPhone(phone);
    tenant.setEmail(email);
    tenant.setAdditionalInfo(additionalInfo);
    return tenant;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) Tenant(org.thingsboard.server.common.data.Tenant)

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