Search in sources :

Example 66 with TenantId

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

the class PluginMetaDataEntity method toData.

@Override
public PluginMetaData toData() {
    PluginMetaData data = new PluginMetaData(new PluginId(id));
    data.setTenantId(new TenantId(tenantId));
    data.setCreatedTime(UUIDs.unixTimestamp(id));
    data.setName(name);
    data.setConfiguration(configuration);
    data.setClazz(clazz);
    data.setPublicAccess(publicAccess);
    data.setState(state);
    data.setApiToken(apiToken);
    data.setAdditionalInfo(additionalInfo);
    return data;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) PluginMetaData(org.thingsboard.server.common.data.plugin.PluginMetaData) PluginId(org.thingsboard.server.common.data.id.PluginId)

Example 67 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(id));
    rule.setTenantId(new TenantId(tenantId));
    rule.setName(name);
    rule.setState(state);
    rule.setWeight(weight);
    rule.setCreatedTime(UUIDs.unixTimestamp(id));
    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 68 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(id));
    tenant.setCreatedTime(UUIDs.unixTimestamp(id));
    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)

Example 69 with TenantId

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

the class UserEntity method toData.

@Override
public User toData() {
    User user = new User(new UserId(id));
    user.setCreatedTime(UUIDs.unixTimestamp(id));
    user.setAuthority(authority);
    if (tenantId != null) {
        user.setTenantId(new TenantId(tenantId));
    }
    if (customerId != null) {
        user.setCustomerId(new CustomerId(customerId));
    }
    user.setEmail(email);
    user.setFirstName(firstName);
    user.setLastName(lastName);
    user.setAdditionalInfo(additionalInfo);
    return user;
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) User(org.thingsboard.server.common.data.User) UserId(org.thingsboard.server.common.data.id.UserId) CustomerId(org.thingsboard.server.common.data.id.CustomerId)

Example 70 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(id));
    widgetsBundle.setCreatedTime(UUIDs.unixTimestamp(id));
    if (tenantId != null) {
        widgetsBundle.setTenantId(new TenantId(tenantId));
    }
    widgetsBundle.setAlias(alias);
    widgetsBundle.setTitle(title);
    if (image != null) {
        byte[] imageByteArray = new byte[image.remaining()];
        image.get(imageByteArray);
        widgetsBundle.setImage(imageByteArray);
    }
    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