[2.5] vulnerabilities (#2608)
* Version updates * added @Retention(RetentionPolicy.RUNTIME) for all custom Dao annotations. * changed getId, setId to getUuid, setUuid from BaseEntity, improvement AbstractControllerTest * fix rabbitmq * fix RuleChainManagerActor * refactored InMemory queue Co-authored-by: Andrii Shvaika <ashvayka@thingsboard.io>
This commit is contained in:
parent
1dd3334825
commit
8442159811
@ -72,11 +72,11 @@ public abstract class RuleChainManagerActor extends ContextAwareActor {
|
||||
}
|
||||
}
|
||||
|
||||
public ActorRef getOrCreateActor(ActorContext context, RuleChainId ruleChainId) {
|
||||
public ActorRef getOrCreateActor(akka.actor.ActorContext context, RuleChainId ruleChainId) {
|
||||
return getOrCreateActor(context, ruleChainId, eId -> ruleChainService.findRuleChainById(TenantId.SYS_TENANT_ID, eId));
|
||||
}
|
||||
|
||||
public ActorRef getOrCreateActor(ActorContext context, RuleChainId ruleChainId, Function<RuleChainId, RuleChain> provider) {
|
||||
public ActorRef getOrCreateActor(akka.actor.ActorContext context, RuleChainId ruleChainId, Function<RuleChainId, RuleChain> provider) {
|
||||
return actors.computeIfAbsent(ruleChainId, eId -> {
|
||||
RuleChain ruleChain = provider.apply(eId);
|
||||
return context.actorOf(Props.create(new RuleChainActor.ActorCreator(systemContext, tenantId, ruleChain))
|
||||
|
||||
@ -16,14 +16,14 @@
|
||||
package org.thingsboard.server.actors.service;
|
||||
|
||||
import akka.actor.Terminated;
|
||||
import akka.actor.UntypedActor;
|
||||
import akka.actor.UntypedAbstractActor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.thingsboard.server.actors.ActorSystemContext;
|
||||
import org.thingsboard.server.common.msg.TbActorMsg;
|
||||
|
||||
|
||||
public abstract class ContextAwareActor extends UntypedActor {
|
||||
public abstract class ContextAwareActor extends UntypedAbstractActor {
|
||||
|
||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
|
||||
@ -114,9 +114,7 @@ public abstract class AbstractControllerTest {
|
||||
*/
|
||||
private static final long DEFAULT_TIMEOUT = -1L;
|
||||
|
||||
protected MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(),
|
||||
MediaType.APPLICATION_JSON.getSubtype(),
|
||||
Charset.forName("utf8"));
|
||||
protected MediaType contentType = MediaType.APPLICATION_JSON;
|
||||
|
||||
protected MockMvc mockMvc;
|
||||
|
||||
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnProperty(prefix = "spring.jpa", value = "database-platform", havingValue = "org.hibernate.dialect.HSQLDialect")
|
||||
public @interface HsqlDao {
|
||||
}
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnExpression("'${database.ts.type}'=='cassandra' || '${database.entities.type}'=='cassandra'")
|
||||
public @interface NoSqlAnyDao {
|
||||
}
|
||||
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnProperty(prefix = "database.entities", value = "type", havingValue = "cassandra")
|
||||
public @interface NoSqlDao {
|
||||
}
|
||||
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnProperty(prefix = "database.ts", value = "type", havingValue = "cassandra")
|
||||
public @interface NoSqlTsDao {
|
||||
}
|
||||
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnProperty(prefix = "spring.jpa", value = "database-platform", havingValue = "org.hibernate.dialect.PostgreSQLDialect")
|
||||
public @interface PsqlDao {
|
||||
}
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnExpression("('${database.ts.type}'=='sql' || '${database.ts.type}'=='timescale') " +
|
||||
"&& '${spring.jpa.database-platform}'=='org.hibernate.dialect.PostgreSQLDialect'")
|
||||
public @interface PsqlTsAnyDao {
|
||||
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnProperty(prefix = "database.entities", value = "type", havingValue = "sql")
|
||||
public @interface SqlDao {
|
||||
}
|
||||
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnExpression("'${database.ts.type}'=='sql' || '${database.ts.type}'=='timescale'")
|
||||
public @interface SqlTsAnyDao {
|
||||
}
|
||||
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnProperty(prefix = "database.ts", value = "type", havingValue = "sql")
|
||||
public @interface SqlTsDao {
|
||||
}
|
||||
|
||||
@ -17,6 +17,10 @@ package org.thingsboard.server.dao.util;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ConditionalOnProperty(prefix = "database.ts", value = "type", havingValue = "timescale")
|
||||
public @interface TimescaleDBTsDao {
|
||||
}
|
||||
|
||||
@ -21,7 +21,6 @@ import org.thingsboard.server.queue.TbQueueMsg;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@ -30,10 +29,12 @@ import java.util.concurrent.TimeUnit;
|
||||
@Slf4j
|
||||
public final class InMemoryStorage {
|
||||
private static InMemoryStorage instance;
|
||||
private final Map<String, BlockingQueue<TbQueueMsg>> storage;
|
||||
private final ConcurrentHashMap<String, BlockingQueue<TbQueueMsg>> storage;
|
||||
private volatile boolean stopped;
|
||||
|
||||
private InMemoryStorage() {
|
||||
storage = new ConcurrentHashMap<>();
|
||||
stopped = false;
|
||||
}
|
||||
|
||||
public static InMemoryStorage getInstance() {
|
||||
@ -67,19 +68,20 @@ public final class InMemoryStorage {
|
||||
entities.add((T) other);
|
||||
}
|
||||
}
|
||||
if (entities.size() > 0) {
|
||||
storage.computeIfAbsent(topic, (t) -> new LinkedBlockingQueue<>()).addAll(entities);
|
||||
}
|
||||
return entities;
|
||||
} catch (InterruptedException e) {
|
||||
log.warn("Queue was interrupted", e);
|
||||
return Collections.emptyList();
|
||||
if (!stopped) {
|
||||
log.warn("Queue was interrupted", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void commit(String topic) {
|
||||
//TODO: 2.5 Until someone calls commit you should not allow to poll new elements.
|
||||
if (storage.containsKey(topic)) {
|
||||
// storage.get(topic).remove();
|
||||
}
|
||||
public void stop() {
|
||||
stopped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,18 +15,26 @@
|
||||
*/
|
||||
package org.thingsboard.server.queue.memory;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.thingsboard.server.common.msg.queue.TopicPartitionInfo;
|
||||
import org.thingsboard.server.queue.TbQueueConsumer;
|
||||
import org.thingsboard.server.queue.TbQueueMsg;
|
||||
import org.thingsboard.server.common.msg.queue.TopicPartitionInfo;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class InMemoryTbQueueConsumer<T extends TbQueueMsg> implements TbQueueConsumer<T> {
|
||||
private final InMemoryStorage storage = InMemoryStorage.getInstance();
|
||||
private volatile Set<TopicPartitionInfo> partitions;
|
||||
private volatile boolean stopped;
|
||||
private volatile boolean subscribed;
|
||||
|
||||
public InMemoryTbQueueConsumer(String topic) {
|
||||
this.topic = topic;
|
||||
stopped = false;
|
||||
}
|
||||
|
||||
private final String topic;
|
||||
@ -38,26 +46,44 @@ public class InMemoryTbQueueConsumer<T extends TbQueueMsg> implements TbQueueCon
|
||||
|
||||
@Override
|
||||
public void subscribe() {
|
||||
|
||||
partitions = Collections.singleton(new TopicPartitionInfo(topic, null, null, true));
|
||||
subscribed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subscribe(Set<TopicPartitionInfo> partitions) {
|
||||
|
||||
this.partitions = partitions;
|
||||
subscribed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsubscribe() {
|
||||
|
||||
stopped = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> poll(long durationInMillis) {
|
||||
return storage.get(topic, durationInMillis);
|
||||
if (subscribed) {
|
||||
List<T> messages = partitions
|
||||
.stream()
|
||||
.map(tpi -> storage.get(tpi.getFullTopicName(), durationInMillis))
|
||||
.flatMap(List::stream)
|
||||
.map(msg -> (T) msg).collect(Collectors.toList());
|
||||
if (messages.size() > 0) {
|
||||
return messages;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(durationInMillis);
|
||||
} catch (InterruptedException e) {
|
||||
if (!stopped) {
|
||||
log.error("Failed to sleep.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() {
|
||||
storage.commit(topic);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public class InMemoryTbQueueProducer<T extends TbQueueMsg> implements TbQueuePro
|
||||
|
||||
@Override
|
||||
public void send(TopicPartitionInfo tpi, T msg, TbQueueCallback callback) {
|
||||
boolean result = storage.put(tpi.getTopic(), msg);
|
||||
boolean result = storage.put(tpi.getFullTopicName(), msg);
|
||||
if (result) {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(null);
|
||||
|
||||
@ -18,19 +18,16 @@ package org.thingsboard.server.queue.provider;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.msg.queue.ServiceType;
|
||||
import org.thingsboard.server.gen.js.JsInvokeProtos;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToCoreMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToCoreNotificationMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineNotificationMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.TransportApiResponseMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos;
|
||||
import org.thingsboard.server.queue.TbQueueConsumer;
|
||||
import org.thingsboard.server.queue.TbQueueProducer;
|
||||
import org.thingsboard.server.queue.TbQueueRequestTemplate;
|
||||
import org.thingsboard.server.queue.common.TbProtoJsQueueMsg;
|
||||
import org.thingsboard.server.queue.common.TbProtoQueueMsg;
|
||||
import org.thingsboard.server.queue.discovery.PartitionService;
|
||||
import org.thingsboard.server.queue.discovery.TbServiceInfoProvider;
|
||||
import org.thingsboard.server.queue.memory.InMemoryTbQueueConsumer;
|
||||
import org.thingsboard.server.queue.memory.InMemoryTbQueueProducer;
|
||||
import org.thingsboard.server.queue.settings.TbQueueCoreSettings;
|
||||
@ -44,76 +41,81 @@ import org.thingsboard.server.queue.settings.TbRuleEngineQueueConfiguration;
|
||||
@ConditionalOnExpression("'${queue.type:null}'=='in-memory' && '${service.type:null}'=='monolith'")
|
||||
public class InMemoryMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngineQueueFactory {
|
||||
|
||||
private final PartitionService partitionService;
|
||||
private final TbQueueCoreSettings coreSettings;
|
||||
private final TbServiceInfoProvider serviceInfoProvider;
|
||||
private final TbQueueRuleEngineSettings ruleEngineSettings;
|
||||
private final TbQueueTransportApiSettings transportApiSettings;
|
||||
private final TbQueueTransportNotificationSettings notificationSettings;
|
||||
private final TbQueueTransportNotificationSettings transportNotificationSettings;
|
||||
|
||||
public InMemoryMonolithQueueFactory(TbQueueCoreSettings coreSettings,
|
||||
public InMemoryMonolithQueueFactory(PartitionService partitionService, TbQueueCoreSettings coreSettings,
|
||||
TbQueueRuleEngineSettings ruleEngineSettings,
|
||||
TbServiceInfoProvider serviceInfoProvider,
|
||||
TbQueueTransportApiSettings transportApiSettings,
|
||||
TbQueueTransportNotificationSettings notificationSettings) {
|
||||
TbQueueTransportNotificationSettings transportNotificationSettings) {
|
||||
this.partitionService = partitionService;
|
||||
this.coreSettings = coreSettings;
|
||||
this.serviceInfoProvider = serviceInfoProvider;
|
||||
this.ruleEngineSettings = ruleEngineSettings;
|
||||
this.transportApiSettings = transportApiSettings;
|
||||
this.notificationSettings = notificationSettings;
|
||||
this.transportNotificationSettings = transportNotificationSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<ToTransportMsg>> createTransportNotificationsMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(notificationSettings.getNotificationsTopic());
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportProtos.ToTransportMsg>> createTransportNotificationsMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(transportNotificationSettings.getNotificationsTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<ToRuleEngineMsg>> createRuleEngineMsgProducer() {
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> createRuleEngineMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(ruleEngineSettings.getTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<ToCoreMsg>> createTbCoreMsgProducer() {
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportProtos.ToRuleEngineNotificationMsg>> createRuleEngineNotificationsMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(ruleEngineSettings.getTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportProtos.ToCoreMsg>> createTbCoreMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(coreSettings.getTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<ToRuleEngineMsg>> createToRuleEngineMsgConsumer(TbRuleEngineQueueConfiguration configuration) {
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportProtos.ToCoreNotificationMsg>> createTbCoreNotificationsMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(coreSettings.getTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> createToRuleEngineMsgConsumer(TbRuleEngineQueueConfiguration configuration) {
|
||||
return new InMemoryTbQueueConsumer<>(ruleEngineSettings.getTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<ToCoreMsg>> createToCoreMsgConsumer() {
|
||||
public TbQueueConsumer<TbProtoQueueMsg<TransportProtos.ToRuleEngineNotificationMsg>> createToRuleEngineNotificationsMsgConsumer() {
|
||||
return new InMemoryTbQueueConsumer<>(partitionService.getNotificationsTopic(ServiceType.TB_RULE_ENGINE, serviceInfoProvider.getServiceId()).getFullTopicName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<TransportProtos.ToCoreMsg>> createToCoreMsgConsumer() {
|
||||
return new InMemoryTbQueueConsumer<>(coreSettings.getTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<TransportApiRequestMsg>> createTransportApiRequestConsumer() {
|
||||
public TbQueueConsumer<TbProtoQueueMsg<TransportProtos.ToCoreNotificationMsg>> createToCoreNotificationsMsgConsumer() {
|
||||
return new InMemoryTbQueueConsumer<>(partitionService.getNotificationsTopic(ServiceType.TB_CORE, serviceInfoProvider.getServiceId()).getFullTopicName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<TransportProtos.TransportApiRequestMsg>> createTransportApiRequestConsumer() {
|
||||
return new InMemoryTbQueueConsumer<>(transportApiSettings.getRequestsTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportApiResponseMsg>> createTransportApiResponseProducer() {
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportProtos.TransportApiResponseMsg>> createTransportApiResponseProducer() {
|
||||
return new InMemoryTbQueueProducer<>(transportApiSettings.getResponsesTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<ToRuleEngineNotificationMsg>> createRuleEngineNotificationsMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(ruleEngineSettings.getTopic() + ".notifications");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<ToCoreNotificationMsg>> createTbCoreNotificationsMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(coreSettings.getTopic() + ".notifications");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<ToCoreNotificationMsg>> createToCoreNotificationsMsgConsumer() {
|
||||
return new InMemoryTbQueueConsumer<>(coreSettings.getTopic() + ".notifications");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<ToRuleEngineNotificationMsg>> createToRuleEngineNotificationsMsgConsumer() {
|
||||
return new InMemoryTbQueueConsumer<>(ruleEngineSettings.getTopic() + ".notifications");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueRequestTemplate<TbProtoJsQueueMsg<JsInvokeProtos.RemoteJsRequest>, TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>> createRemoteJsRequestTemplate() {
|
||||
return null;
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.thingsboard.server.queue.provider;
|
||||
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -29,10 +28,9 @@ import org.thingsboard.server.queue.TbQueueProducer;
|
||||
import org.thingsboard.server.queue.TbQueueRequestTemplate;
|
||||
import org.thingsboard.server.queue.common.DefaultTbQueueRequestTemplate;
|
||||
import org.thingsboard.server.queue.common.TbProtoQueueMsg;
|
||||
import org.thingsboard.server.queue.discovery.TbServiceInfoProvider;
|
||||
import org.thingsboard.server.queue.memory.InMemoryTbQueueConsumer;
|
||||
import org.thingsboard.server.queue.memory.InMemoryTbQueueProducer;
|
||||
import org.thingsboard.server.queue.settings.TbQueueCoreSettings;
|
||||
import org.thingsboard.server.queue.settings.TbQueueRuleEngineSettings;
|
||||
import org.thingsboard.server.queue.settings.TbQueueTransportApiSettings;
|
||||
import org.thingsboard.server.queue.settings.TbQueueTransportNotificationSettings;
|
||||
|
||||
@ -40,32 +38,32 @@ import org.thingsboard.server.queue.settings.TbQueueTransportNotificationSetting
|
||||
@ConditionalOnExpression("'${queue.type:null}'=='in-memory' && ('${service.type:null}'=='monolith' || '${service.type:null}'=='tb-transport')")
|
||||
@Slf4j
|
||||
public class InMemoryTbTransportQueueFactory implements TbTransportQueueFactory {
|
||||
|
||||
private final TbQueueCoreSettings coreSettings;
|
||||
private final TbQueueRuleEngineSettings ruleEngineSettings;
|
||||
private final TbQueueTransportApiSettings transportApiSettings;
|
||||
private final TbQueueTransportNotificationSettings notificationSettings;
|
||||
private final TbQueueTransportNotificationSettings transportNotificationSettings;
|
||||
private final TbServiceInfoProvider serviceInfoProvider;
|
||||
|
||||
public InMemoryTbTransportQueueFactory(TbQueueCoreSettings coreSettings,
|
||||
TbQueueRuleEngineSettings ruleEngineSettings,
|
||||
TbQueueTransportApiSettings transportApiSettings,
|
||||
TbQueueTransportNotificationSettings notificationSettings) {
|
||||
this.coreSettings = coreSettings;
|
||||
this.ruleEngineSettings = ruleEngineSettings;
|
||||
public InMemoryTbTransportQueueFactory(TbQueueTransportApiSettings transportApiSettings,
|
||||
TbQueueTransportNotificationSettings transportNotificationSettings,
|
||||
TbServiceInfoProvider serviceInfoProvider) {
|
||||
this.transportApiSettings = transportApiSettings;
|
||||
this.notificationSettings = notificationSettings;
|
||||
this.transportNotificationSettings = transportNotificationSettings;
|
||||
this.serviceInfoProvider = serviceInfoProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueRequestTemplate<TbProtoQueueMsg<TransportApiRequestMsg>, TbProtoQueueMsg<TransportApiResponseMsg>> createTransportApiRequestTemplate() {
|
||||
InMemoryTbQueueProducer<TbProtoQueueMsg<TransportApiRequestMsg>> producer = new InMemoryTbQueueProducer<>(transportApiSettings.getRequestsTopic());
|
||||
InMemoryTbQueueConsumer<TbProtoQueueMsg<TransportApiResponseMsg>> consumer = new InMemoryTbQueueConsumer<>(transportApiSettings.getResponsesTopic());
|
||||
InMemoryTbQueueProducer<TbProtoQueueMsg<TransportApiRequestMsg>> producerTemplate =
|
||||
new InMemoryTbQueueProducer<>(transportApiSettings.getRequestsTopic());
|
||||
|
||||
InMemoryTbQueueConsumer<TbProtoQueueMsg<TransportApiResponseMsg>> consumerTemplate =
|
||||
new InMemoryTbQueueConsumer<>(transportApiSettings.getResponsesTopic() + "." + serviceInfoProvider.getServiceId());
|
||||
|
||||
DefaultTbQueueRequestTemplate.DefaultTbQueueRequestTemplateBuilder
|
||||
<TbProtoQueueMsg<TransportApiRequestMsg>, TbProtoQueueMsg<TransportApiResponseMsg>> templateBuilder = DefaultTbQueueRequestTemplate.builder();
|
||||
templateBuilder.queueAdmin(topic -> Futures.immediateFuture(null));
|
||||
templateBuilder.requestTemplate(producer);
|
||||
templateBuilder.responseTemplate(consumer);
|
||||
templateBuilder.queueAdmin(topic -> {
|
||||
});
|
||||
templateBuilder.requestTemplate(producerTemplate);
|
||||
templateBuilder.responseTemplate(consumerTemplate);
|
||||
templateBuilder.maxPendingRequests(transportApiSettings.getMaxPendingRequests());
|
||||
templateBuilder.maxRequestTimeout(transportApiSettings.getMaxRequestsTimeout());
|
||||
templateBuilder.pollInterval(transportApiSettings.getResponsePollInterval());
|
||||
@ -74,16 +72,16 @@ public class InMemoryTbTransportQueueFactory implements TbTransportQueueFactory
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<ToRuleEngineMsg>> createRuleEngineMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(ruleEngineSettings.getTopic());
|
||||
return new InMemoryTbQueueProducer<>(transportApiSettings.getRequestsTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueProducer<TbProtoQueueMsg<ToCoreMsg>> createTbCoreMsgProducer() {
|
||||
return new InMemoryTbQueueProducer<>(coreSettings.getTopic());
|
||||
return new InMemoryTbQueueProducer<>(transportApiSettings.getRequestsTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueConsumer<TbProtoQueueMsg<ToTransportMsg>> createTransportNotificationsConsumer() {
|
||||
return new InMemoryTbQueueConsumer<>(notificationSettings.getNotificationsTopic());
|
||||
return new InMemoryTbQueueConsumer<>(transportNotificationSettings.getNotificationsTopic() + "." + serviceInfoProvider.getServiceId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,10 +18,13 @@ package org.thingsboard.server.queue.provider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.msg.queue.ServiceType;
|
||||
import org.thingsboard.server.gen.js.JsInvokeProtos;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos;
|
||||
import org.thingsboard.server.queue.TbQueueAdmin;
|
||||
import org.thingsboard.server.queue.TbQueueConsumer;
|
||||
import org.thingsboard.server.queue.TbQueueProducer;
|
||||
import org.thingsboard.server.queue.TbQueueRequestTemplate;
|
||||
import org.thingsboard.server.queue.common.TbProtoJsQueueMsg;
|
||||
import org.thingsboard.server.queue.common.TbProtoQueueMsg;
|
||||
import org.thingsboard.server.queue.discovery.PartitionService;
|
||||
import org.thingsboard.server.queue.discovery.TbServiceInfoProvider;
|
||||
@ -125,4 +128,9 @@ public class RabbitMqMonolithQueueFactory implements TbCoreQueueFactory, TbRuleE
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportProtos.TransportApiResponseMsg>> createTransportApiResponseProducer() {
|
||||
return new TbRabbitMqProducerTemplate<>(admin, rabbitMqSettings, transportApiSettings.getResponsesTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueRequestTemplate<TbProtoJsQueueMsg<JsInvokeProtos.RemoteJsRequest>, TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>> createRemoteJsRequestTemplate() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ package org.thingsboard.server.queue.provider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.msg.queue.ServiceType;
|
||||
import org.thingsboard.server.gen.js.JsInvokeProtos;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToCoreMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToCoreNotificationMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg;
|
||||
@ -28,6 +29,8 @@ import org.thingsboard.server.gen.transport.TransportProtos.TransportApiResponse
|
||||
import org.thingsboard.server.queue.TbQueueAdmin;
|
||||
import org.thingsboard.server.queue.TbQueueConsumer;
|
||||
import org.thingsboard.server.queue.TbQueueProducer;
|
||||
import org.thingsboard.server.queue.TbQueueRequestTemplate;
|
||||
import org.thingsboard.server.queue.common.TbProtoJsQueueMsg;
|
||||
import org.thingsboard.server.queue.common.TbProtoQueueMsg;
|
||||
import org.thingsboard.server.queue.discovery.PartitionService;
|
||||
import org.thingsboard.server.queue.discovery.TbServiceInfoProvider;
|
||||
@ -114,4 +117,9 @@ public class RabbitMqTbCoreQueueFactory implements TbCoreQueueFactory {
|
||||
public TbQueueProducer<TbProtoQueueMsg<TransportApiResponseMsg>> createTransportApiResponseProducer() {
|
||||
return new TbRabbitMqProducerTemplate<>(admin, rabbitMqSettings, coreSettings.getTopic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueRequestTemplate<TbProtoJsQueueMsg<JsInvokeProtos.RemoteJsRequest>, TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>> createRemoteJsRequestTemplate() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ package org.thingsboard.server.queue.provider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.common.msg.queue.ServiceType;
|
||||
import org.thingsboard.server.gen.js.JsInvokeProtos;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToCoreMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToCoreNotificationMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg;
|
||||
@ -26,6 +27,8 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg;
|
||||
import org.thingsboard.server.queue.TbQueueAdmin;
|
||||
import org.thingsboard.server.queue.TbQueueConsumer;
|
||||
import org.thingsboard.server.queue.TbQueueProducer;
|
||||
import org.thingsboard.server.queue.TbQueueRequestTemplate;
|
||||
import org.thingsboard.server.queue.common.TbProtoJsQueueMsg;
|
||||
import org.thingsboard.server.queue.common.TbProtoQueueMsg;
|
||||
import org.thingsboard.server.queue.discovery.PartitionService;
|
||||
import org.thingsboard.server.queue.discovery.TbServiceInfoProvider;
|
||||
@ -97,4 +100,9 @@ public class RabbitMqTbRuleEngineQueueFactory implements TbRuleEngineQueueFactor
|
||||
partitionService.getNotificationsTopic(ServiceType.TB_RULE_ENGINE, serviceInfoProvider.getServiceId()).getFullTopicName(),
|
||||
msg -> new TbProtoQueueMsg<>(msg.getKey(), ToRuleEngineNotificationMsg.parseFrom(msg.getData()), msg.getHeaders()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbQueueRequestTemplate<TbProtoJsQueueMsg<JsInvokeProtos.RemoteJsRequest>, TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>> createRemoteJsRequestTemplate() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,12 +151,12 @@ public class CassandraBaseComponentDescriptorDao extends CassandraAbstractSearch
|
||||
}
|
||||
|
||||
private Optional<ComponentDescriptor> saveIfNotExist(TenantId tenantId, ComponentDescriptorEntity entity) {
|
||||
if (entity.getId() == null) {
|
||||
entity.setId(UUIDs.timeBased());
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUIDs.timeBased());
|
||||
}
|
||||
|
||||
ResultSet rs = executeRead(tenantId, QueryBuilder.insertInto(getColumnFamilyName())
|
||||
.value(ModelConstants.ID_PROPERTY, entity.getId())
|
||||
.value(ModelConstants.ID_PROPERTY, entity.getUuid())
|
||||
.value(ModelConstants.COMPONENT_DESCRIPTOR_NAME_PROPERTY, entity.getName())
|
||||
.value(ModelConstants.COMPONENT_DESCRIPTOR_CLASS_PROPERTY, entity.getClazz())
|
||||
.value(ModelConstants.COMPONENT_DESCRIPTOR_TYPE_PROPERTY, entity.getType())
|
||||
|
||||
@ -184,11 +184,11 @@ public class CassandraBaseEventDao extends CassandraAbstractSearchTimeDao<EventE
|
||||
}
|
||||
|
||||
private ListenableFuture<Optional<Event>> saveAsync(TenantId tenantId, EventEntity entity, boolean ifNotExists, int ttl) {
|
||||
if (entity.getId() == null) {
|
||||
entity.setId(UUIDs.timeBased());
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUIDs.timeBased());
|
||||
}
|
||||
Insert insert = QueryBuilder.insertInto(getColumnFamilyName())
|
||||
.value(ModelConstants.ID_PROPERTY, entity.getId())
|
||||
.value(ModelConstants.ID_PROPERTY, entity.getUuid())
|
||||
.value(ModelConstants.EVENT_TENANT_ID_PROPERTY, entity.getTenantId())
|
||||
.value(ModelConstants.EVENT_ENTITY_TYPE_PROPERTY, entity.getEntityType())
|
||||
.value(ModelConstants.EVENT_ENTITY_ID_PROPERTY, entity.getEntityId())
|
||||
|
||||
@ -19,8 +19,8 @@ import java.util.UUID;
|
||||
|
||||
public interface BaseEntity<D> extends ToData<D> {
|
||||
|
||||
UUID getId();
|
||||
UUID getUuid();
|
||||
|
||||
void setId(UUID id);
|
||||
void setUuid(UUID id);
|
||||
|
||||
}
|
||||
|
||||
@ -35,14 +35,15 @@ public abstract class BaseSqlEntity<D> implements BaseEntity<D> {
|
||||
protected String id;
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
return UUIDConverter.fromString(id);
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
@Override
|
||||
public void setUuid(UUID id) {
|
||||
this.id = UUIDConverter.fromTimeUUID(id);
|
||||
}
|
||||
|
||||
|
||||
@ -61,11 +61,11 @@ public final class AdminSettingsEntity implements BaseEntity<AdminSettings> {
|
||||
this.jsonValue = adminSettings.getJsonValue();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -141,11 +141,11 @@ public final class AlarmEntity implements BaseEntity<Alarm> {
|
||||
}
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -94,11 +94,11 @@ public final class AssetEntity implements SearchTextEntity<Asset> {
|
||||
this.additionalInfo = asset.getAdditionalInfo();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -94,12 +94,12 @@ public class AuditLogEntity implements BaseEntity<AuditLog> {
|
||||
private String actionFailureDetails;
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -98,12 +98,12 @@ public class ComponentDescriptorEntity implements SearchTextEntity<ComponentDesc
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -112,11 +112,11 @@ public final class CustomerEntity implements SearchTextEntity<Customer> {
|
||||
this.additionalInfo = customer.getAdditionalInfo();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -98,11 +98,11 @@ public final class DashboardEntity implements SearchTextEntity<Dashboard> {
|
||||
this.configuration = dashboard.getConfiguration();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -91,11 +91,11 @@ public class DashboardInfoEntity implements SearchTextEntity<DashboardInfo> {
|
||||
}
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -74,11 +74,11 @@ public final class DeviceCredentialsEntity implements BaseEntity<DeviceCredentia
|
||||
this.credentialsValue = deviceCredentials.getCredentialsValue();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -86,11 +86,11 @@ public final class DeviceEntity implements SearchTextEntity<Device> {
|
||||
this.additionalInfo = device.getAdditionalInfo();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -161,4 +161,14 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> {
|
||||
entityView.setAdditionalInfo(additionalInfo);
|
||||
return entityView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUuid() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,12 +94,12 @@ public class EventEntity implements BaseEntity<Event> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -102,12 +102,12 @@ public class RuleChainEntity implements SearchTextEntity<RuleChain> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -96,12 +96,12 @@ public class RuleNodeEntity implements SearchTextEntity<RuleNode> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -110,11 +110,11 @@ public final class TenantEntity implements SearchTextEntity<Tenant> {
|
||||
this.additionalInfo = tenant.getAdditionalInfo();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -75,11 +75,11 @@ public final class UserCredentialsEntity implements BaseEntity<UserCredentials>
|
||||
this.resetToken = userCredentials.getResetToken();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -101,11 +101,11 @@ public final class UserEntity implements SearchTextEntity<User> {
|
||||
this.additionalInfo = user.getAdditionalInfo();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -82,12 +82,12 @@ public final class WidgetTypeEntity implements BaseEntity<WidgetType> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -82,12 +82,12 @@ public final class WidgetsBundleEntity implements SearchTextEntity<WidgetsBundle
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
public UUID getUuid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
public void setUuid(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ public final class AdminSettingsEntity extends BaseSqlEntity<AdminSettings> impl
|
||||
|
||||
public AdminSettingsEntity(AdminSettings adminSettings) {
|
||||
if (adminSettings.getId() != null) {
|
||||
this.setId(adminSettings.getId().getId());
|
||||
this.setUuid(adminSettings.getId().getId());
|
||||
}
|
||||
this.key = adminSettings.getKey();
|
||||
this.jsonValue = adminSettings.getJsonValue();
|
||||
|
||||
@ -114,7 +114,7 @@ public final class AlarmEntity extends BaseSqlEntity<Alarm> implements BaseEntit
|
||||
|
||||
public AlarmEntity(Alarm alarm) {
|
||||
if (alarm.getId() != null) {
|
||||
this.setId(alarm.getId().getId());
|
||||
this.setUuid(alarm.getId().getId());
|
||||
}
|
||||
if (alarm.getTenantId() != null) {
|
||||
this.tenantId = UUIDConverter.fromTimeUUID(alarm.getTenantId().getId());
|
||||
|
||||
@ -78,7 +78,7 @@ public final class AssetEntity extends BaseSqlEntity<Asset> implements SearchTex
|
||||
|
||||
public AssetEntity(Asset asset) {
|
||||
if (asset.getId() != null) {
|
||||
this.setId(asset.getId().getId());
|
||||
this.setUuid(asset.getId().getId());
|
||||
}
|
||||
if (asset.getTenantId() != null) {
|
||||
this.tenantId = UUIDConverter.fromTimeUUID(asset.getTenantId().getId());
|
||||
|
||||
@ -103,7 +103,7 @@ public class AuditLogEntity extends BaseSqlEntity<AuditLog> implements BaseEntit
|
||||
|
||||
public AuditLogEntity(AuditLog auditLog) {
|
||||
if (auditLog.getId() != null) {
|
||||
this.setId(auditLog.getId().getId());
|
||||
this.setUuid(auditLog.getId().getId());
|
||||
}
|
||||
if (auditLog.getTenantId() != null) {
|
||||
this.tenantId = toString(auditLog.getTenantId().getId());
|
||||
@ -128,8 +128,8 @@ public class AuditLogEntity extends BaseSqlEntity<AuditLog> implements BaseEntit
|
||||
|
||||
@Override
|
||||
public AuditLog toData() {
|
||||
AuditLog auditLog = new AuditLog(new AuditLogId(getId()));
|
||||
auditLog.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
AuditLog auditLog = new AuditLog(new AuditLogId(this.getUuid()));
|
||||
auditLog.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
if (tenantId != null) {
|
||||
auditLog.setTenantId(new TenantId(toUUID(tenantId)));
|
||||
}
|
||||
|
||||
@ -34,7 +34,6 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -72,7 +71,7 @@ public class ComponentDescriptorEntity extends BaseSqlEntity<ComponentDescriptor
|
||||
|
||||
public ComponentDescriptorEntity(ComponentDescriptor component) {
|
||||
if (component.getId() != null) {
|
||||
this.setId(component.getId().getId());
|
||||
this.setUuid(component.getId().getId());
|
||||
}
|
||||
this.actions = component.getActions();
|
||||
this.type = component.getType();
|
||||
@ -85,7 +84,7 @@ public class ComponentDescriptorEntity extends BaseSqlEntity<ComponentDescriptor
|
||||
|
||||
@Override
|
||||
public ComponentDescriptor toData() {
|
||||
ComponentDescriptor data = new ComponentDescriptor(new ComponentDescriptorId(this.getId()));
|
||||
ComponentDescriptor data = new ComponentDescriptor(new ComponentDescriptorId(this.getUuid()));
|
||||
data.setType(type);
|
||||
data.setScope(scope);
|
||||
data.setName(this.getName());
|
||||
|
||||
@ -84,7 +84,7 @@ public final class CustomerEntity extends BaseSqlEntity<Customer> implements Sea
|
||||
|
||||
public CustomerEntity(Customer customer) {
|
||||
if (customer.getId() != null) {
|
||||
this.setId(customer.getId().getId());
|
||||
this.setUuid(customer.getId().getId());
|
||||
}
|
||||
this.tenantId = UUIDConverter.fromTimeUUID(customer.getTenantId().getId());
|
||||
this.title = customer.getTitle();
|
||||
@ -111,8 +111,8 @@ public final class CustomerEntity extends BaseSqlEntity<Customer> implements Sea
|
||||
|
||||
@Override
|
||||
public Customer toData() {
|
||||
Customer customer = new Customer(new CustomerId(getId()));
|
||||
customer.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
Customer customer = new Customer(new CustomerId(this.getUuid()));
|
||||
customer.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
customer.setTenantId(new TenantId(UUIDConverter.fromString(tenantId)));
|
||||
customer.setTitle(title);
|
||||
customer.setCountry(country);
|
||||
|
||||
@ -75,7 +75,7 @@ public final class DashboardEntity extends BaseSqlEntity<Dashboard> implements S
|
||||
|
||||
public DashboardEntity(Dashboard dashboard) {
|
||||
if (dashboard.getId() != null) {
|
||||
this.setId(dashboard.getId().getId());
|
||||
this.setUuid(dashboard.getId().getId());
|
||||
}
|
||||
if (dashboard.getTenantId() != null) {
|
||||
this.tenantId = toString(dashboard.getTenantId().getId());
|
||||
@ -103,8 +103,8 @@ public final class DashboardEntity extends BaseSqlEntity<Dashboard> implements S
|
||||
|
||||
@Override
|
||||
public Dashboard toData() {
|
||||
Dashboard dashboard = new Dashboard(new DashboardId(this.getId()));
|
||||
dashboard.setCreatedTime(UUIDs.unixTimestamp(this.getId()));
|
||||
Dashboard dashboard = new Dashboard(new DashboardId(this.getUuid()));
|
||||
dashboard.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
if (tenantId != null) {
|
||||
dashboard.setTenantId(new TenantId(toUUID(tenantId)));
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public class DashboardInfoEntity extends BaseSqlEntity<DashboardInfo> implements
|
||||
|
||||
public DashboardInfoEntity(DashboardInfo dashboardInfo) {
|
||||
if (dashboardInfo.getId() != null) {
|
||||
this.setId(dashboardInfo.getId().getId());
|
||||
this.setUuid(dashboardInfo.getId().getId());
|
||||
}
|
||||
if (dashboardInfo.getTenantId() != null) {
|
||||
this.tenantId = toString(dashboardInfo.getTenantId().getId());
|
||||
@ -97,8 +97,8 @@ public class DashboardInfoEntity extends BaseSqlEntity<DashboardInfo> implements
|
||||
|
||||
@Override
|
||||
public DashboardInfo toData() {
|
||||
DashboardInfo dashboardInfo = new DashboardInfo(new DashboardId(getId()));
|
||||
dashboardInfo.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
DashboardInfo dashboardInfo = new DashboardInfo(new DashboardId(this.getUuid()));
|
||||
dashboardInfo.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
if (tenantId != null) {
|
||||
dashboardInfo.setTenantId(new TenantId(toUUID(tenantId)));
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public final class DeviceCredentialsEntity extends BaseSqlEntity<DeviceCredentia
|
||||
|
||||
public DeviceCredentialsEntity(DeviceCredentials deviceCredentials) {
|
||||
if (deviceCredentials.getId() != null) {
|
||||
this.setId(deviceCredentials.getId().getId());
|
||||
this.setUuid(deviceCredentials.getId().getId());
|
||||
}
|
||||
if (deviceCredentials.getDeviceId() != null) {
|
||||
this.deviceId = toString(deviceCredentials.getDeviceId().getId());
|
||||
@ -69,8 +69,8 @@ public final class DeviceCredentialsEntity extends BaseSqlEntity<DeviceCredentia
|
||||
|
||||
@Override
|
||||
public DeviceCredentials toData() {
|
||||
DeviceCredentials deviceCredentials = new DeviceCredentials(new DeviceCredentialsId(getId()));
|
||||
deviceCredentials.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
DeviceCredentials deviceCredentials = new DeviceCredentials(new DeviceCredentialsId(this.getUuid()));
|
||||
deviceCredentials.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
if (deviceId != null) {
|
||||
deviceCredentials.setDeviceId(new DeviceId(toUUID(deviceId)));
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ public final class DeviceEntity extends BaseSqlEntity<Device> implements SearchT
|
||||
|
||||
public DeviceEntity(Device device) {
|
||||
if (device.getId() != null) {
|
||||
this.setId(device.getId().getId());
|
||||
this.setUuid(device.getId().getId());
|
||||
}
|
||||
if (device.getTenantId() != null) {
|
||||
this.tenantId = toString(device.getTenantId().getId());
|
||||
@ -95,8 +95,8 @@ public final class DeviceEntity extends BaseSqlEntity<Device> implements SearchT
|
||||
|
||||
@Override
|
||||
public Device toData() {
|
||||
Device device = new Device(new DeviceId(getId()));
|
||||
device.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
Device device = new Device(new DeviceId(this.getUuid()));
|
||||
device.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
if (tenantId != null) {
|
||||
device.setTenantId(new TenantId(toUUID(tenantId)));
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class EntityViewEntity extends BaseSqlEntity<EntityView> implements Searc
|
||||
|
||||
public EntityViewEntity(EntityView entityView) {
|
||||
if (entityView.getId() != null) {
|
||||
this.setId(entityView.getId().getId());
|
||||
this.setUuid(entityView.getId().getId());
|
||||
}
|
||||
if (entityView.getEntityId() != null) {
|
||||
this.entityId = toString(entityView.getEntityId().getId());
|
||||
@ -136,8 +136,8 @@ public class EntityViewEntity extends BaseSqlEntity<EntityView> implements Searc
|
||||
|
||||
@Override
|
||||
public EntityView toData() {
|
||||
EntityView entityView = new EntityView(new EntityViewId(getId()));
|
||||
entityView.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
EntityView entityView = new EntityView(new EntityViewId(this.getUuid()));
|
||||
entityView.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
|
||||
if (entityId != null) {
|
||||
entityView.setEntityId(EntityIdFactory.getByTypeAndId(entityType.name(), toUUID(entityId).toString()));
|
||||
|
||||
@ -75,7 +75,7 @@ public class EventEntity extends BaseSqlEntity<Event> implements BaseEntity<Eve
|
||||
|
||||
public EventEntity(Event event) {
|
||||
if (event.getId() != null) {
|
||||
this.setId(event.getId().getId());
|
||||
this.setUuid(event.getId().getId());
|
||||
}
|
||||
if (event.getTenantId() != null) {
|
||||
this.tenantId = toString(event.getTenantId().getId());
|
||||
@ -92,8 +92,8 @@ public class EventEntity extends BaseSqlEntity<Event> implements BaseEntity<Eve
|
||||
|
||||
@Override
|
||||
public Event toData() {
|
||||
Event event = new Event(new EventId(getId()));
|
||||
event.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
Event event = new Event(new EventId(this.getUuid()));
|
||||
event.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
event.setTenantId(new TenantId(toUUID(tenantId)));
|
||||
event.setEntityId(EntityIdFactory.getByTypeAndUuid(entityType, toUUID(entityId)));
|
||||
event.setBody(body);
|
||||
|
||||
@ -74,7 +74,7 @@ public class RuleChainEntity extends BaseSqlEntity<RuleChain> implements SearchT
|
||||
|
||||
public RuleChainEntity(RuleChain ruleChain) {
|
||||
if (ruleChain.getId() != null) {
|
||||
this.setId(ruleChain.getUuidId());
|
||||
this.setUuid(ruleChain.getUuidId());
|
||||
}
|
||||
this.tenantId = toString(DaoUtil.getId(ruleChain.getTenantId()));
|
||||
this.name = ruleChain.getName();
|
||||
@ -100,8 +100,8 @@ public class RuleChainEntity extends BaseSqlEntity<RuleChain> implements SearchT
|
||||
|
||||
@Override
|
||||
public RuleChain toData() {
|
||||
RuleChain ruleChain = new RuleChain(new RuleChainId(getId()));
|
||||
ruleChain.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
RuleChain ruleChain = new RuleChain(new RuleChainId(this.getUuid()));
|
||||
ruleChain.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
ruleChain.setTenantId(new TenantId(toUUID(tenantId)));
|
||||
ruleChain.setName(name);
|
||||
if (firstRuleNodeId != null) {
|
||||
|
||||
@ -69,7 +69,7 @@ public class RuleNodeEntity extends BaseSqlEntity<RuleNode> implements SearchTex
|
||||
|
||||
public RuleNodeEntity(RuleNode ruleNode) {
|
||||
if (ruleNode.getId() != null) {
|
||||
this.setId(ruleNode.getUuidId());
|
||||
this.setUuid(ruleNode.getUuidId());
|
||||
}
|
||||
if (ruleNode.getRuleChainId() != null) {
|
||||
this.ruleChainId = toString(DaoUtil.getId(ruleNode.getRuleChainId()));
|
||||
@ -94,8 +94,8 @@ public class RuleNodeEntity extends BaseSqlEntity<RuleNode> implements SearchTex
|
||||
|
||||
@Override
|
||||
public RuleNode toData() {
|
||||
RuleNode ruleNode = new RuleNode(new RuleNodeId(getId()));
|
||||
ruleNode.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
RuleNode ruleNode = new RuleNode(new RuleNodeId(this.getUuid()));
|
||||
ruleNode.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
if (ruleChainId != null) {
|
||||
ruleNode.setRuleChainId(new RuleChainId(toUUID(ruleChainId)));
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public final class TenantEntity extends BaseSqlEntity<Tenant> implements SearchT
|
||||
|
||||
public TenantEntity(Tenant tenant) {
|
||||
if (tenant.getId() != null) {
|
||||
this.setId(tenant.getId().getId());
|
||||
this.setUuid(tenant.getId().getId());
|
||||
}
|
||||
this.title = tenant.getTitle();
|
||||
this.region = tenant.getRegion();
|
||||
@ -113,8 +113,8 @@ public final class TenantEntity extends BaseSqlEntity<Tenant> implements SearchT
|
||||
|
||||
@Override
|
||||
public Tenant toData() {
|
||||
Tenant tenant = new Tenant(new TenantId(getId()));
|
||||
tenant.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
Tenant tenant = new Tenant(new TenantId(this.getUuid()));
|
||||
tenant.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
tenant.setTitle(title);
|
||||
tenant.setRegion(region);
|
||||
tenant.setCountry(country);
|
||||
|
||||
@ -56,7 +56,7 @@ public final class UserCredentialsEntity extends BaseSqlEntity<UserCredentials>
|
||||
|
||||
public UserCredentialsEntity(UserCredentials userCredentials) {
|
||||
if (userCredentials.getId() != null) {
|
||||
this.setId(userCredentials.getId().getId());
|
||||
this.setUuid(userCredentials.getId().getId());
|
||||
}
|
||||
if (userCredentials.getUserId() != null) {
|
||||
this.userId = toString(userCredentials.getUserId().getId());
|
||||
@ -69,8 +69,8 @@ public final class UserCredentialsEntity extends BaseSqlEntity<UserCredentials>
|
||||
|
||||
@Override
|
||||
public UserCredentials toData() {
|
||||
UserCredentials userCredentials = new UserCredentials(new UserCredentialsId(getId()));
|
||||
userCredentials.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
UserCredentials userCredentials = new UserCredentials(new UserCredentialsId(this.getUuid()));
|
||||
userCredentials.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
if (userId != null) {
|
||||
userCredentials.setUserId(new UserId(toUUID(userId)));
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class UserEntity extends BaseSqlEntity<User> implements SearchTextEntity<
|
||||
|
||||
public UserEntity(User user) {
|
||||
if (user.getId() != null) {
|
||||
this.setId(user.getId().getId());
|
||||
this.setUuid(user.getId().getId());
|
||||
}
|
||||
this.authority = user.getAuthority();
|
||||
if (user.getTenantId() != null) {
|
||||
@ -108,8 +108,8 @@ public class UserEntity extends BaseSqlEntity<User> implements SearchTextEntity<
|
||||
|
||||
@Override
|
||||
public User toData() {
|
||||
User user = new User(new UserId(getId()));
|
||||
user.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
User user = new User(new UserId(this.getUuid()));
|
||||
user.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
user.setAuthority(authority);
|
||||
if (tenantId != null) {
|
||||
user.setTenantId(new TenantId(fromString(tenantId)));
|
||||
|
||||
@ -62,7 +62,7 @@ public final class WidgetTypeEntity extends BaseSqlEntity<WidgetType> implement
|
||||
|
||||
public WidgetTypeEntity(WidgetType widgetType) {
|
||||
if (widgetType.getId() != null) {
|
||||
this.setId(widgetType.getId().getId());
|
||||
this.setUuid(widgetType.getId().getId());
|
||||
}
|
||||
if (widgetType.getTenantId() != null) {
|
||||
this.tenantId = toString(widgetType.getTenantId().getId());
|
||||
@ -75,8 +75,8 @@ public final class WidgetTypeEntity extends BaseSqlEntity<WidgetType> implement
|
||||
|
||||
@Override
|
||||
public WidgetType toData() {
|
||||
WidgetType widgetType = new WidgetType(new WidgetTypeId(getId()));
|
||||
widgetType.setCreatedTime(UUIDs.unixTimestamp(getId()));
|
||||
WidgetType widgetType = new WidgetType(new WidgetTypeId(this.getUuid()));
|
||||
widgetType.setCreatedTime(UUIDs.unixTimestamp(this.getUuid()));
|
||||
if (tenantId != null) {
|
||||
widgetType.setTenantId(new TenantId(toUUID(tenantId)));
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public final class WidgetsBundleEntity extends BaseSqlEntity<WidgetsBundle> impl
|
||||
|
||||
public WidgetsBundleEntity(WidgetsBundle widgetsBundle) {
|
||||
if (widgetsBundle.getId() != null) {
|
||||
this.setId(widgetsBundle.getId().getId());
|
||||
this.setUuid(widgetsBundle.getId().getId());
|
||||
}
|
||||
if (widgetsBundle.getTenantId() != null) {
|
||||
this.tenantId = UUIDConverter.fromTimeUUID(widgetsBundle.getTenantId().getId());
|
||||
|
||||
@ -132,10 +132,10 @@ public abstract class CassandraAbstractModelDao<E extends BaseEntity<D>, D> exte
|
||||
|
||||
protected EntityResultSet<E> saveWithResult(TenantId tenantId, E entity) {
|
||||
log.debug("Save entity {}", entity);
|
||||
if (entity.getId() == null) {
|
||||
entity.setId(UUIDs.timeBased());
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUIDs.timeBased());
|
||||
} else if (isDeleteOnSave()) {
|
||||
removeById(tenantId, entity.getId());
|
||||
removeById(tenantId, entity.getUuid());
|
||||
}
|
||||
Statement saveStatement = getSaveQuery(entity);
|
||||
saveStatement.setConsistencyLevel(cluster.getDefaultWriteConsistencyLevel());
|
||||
|
||||
@ -58,8 +58,8 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D>
|
||||
}
|
||||
setSearchText(entity);
|
||||
log.debug("Saving entity {}", entity);
|
||||
if (entity.getId() == null) {
|
||||
entity.setId(UUIDs.timeBased());
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUIDs.timeBased());
|
||||
}
|
||||
entity = getCrudRepository().save(entity);
|
||||
return DaoUtil.getData(entity);
|
||||
|
||||
@ -69,7 +69,7 @@ public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> im
|
||||
fromTimeUUID(tenantId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -86,7 +86,7 @@ public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> im
|
||||
fromTimeUUID(customerId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,7 +109,7 @@ public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> im
|
||||
type,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -121,7 +121,7 @@ public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> im
|
||||
type,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -16,8 +16,6 @@
|
||||
package org.thingsboard.server.dao.sql.audit;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@ -39,14 +37,11 @@ import org.thingsboard.server.dao.sql.JpaAbstractDao;
|
||||
import org.thingsboard.server.dao.sql.JpaAbstractSearchTimeDao;
|
||||
import org.thingsboard.server.dao.util.SqlDao;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static org.springframework.data.jpa.domain.Specifications.where;
|
||||
import static org.thingsboard.server.dao.model.ModelConstants.ID_PROPERTY;
|
||||
|
||||
@Component
|
||||
@ -118,8 +113,8 @@ public class JpaAuditLogDao extends JpaAbstractDao<AuditLogEntity, AuditLog> imp
|
||||
Specification<AuditLogEntity> timeSearchSpec = JpaAbstractSearchTimeDao.getTimeSearchPageSpec(pageLink, "id");
|
||||
Specification<AuditLogEntity> fieldsSpec = getEntityFieldsSpec(tenantId, entityId, customerId, userId, actionTypes);
|
||||
Sort.Direction sortDirection = pageLink.isAscOrder() ? Sort.Direction.ASC : Sort.Direction.DESC;
|
||||
Pageable pageable = new PageRequest(0, pageLink.getLimit(), sortDirection, ID_PROPERTY);
|
||||
return DaoUtil.convertDataList(auditLogRepository.findAll(where(timeSearchSpec).and(fieldsSpec), pageable).getContent());
|
||||
Pageable pageable = PageRequest.of(0, pageLink.getLimit(), sortDirection, ID_PROPERTY);
|
||||
return DaoUtil.convertDataList(auditLogRepository.findAll(Specification.where(timeSearchSpec).and(fieldsSpec), pageable).getContent());
|
||||
}
|
||||
|
||||
private Specification<AuditLogEntity> getEntityFieldsSpec(UUID tenantId, EntityId entityId, CustomerId customerId, UserId userId, List<ActionType> actionTypes) {
|
||||
|
||||
@ -48,17 +48,17 @@ public abstract class AbstractComponentDescriptorInsertRepository implements Com
|
||||
} catch (Throwable throwable) {
|
||||
transactionManager.rollback(insertTransaction);
|
||||
if (throwable.getCause() instanceof ConstraintViolationException) {
|
||||
log.trace("Insert request leaded in a violation of a defined integrity constraint {} for Component Descriptor with id {}, name {} and entityType {}", throwable.getMessage(), entity.getId(), entity.getName(), entity.getType());
|
||||
log.trace("Insert request leaded in a violation of a defined integrity constraint {} for Component Descriptor with id {}, name {} and entityType {}", throwable.getMessage(), entity.getUuid(), entity.getName(), entity.getType());
|
||||
TransactionStatus transaction = getTransactionStatus(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||
try {
|
||||
componentDescriptorEntity = processSaveOrUpdate(entity, insertOrUpdateOnUniqueKeyConflict);
|
||||
} catch (Throwable th) {
|
||||
log.trace("Could not execute the update statement for Component Descriptor with id {}, name {} and entityType {}", entity.getId(), entity.getName(), entity.getType());
|
||||
log.trace("Could not execute the update statement for Component Descriptor with id {}, name {} and entityType {}", entity.getUuid(), entity.getName(), entity.getType());
|
||||
transactionManager.rollback(transaction);
|
||||
}
|
||||
transactionManager.commit(transaction);
|
||||
} else {
|
||||
log.trace("Could not execute the insert statement for Component Descriptor with id {}, name {} and entityType {}", entity.getId(), entity.getName(), entity.getType());
|
||||
log.trace("Could not execute the insert statement for Component Descriptor with id {}, name {} and entityType {}", entity.getUuid(), entity.getName(), entity.getType());
|
||||
}
|
||||
}
|
||||
return componentDescriptorEntity;
|
||||
@ -69,7 +69,7 @@ public abstract class AbstractComponentDescriptorInsertRepository implements Com
|
||||
|
||||
protected Query getQuery(ComponentDescriptorEntity entity, String query) {
|
||||
return entityManager.createNativeQuery(query, ComponentDescriptorEntity.class)
|
||||
.setParameter("id", UUIDConverter.fromTimeUUID(entity.getId()))
|
||||
.setParameter("id", UUIDConverter.fromTimeUUID(entity.getUuid()))
|
||||
.setParameter("actions", entity.getActions())
|
||||
.setParameter("clazz", entity.getClazz())
|
||||
.setParameter("configuration_descriptor", entity.getConfigurationDescriptor().toString())
|
||||
|
||||
@ -40,7 +40,7 @@ public class HsqlComponentDescriptorInsertRepository extends AbstractComponentDe
|
||||
@Override
|
||||
protected ComponentDescriptorEntity doProcessSaveOrUpdate(ComponentDescriptorEntity entity, String query) {
|
||||
getQuery(entity, query).executeUpdate();
|
||||
return entityManager.find(ComponentDescriptorEntity.class, UUIDConverter.fromTimeUUID(entity.getId()));
|
||||
return entityManager.find(ComponentDescriptorEntity.class, UUIDConverter.fromTimeUUID(entity.getUuid()));
|
||||
}
|
||||
|
||||
private static String getInsertString(String conflictStatement) {
|
||||
|
||||
@ -94,7 +94,7 @@ public class JpaBaseComponentDescriptorDao extends JpaAbstractSearchTextDao<Comp
|
||||
type,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,7 +105,7 @@ public class JpaBaseComponentDescriptorDao extends JpaAbstractSearchTextDao<Comp
|
||||
scope,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -61,7 +61,7 @@ public class JpaCustomerDao extends JpaAbstractSearchTextDao<CustomerEntity, Cus
|
||||
UUIDConverter.fromTimeUUID(tenantId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -77,7 +77,7 @@ public class JpaDashboardInfoDao extends JpaAbstractSearchTextDao<DashboardInfoE
|
||||
UUIDConverter.fromTimeUUID(tenantId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -71,14 +71,14 @@ public class JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device>
|
||||
deviceRepository.findByTenantId(
|
||||
fromTimeUUID(tenantId),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
} else {
|
||||
return DaoUtil.convertDataList(
|
||||
deviceRepository.findByTenantId(
|
||||
fromTimeUUID(tenantId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public class JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device>
|
||||
fromTimeUUID(customerId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,7 +118,7 @@ public class JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device>
|
||||
type,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,7 +130,7 @@ public class JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device>
|
||||
type,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -70,7 +70,7 @@ public class JpaEntityViewDao extends JpaAbstractSearchTextDao<EntityViewEntity,
|
||||
fromTimeUUID(tenantId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -81,7 +81,7 @@ public class JpaEntityViewDao extends JpaAbstractSearchTextDao<EntityViewEntity,
|
||||
type,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,7 +100,7 @@ public class JpaEntityViewDao extends JpaAbstractSearchTextDao<EntityViewEntity,
|
||||
fromTimeUUID(customerId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())
|
||||
PageRequest.of(0, pageLink.getLimit())
|
||||
));
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ public class JpaEntityViewDao extends JpaAbstractSearchTextDao<EntityViewEntity,
|
||||
type,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())
|
||||
PageRequest.of(0, pageLink.getLimit())
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ public abstract class AbstractEventInsertRepository implements EventInsertReposi
|
||||
|
||||
protected Query getQuery(EventEntity entity, String query) {
|
||||
return entityManager.createNativeQuery(query, EventEntity.class)
|
||||
.setParameter("id", UUIDConverter.fromTimeUUID(entity.getId()))
|
||||
.setParameter("id", UUIDConverter.fromTimeUUID(entity.getUuid()))
|
||||
.setParameter("body", entity.getBody().toString())
|
||||
.setParameter("entity_id", entity.getEntityId())
|
||||
.setParameter("entity_type", entity.getEntityType().name())
|
||||
|
||||
@ -40,7 +40,7 @@ public class HsqlEventInsertRepository extends AbstractEventInsertRepository {
|
||||
@Override
|
||||
protected EventEntity doProcessSaveOrUpdate(EventEntity entity, String query) {
|
||||
getQuery(entity, query).executeUpdate();
|
||||
return entityManager.find(EventEntity.class, UUIDConverter.fromTimeUUID(entity.getId()));
|
||||
return entityManager.find(EventEntity.class, UUIDConverter.fromTimeUUID(entity.getUuid()));
|
||||
}
|
||||
|
||||
private static String getInsertString(String conflictStatement) {
|
||||
|
||||
@ -44,7 +44,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.springframework.data.jpa.domain.Specifications.where;
|
||||
import static org.thingsboard.server.dao.model.ModelConstants.ID_PROPERTY;
|
||||
import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID;
|
||||
|
||||
@ -119,8 +118,8 @@ public class JpaBaseEventDao extends JpaAbstractSearchTimeDao<EventEntity, Event
|
||||
Specification<EventEntity> timeSearchSpec = JpaAbstractSearchTimeDao.getTimeSearchPageSpec(pageLink, "id");
|
||||
Specification<EventEntity> fieldsSpec = getEntityFieldsSpec(tenantId, entityId, eventType);
|
||||
Sort.Direction sortDirection = pageLink.isAscOrder() ? Sort.Direction.ASC : Sort.Direction.DESC;
|
||||
Pageable pageable = new PageRequest(0, pageLink.getLimit(), sortDirection, ID_PROPERTY);
|
||||
return DaoUtil.convertDataList(eventRepository.findAll(where(timeSearchSpec).and(fieldsSpec), pageable).getContent());
|
||||
Pageable pageable = PageRequest.of(0, pageLink.getLimit(), sortDirection, ID_PROPERTY);
|
||||
return DaoUtil.convertDataList(eventRepository.findAll(Specification.where(timeSearchSpec).and(fieldsSpec), pageable).getContent());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,7 +129,7 @@ public class JpaBaseEventDao extends JpaAbstractSearchTimeDao<EventEntity, Event
|
||||
entityId.getEntityType(),
|
||||
UUIDConverter.fromTimeUUID(entityId.getId()),
|
||||
eventType,
|
||||
new PageRequest(0, limit));
|
||||
PageRequest.of(0, limit));
|
||||
return DaoUtil.convertDataList(latest);
|
||||
}
|
||||
|
||||
@ -140,11 +139,11 @@ public class JpaBaseEventDao extends JpaAbstractSearchTimeDao<EventEntity, Event
|
||||
log.trace("Save system event with predefined id {}", systemTenantId);
|
||||
entity.setTenantId(UUIDConverter.fromTimeUUID(systemTenantId));
|
||||
}
|
||||
if (entity.getId() == null) {
|
||||
entity.setId(UUIDs.timeBased());
|
||||
if (entity.getUuid() == null) {
|
||||
entity.setUuid(UUIDs.timeBased());
|
||||
}
|
||||
if (StringUtils.isEmpty(entity.getEventUid())) {
|
||||
entity.setEventUid(entity.getId().toString());
|
||||
entity.setEventUid(entity.getUuid().toString());
|
||||
}
|
||||
if (ifNotExists &&
|
||||
eventRepository.findByTenantIdAndEntityTypeAndEntityId(entity.getTenantId(), entity.getEntityType(), entity.getEntityId()) != null) {
|
||||
|
||||
@ -42,7 +42,6 @@ import javax.persistence.criteria.Predicate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.data.jpa.domain.Specifications.where;
|
||||
import static org.thingsboard.server.common.data.UUIDConverter.fromTimeUUID;
|
||||
|
||||
/**
|
||||
@ -192,9 +191,9 @@ public class JpaRelationDao extends JpaAbstractDaoListeningExecutorService imple
|
||||
Specification<RelationEntity> timeSearchSpec = JpaAbstractSearchTimeDao.getTimeSearchPageSpec(pageLink, "toId");
|
||||
Specification<RelationEntity> fieldsSpec = getEntityFieldsSpec(from, relationType, typeGroup, childType);
|
||||
Sort.Direction sortDirection = pageLink.isAscOrder() ? Sort.Direction.ASC : Sort.Direction.DESC;
|
||||
Pageable pageable = new PageRequest(0, pageLink.getLimit(), sortDirection, "toId");
|
||||
Pageable pageable = PageRequest.of(0, pageLink.getLimit(), sortDirection, "toId");
|
||||
return service.submit(() ->
|
||||
DaoUtil.convertDataList(relationRepository.findAll(where(timeSearchSpec).and(fieldsSpec), pageable).getContent()));
|
||||
DaoUtil.convertDataList(relationRepository.findAll(Specification.where(timeSearchSpec).and(fieldsSpec), pageable).getContent()));
|
||||
}
|
||||
|
||||
private Specification<RelationEntity> getEntityFieldsSpec(EntityId from, String relationType, RelationTypeGroup typeGroup, EntityType childType) {
|
||||
|
||||
@ -60,7 +60,7 @@ public class JpaRuleChainDao extends JpaAbstractSearchTextDao<RuleChainEntity, R
|
||||
UUIDConverter.fromTimeUUID(tenantId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -61,6 +61,6 @@ public class JpaTenantDao extends JpaAbstractSearchTextDao<TenantEntity, Tenant>
|
||||
region,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ public class JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> imple
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
Authority.TENANT_ADMIN,
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -84,7 +84,7 @@ public class JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> imple
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
Authority.CUSTOMER_USER,
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class JpaWidgetsBundleDao extends JpaAbstractSearchTextDao<WidgetsBundleE
|
||||
NULL_UUID_STR,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,7 +79,7 @@ public class JpaWidgetsBundleDao extends JpaAbstractSearchTextDao<WidgetsBundleE
|
||||
UUIDConverter.fromTimeUUID(tenantId),
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,6 +91,6 @@ public class JpaWidgetsBundleDao extends JpaAbstractSearchTextDao<WidgetsBundleE
|
||||
NULL_UUID_STR,
|
||||
Objects.toString(pageLink.getTextSearch(), ""),
|
||||
pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()),
|
||||
new PageRequest(0, pageLink.getLimit())));
|
||||
PageRequest.of(0, pageLink.getLimit())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,8 +150,8 @@ public abstract class AbstractChunkedAggregationTimeseriesDao extends AbstractSq
|
||||
keyId,
|
||||
query.getStartTs(),
|
||||
query.getEndTs(),
|
||||
new PageRequest(0, query.getLimit(),
|
||||
new Sort(Sort.Direction.fromString(
|
||||
PageRequest.of(0, query.getLimit(),
|
||||
Sort.by(Sort.Direction.fromString(
|
||||
query.getOrderBy()), "ts")));
|
||||
tsKvEntities.forEach(tsKvEntity -> tsKvEntity.setStrKey(query.getKey()));
|
||||
return Futures.immediateFuture(DaoUtil.convertDataList(tsKvEntities));
|
||||
|
||||
@ -109,8 +109,8 @@ public class TimescaleTimeseriesDao extends AbstractSqlTimeseriesDao implements
|
||||
keyId,
|
||||
query.getStartTs(),
|
||||
query.getEndTs(),
|
||||
new PageRequest(0, query.getLimit(),
|
||||
new Sort(Sort.Direction.fromString(
|
||||
PageRequest.of(0, query.getLimit(),
|
||||
Sort.by(Sort.Direction.fromString(
|
||||
query.getOrderBy()), "ts")));
|
||||
timescaleTsKvEntities.forEach(tsKvEntity -> tsKvEntity.setStrKey(strKey));
|
||||
return Futures.immediateFuture(DaoUtil.convertDataList(timescaleTsKvEntities));
|
||||
|
||||
60
pom.xml
60
pom.xml
@ -30,11 +30,11 @@
|
||||
<properties>
|
||||
<main.dir>${basedir}</main.dir>
|
||||
<pkg.user>thingsboard</pkg.user>
|
||||
<spring-boot.version>2.1.3.RELEASE</spring-boot.version>
|
||||
<spring.version>5.1.5.RELEASE</spring.version>
|
||||
<spring-security.version>5.1.4.RELEASE</spring-security.version>
|
||||
<spring-data-redis.version>2.1.5.RELEASE</spring-data-redis.version>
|
||||
<jedis.version>2.9.0</jedis.version>
|
||||
<spring-boot.version>2.2.4.RELEASE</spring-boot.version>
|
||||
<spring.version>5.2.2.RELEASE</spring.version>
|
||||
<spring-security.version>5.2.2.RELEASE</spring-security.version>
|
||||
<spring-data-redis.version>2.2.4.RELEASE</spring-data-redis.version>
|
||||
<jedis.version>3.1.0</jedis.version>
|
||||
<jjwt.version>0.7.0</jjwt.version>
|
||||
<json-path.version>2.2.0</json-path.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
@ -51,12 +51,12 @@
|
||||
<commons-validator.version>1.6</commons-validator.version>
|
||||
<commons-io.version>2.5</commons-io.version>
|
||||
<commons-csv.version>1.4</commons-csv.version>
|
||||
<jackson.version>2.9.9.3</jackson.version>
|
||||
<jackson-annotations.version>2.9.9</jackson-annotations.version>
|
||||
<jackson-core.version>2.9.9</jackson-core.version>
|
||||
<jackson.version>2.10.2</jackson.version>
|
||||
<jackson-annotations.version>2.10.2</jackson-annotations.version>
|
||||
<jackson-core.version>2.10.2</jackson-core.version>
|
||||
<json-schema-validator.version>2.2.6</json-schema-validator.version>
|
||||
<scala.version>2.11</scala.version>
|
||||
<akka.version>2.4.2</akka.version>
|
||||
<scala.version>2.13</scala.version>
|
||||
<akka.version>2.6.3</akka.version>
|
||||
<californium.version>1.0.2</californium.version>
|
||||
<gson.version>2.6.2</gson.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
@ -68,7 +68,7 @@
|
||||
<grpc.version>1.22.1</grpc.version>
|
||||
<lombok.version>1.16.18</lombok.version>
|
||||
<paho.client.version>1.1.0</paho.client.version>
|
||||
<netty.version>4.1.37.Final</netty.version>
|
||||
<netty.version>4.1.45.Final</netty.version>
|
||||
<os-maven-plugin.version>1.5.0</os-maven-plugin.version>
|
||||
<rabbitmq.version>4.8.0</rabbitmq.version>
|
||||
<surfire.version>2.19.1</surfire.version>
|
||||
@ -77,7 +77,7 @@
|
||||
<springfox-swagger-ui-rfc6570.version>1.0.0</springfox-swagger-ui-rfc6570.version>
|
||||
<spatial4j.version>0.7</spatial4j.version>
|
||||
<jts.version>1.15.0</jts.version>
|
||||
<bouncycastle.version>1.56</bouncycastle.version>
|
||||
<bouncycastle.version>1.64</bouncycastle.version>
|
||||
<winsw.version>2.0.1</winsw.version>
|
||||
<hsqldb.version>2.5.0</hsqldb.version>
|
||||
<dbunit.version>2.5.3</dbunit.version>
|
||||
@ -92,12 +92,15 @@
|
||||
<bucket4j.version>4.1.1</bucket4j.version>
|
||||
<fst.version>2.57</fst.version>
|
||||
<antlr.version>2.7.7</antlr.version>
|
||||
<snakeyaml.version>1.23</snakeyaml.version>
|
||||
<snakeyaml.version>1.25</snakeyaml.version>
|
||||
<struts.version>1.3.10</struts.version>
|
||||
<amazonaws.sqs.version>1.11.747</amazonaws.sqs.version>
|
||||
<pubsub.client.version>1.84.0</pubsub.client.version>
|
||||
<azure-servicebus.version>3.2.0</azure-servicebus.version>
|
||||
<passay.version>1.5.0</passay.version>
|
||||
<ua-parser.version>1.4.3</ua-parser.version>
|
||||
<commons-beanutils.version>1.9.4</commons-beanutils.version>
|
||||
<commons-collections.version>3.2.2</commons-collections.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
@ -915,6 +918,37 @@
|
||||
<artifactId>uap-java</artifactId>
|
||||
<version>${ua-parser.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>${commons-beanutils.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>${commons-collections.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>${snakeyaml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts-core</artifactId>
|
||||
<version>${struts.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts-taglib</artifactId>
|
||||
<version>${struts.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts-tiles</artifactId>
|
||||
<version>${struts.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user