Showing
12 changed files
with
39 additions
and
61 deletions
@@ -31,17 +31,9 @@ import org.thingsboard.server.common.data.id.CustomerId; | @@ -31,17 +31,9 @@ import org.thingsboard.server.common.data.id.CustomerId; | ||
31 | import org.thingsboard.server.common.data.id.DeviceProfileId; | 31 | import org.thingsboard.server.common.data.id.DeviceProfileId; |
32 | import org.thingsboard.server.common.data.id.EntityId; | 32 | import org.thingsboard.server.common.data.id.EntityId; |
33 | import org.thingsboard.server.common.data.id.TenantId; | 33 | import org.thingsboard.server.common.data.id.TenantId; |
34 | -import org.thingsboard.server.common.data.kv.AttributeKvEntry; | ||
35 | -import org.thingsboard.server.common.data.kv.BaseAttributeKvEntry; | ||
36 | -import org.thingsboard.server.common.data.kv.BooleanDataEntry; | ||
37 | -import org.thingsboard.server.common.data.kv.DeleteTsKvQuery; | ||
38 | -import org.thingsboard.server.common.data.kv.DoubleDataEntry; | ||
39 | -import org.thingsboard.server.common.data.kv.LongDataEntry; | ||
40 | -import org.thingsboard.server.common.data.kv.StringDataEntry; | ||
41 | -import org.thingsboard.server.common.data.kv.TsKvEntry; | ||
42 | -import org.thingsboard.server.common.data.kv.TsKvLatestRemovingResult; | 34 | +import org.thingsboard.server.common.data.kv.*; |
43 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 35 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
44 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 36 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
45 | import org.thingsboard.server.common.msg.queue.ServiceType; | 37 | import org.thingsboard.server.common.msg.queue.ServiceType; |
46 | import org.thingsboard.server.common.msg.queue.TbCallback; | 38 | import org.thingsboard.server.common.msg.queue.TbCallback; |
47 | import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; | 39 | import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; |
@@ -58,15 +50,7 @@ import org.thingsboard.server.service.subscription.TbSubscriptionUtils; | @@ -58,15 +50,7 @@ import org.thingsboard.server.service.subscription.TbSubscriptionUtils; | ||
58 | import javax.annotation.Nullable; | 50 | import javax.annotation.Nullable; |
59 | import javax.annotation.PostConstruct; | 51 | import javax.annotation.PostConstruct; |
60 | import javax.annotation.PreDestroy; | 52 | import javax.annotation.PreDestroy; |
61 | -import java.util.ArrayList; | ||
62 | -import java.util.Collection; | ||
63 | -import java.util.Collections; | ||
64 | -import java.util.Comparator; | ||
65 | -import java.util.HashMap; | ||
66 | -import java.util.List; | ||
67 | -import java.util.Map; | ||
68 | -import java.util.Objects; | ||
69 | -import java.util.Optional; | 53 | +import java.util.*; |
70 | import java.util.concurrent.ExecutorService; | 54 | import java.util.concurrent.ExecutorService; |
71 | import java.util.concurrent.Executors; | 55 | import java.util.concurrent.Executors; |
72 | 56 | ||
@@ -252,12 +236,12 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer | @@ -252,12 +236,12 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer | ||
252 | 236 | ||
253 | //Thingskit function | 237 | //Thingskit function |
254 | @Override | 238 | @Override |
255 | - public void saveAndNotify(TenantId tenantId, DeviceProfileId profileId, EntityId entityId, String eventId, TkEventType eventType, List<TkEventKvEntry> attributes, FutureCallback<Void> callback) { | 239 | + public void saveAndNotify(TenantId tenantId, DeviceProfileId profileId, EntityId entityId, String eventId, DeviceEventTypeEnum eventType, List<TkEventKvEntry> attributes, FutureCallback<Void> callback) { |
256 | checkInternalEntity(entityId); | 240 | checkInternalEntity(entityId); |
257 | saveAndNotifyInternal(tenantId,profileId, entityId, eventId,eventType, attributes, callback); | 241 | saveAndNotifyInternal(tenantId,profileId, entityId, eventId,eventType, attributes, callback); |
258 | } | 242 | } |
259 | @Override | 243 | @Override |
260 | - public void saveAndNotifyInternal(TenantId tenantId,DeviceProfileId profileId, EntityId entityId,String eventId, TkEventType eventType, List<TkEventKvEntry> attributes, FutureCallback<Void> callback) { | 244 | + public void saveAndNotifyInternal(TenantId tenantId,DeviceProfileId profileId, EntityId entityId,String eventId, DeviceEventTypeEnum eventType, List<TkEventKvEntry> attributes, FutureCallback<Void> callback) { |
261 | ListenableFuture<List<Void>> saveFuture = eventsService.save(tenantId,profileId, entityId,eventId,eventType, attributes); | 245 | ListenableFuture<List<Void>> saveFuture = eventsService.save(tenantId,profileId, entityId,eventId,eventType, attributes); |
262 | addVoidCallback(saveFuture, callback); | 246 | addVoidCallback(saveFuture, callback); |
263 | // addWsCallback(saveFuture, success -> onAttributesUpdate(tenantId, entityId, scope, attributes, notifyDevice)); | 247 | // addWsCallback(saveFuture, success -> onAttributesUpdate(tenantId, entityId, scope, attributes, notifyDevice)); |
@@ -23,7 +23,7 @@ import org.thingsboard.server.common.data.id.TenantId; | @@ -23,7 +23,7 @@ import org.thingsboard.server.common.data.id.TenantId; | ||
23 | import org.thingsboard.server.common.data.kv.AttributeKvEntry; | 23 | import org.thingsboard.server.common.data.kv.AttributeKvEntry; |
24 | import org.thingsboard.server.common.data.kv.TsKvEntry; | 24 | import org.thingsboard.server.common.data.kv.TsKvEntry; |
25 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 25 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
26 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 26 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
27 | 27 | ||
28 | import java.util.List; | 28 | import java.util.List; |
29 | 29 | ||
@@ -39,7 +39,7 @@ public interface InternalTelemetryService extends RuleEngineTelemetryService { | @@ -39,7 +39,7 @@ public interface InternalTelemetryService extends RuleEngineTelemetryService { | ||
39 | void saveAndNotifyInternal(TenantId tenantId, EntityId entityId, String scope, List<AttributeKvEntry> attributes, boolean notifyDevice, FutureCallback<Void> callback); | 39 | void saveAndNotifyInternal(TenantId tenantId, EntityId entityId, String scope, List<AttributeKvEntry> attributes, boolean notifyDevice, FutureCallback<Void> callback); |
40 | 40 | ||
41 | //Thingskit function | 41 | //Thingskit function |
42 | - void saveAndNotifyInternal(TenantId tenantId, DeviceProfileId profileId, EntityId entityId, String eventId, TkEventType eventType, List<TkEventKvEntry> attributes, FutureCallback<Void> callback); | 42 | + void saveAndNotifyInternal(TenantId tenantId, DeviceProfileId profileId, EntityId entityId, String eventId, DeviceEventTypeEnum eventType, List<TkEventKvEntry> attributes, FutureCallback<Void> callback); |
43 | 43 | ||
44 | void saveLatestAndNotifyInternal(TenantId tenantId, EntityId entityId, List<TsKvEntry> ts, FutureCallback<Void> callback); | 44 | void saveLatestAndNotifyInternal(TenantId tenantId, EntityId entityId, List<TsKvEntry> ts, FutureCallback<Void> callback); |
45 | 45 |
@@ -21,7 +21,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; | @@ -21,7 +21,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; | ||
21 | import org.thingsboard.server.common.data.id.EntityId; | 21 | import org.thingsboard.server.common.data.id.EntityId; |
22 | import org.thingsboard.server.common.data.id.TenantId; | 22 | import org.thingsboard.server.common.data.id.TenantId; |
23 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 23 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
24 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 24 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
25 | 25 | ||
26 | import java.util.Collection; | 26 | import java.util.Collection; |
27 | import java.util.List; | 27 | import java.util.List; |
@@ -36,11 +36,11 @@ public interface TkEventsService { | @@ -36,11 +36,11 @@ public interface TkEventsService { | ||
36 | 36 | ||
37 | ListenableFuture<List<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, String scope, Collection<String> eventKeys); | 37 | ListenableFuture<List<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, String scope, Collection<String> eventKeys); |
38 | 38 | ||
39 | - ListenableFuture<List<TkEventKvEntry>> findAll(TenantId tenantId, EntityId entityId,String eventId, TkEventType eventType); | 39 | + ListenableFuture<List<TkEventKvEntry>> findAll(TenantId tenantId, EntityId entityId,String eventId, DeviceEventTypeEnum eventType); |
40 | 40 | ||
41 | - ListenableFuture<List<Void>> save(TenantId tenantId, DeviceProfileId profileId,EntityId entityId, String eventId, TkEventType eventType, List<TkEventKvEntry> attributes); | 41 | + ListenableFuture<List<Void>> save(TenantId tenantId, DeviceProfileId profileId,EntityId entityId, String eventId, DeviceEventTypeEnum eventType, List<TkEventKvEntry> attributes); |
42 | 42 | ||
43 | - ListenableFuture<List<Void>> removeAll(TenantId tenantId, EntityId entityId, String eventId, TkEventType eventType, List<String> eventKeys); | 43 | + ListenableFuture<List<Void>> removeAll(TenantId tenantId, EntityId entityId, String eventId, DeviceEventTypeEnum eventType, List<String> eventKeys); |
44 | 44 | ||
45 | List<String> findAllKeysByDeviceProfileId(TenantId tenantId, DeviceProfileId deviceProfileId); | 45 | List<String> findAllKeysByDeviceProfileId(TenantId tenantId, DeviceProfileId deviceProfileId); |
46 | 46 |
@@ -24,7 +24,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; | @@ -24,7 +24,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; | ||
24 | import org.thingsboard.server.common.data.id.EntityId; | 24 | import org.thingsboard.server.common.data.id.EntityId; |
25 | import org.thingsboard.server.common.data.id.TenantId; | 25 | import org.thingsboard.server.common.data.id.TenantId; |
26 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 26 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
27 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 27 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
28 | import org.thingsboard.server.dao.service.Validator; | 28 | import org.thingsboard.server.dao.service.Validator; |
29 | import org.thingsboard.server.dao.yunteng.event.TkEventsService; | 29 | import org.thingsboard.server.dao.yunteng.event.TkEventsService; |
30 | 30 | ||
@@ -63,7 +63,7 @@ public class BaseEventsService implements TkEventsService { | @@ -63,7 +63,7 @@ public class BaseEventsService implements TkEventsService { | ||
63 | } | 63 | } |
64 | 64 | ||
65 | @Override | 65 | @Override |
66 | - public ListenableFuture<List<TkEventKvEntry>> findAll(TenantId tenantId, EntityId entityId,String eventId, TkEventType eventType) { | 66 | + public ListenableFuture<List<TkEventKvEntry>> findAll(TenantId tenantId, EntityId entityId,String eventId, DeviceEventTypeEnum eventType) { |
67 | validate(entityId,eventId); | 67 | validate(entityId,eventId); |
68 | return eventsDao.findAll(tenantId, entityId, eventType); | 68 | return eventsDao.findAll(tenantId, entityId, eventType); |
69 | } | 69 | } |
@@ -79,7 +79,7 @@ public class BaseEventsService implements TkEventsService { | @@ -79,7 +79,7 @@ public class BaseEventsService implements TkEventsService { | ||
79 | } | 79 | } |
80 | 80 | ||
81 | @Override | 81 | @Override |
82 | - public ListenableFuture<List<Void>> save(TenantId tenantId,DeviceProfileId profileId, EntityId entityId, String eventId, TkEventType eventType, List<TkEventKvEntry> attributes) { | 82 | + public ListenableFuture<List<Void>> save(TenantId tenantId,DeviceProfileId profileId, EntityId entityId, String eventId, DeviceEventTypeEnum eventType, List<TkEventKvEntry> attributes) { |
83 | validate(entityId, eventId,eventType); | 83 | validate(entityId, eventId,eventType); |
84 | attributes.forEach(attribute -> validate(attribute)); | 84 | attributes.forEach(attribute -> validate(attribute)); |
85 | 85 | ||
@@ -88,7 +88,7 @@ public class BaseEventsService implements TkEventsService { | @@ -88,7 +88,7 @@ public class BaseEventsService implements TkEventsService { | ||
88 | } | 88 | } |
89 | 89 | ||
90 | @Override | 90 | @Override |
91 | - public ListenableFuture<List<Void>> removeAll(TenantId tenantId, EntityId entityId, String eventId, TkEventType eventType, List<String> eventKeys) { | 91 | + public ListenableFuture<List<Void>> removeAll(TenantId tenantId, EntityId entityId, String eventId, DeviceEventTypeEnum eventType, List<String> eventKeys) { |
92 | validate(entityId, eventId); | 92 | validate(entityId, eventId); |
93 | return eventsDao.removeAll(tenantId, entityId, eventId,eventType, eventKeys); | 93 | return eventsDao.removeAll(tenantId, entityId, eventId,eventType, eventKeys); |
94 | } | 94 | } |
@@ -16,9 +16,8 @@ | @@ -16,9 +16,8 @@ | ||
16 | package org.thingsboard.server.dao.yunteng.jpa.dao.event; | 16 | package org.thingsboard.server.dao.yunteng.jpa.dao.event; |
17 | 17 | ||
18 | import org.thingsboard.server.common.data.id.EntityId; | 18 | import org.thingsboard.server.common.data.id.EntityId; |
19 | -import org.thingsboard.server.common.data.kv.AttributeKvEntry; | ||
20 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 19 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
21 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 20 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
22 | import org.thingsboard.server.dao.exception.IncorrectParameterException; | 21 | import org.thingsboard.server.dao.exception.IncorrectParameterException; |
23 | import org.thingsboard.server.dao.service.Validator; | 22 | import org.thingsboard.server.dao.service.Validator; |
24 | 23 | ||
@@ -29,7 +28,7 @@ public class EventUtils { | @@ -29,7 +28,7 @@ public class EventUtils { | ||
29 | } | 28 | } |
30 | 29 | ||
31 | 30 | ||
32 | - public static void validate(EntityId id, String eventIdentifier, TkEventType eventType) { | 31 | + public static void validate(EntityId id, String eventIdentifier, DeviceEventTypeEnum eventType) { |
33 | Validator.validateId(id.getId(), "Incorrect id " + id); | 32 | Validator.validateId(id.getId(), "Incorrect id " + id); |
34 | Validator.validateString(eventIdentifier, "Incorrect scope " + eventIdentifier); | 33 | Validator.validateString(eventIdentifier, "Incorrect scope " + eventIdentifier); |
35 | if(eventType == null){ | 34 | if(eventType == null){ |
@@ -21,7 +21,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; | @@ -21,7 +21,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; | ||
21 | import org.thingsboard.server.common.data.id.EntityId; | 21 | import org.thingsboard.server.common.data.id.EntityId; |
22 | import org.thingsboard.server.common.data.id.TenantId; | 22 | import org.thingsboard.server.common.data.id.TenantId; |
23 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 23 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
24 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 24 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
25 | 25 | ||
26 | import java.util.Collection; | 26 | import java.util.Collection; |
27 | import java.util.List; | 27 | import java.util.List; |
@@ -32,15 +32,15 @@ import java.util.Optional; | @@ -32,15 +32,15 @@ import java.util.Optional; | ||
32 | */ | 32 | */ |
33 | public interface EventsDao { | 33 | public interface EventsDao { |
34 | 34 | ||
35 | - ListenableFuture<Optional<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, TkEventType attributeType, String attributeKey); | 35 | + ListenableFuture<Optional<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, DeviceEventTypeEnum attributeType, String attributeKey); |
36 | 36 | ||
37 | - ListenableFuture<List<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, TkEventType attributeType, Collection<String> attributeKey); | 37 | + ListenableFuture<List<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, DeviceEventTypeEnum attributeType, Collection<String> attributeKey); |
38 | 38 | ||
39 | - ListenableFuture<List<TkEventKvEntry>> findAll(TenantId tenantId, EntityId entityId, TkEventType attributeType); | 39 | + ListenableFuture<List<TkEventKvEntry>> findAll(TenantId tenantId, EntityId entityId, DeviceEventTypeEnum attributeType); |
40 | 40 | ||
41 | - ListenableFuture<Void> save(TenantId tenantId, DeviceProfileId profileId,EntityId entityId, TkEventType attributeType,String eventIdentifier, TkEventKvEntry attribute); | 41 | + ListenableFuture<Void> save(TenantId tenantId, DeviceProfileId profileId,EntityId entityId, DeviceEventTypeEnum attributeType,String eventIdentifier, TkEventKvEntry attribute); |
42 | 42 | ||
43 | - ListenableFuture<List<Void>> removeAll(TenantId tenantId, EntityId entityId, String eventId,TkEventType eventType,List<String> keys); | 43 | + ListenableFuture<List<Void>> removeAll(TenantId tenantId, EntityId entityId, String eventId,DeviceEventTypeEnum eventType,List<String> keys); |
44 | 44 | ||
45 | List<String> findAllKeysByDeviceProfileId(TenantId tenantId, DeviceProfileId deviceProfileId); | 45 | List<String> findAllKeysByDeviceProfileId(TenantId tenantId, DeviceProfileId deviceProfileId); |
46 | 46 |
@@ -18,7 +18,7 @@ package org.thingsboard.server.dao.yunteng.jpa.entity.events; | @@ -18,7 +18,7 @@ package org.thingsboard.server.dao.yunteng.jpa.entity.events; | ||
18 | import lombok.AllArgsConstructor; | 18 | import lombok.AllArgsConstructor; |
19 | import lombok.Data; | 19 | import lombok.Data; |
20 | import lombok.NoArgsConstructor; | 20 | import lombok.NoArgsConstructor; |
21 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 21 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
22 | 22 | ||
23 | import javax.persistence.Column; | 23 | import javax.persistence.Column; |
24 | import javax.persistence.Embeddable; | 24 | import javax.persistence.Embeddable; |
@@ -36,7 +36,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; | @@ -36,7 +36,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; | ||
36 | public class TkEventKvCompositeKey implements Serializable { | 36 | public class TkEventKvCompositeKey implements Serializable { |
37 | @Enumerated(EnumType.STRING) | 37 | @Enumerated(EnumType.STRING) |
38 | @Column(name = EVENT_TYPE_COLUMN) | 38 | @Column(name = EVENT_TYPE_COLUMN) |
39 | - private TkEventType eventType; | 39 | + private DeviceEventTypeEnum eventType; |
40 | @Column(name = ENTITY_ID_COLUMN, columnDefinition = "uuid") | 40 | @Column(name = ENTITY_ID_COLUMN, columnDefinition = "uuid") |
41 | private UUID entityId; | 41 | private UUID entityId; |
42 | @Column(name = EVENT_IDENTIFIER_COLUMN) | 42 | @Column(name = EVENT_IDENTIFIER_COLUMN) |
@@ -20,7 +20,7 @@ import org.springframework.data.jpa.repository.Query; | @@ -20,7 +20,7 @@ import org.springframework.data.jpa.repository.Query; | ||
20 | import org.springframework.data.repository.CrudRepository; | 20 | import org.springframework.data.repository.CrudRepository; |
21 | import org.springframework.data.repository.query.Param; | 21 | import org.springframework.data.repository.query.Param; |
22 | import org.springframework.transaction.annotation.Transactional; | 22 | import org.springframework.transaction.annotation.Transactional; |
23 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 23 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
24 | import org.thingsboard.server.dao.yunteng.jpa.entity.events.TkEventKvCompositeKey; | 24 | import org.thingsboard.server.dao.yunteng.jpa.entity.events.TkEventKvCompositeKey; |
25 | import org.thingsboard.server.dao.yunteng.jpa.entity.events.TkEventKvEntity; | 25 | import org.thingsboard.server.dao.yunteng.jpa.entity.events.TkEventKvEntity; |
26 | 26 | ||
@@ -31,7 +31,7 @@ public interface EventKvRepository extends CrudRepository<TkEventKvEntity, TkEve | @@ -31,7 +31,7 @@ public interface EventKvRepository extends CrudRepository<TkEventKvEntity, TkEve | ||
31 | 31 | ||
32 | @Query("SELECT a FROM TkEventKvEntity a WHERE a.id.eventType = :eventType " + | 32 | @Query("SELECT a FROM TkEventKvEntity a WHERE a.id.eventType = :eventType " + |
33 | "AND a.id.entityId = :entityId " ) | 33 | "AND a.id.entityId = :entityId " ) |
34 | - List<TkEventKvEntity> findAllByEventTypeAndEntityId(@Param("eventType") TkEventType eventType, | 34 | + List<TkEventKvEntity> findAllByEventTypeAndEntityId(@Param("eventType") DeviceEventTypeEnum eventType, |
35 | @Param("entityId") UUID entityId); | 35 | @Param("entityId") UUID entityId); |
36 | 36 | ||
37 | @Transactional | 37 | @Transactional |
@@ -40,7 +40,7 @@ public interface EventKvRepository extends CrudRepository<TkEventKvEntity, TkEve | @@ -40,7 +40,7 @@ public interface EventKvRepository extends CrudRepository<TkEventKvEntity, TkEve | ||
40 | "AND a.id.entityId = :entityId " + | 40 | "AND a.id.entityId = :entityId " + |
41 | "AND a.id.eventIdentifier = :eventIdentifier " + | 41 | "AND a.id.eventIdentifier = :eventIdentifier " + |
42 | "AND a.id.eventKey = :eventKey") | 42 | "AND a.id.eventKey = :eventKey") |
43 | - void delete(@Param("eventType") TkEventType eventType, | 43 | + void delete(@Param("eventType") DeviceEventTypeEnum eventType, |
44 | @Param("entityId") UUID entityId, | 44 | @Param("entityId") UUID entityId, |
45 | @Param("eventIdentifier") String eventIdentifier, | 45 | @Param("eventIdentifier") String eventIdentifier, |
46 | @Param("eventKey") String eventKey); | 46 | @Param("eventKey") String eventKey); |
@@ -27,7 +27,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; | @@ -27,7 +27,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; | ||
27 | import org.thingsboard.server.common.data.id.EntityId; | 27 | import org.thingsboard.server.common.data.id.EntityId; |
28 | import org.thingsboard.server.common.data.id.TenantId; | 28 | import org.thingsboard.server.common.data.id.TenantId; |
29 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 29 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
30 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 30 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
31 | import org.thingsboard.server.common.stats.StatsFactory; | 31 | import org.thingsboard.server.common.stats.StatsFactory; |
32 | import org.thingsboard.server.dao.DaoUtil; | 32 | import org.thingsboard.server.dao.DaoUtil; |
33 | import org.thingsboard.server.dao.sql.JpaAbstractDaoListeningExecutorService; | 33 | import org.thingsboard.server.dao.sql.JpaAbstractDaoListeningExecutorService; |
@@ -109,7 +109,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | @@ -109,7 +109,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | ||
109 | } | 109 | } |
110 | 110 | ||
111 | @Override | 111 | @Override |
112 | - public ListenableFuture<Optional<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, TkEventType eventType, String attributeKey) { | 112 | + public ListenableFuture<Optional<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, DeviceEventTypeEnum eventType, String attributeKey) { |
113 | TkEventKvCompositeKey compositeKey = | 113 | TkEventKvCompositeKey compositeKey = |
114 | getEventKvCompositeKey(eventType,entityId,null, attributeKey,null); | 114 | getEventKvCompositeKey(eventType,entityId,null, attributeKey,null); |
115 | return Futures.immediateFuture( | 115 | return Futures.immediateFuture( |
@@ -117,7 +117,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | @@ -117,7 +117,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | ||
117 | } | 117 | } |
118 | 118 | ||
119 | @Override | 119 | @Override |
120 | - public ListenableFuture<List<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, TkEventType eventType, Collection<String> attributeKeys) { | 120 | + public ListenableFuture<List<TkEventKvEntry>> find(TenantId tenantId, EntityId entityId, DeviceEventTypeEnum eventType, Collection<String> attributeKeys) { |
121 | List<TkEventKvCompositeKey> compositeKeys = | 121 | List<TkEventKvCompositeKey> compositeKeys = |
122 | attributeKeys | 122 | attributeKeys |
123 | .stream() | 123 | .stream() |
@@ -129,7 +129,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | @@ -129,7 +129,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | ||
129 | } | 129 | } |
130 | 130 | ||
131 | @Override | 131 | @Override |
132 | - public ListenableFuture<List<TkEventKvEntry>> findAll(TenantId tenantId, EntityId entityId, TkEventType eventType) { | 132 | + public ListenableFuture<List<TkEventKvEntry>> findAll(TenantId tenantId, EntityId entityId, DeviceEventTypeEnum eventType) { |
133 | return Futures.immediateFuture( | 133 | return Futures.immediateFuture( |
134 | DaoUtil.convertDataList(Lists.newArrayList( | 134 | DaoUtil.convertDataList(Lists.newArrayList( |
135 | eventKvRepository.findAllByEventTypeAndEntityId( | 135 | eventKvRepository.findAllByEventTypeAndEntityId( |
@@ -153,7 +153,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | @@ -153,7 +153,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | ||
153 | } | 153 | } |
154 | 154 | ||
155 | @Override | 155 | @Override |
156 | - public ListenableFuture<Void> save(TenantId tenantId, DeviceProfileId profileId,EntityId entityId,TkEventType eventType, String eventIdentifier, TkEventKvEntry attribute) { | 156 | + public ListenableFuture<Void> save(TenantId tenantId, DeviceProfileId profileId,EntityId entityId,DeviceEventTypeEnum eventType, String eventIdentifier, TkEventKvEntry attribute) { |
157 | TkEventKvEntity entity = new TkEventKvEntity(); | 157 | TkEventKvEntity entity = new TkEventKvEntity(); |
158 | entity.setId(new TkEventKvCompositeKey(eventType, entityId.getId(), eventIdentifier, attribute.getEventTime(),attribute.getKey())); | 158 | entity.setId(new TkEventKvCompositeKey(eventType, entityId.getId(), eventIdentifier, attribute.getEventTime(),attribute.getKey())); |
159 | entity.setDeviceProfileId(profileId.getId()); | 159 | entity.setDeviceProfileId(profileId.getId()); |
@@ -170,7 +170,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | @@ -170,7 +170,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | ||
170 | } | 170 | } |
171 | 171 | ||
172 | @Override | 172 | @Override |
173 | - public ListenableFuture<List<Void>> removeAll(TenantId tenantId, EntityId entityId, String eventId,TkEventType eventType,List<String> keys) { | 173 | + public ListenableFuture<List<Void>> removeAll(TenantId tenantId, EntityId entityId, String eventId,DeviceEventTypeEnum eventType,List<String> keys) { |
174 | return service.submit(() -> { | 174 | return service.submit(() -> { |
175 | keys.forEach(key -> | 175 | keys.forEach(key -> |
176 | eventKvRepository.delete(eventType,entityId.getId(), eventId,key) | 176 | eventKvRepository.delete(eventType,entityId.getId(), eventId,key) |
@@ -179,7 +179,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | @@ -179,7 +179,7 @@ public class JpaEventDao extends JpaAbstractDaoListeningExecutorService implemen | ||
179 | }); | 179 | }); |
180 | } | 180 | } |
181 | 181 | ||
182 | - private TkEventKvCompositeKey getEventKvCompositeKey(TkEventType eventType,EntityId entityId, String eventIdentifier,String eventKey, Long eventTime) { | 182 | + private TkEventKvCompositeKey getEventKvCompositeKey(DeviceEventTypeEnum eventType,EntityId entityId, String eventIdentifier,String eventKey, Long eventTime) { |
183 | return new TkEventKvCompositeKey( | 183 | return new TkEventKvCompositeKey( |
184 | eventType, | 184 | eventType, |
185 | entityId.getId(), | 185 | entityId.getId(), |
@@ -24,7 +24,7 @@ import org.thingsboard.server.common.data.kv.AttributeKvEntry; | @@ -24,7 +24,7 @@ import org.thingsboard.server.common.data.kv.AttributeKvEntry; | ||
24 | import org.thingsboard.server.common.data.kv.DeleteTsKvQuery; | 24 | import org.thingsboard.server.common.data.kv.DeleteTsKvQuery; |
25 | import org.thingsboard.server.common.data.kv.TsKvEntry; | 25 | import org.thingsboard.server.common.data.kv.TsKvEntry; |
26 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 26 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
27 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 27 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
28 | 28 | ||
29 | import java.util.Collection; | 29 | import java.util.Collection; |
30 | import java.util.List; | 30 | import java.util.List; |
@@ -45,7 +45,7 @@ public interface RuleEngineTelemetryService { | @@ -45,7 +45,7 @@ public interface RuleEngineTelemetryService { | ||
45 | void saveAndNotify(TenantId tenantId, EntityId entityId, String scope, List<AttributeKvEntry> attributes, boolean notifyDevice, FutureCallback<Void> callback); | 45 | void saveAndNotify(TenantId tenantId, EntityId entityId, String scope, List<AttributeKvEntry> attributes, boolean notifyDevice, FutureCallback<Void> callback); |
46 | 46 | ||
47 | //Thingskit function | 47 | //Thingskit function |
48 | - void saveAndNotify(TenantId tenantId, DeviceProfileId profileId,EntityId entityId, String eventId, TkEventType eventType, List<TkEventKvEntry> attributes, FutureCallback<Void> callback); | 48 | + void saveAndNotify(TenantId tenantId, DeviceProfileId profileId, EntityId entityId, String eventId, DeviceEventTypeEnum eventType, List<TkEventKvEntry> attributes, FutureCallback<Void> callback); |
49 | 49 | ||
50 | void saveLatestAndNotify(TenantId tenantId, EntityId entityId, List<TsKvEntry> ts, FutureCallback<Void> callback); | 50 | void saveLatestAndNotify(TenantId tenantId, EntityId entityId, List<TsKvEntry> ts, FutureCallback<Void> callback); |
51 | 51 |
@@ -23,7 +23,7 @@ import org.thingsboard.rule.engine.telemetry.TelemetryNodeCallback; | @@ -23,7 +23,7 @@ import org.thingsboard.rule.engine.telemetry.TelemetryNodeCallback; | ||
23 | import org.thingsboard.server.common.data.id.DeviceProfileId; | 23 | import org.thingsboard.server.common.data.id.DeviceProfileId; |
24 | import org.thingsboard.server.common.data.plugin.ComponentType; | 24 | import org.thingsboard.server.common.data.plugin.ComponentType; |
25 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; | 25 | import org.thingsboard.server.common.data.yunteng.dto.TkEventKvEntry; |
26 | -import org.thingsboard.server.common.data.yunteng.enums.TkEventType; | 26 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; |
27 | import org.thingsboard.server.common.msg.TbMsg; | 27 | import org.thingsboard.server.common.msg.TbMsg; |
28 | import org.thingsboard.server.common.msg.session.SessionMsgType; | 28 | import org.thingsboard.server.common.msg.session.SessionMsgType; |
29 | import org.thingsboard.server.common.transport.adaptor.JsonConverter; | 29 | import org.thingsboard.server.common.transport.adaptor.JsonConverter; |
@@ -64,7 +64,7 @@ public class TkMsgEventNode implements TbNode { | @@ -64,7 +64,7 @@ public class TkMsgEventNode implements TbNode { | ||
64 | Set<TkEventKvEntry> events = JsonConverter.convertToEvents(new JsonParser().parse(src)); | 64 | Set<TkEventKvEntry> events = JsonConverter.convertToEvents(new JsonParser().parse(src)); |
65 | String eventIdentifier = msg.getMetaData().getValue(EVENT_IDENTIFIER_COLUMN); | 65 | String eventIdentifier = msg.getMetaData().getValue(EVENT_IDENTIFIER_COLUMN); |
66 | String deviceProfileId = msg.getMetaData().getValue(DEVICE_DEVICE_PROFILE_ID_PROPERTY); | 66 | String deviceProfileId = msg.getMetaData().getValue(DEVICE_DEVICE_PROFILE_ID_PROPERTY); |
67 | - TkEventType eventType = TkEventType.valueOf(msg.getMetaData().getValue(EVENT_TYPE_COLUMN)); | 67 | + DeviceEventTypeEnum eventType = DeviceEventTypeEnum.valueOf(msg.getMetaData().getValue(EVENT_TYPE_COLUMN)); |
68 | ctx.getTelemetryService().saveAndNotify( | 68 | ctx.getTelemetryService().saveAndNotify( |
69 | ctx.getTenantId(),new DeviceProfileId(UUID.fromString(deviceProfileId)), | 69 | ctx.getTenantId(),new DeviceProfileId(UUID.fromString(deviceProfileId)), |
70 | msg.getOriginator(), | 70 | msg.getOriginator(), |