Commit 80c2721d1d46cd77e4cf391a543dc72ff1cd6f89

Authored by viktorbasanets
1 parent 3a3f6636

Was added the findEntityViewByIdAsync method

@@ -15,12 +15,10 @@ @@ -15,12 +15,10 @@
15 */ 15 */
16 package org.thingsboard.server.dao.entityview; 16 package org.thingsboard.server.dao.entityview;
17 17
  18 +import com.google.common.util.concurrent.ListenableFuture;
18 import org.thingsboard.server.common.data.EntityType; 19 import org.thingsboard.server.common.data.EntityType;
19 import org.thingsboard.server.common.data.EntityView; 20 import org.thingsboard.server.common.data.EntityView;
20 -import org.thingsboard.server.common.data.id.CustomerId;  
21 -import org.thingsboard.server.common.data.id.EntityId;  
22 -import org.thingsboard.server.common.data.id.EntityViewId;  
23 -import org.thingsboard.server.common.data.id.TenantId; 21 +import org.thingsboard.server.common.data.id.*;
24 import org.thingsboard.server.common.data.page.TextPageData; 22 import org.thingsboard.server.common.data.page.TextPageData;
25 import org.thingsboard.server.common.data.page.TextPageLink; 23 import org.thingsboard.server.common.data.page.TextPageLink;
26 24
@@ -57,4 +55,6 @@ public interface EntityViewService { @@ -57,4 +55,6 @@ public interface EntityViewService {
57 TextPageLink pageLink); 55 TextPageLink pageLink);
58 56
59 void unassignCustomerEntityViews(TenantId tenantId, CustomerId customerId); 57 void unassignCustomerEntityViews(TenantId tenantId, CustomerId customerId);
  58 +
  59 + ListenableFuture<EntityView> findEntityViewByIdAsync(EntityViewId entityViewId);
60 } 60 }
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 */ 15 */
16 package org.thingsboard.server.dao.entityview; 16 package org.thingsboard.server.dao.entityview;
17 17
  18 +import com.google.common.util.concurrent.ListenableFuture;
18 import lombok.extern.slf4j.Slf4j; 19 import lombok.extern.slf4j.Slf4j;
19 import org.apache.commons.lang3.StringUtils; 20 import org.apache.commons.lang3.StringUtils;
20 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
@@ -190,6 +191,13 @@ public class EntityViewServiceImpl extends AbstractEntityService @@ -190,6 +191,13 @@ public class EntityViewServiceImpl extends AbstractEntityService
190 new CustomerEntityViewsUnAssigner(tenantId).removeEntities(customerId); 191 new CustomerEntityViewsUnAssigner(tenantId).removeEntities(customerId);
191 } 192 }
192 193
  194 + @Override
  195 + public ListenableFuture<EntityView> findEntityViewByIdAsync(EntityViewId entityViewId) {
  196 + log.trace("Executing findDeviceById [{}]", entityViewId);
  197 + validateId(entityViewId, INCORRECT_ENTITY_VIEW_ID + entityViewId);
  198 + return entityViewDao.findByIdAsync(entityViewId.getId());
  199 + }
  200 +
193 private DataValidator<EntityView> entityViewValidator = 201 private DataValidator<EntityView> entityViewValidator =
194 new DataValidator<EntityView>() { 202 new DataValidator<EntityView>() {
195 203