Search in sources :

Example 11 with TenantId

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

the class WidgetTypeEntity method toData.

@Override
public WidgetType toData() {
    WidgetType widgetType = new WidgetType(new WidgetTypeId(id));
    widgetType.setCreatedTime(UUIDs.unixTimestamp(id));
    if (tenantId != null) {
        widgetType.setTenantId(new TenantId(tenantId));
    }
    widgetType.setBundleAlias(bundleAlias);
    widgetType.setAlias(alias);
    widgetType.setName(name);
    widgetType.setDescriptor(descriptor);
    return widgetType;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) WidgetTypeId(org.thingsboard.server.common.data.id.WidgetTypeId) WidgetType(org.thingsboard.server.common.data.widget.WidgetType)

Example 12 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(getId()));
    customer.setCreatedTime(UUIDs.unixTimestamp(getId()));
    customer.setTenantId(new TenantId(UUIDConverter.fromString(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 13 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(id));
    dashboard.setCreatedTime(UUIDs.unixTimestamp(id));
    if (tenantId != null) {
        dashboard.setTenantId(new TenantId(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 14 with TenantId

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

the class WidgetTypeEntity method toData.

@Override
public WidgetType toData() {
    WidgetType widgetType = new WidgetType(new WidgetTypeId(getId()));
    widgetType.setCreatedTime(UUIDs.unixTimestamp(getId()));
    if (tenantId != null) {
        widgetType.setTenantId(new TenantId(toUUID(tenantId)));
    }
    widgetType.setBundleAlias(bundleAlias);
    widgetType.setAlias(alias);
    widgetType.setName(name);
    widgetType.setDescriptor(descriptor);
    return widgetType;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) WidgetTypeId(org.thingsboard.server.common.data.id.WidgetTypeId) WidgetType(org.thingsboard.server.common.data.widget.WidgetType)

Example 15 with TenantId

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

the class WidgetsBundleEntity method toData.

@Override
public WidgetsBundle toData() {
    WidgetsBundle widgetsBundle = new WidgetsBundle(new WidgetsBundleId(UUIDConverter.fromString(id)));
    widgetsBundle.setCreatedTime(UUIDs.unixTimestamp(UUIDConverter.fromString(id)));
    if (tenantId != null) {
        widgetsBundle.setTenantId(new TenantId(UUIDConverter.fromString(tenantId)));
    }
    widgetsBundle.setAlias(alias);
    widgetsBundle.setTitle(title);
    return widgetsBundle;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) WidgetsBundleId(org.thingsboard.server.common.data.id.WidgetsBundleId) WidgetsBundle(org.thingsboard.server.common.data.widget.WidgetsBundle)

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