use of org.thingsboard.server.common.data.id.WidgetsBundleId 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;
}
use of org.thingsboard.server.common.data.id.WidgetsBundleId in project thingsboard by thingsboard.
the class WidgetsBundleController method deleteWidgetsBundle.
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
@RequestMapping(value = "/widgetsBundle/{widgetsBundleId}", method = RequestMethod.DELETE)
@ResponseStatus(value = HttpStatus.OK)
public void deleteWidgetsBundle(@PathVariable("widgetsBundleId") String strWidgetsBundleId) throws ThingsboardException {
checkParameter("widgetsBundleId", strWidgetsBundleId);
try {
WidgetsBundleId widgetsBundleId = new WidgetsBundleId(toUUID(strWidgetsBundleId));
checkWidgetsBundleId(widgetsBundleId, true);
widgetsBundleService.deleteWidgetsBundle(widgetsBundleId);
} catch (Exception e) {
throw handleException(e);
}
}
use of org.thingsboard.server.common.data.id.WidgetsBundleId 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;
}
use of org.thingsboard.server.common.data.id.WidgetsBundleId in project thingsboard by thingsboard.
the class JpaWidgetsBundleDaoTest method createSystemWidgetBundles.
private void createSystemWidgetBundles(int count, String prefix) {
for (int i = 0; i < count; i++) {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setAlias(prefix + i);
widgetsBundle.setTitle(prefix + i);
widgetsBundle.setTenantId(new TenantId(NULL_UUID));
widgetsBundle.setId(new WidgetsBundleId(UUIDs.timeBased()));
widgetsBundleDao.save(widgetsBundle);
}
}
use of org.thingsboard.server.common.data.id.WidgetsBundleId in project thingsboard by thingsboard.
the class JpaWidgetsBundleDaoTest method createWidgetBundles.
private void createWidgetBundles(int count, UUID tenantId, String prefix) {
for (int i = 0; i < count; i++) {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setAlias(prefix + i);
widgetsBundle.setTitle(prefix + i);
widgetsBundle.setId(new WidgetsBundleId(UUIDs.timeBased()));
widgetsBundle.setTenantId(new TenantId(tenantId));
widgetsBundleDao.save(widgetsBundle);
}
}
Aggregations