use of org.thingsboard.server.common.data.EntityViewInfo in project thingsboard by thingsboard.
the class BaseEntityViewControllerTest method testGetTenantEntityViews.
@Test
public void testGetTenantEntityViews() throws Exception {
List<EntityViewInfo> views = new ArrayList<>();
for (int i = 0; i < 178; i++) {
views.add(new EntityViewInfo(getNewSavedEntityView("Test entity view" + i), null, false));
}
List<EntityViewInfo> loadedViews = loadListOfInfo(new PageLink(23), "/api/tenant/entityViewInfos?");
Collections.sort(views, idComparator);
Collections.sort(loadedViews, idComparator);
assertEquals(views, loadedViews);
}
use of org.thingsboard.server.common.data.EntityViewInfo in project thingsboard by thingsboard.
the class BaseEntityViewControllerTest method testGetCustomerEntityViews.
@Test
public void testGetCustomerEntityViews() throws Exception {
Customer customer = doPost("/api/customer", getNewCustomer("Test customer"), Customer.class);
CustomerId customerId = customer.getId();
String urlTemplate = "/api/customer/" + customerId.getId().toString() + "/entityViewInfos?";
List<EntityViewInfo> views = new ArrayList<>();
for (int i = 0; i < 128; i++) {
views.add(new EntityViewInfo(doPost("/api/customer/" + customerId.getId().toString() + "/entityView/" + getNewSavedEntityView("Test entity view " + i).getId().getId().toString(), EntityView.class), customer.getTitle(), customer.isPublic()));
}
List<EntityViewInfo> loadedViews = loadListOfInfo(new PageLink(23), urlTemplate);
Collections.sort(views, idComparator);
Collections.sort(loadedViews, idComparator);
assertEquals(views, loadedViews);
}
use of org.thingsboard.server.common.data.EntityViewInfo in project thingsboard by thingsboard.
the class BaseController method checkEntityViewInfoId.
EntityViewInfo checkEntityViewInfoId(EntityViewId entityViewId, Operation operation) throws ThingsboardException {
try {
validateId(entityViewId, "Incorrect entityViewId " + entityViewId);
EntityViewInfo entityView = entityViewService.findEntityViewInfoById(getCurrentUser().getTenantId(), entityViewId);
checkNotNull(entityView, "Entity view with id [" + entityViewId + "] is not found");
accessControlService.checkPermission(getCurrentUser(), Resource.ENTITY_VIEW, operation, entityViewId, entityView);
return entityView;
} catch (Exception e) {
throw handleException(e, false);
}
}
Aggregations