use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.
the class AbstractServiceTest method generateEvent.
protected Event generateEvent(TenantId tenantId, EntityId entityId, String eventType, String eventUid) throws IOException {
if (tenantId == null) {
tenantId = new TenantId(UUIDs.timeBased());
}
Event event = new Event();
event.setTenantId(tenantId);
event.setEntityId(entityId);
event.setType(eventType);
event.setUid(eventUid);
event.setBody(readFromResource("TestJsonData.json"));
return event;
}
use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.
the class BaseAssetServiceTest method testSaveAssetWithInvalidTenant.
@Test(expected = DataValidationException.class)
public void testSaveAssetWithInvalidTenant() {
Asset asset = new Asset();
asset.setName("My asset");
asset.setType("default");
asset.setTenantId(new TenantId(UUIDs.timeBased()));
assetService.saveAsset(asset);
}
use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.
the class BasicRpcSessionListener method deserialize.
private static ToPluginRpcResponseDeviceMsg deserialize(ServerAddress serverAddress, ClusterAPIProtos.ToPluginRpcResponseRpcMessage msg) {
ClusterAPIProtos.PluginAddress address = msg.getAddress();
TenantId pluginTenantId = new TenantId(toUUID(address.getTenantId()));
PluginId pluginId = new PluginId(toUUID(address.getPluginId()));
RpcError error = !StringUtils.isEmpty(msg.getError()) ? RpcError.valueOf(msg.getError()) : null;
FromDeviceRpcResponse response = new FromDeviceRpcResponse(toUUID(msg.getMsgId()), msg.getResponse(), error);
return new ToPluginRpcResponseDeviceMsg(pluginId, pluginTenantId, response);
}
use of org.thingsboard.server.common.data.id.TenantId in project thingsboard by thingsboard.
the class DashboardInfoEntity method toData.
@Override
public DashboardInfo toData() {
DashboardInfo dashboardInfo = new DashboardInfo(new DashboardId(getId()));
dashboardInfo.setCreatedTime(UUIDs.unixTimestamp(getId()));
if (tenantId != null) {
dashboardInfo.setTenantId(new TenantId(toUUID(tenantId)));
}
dashboardInfo.setTitle(title);
if (!StringUtils.isEmpty(assignedCustomers)) {
try {
dashboardInfo.setAssignedCustomers(objectMapper.readValue(assignedCustomers, assignedCustomersType));
} catch (IOException e) {
log.warn("Unable to parse assigned customers!", e);
}
}
return dashboardInfo;
}
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(getId()));
data.setTenantId(new TenantId(fromString(tenantId)));
data.setCreatedTime(UUIDs.unixTimestamp(getId()));
data.setName(name);
data.setClazz(clazz);
data.setPublicAccess(publicAccess);
data.setState(state);
data.setApiToken(apiToken);
data.setConfiguration(configuration);
data.setAdditionalInfo(additionalInfo);
return data;
}
Aggregations