use of org.thingsboard.server.common.data.id.WidgetTypeId in project thingsboard by thingsboard.
the class WidgetTypeServiceImpl method deleteWidgetTypesByTenantIdAndBundleAlias.
@Override
public void deleteWidgetTypesByTenantIdAndBundleAlias(TenantId tenantId, String bundleAlias) {
log.trace("Executing deleteWidgetTypesByTenantIdAndBundleAlias, tenantId [{}], bundleAlias [{}]", tenantId, bundleAlias);
Validator.validateId(tenantId, INCORRECT_TENANT_ID + tenantId);
Validator.validateString(bundleAlias, INCORRECT_BUNDLE_ALIAS + bundleAlias);
List<WidgetType> widgetTypes = widgetTypeDao.findWidgetTypesByTenantIdAndBundleAlias(tenantId.getId(), bundleAlias);
for (WidgetType widgetType : widgetTypes) {
deleteWidgetType(new WidgetTypeId(widgetType.getUuidId()));
}
}
use of org.thingsboard.server.common.data.id.WidgetTypeId 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;
}
use of org.thingsboard.server.common.data.id.WidgetTypeId 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;
}
use of org.thingsboard.server.common.data.id.WidgetTypeId in project thingsboard by thingsboard.
the class WidgetTypeController method deleteWidgetType.
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
@RequestMapping(value = "/widgetType/{widgetTypeId}", method = RequestMethod.DELETE)
@ResponseStatus(value = HttpStatus.OK)
public void deleteWidgetType(@PathVariable("widgetTypeId") String strWidgetTypeId) throws ThingsboardException {
checkParameter("widgetTypeId", strWidgetTypeId);
try {
WidgetTypeId widgetTypeId = new WidgetTypeId(toUUID(strWidgetTypeId));
checkWidgetTypeId(widgetTypeId, true);
widgetTypeService.deleteWidgetType(widgetTypeId);
} catch (Exception e) {
throw handleException(e);
}
}
Aggregations