use of org.thingsboard.server.common.data.id.CustomerId in project thingsboard by thingsboard.
the class CustomerController method getCustomerTitleById.
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/customer/{customerId}/title", method = RequestMethod.GET, produces = "application/text")
@ResponseBody
public String getCustomerTitleById(@PathVariable(CUSTOMER_ID) String strCustomerId) throws ThingsboardException {
checkParameter(CUSTOMER_ID, strCustomerId);
try {
CustomerId customerId = new CustomerId(toUUID(strCustomerId));
Customer customer = checkCustomerId(customerId);
return customer.getTitle();
} catch (Exception e) {
throw handleException(e);
}
}
use of org.thingsboard.server.common.data.id.CustomerId in project thingsboard by thingsboard.
the class DashboardController method getCustomerDashboards.
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/customer/{customerId}/dashboards", params = { "limit" }, method = RequestMethod.GET)
@ResponseBody
public TimePageData<DashboardInfo> getCustomerDashboards(@PathVariable("customerId") String strCustomerId, @RequestParam int limit, @RequestParam(required = false) Long startTime, @RequestParam(required = false) Long endTime, @RequestParam(required = false, defaultValue = "false") boolean ascOrder, @RequestParam(required = false) String offset) throws ThingsboardException {
checkParameter("customerId", strCustomerId);
try {
TenantId tenantId = getCurrentUser().getTenantId();
CustomerId customerId = new CustomerId(toUUID(strCustomerId));
checkCustomerId(customerId);
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
return checkNotNull(dashboardService.findDashboardsByTenantIdAndCustomerId(tenantId, customerId, pageLink).get());
} catch (Exception e) {
throw handleException(e);
}
}
use of org.thingsboard.server.common.data.id.CustomerId in project thingsboard by thingsboard.
the class DeviceEntity method toData.
@Override
public Device toData() {
Device device = new Device(new DeviceId(id));
device.setCreatedTime(UUIDs.unixTimestamp(id));
if (tenantId != null) {
device.setTenantId(new TenantId(tenantId));
}
if (customerId != null) {
device.setCustomerId(new CustomerId(customerId));
}
device.setName(name);
device.setType(type);
device.setAdditionalInfo(additionalInfo);
return device;
}
use of org.thingsboard.server.common.data.id.CustomerId 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;
}
use of org.thingsboard.server.common.data.id.CustomerId in project thingsboard by thingsboard.
the class AssetEntity method toData.
@Override
public Asset toData() {
Asset asset = new Asset(new AssetId(UUIDConverter.fromString(id)));
asset.setCreatedTime(UUIDs.unixTimestamp(UUIDConverter.fromString(id)));
if (tenantId != null) {
asset.setTenantId(new TenantId(UUIDConverter.fromString(tenantId)));
}
if (customerId != null) {
asset.setCustomerId(new CustomerId(UUIDConverter.fromString(customerId)));
}
asset.setName(name);
asset.setType(type);
asset.setAdditionalInfo(additionalInfo);
return asset;
}
Aggregations