Commit 73d6eee4fca323d381e6da910a9c1bc3ff4e3923
1 parent
f806c392
Moved ConditionalProperty for sql and nosql dao to new annotations
Showing
64 changed files
with
145 additions
and
144 deletions
... | ... | @@ -16,13 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao; |
17 | 17 | |
18 | 18 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.boot.autoconfigure.domain.EntityScan; |
21 | -import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; | |
22 | 20 | import org.springframework.context.annotation.ComponentScan; |
23 | 21 | import org.springframework.context.annotation.Configuration; |
24 | 22 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; |
25 | 23 | import org.springframework.transaction.annotation.EnableTransactionManagement; |
24 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
26 | 25 | |
27 | 26 | /** |
28 | 27 | * @author Valerii Sosliuk |
... | ... | @@ -33,7 +32,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; |
33 | 32 | @EnableJpaRepositories("org.thingsboard.server.dao.sql") |
34 | 33 | @EntityScan("org.thingsboard.server.dao.model.sql") |
35 | 34 | @EnableTransactionManagement |
36 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
35 | +@SqlDao | |
37 | 36 | public class JpaDaoConfig { |
38 | 37 | |
39 | 38 | } | ... | ... |
... | ... | @@ -16,11 +16,11 @@ |
16 | 16 | package org.thingsboard.server.dao; |
17 | 17 | |
18 | 18 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
21 | 20 | import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; |
22 | 21 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; |
23 | 22 | import org.springframework.context.annotation.Configuration; |
23 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
24 | 24 | |
25 | 25 | @Configuration |
26 | 26 | @EnableAutoConfiguration( |
... | ... | @@ -28,6 +28,6 @@ import org.springframework.context.annotation.Configuration; |
28 | 28 | DataSourceAutoConfiguration.class, |
29 | 29 | DataSourceTransactionManagerAutoConfiguration.class, |
30 | 30 | HibernateJpaAutoConfiguration.class}) |
31 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true") | |
31 | +@NoSqlDao | |
32 | 32 | public class NoSqlDaoConfig { |
33 | 33 | } | ... | ... |
... | ... | @@ -23,7 +23,6 @@ import com.google.common.util.concurrent.Futures; |
23 | 23 | import com.google.common.util.concurrent.ListenableFuture; |
24 | 24 | import lombok.extern.slf4j.Slf4j; |
25 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
26 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
27 | 26 | import org.springframework.stereotype.Component; |
28 | 27 | import org.thingsboard.server.common.data.EntityType; |
29 | 28 | import org.thingsboard.server.common.data.alarm.Alarm; |
... | ... | @@ -35,6 +34,7 @@ import org.thingsboard.server.common.data.id.TenantId; |
35 | 34 | import org.thingsboard.server.common.data.relation.EntityRelation; |
36 | 35 | import org.thingsboard.server.common.data.relation.RelationTypeGroup; |
37 | 36 | import org.thingsboard.server.dao.CassandraAbstractModelDao; |
37 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
38 | 38 | import org.thingsboard.server.dao.model.ModelConstants; |
39 | 39 | import org.thingsboard.server.dao.model.nosql.AlarmEntity; |
40 | 40 | import org.thingsboard.server.dao.relation.RelationDao; |
... | ... | @@ -49,7 +49,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
49 | 49 | |
50 | 50 | @Component |
51 | 51 | @Slf4j |
52 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
52 | +@NoSqlDao | |
53 | 53 | public class CassandraAlarmDao extends CassandraAbstractModelDao<AlarmEntity, Alarm> implements AlarmDao { |
54 | 54 | |
55 | 55 | @Autowired | ... | ... |
... | ... | @@ -23,13 +23,13 @@ import com.google.common.base.Function; |
23 | 23 | import com.google.common.util.concurrent.Futures; |
24 | 24 | import com.google.common.util.concurrent.ListenableFuture; |
25 | 25 | import lombok.extern.slf4j.Slf4j; |
26 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
27 | 26 | import org.springframework.stereotype.Component; |
28 | 27 | import org.thingsboard.server.common.data.asset.Asset; |
29 | 28 | import org.thingsboard.server.common.data.asset.TenantAssetType; |
30 | 29 | import org.thingsboard.server.common.data.page.TextPageLink; |
31 | 30 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
32 | 31 | import org.thingsboard.server.dao.DaoUtil; |
32 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
33 | 33 | import org.thingsboard.server.dao.model.TenantAssetTypeEntity; |
34 | 34 | import org.thingsboard.server.dao.model.nosql.AssetEntity; |
35 | 35 | |
... | ... | @@ -41,7 +41,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
41 | 41 | |
42 | 42 | @Component |
43 | 43 | @Slf4j |
44 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
44 | +@NoSqlDao | |
45 | 45 | public class CassandraAssetDao extends CassandraAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { |
46 | 46 | |
47 | 47 | @Override | ... | ... |
... | ... | @@ -22,12 +22,12 @@ import com.google.common.base.Function; |
22 | 22 | import com.google.common.util.concurrent.Futures; |
23 | 23 | import com.google.common.util.concurrent.ListenableFuture; |
24 | 24 | import lombok.extern.slf4j.Slf4j; |
25 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
26 | 25 | import org.springframework.stereotype.Component; |
27 | 26 | import org.thingsboard.server.common.data.id.EntityId; |
28 | 27 | import org.thingsboard.server.common.data.kv.AttributeKvEntry; |
29 | 28 | import org.thingsboard.server.common.data.kv.BaseAttributeKvEntry; |
30 | 29 | import org.thingsboard.server.dao.CassandraAbstractAsyncDao; |
30 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
31 | 31 | import org.thingsboard.server.dao.model.ModelConstants; |
32 | 32 | import org.thingsboard.server.dao.timeseries.CassandraBaseTimeseriesDao; |
33 | 33 | |
... | ... | @@ -48,7 +48,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
48 | 48 | */ |
49 | 49 | @Component |
50 | 50 | @Slf4j |
51 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
51 | +@NoSqlDao | |
52 | 52 | public class CassandraBaseAttributesDao extends CassandraAbstractAsyncDao implements AttributesDao { |
53 | 53 | |
54 | 54 | private PreparedStatement saveStmt; | ... | ... |
... | ... | @@ -25,8 +25,8 @@ import lombok.extern.slf4j.Slf4j; |
25 | 25 | import org.apache.commons.lang3.StringUtils; |
26 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
27 | 27 | import org.springframework.beans.factory.annotation.Value; |
28 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
29 | 28 | import org.springframework.stereotype.Component; |
29 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
30 | 30 | |
31 | 31 | import javax.annotation.PostConstruct; |
32 | 32 | import javax.annotation.PreDestroy; |
... | ... | @@ -38,7 +38,7 @@ import java.util.List; |
38 | 38 | @Component |
39 | 39 | @Slf4j |
40 | 40 | @Data |
41 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true") | |
41 | +@NoSqlDao | |
42 | 42 | public class CassandraCluster { |
43 | 43 | |
44 | 44 | private static final String COMMA = ","; | ... | ... |
... | ... | @@ -21,7 +21,6 @@ import com.datastax.driver.core.querybuilder.QueryBuilder; |
21 | 21 | import com.datastax.driver.core.querybuilder.Select; |
22 | 22 | import com.datastax.driver.core.utils.UUIDs; |
23 | 23 | import lombok.extern.slf4j.Slf4j; |
24 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
25 | 24 | import org.springframework.stereotype.Component; |
26 | 25 | import org.thingsboard.server.common.data.id.ComponentDescriptorId; |
27 | 26 | import org.thingsboard.server.common.data.page.TextPageLink; |
... | ... | @@ -30,8 +29,9 @@ import org.thingsboard.server.common.data.plugin.ComponentScope; |
30 | 29 | import org.thingsboard.server.common.data.plugin.ComponentType; |
31 | 30 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
32 | 31 | import org.thingsboard.server.dao.DaoUtil; |
33 | -import org.thingsboard.server.dao.model.nosql.ComponentDescriptorEntity; | |
32 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
34 | 33 | import org.thingsboard.server.dao.model.ModelConstants; |
34 | +import org.thingsboard.server.dao.model.nosql.ComponentDescriptorEntity; | |
35 | 35 | |
36 | 36 | import java.util.Arrays; |
37 | 37 | import java.util.List; |
... | ... | @@ -46,7 +46,7 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.select; |
46 | 46 | */ |
47 | 47 | @Component |
48 | 48 | @Slf4j |
49 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
49 | +@NoSqlDao | |
50 | 50 | public class CassandraBaseComponentDescriptorDao extends CassandraAbstractSearchTextDao<ComponentDescriptorEntity, ComponentDescriptor> implements ComponentDescriptorDao { |
51 | 51 | |
52 | 52 | @Override | ... | ... |
... | ... | @@ -15,31 +15,28 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.customer; |
17 | 17 | |
18 | -import static com.datastax.driver.core.querybuilder.QueryBuilder.select; | |
19 | -import static org.thingsboard.server.dao.model.ModelConstants.CUSTOMER_BY_TENANT_AND_TITLE_VIEW_NAME; | |
20 | -import static org.thingsboard.server.dao.model.ModelConstants.CUSTOMER_TITLE_PROPERTY; | |
21 | -import static org.thingsboard.server.dao.model.ModelConstants.CUSTOMER_TENANT_ID_PROPERTY; | |
22 | - | |
23 | -import java.util.Optional; | |
24 | 18 | import com.datastax.driver.core.querybuilder.Select; |
25 | 19 | import lombok.extern.slf4j.Slf4j; |
26 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
27 | 20 | import org.springframework.stereotype.Component; |
28 | 21 | import org.thingsboard.server.common.data.Customer; |
29 | 22 | import org.thingsboard.server.common.data.page.TextPageLink; |
30 | 23 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
31 | 24 | import org.thingsboard.server.dao.DaoUtil; |
32 | -import org.thingsboard.server.dao.model.nosql.CustomerEntity; | |
25 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
33 | 26 | import org.thingsboard.server.dao.model.ModelConstants; |
27 | +import org.thingsboard.server.dao.model.nosql.CustomerEntity; | |
34 | 28 | |
35 | 29 | import java.util.Arrays; |
36 | 30 | import java.util.List; |
31 | +import java.util.Optional; | |
37 | 32 | import java.util.UUID; |
38 | 33 | |
39 | 34 | import static com.datastax.driver.core.querybuilder.QueryBuilder.eq; |
35 | +import static com.datastax.driver.core.querybuilder.QueryBuilder.select; | |
36 | +import static org.thingsboard.server.dao.model.ModelConstants.*; | |
40 | 37 | @Component |
41 | 38 | @Slf4j |
42 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
39 | +@NoSqlDao | |
43 | 40 | public class CassandraCustomerDao extends CassandraAbstractSearchTextDao<CustomerEntity, Customer> implements CustomerDao { |
44 | 41 | |
45 | 42 | @Override | ... | ... |
... | ... | @@ -15,16 +15,16 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.dashboard; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.stereotype.Component; |
20 | 19 | import org.thingsboard.server.common.data.Dashboard; |
21 | 20 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
21 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.nosql.DashboardEntity; |
23 | 23 | |
24 | 24 | import static org.thingsboard.server.dao.model.ModelConstants.DASHBOARD_COLUMN_FAMILY_NAME; |
25 | 25 | |
26 | 26 | @Component |
27 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
27 | +@NoSqlDao | |
28 | 28 | public class CassandraDashboardDao extends CassandraAbstractSearchTextDao<DashboardEntity, Dashboard> implements DashboardDao { |
29 | 29 | |
30 | 30 | @Override | ... | ... |
... | ... | @@ -16,12 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao.dashboard; |
17 | 17 | |
18 | 18 | import lombok.extern.slf4j.Slf4j; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.stereotype.Component; |
21 | 20 | import org.thingsboard.server.common.data.DashboardInfo; |
22 | 21 | import org.thingsboard.server.common.data.page.TextPageLink; |
23 | 22 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
25 | 25 | import org.thingsboard.server.dao.model.nosql.DashboardInfoEntity; |
26 | 26 | |
27 | 27 | import java.util.Arrays; |
... | ... | @@ -34,7 +34,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
34 | 34 | |
35 | 35 | @Component |
36 | 36 | @Slf4j |
37 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
37 | +@NoSqlDao | |
38 | 38 | public class CassandraDashboardInfoDao extends CassandraAbstractSearchTextDao<DashboardInfoEntity, DashboardInfo> implements DashboardInfoDao { |
39 | 39 | |
40 | 40 | @Override | ... | ... |
... | ... | @@ -17,13 +17,13 @@ package org.thingsboard.server.dao.device; |
17 | 17 | |
18 | 18 | import com.datastax.driver.core.querybuilder.Select.Where; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.security.DeviceCredentials; |
23 | 22 | import org.thingsboard.server.dao.CassandraAbstractModelDao; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
25 | -import org.thingsboard.server.dao.model.nosql.DeviceCredentialsEntity; | |
24 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
26 | 25 | import org.thingsboard.server.dao.model.ModelConstants; |
26 | +import org.thingsboard.server.dao.model.nosql.DeviceCredentialsEntity; | |
27 | 27 | |
28 | 28 | import java.util.UUID; |
29 | 29 | |
... | ... | @@ -32,7 +32,7 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.select; |
32 | 32 | |
33 | 33 | @Component |
34 | 34 | @Slf4j |
35 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
35 | +@NoSqlDao | |
36 | 36 | public class CassandraDeviceCredentialsDao extends CassandraAbstractModelDao<DeviceCredentialsEntity, DeviceCredentials> implements DeviceCredentialsDao { |
37 | 37 | |
38 | 38 | @Override | ... | ... |
... | ... | @@ -23,13 +23,13 @@ import com.google.common.base.Function; |
23 | 23 | import com.google.common.util.concurrent.Futures; |
24 | 24 | import com.google.common.util.concurrent.ListenableFuture; |
25 | 25 | import lombok.extern.slf4j.Slf4j; |
26 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
27 | 26 | import org.springframework.stereotype.Component; |
28 | 27 | import org.thingsboard.server.common.data.Device; |
29 | 28 | import org.thingsboard.server.common.data.TenantDeviceType; |
30 | 29 | import org.thingsboard.server.common.data.page.TextPageLink; |
31 | 30 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
32 | 31 | import org.thingsboard.server.dao.DaoUtil; |
32 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
33 | 33 | import org.thingsboard.server.dao.model.TenantDeviceTypeEntity; |
34 | 34 | import org.thingsboard.server.dao.model.nosql.DeviceEntity; |
35 | 35 | |
... | ... | @@ -41,7 +41,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
41 | 41 | |
42 | 42 | @Component |
43 | 43 | @Slf4j |
44 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
44 | +@NoSqlDao | |
45 | 45 | public class CassandraDeviceDao extends CassandraAbstractSearchTextDao<DeviceEntity, Device> implements DeviceDao { |
46 | 46 | |
47 | 47 | @Override | ... | ... |
... | ... | @@ -22,7 +22,6 @@ import com.datastax.driver.core.querybuilder.Select; |
22 | 22 | import com.datastax.driver.core.utils.UUIDs; |
23 | 23 | import lombok.extern.slf4j.Slf4j; |
24 | 24 | import org.apache.commons.lang3.StringUtils; |
25 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
26 | 25 | import org.springframework.stereotype.Component; |
27 | 26 | import org.thingsboard.server.common.data.Event; |
28 | 27 | import org.thingsboard.server.common.data.id.EntityId; |
... | ... | @@ -31,8 +30,9 @@ import org.thingsboard.server.common.data.id.TenantId; |
31 | 30 | import org.thingsboard.server.common.data.page.TimePageLink; |
32 | 31 | import org.thingsboard.server.dao.CassandraAbstractSearchTimeDao; |
33 | 32 | import org.thingsboard.server.dao.DaoUtil; |
34 | -import org.thingsboard.server.dao.model.nosql.EventEntity; | |
33 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
35 | 34 | import org.thingsboard.server.dao.model.ModelConstants; |
35 | +import org.thingsboard.server.dao.model.nosql.EventEntity; | |
36 | 36 | |
37 | 37 | import java.util.Arrays; |
38 | 38 | import java.util.List; |
... | ... | @@ -45,7 +45,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
45 | 45 | |
46 | 46 | @Component |
47 | 47 | @Slf4j |
48 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
48 | +@NoSqlDao | |
49 | 49 | public class CassandraBaseEventDao extends CassandraAbstractSearchTimeDao<EventEntity, Event> implements EventDao { |
50 | 50 | |
51 | 51 | private final TenantId systemTenantId = new TenantId(NULL_UUID); | ... | ... |
... | ... | @@ -17,7 +17,6 @@ package org.thingsboard.server.dao.plugin; |
17 | 17 | |
18 | 18 | import com.datastax.driver.core.querybuilder.Select; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.id.PluginId; |
23 | 22 | import org.thingsboard.server.common.data.id.TenantId; |
... | ... | @@ -25,6 +24,7 @@ import org.thingsboard.server.common.data.page.TextPageLink; |
25 | 24 | import org.thingsboard.server.common.data.plugin.PluginMetaData; |
26 | 25 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
27 | 26 | import org.thingsboard.server.dao.DaoUtil; |
27 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
28 | 28 | import org.thingsboard.server.dao.model.ModelConstants; |
29 | 29 | import org.thingsboard.server.dao.model.nosql.PluginMetaDataEntity; |
30 | 30 | |
... | ... | @@ -37,7 +37,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
37 | 37 | |
38 | 38 | @Component |
39 | 39 | @Slf4j |
40 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
40 | +@NoSqlDao | |
41 | 41 | public class CassandraBasePluginDao extends CassandraAbstractSearchTextDao<PluginMetaDataEntity, PluginMetaData> implements PluginDao { |
42 | 42 | |
43 | 43 | @Override | ... | ... |
... | ... | @@ -19,11 +19,8 @@ import com.datastax.driver.core.*; |
19 | 19 | import com.datastax.driver.core.querybuilder.QueryBuilder; |
20 | 20 | import com.datastax.driver.core.querybuilder.Select; |
21 | 21 | import com.fasterxml.jackson.databind.JsonNode; |
22 | -import com.google.common.base.Function; | |
23 | -import com.google.common.util.concurrent.Futures; | |
24 | 22 | import com.google.common.util.concurrent.ListenableFuture; |
25 | 23 | import lombok.extern.slf4j.Slf4j; |
26 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
27 | 24 | import org.springframework.stereotype.Component; |
28 | 25 | import org.thingsboard.server.common.data.EntityType; |
29 | 26 | import org.thingsboard.server.common.data.id.EntityId; |
... | ... | @@ -33,10 +30,10 @@ import org.thingsboard.server.common.data.relation.EntityRelation; |
33 | 30 | import org.thingsboard.server.common.data.relation.RelationTypeGroup; |
34 | 31 | import org.thingsboard.server.dao.CassandraAbstractAsyncDao; |
35 | 32 | import org.thingsboard.server.dao.CassandraAbstractSearchTimeDao; |
33 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
36 | 34 | import org.thingsboard.server.dao.model.ModelConstants; |
37 | 35 | import org.thingsboard.server.dao.model.type.RelationTypeGroupCodec; |
38 | 36 | |
39 | -import javax.annotation.Nullable; | |
40 | 37 | import javax.annotation.PostConstruct; |
41 | 38 | import java.util.ArrayList; |
42 | 39 | import java.util.Arrays; |
... | ... | @@ -49,7 +46,7 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.eq; |
49 | 46 | */ |
50 | 47 | @Component |
51 | 48 | @Slf4j |
52 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
49 | +@NoSqlDao | |
53 | 50 | public class BaseRelationDao extends CassandraAbstractAsyncDao implements RelationDao { |
54 | 51 | |
55 | 52 | private static final String SELECT_COLUMNS = "SELECT " + | ... | ... |
... | ... | @@ -17,7 +17,6 @@ package org.thingsboard.server.dao.rule; |
17 | 17 | |
18 | 18 | import com.datastax.driver.core.querybuilder.Select; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.id.RuleId; |
23 | 22 | import org.thingsboard.server.common.data.id.TenantId; |
... | ... | @@ -25,6 +24,7 @@ import org.thingsboard.server.common.data.page.TextPageLink; |
25 | 24 | import org.thingsboard.server.common.data.rule.RuleMetaData; |
26 | 25 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
27 | 26 | import org.thingsboard.server.dao.DaoUtil; |
27 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
28 | 28 | import org.thingsboard.server.dao.model.ModelConstants; |
29 | 29 | import org.thingsboard.server.dao.model.nosql.RuleMetaDataEntity; |
30 | 30 | |
... | ... | @@ -37,7 +37,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
37 | 37 | |
38 | 38 | @Component |
39 | 39 | @Slf4j |
40 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
40 | +@NoSqlDao | |
41 | 41 | public class CassandraBaseRuleDao extends CassandraAbstractSearchTextDao<RuleMetaDataEntity, RuleMetaData> implements RuleDao { |
42 | 42 | |
43 | 43 | @Override | ... | ... |
... | ... | @@ -17,11 +17,11 @@ package org.thingsboard.server.dao.settings; |
17 | 17 | |
18 | 18 | import com.datastax.driver.core.querybuilder.Select.Where; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.AdminSettings; |
23 | 22 | import org.thingsboard.server.dao.CassandraAbstractModelDao; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
25 | 25 | import org.thingsboard.server.dao.model.nosql.AdminSettingsEntity; |
26 | 26 | |
27 | 27 | import static com.datastax.driver.core.querybuilder.QueryBuilder.eq; |
... | ... | @@ -30,7 +30,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
30 | 30 | |
31 | 31 | @Component |
32 | 32 | @Slf4j |
33 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
33 | +@NoSqlDao | |
34 | 34 | public class CassandraAdminSettingsDao extends CassandraAbstractModelDao<AdminSettingsEntity, AdminSettings> implements AdminSettingsDao { |
35 | 35 | |
36 | 36 | @Override | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.alarm; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.AlarmEntity; |
23 | 23 | |
24 | 24 | import java.util.UUID; |
... | ... | @@ -26,7 +26,7 @@ import java.util.UUID; |
26 | 26 | /** |
27 | 27 | * Created by Valerii Sosliuk on 5/21/2017. |
28 | 28 | */ |
29 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
29 | +@SqlDao | |
30 | 30 | public interface AlarmRepository extends CrudRepository<AlarmEntity, UUID> { |
31 | 31 | |
32 | 32 | @Query(nativeQuery = true, value = "SELECT * FROM ALARM WHERE TENANT_ID = :tenantId AND ORIGINATOR_ID = :originatorId " + | ... | ... |
... | ... | @@ -21,7 +21,6 @@ import com.google.common.util.concurrent.Futures; |
21 | 21 | import com.google.common.util.concurrent.ListenableFuture; |
22 | 22 | import lombok.extern.slf4j.Slf4j; |
23 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
24 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
25 | 24 | import org.springframework.data.repository.CrudRepository; |
26 | 25 | import org.springframework.stereotype.Component; |
27 | 26 | import org.springframework.transaction.annotation.Transactional; |
... | ... | @@ -37,6 +36,7 @@ import org.thingsboard.server.common.data.relation.RelationTypeGroup; |
37 | 36 | import org.thingsboard.server.dao.DaoUtil; |
38 | 37 | import org.thingsboard.server.dao.alarm.AlarmDao; |
39 | 38 | import org.thingsboard.server.dao.alarm.BaseAlarmService; |
39 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
40 | 40 | import org.thingsboard.server.dao.model.sql.AlarmEntity; |
41 | 41 | import org.thingsboard.server.dao.relation.RelationDao; |
42 | 42 | import org.thingsboard.server.dao.sql.JpaAbstractDao; |
... | ... | @@ -52,7 +52,7 @@ import static org.springframework.transaction.annotation.Propagation.REQUIRES_NE |
52 | 52 | */ |
53 | 53 | @Slf4j |
54 | 54 | @Component |
55 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
55 | +@SqlDao | |
56 | 56 | public class JpaAlarmDao extends JpaAbstractDao<AlarmEntity, Alarm> implements AlarmDao { |
57 | 57 | |
58 | 58 | @Autowired | ... | ... |
... | ... | @@ -15,11 +15,11 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.asset; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
22 | 21 | import org.thingsboard.server.common.data.asset.TenantAssetType; |
22 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
23 | 23 | import org.thingsboard.server.dao.model.sql.AssetEntity; |
24 | 24 | |
25 | 25 | import java.util.List; |
... | ... | @@ -28,7 +28,7 @@ import java.util.UUID; |
28 | 28 | /** |
29 | 29 | * Created by Valerii Sosliuk on 5/21/2017. |
30 | 30 | */ |
31 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
31 | +@SqlDao | |
32 | 32 | public interface AssetRepository extends CrudRepository<AssetEntity, UUID> { |
33 | 33 | |
34 | 34 | @Query(nativeQuery = true, value = "SELECT * FROM ASSET WHERE TENANT_ID = :tenantId " + | ... | ... |
... | ... | @@ -17,13 +17,13 @@ package org.thingsboard.server.dao.sql.asset; |
17 | 17 | |
18 | 18 | import com.google.common.util.concurrent.ListenableFuture; |
19 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.data.repository.CrudRepository; |
22 | 21 | import org.springframework.stereotype.Component; |
23 | 22 | import org.thingsboard.server.common.data.asset.Asset; |
24 | 23 | import org.thingsboard.server.common.data.asset.TenantAssetType; |
25 | 24 | import org.thingsboard.server.common.data.page.TextPageLink; |
26 | 25 | import org.thingsboard.server.dao.DaoUtil; |
26 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
27 | 27 | import org.thingsboard.server.dao.asset.AssetDao; |
28 | 28 | import org.thingsboard.server.dao.model.sql.AssetEntity; |
29 | 29 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
... | ... | @@ -38,7 +38,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
38 | 38 | * Created by Valerii Sosliuk on 5/19/2017. |
39 | 39 | */ |
40 | 40 | @Component |
41 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
41 | +@SqlDao | |
42 | 42 | public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { |
43 | 43 | |
44 | 44 | @Autowired | ... | ... |
... | ... | @@ -15,15 +15,15 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.attributes; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.repository.CrudRepository; |
19 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
20 | 20 | import org.thingsboard.server.dao.model.sql.AttributeKvCompositeKey; |
21 | 21 | import org.thingsboard.server.dao.model.sql.AttributeKvEntity; |
22 | 22 | |
23 | 23 | import java.util.List; |
24 | 24 | import java.util.UUID; |
25 | 25 | |
26 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
26 | +@SqlDao | |
27 | 27 | public interface AttributeKvRepository extends CrudRepository<AttributeKvEntity, AttributeKvCompositeKey> { |
28 | 28 | |
29 | 29 | List<AttributeKvEntity> findAllByEntityTypeAndEntityIdAndAttributeType(String entityType, | ... | ... |
... | ... | @@ -19,11 +19,11 @@ import com.google.common.collect.Lists; |
19 | 19 | import com.google.common.util.concurrent.ListenableFuture; |
20 | 20 | import lombok.extern.slf4j.Slf4j; |
21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
22 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
23 | 22 | import org.springframework.stereotype.Component; |
24 | 23 | import org.thingsboard.server.common.data.id.EntityId; |
25 | 24 | import org.thingsboard.server.common.data.kv.AttributeKvEntry; |
26 | 25 | import org.thingsboard.server.dao.DaoUtil; |
26 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
27 | 27 | import org.thingsboard.server.dao.attributes.AttributesDao; |
28 | 28 | import org.thingsboard.server.dao.model.sql.AttributeKvCompositeKey; |
29 | 29 | import org.thingsboard.server.dao.model.sql.AttributeKvEntity; |
... | ... | @@ -36,7 +36,7 @@ import java.util.stream.Collectors; |
36 | 36 | |
37 | 37 | @Component |
38 | 38 | @Slf4j |
39 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
39 | +@SqlDao | |
40 | 40 | public class JpaAttributeDao extends JpaAbstractDaoListeningExecutorService implements AttributesDao { |
41 | 41 | |
42 | 42 | @Autowired | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.component; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.ComponentDescriptorEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
... | ... | @@ -27,7 +27,7 @@ import java.util.UUID; |
27 | 27 | /** |
28 | 28 | * Created by Valerii Sosliuk on 5/6/2017. |
29 | 29 | */ |
30 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
30 | +@SqlDao | |
31 | 31 | public interface ComponentDescriptorRepository extends CrudRepository<ComponentDescriptorEntity, UUID> { |
32 | 32 | |
33 | 33 | ComponentDescriptorEntity findByClazz(String clazz); | ... | ... |
... | ... | @@ -17,7 +17,6 @@ package org.thingsboard.server.dao.sql.component; |
17 | 17 | |
18 | 18 | import com.datastax.driver.core.utils.UUIDs; |
19 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.data.repository.CrudRepository; |
22 | 21 | import org.springframework.stereotype.Component; |
23 | 22 | import org.thingsboard.server.common.data.id.ComponentDescriptorId; |
... | ... | @@ -26,6 +25,7 @@ import org.thingsboard.server.common.data.plugin.ComponentDescriptor; |
26 | 25 | import org.thingsboard.server.common.data.plugin.ComponentScope; |
27 | 26 | import org.thingsboard.server.common.data.plugin.ComponentType; |
28 | 27 | import org.thingsboard.server.dao.DaoUtil; |
28 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
29 | 29 | import org.thingsboard.server.dao.component.ComponentDescriptorDao; |
30 | 30 | import org.thingsboard.server.dao.model.sql.ComponentDescriptorEntity; |
31 | 31 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
... | ... | @@ -40,7 +40,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
40 | 40 | * Created by Valerii Sosliuk on 5/6/2017. |
41 | 41 | */ |
42 | 42 | @Component |
43 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
43 | +@SqlDao | |
44 | 44 | public class JpaBaseComponentDescriptorDao extends JpaAbstractSearchTextDao<ComponentDescriptorEntity, ComponentDescriptor> |
45 | 45 | implements ComponentDescriptorDao { |
46 | 46 | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.customer; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.CustomerEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
... | ... | @@ -27,7 +27,7 @@ import java.util.UUID; |
27 | 27 | /** |
28 | 28 | * Created by Valerii Sosliuk on 5/6/2017. |
29 | 29 | */ |
30 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
30 | +@SqlDao | |
31 | 31 | public interface CustomerRepository extends CrudRepository<CustomerEntity, UUID> { |
32 | 32 | |
33 | 33 | @Query(nativeQuery = true, value = "SELECT * FROM CUSTOMER WHERE TENANT_ID = :tenantId " + | ... | ... |
... | ... | @@ -16,12 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao.sql.customer; |
17 | 17 | |
18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.Customer; |
23 | 22 | import org.thingsboard.server.common.data.page.TextPageLink; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
25 | 25 | import org.thingsboard.server.dao.customer.CustomerDao; |
26 | 26 | import org.thingsboard.server.dao.model.sql.CustomerEntity; |
27 | 27 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
... | ... | @@ -36,7 +36,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
36 | 36 | * Created by Valerii Sosliuk on 5/6/2017. |
37 | 37 | */ |
38 | 38 | @Component |
39 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
39 | +@SqlDao | |
40 | 40 | public class JpaCustomerDao extends JpaAbstractSearchTextDao<CustomerEntity, Customer> implements CustomerDao { |
41 | 41 | |
42 | 42 | @Autowired | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.dashboard; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.DashboardInfoEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
... | ... | @@ -27,7 +27,7 @@ import java.util.UUID; |
27 | 27 | /** |
28 | 28 | * Created by Valerii Sosliuk on 5/6/2017. |
29 | 29 | */ |
30 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
30 | +@SqlDao | |
31 | 31 | public interface DashboardInfoRepository extends CrudRepository<DashboardInfoEntity, UUID> { |
32 | 32 | |
33 | 33 | @Query(nativeQuery = true, value = "SELECT * FROM DASHBOARD WHERE TENANT_ID = :tenantId " + | ... | ... |
... | ... | @@ -15,8 +15,8 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.dashboard; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.repository.CrudRepository; |
19 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
20 | 20 | import org.thingsboard.server.dao.model.sql.DashboardEntity; |
21 | 21 | |
22 | 22 | import java.util.UUID; |
... | ... | @@ -24,6 +24,6 @@ import java.util.UUID; |
24 | 24 | /** |
25 | 25 | * Created by Valerii Sosliuk on 5/6/2017. |
26 | 26 | */ |
27 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
27 | +@SqlDao | |
28 | 28 | public interface DashboardRepository extends CrudRepository<DashboardEntity, UUID> { |
29 | 29 | } | ... | ... |
... | ... | @@ -16,23 +16,21 @@ |
16 | 16 | package org.thingsboard.server.dao.sql.dashboard; |
17 | 17 | |
18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.Dashboard; |
22 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
23 | 23 | import org.thingsboard.server.dao.dashboard.DashboardDao; |
24 | 24 | import org.thingsboard.server.dao.model.sql.DashboardEntity; |
25 | 25 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
26 | 26 | |
27 | 27 | import java.util.UUID; |
28 | 28 | |
29 | -import static org.thingsboard.server.dao.model.ModelConstants.DASHBOARD_COLUMN_FAMILY_NAME; | |
30 | - | |
31 | 29 | /** |
32 | 30 | * Created by Valerii Sosliuk on 5/6/2017. |
33 | 31 | */ |
34 | 32 | @Component |
35 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
33 | +@SqlDao | |
36 | 34 | public class JpaDashboardDao extends JpaAbstractSearchTextDao<DashboardEntity, Dashboard> implements DashboardDao { |
37 | 35 | |
38 | 36 | @Autowired | ... | ... |
... | ... | @@ -16,12 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao.sql.dashboard; |
17 | 17 | |
18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.DashboardInfo; |
23 | 22 | import org.thingsboard.server.common.data.page.TextPageLink; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
25 | 25 | import org.thingsboard.server.dao.dashboard.DashboardInfoDao; |
26 | 26 | import org.thingsboard.server.dao.model.sql.DashboardInfoEntity; |
27 | 27 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
... | ... | @@ -35,7 +35,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
35 | 35 | * Created by Valerii Sosliuk on 5/6/2017. |
36 | 36 | */ |
37 | 37 | @Component |
38 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
38 | +@SqlDao | |
39 | 39 | public class JpaDashboardInfoDao extends JpaAbstractSearchTextDao<DashboardInfoEntity, DashboardInfo> implements DashboardInfoDao { |
40 | 40 | |
41 | 41 | @Autowired | ... | ... |
... | ... | @@ -15,9 +15,8 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.device; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.repository.CrudRepository; |
20 | -import org.springframework.stereotype.Component; | |
19 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
21 | 20 | import org.thingsboard.server.dao.model.sql.DeviceCredentialsEntity; |
22 | 21 | |
23 | 22 | import java.util.UUID; |
... | ... | @@ -25,7 +24,7 @@ import java.util.UUID; |
25 | 24 | /** |
26 | 25 | * Created by Valerii Sosliuk on 5/6/2017. |
27 | 26 | */ |
28 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
27 | +@SqlDao | |
29 | 28 | public interface DeviceCredentialsRepository extends CrudRepository<DeviceCredentialsEntity, UUID> { |
30 | 29 | |
31 | 30 | DeviceCredentialsEntity findByDeviceId(UUID deviceId); | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.device; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.DeviceEntity; |
23 | 23 | import org.thingsboard.server.dao.model.sql.TenantDeviceTypeEntity; |
24 | 24 | |
... | ... | @@ -28,7 +28,7 @@ import java.util.UUID; |
28 | 28 | /** |
29 | 29 | * Created by Valerii Sosliuk on 5/6/2017. |
30 | 30 | */ |
31 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
31 | +@SqlDao | |
32 | 32 | public interface DeviceRepository extends CrudRepository<DeviceEntity, UUID> { |
33 | 33 | |
34 | 34 | ... | ... |
... | ... | @@ -16,13 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao.sql.device; |
17 | 17 | |
18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.security.DeviceCredentials; |
23 | 22 | import org.thingsboard.server.dao.DaoUtil; |
23 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
24 | 24 | import org.thingsboard.server.dao.device.DeviceCredentialsDao; |
25 | -import org.thingsboard.server.dao.model.ModelConstants; | |
26 | 25 | import org.thingsboard.server.dao.model.sql.DeviceCredentialsEntity; |
27 | 26 | import org.thingsboard.server.dao.sql.JpaAbstractDao; |
28 | 27 | |
... | ... | @@ -32,7 +31,7 @@ import java.util.UUID; |
32 | 31 | * Created by Valerii Sosliuk on 5/6/2017. |
33 | 32 | */ |
34 | 33 | @Component |
35 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
34 | +@SqlDao | |
36 | 35 | public class JpaDeviceCredentialsDao extends JpaAbstractDao<DeviceCredentialsEntity, DeviceCredentials> implements DeviceCredentialsDao { |
37 | 36 | |
38 | 37 | @Autowired | ... | ... |
... | ... | @@ -17,7 +17,6 @@ package org.thingsboard.server.dao.sql.device; |
17 | 17 | |
18 | 18 | import com.google.common.util.concurrent.ListenableFuture; |
19 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.data.repository.CrudRepository; |
22 | 21 | import org.springframework.stereotype.Component; |
23 | 22 | import org.thingsboard.server.common.data.Device; |
... | ... | @@ -25,6 +24,7 @@ import org.thingsboard.server.common.data.TenantDeviceType; |
25 | 24 | import org.thingsboard.server.common.data.id.TenantId; |
26 | 25 | import org.thingsboard.server.common.data.page.TextPageLink; |
27 | 26 | import org.thingsboard.server.dao.DaoUtil; |
27 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
28 | 28 | import org.thingsboard.server.dao.device.DeviceDao; |
29 | 29 | import org.thingsboard.server.dao.model.sql.DeviceEntity; |
30 | 30 | import org.thingsboard.server.dao.model.sql.TenantDeviceTypeEntity; |
... | ... | @@ -38,7 +38,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
38 | 38 | * Created by Valerii Sosliuk on 5/6/2017. |
39 | 39 | */ |
40 | 40 | @Component |
41 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
41 | +@SqlDao | |
42 | 42 | public class JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device> implements DeviceDao { |
43 | 43 | |
44 | 44 | @Autowired | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.event; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.thingsboard.server.common.data.EntityType; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.EventEntity; |
23 | 23 | |
24 | 24 | import java.util.UUID; |
... | ... | @@ -26,7 +26,7 @@ import java.util.UUID; |
26 | 26 | /** |
27 | 27 | * Created by Valerii Sosliuk on 5/3/2017. |
28 | 28 | */ |
29 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
29 | +@SqlDao | |
30 | 30 | public interface EventRepository extends CrudRepository<EventEntity, UUID>, JpaSpecificationExecutor<EventEntity> { |
31 | 31 | |
32 | 32 | EventEntity findByTenantIdAndEntityTypeAndEntityIdAndEventTypeAndEventUid( | ... | ... |
... | ... | @@ -19,7 +19,6 @@ import com.datastax.driver.core.utils.UUIDs; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | 20 | import org.apache.commons.lang3.StringUtils; |
21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
22 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
23 | 22 | import org.springframework.data.domain.PageRequest; |
24 | 23 | import org.springframework.data.domain.Pageable; |
25 | 24 | import org.springframework.data.domain.Sort; |
... | ... | @@ -31,6 +30,7 @@ import org.thingsboard.server.common.data.id.EntityId; |
31 | 30 | import org.thingsboard.server.common.data.id.EventId; |
32 | 31 | import org.thingsboard.server.common.data.page.TimePageLink; |
33 | 32 | import org.thingsboard.server.dao.DaoUtil; |
33 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
34 | 34 | import org.thingsboard.server.dao.event.EventDao; |
35 | 35 | import org.thingsboard.server.dao.model.sql.EventEntity; |
36 | 36 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTimeDao; |
... | ... | @@ -53,7 +53,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
53 | 53 | */ |
54 | 54 | @Slf4j |
55 | 55 | @Component |
56 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
56 | +@SqlDao | |
57 | 57 | public class JpaBaseEventDao extends JpaAbstractSearchTimeDao<EventEntity, Event> implements EventDao { |
58 | 58 | |
59 | 59 | private final UUID systemTenantId = NULL_UUID; | ... | ... |
... | ... | @@ -17,7 +17,6 @@ package org.thingsboard.server.dao.sql.plugin; |
17 | 17 | |
18 | 18 | import lombok.extern.slf4j.Slf4j; |
19 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.data.repository.CrudRepository; |
22 | 21 | import org.springframework.stereotype.Component; |
23 | 22 | import org.thingsboard.server.common.data.id.PluginId; |
... | ... | @@ -25,6 +24,7 @@ import org.thingsboard.server.common.data.id.TenantId; |
25 | 24 | import org.thingsboard.server.common.data.page.TextPageLink; |
26 | 25 | import org.thingsboard.server.common.data.plugin.PluginMetaData; |
27 | 26 | import org.thingsboard.server.dao.DaoUtil; |
27 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
28 | 28 | import org.thingsboard.server.dao.model.sql.PluginMetaDataEntity; |
29 | 29 | import org.thingsboard.server.dao.plugin.PluginDao; |
30 | 30 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
... | ... | @@ -40,7 +40,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
40 | 40 | */ |
41 | 41 | @Slf4j |
42 | 42 | @Component |
43 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
43 | +@SqlDao | |
44 | 44 | public class JpaBasePluginDao extends JpaAbstractSearchTextDao<PluginMetaDataEntity, PluginMetaData> implements PluginDao { |
45 | 45 | |
46 | 46 | @Autowired | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.plugin; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.PluginMetaDataEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
... | ... | @@ -27,7 +27,7 @@ import java.util.UUID; |
27 | 27 | /** |
28 | 28 | * Created by Valerii Sosliuk on 5/1/2017. |
29 | 29 | */ |
30 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
30 | +@SqlDao | |
31 | 31 | public interface PluginMetaDataRepository extends CrudRepository<PluginMetaDataEntity, UUID> { |
32 | 32 | |
33 | 33 | PluginMetaDataEntity findByApiToken(String apiToken); | ... | ... |
... | ... | @@ -18,7 +18,6 @@ package org.thingsboard.server.dao.sql.relation; |
18 | 18 | import com.google.common.util.concurrent.ListenableFuture; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
21 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
22 | 21 | import org.springframework.data.domain.PageRequest; |
23 | 22 | import org.springframework.data.domain.Pageable; |
24 | 23 | import org.springframework.data.domain.Sort; |
... | ... | @@ -31,6 +30,7 @@ import org.thingsboard.server.common.data.page.TimePageLink; |
31 | 30 | import org.thingsboard.server.common.data.relation.EntityRelation; |
32 | 31 | import org.thingsboard.server.common.data.relation.RelationTypeGroup; |
33 | 32 | import org.thingsboard.server.dao.DaoUtil; |
33 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
34 | 34 | import org.thingsboard.server.dao.model.sql.RelationCompositeKey; |
35 | 35 | import org.thingsboard.server.dao.model.sql.RelationEntity; |
36 | 36 | import org.thingsboard.server.dao.relation.RelationDao; |
... | ... | @@ -53,7 +53,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
53 | 53 | */ |
54 | 54 | @Slf4j |
55 | 55 | @Component |
56 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
56 | +@SqlDao | |
57 | 57 | public class JpaRelationDao extends JpaAbstractDaoListeningExecutorService implements RelationDao { |
58 | 58 | |
59 | 59 | @Autowired | ... | ... |
... | ... | @@ -15,16 +15,16 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.relation; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
20 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
21 | 21 | import org.thingsboard.server.dao.model.sql.RelationCompositeKey; |
22 | 22 | import org.thingsboard.server.dao.model.sql.RelationEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
25 | 25 | import java.util.UUID; |
26 | 26 | |
27 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
27 | +@SqlDao | |
28 | 28 | public interface RelationRepository |
29 | 29 | extends CrudRepository<RelationEntity, RelationCompositeKey>, JpaSpecificationExecutor<RelationEntity> { |
30 | 30 | ... | ... |
... | ... | @@ -17,7 +17,6 @@ package org.thingsboard.server.dao.sql.rule; |
17 | 17 | |
18 | 18 | import lombok.extern.slf4j.Slf4j; |
19 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.data.repository.CrudRepository; |
22 | 21 | import org.springframework.stereotype.Component; |
23 | 22 | import org.thingsboard.server.common.data.id.RuleId; |
... | ... | @@ -25,6 +24,7 @@ import org.thingsboard.server.common.data.id.TenantId; |
25 | 24 | import org.thingsboard.server.common.data.page.TextPageLink; |
26 | 25 | import org.thingsboard.server.common.data.rule.RuleMetaData; |
27 | 26 | import org.thingsboard.server.dao.DaoUtil; |
27 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
28 | 28 | import org.thingsboard.server.dao.model.sql.RuleMetaDataEntity; |
29 | 29 | import org.thingsboard.server.dao.rule.RuleDao; |
30 | 30 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
... | ... | @@ -40,7 +40,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
40 | 40 | */ |
41 | 41 | @Slf4j |
42 | 42 | @Component |
43 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
43 | +@SqlDao | |
44 | 44 | public class JpaBaseRuleDao extends JpaAbstractSearchTextDao<RuleMetaDataEntity, RuleMetaData> implements RuleDao { |
45 | 45 | |
46 | 46 | @Autowired | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.rule; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.RuleMetaDataEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
... | ... | @@ -27,7 +27,7 @@ import java.util.UUID; |
27 | 27 | /** |
28 | 28 | * Created by Valerii Sosliuk on 4/30/2017. |
29 | 29 | */ |
30 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
30 | +@SqlDao | |
31 | 31 | public interface RuleMetaDataRepository extends CrudRepository<RuleMetaDataEntity, UUID> { |
32 | 32 | |
33 | 33 | List<RuleMetaDataEntity> findByPluginToken(String pluginToken); | ... | ... |
... | ... | @@ -17,11 +17,11 @@ package org.thingsboard.server.dao.sql.settings; |
17 | 17 | |
18 | 18 | import lombok.extern.slf4j.Slf4j; |
19 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.data.repository.CrudRepository; |
22 | 21 | import org.springframework.stereotype.Component; |
23 | 22 | import org.thingsboard.server.common.data.AdminSettings; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
25 | 25 | import org.thingsboard.server.dao.model.sql.AdminSettingsEntity; |
26 | 26 | import org.thingsboard.server.dao.settings.AdminSettingsDao; |
27 | 27 | import org.thingsboard.server.dao.sql.JpaAbstractDao; |
... | ... | @@ -30,7 +30,7 @@ import java.util.UUID; |
30 | 30 | |
31 | 31 | @Component |
32 | 32 | @Slf4j |
33 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
33 | +@SqlDao | |
34 | 34 | public class JpaAdminSettingsDao extends JpaAbstractDao<AdminSettingsEntity, AdminSettings> implements AdminSettingsDao{ |
35 | 35 | |
36 | 36 | @Autowired | ... | ... |
... | ... | @@ -16,12 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao.sql.tenant; |
17 | 17 | |
18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.Tenant; |
23 | 22 | import org.thingsboard.server.common.data.page.TextPageLink; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
25 | 25 | import org.thingsboard.server.dao.model.sql.TenantEntity; |
26 | 26 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
27 | 27 | import org.thingsboard.server.dao.tenant.TenantDao; |
... | ... | @@ -35,7 +35,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
35 | 35 | * Created by Valerii Sosliuk on 4/30/2017. |
36 | 36 | */ |
37 | 37 | @Component |
38 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
38 | +@SqlDao | |
39 | 39 | public class JpaTenantDao extends JpaAbstractSearchTextDao<TenantEntity, Tenant> implements TenantDao { |
40 | 40 | |
41 | 41 | @Autowired | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.tenant; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.TenantEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
... | ... | @@ -27,7 +27,7 @@ import java.util.UUID; |
27 | 27 | /** |
28 | 28 | * Created by Valerii Sosliuk on 4/30/2017. |
29 | 29 | */ |
30 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
30 | +@SqlDao | |
31 | 31 | public interface TenantRepository extends CrudRepository<TenantEntity, UUID> { |
32 | 32 | |
33 | 33 | @Query(nativeQuery = true, value = "SELECT * FROM TENANT WHERE REGION = :region " + | ... | ... |
... | ... | @@ -19,12 +19,12 @@ import com.google.common.collect.Lists; |
19 | 19 | import com.google.common.util.concurrent.ListenableFuture; |
20 | 20 | import lombok.extern.slf4j.Slf4j; |
21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
22 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
23 | 22 | import org.springframework.stereotype.Component; |
24 | 23 | import org.thingsboard.server.common.data.id.EntityId; |
25 | 24 | import org.thingsboard.server.common.data.kv.TsKvEntry; |
26 | 25 | import org.thingsboard.server.common.data.kv.TsKvQuery; |
27 | 26 | import org.thingsboard.server.dao.DaoUtil; |
27 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
28 | 28 | import org.thingsboard.server.dao.model.sql.TsKvEntity; |
29 | 29 | import org.thingsboard.server.dao.model.sql.TsKvLatestCompositeKey; |
30 | 30 | import org.thingsboard.server.dao.model.sql.TsKvLatestEntity; |
... | ... | @@ -35,7 +35,7 @@ import java.util.List; |
35 | 35 | |
36 | 36 | @Component |
37 | 37 | @Slf4j |
38 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
38 | +@SqlDao | |
39 | 39 | public class JpaTimeseriesDao extends JpaAbstractDaoListeningExecutorService implements TimeseriesDao { |
40 | 40 | |
41 | 41 | @Autowired | ... | ... |
... | ... | @@ -15,15 +15,15 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.timeseries; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.repository.CrudRepository; |
19 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
20 | 20 | import org.thingsboard.server.dao.model.sql.TsKvLatestCompositeKey; |
21 | 21 | import org.thingsboard.server.dao.model.sql.TsKvLatestEntity; |
22 | 22 | |
23 | 23 | import java.util.List; |
24 | 24 | import java.util.UUID; |
25 | 25 | |
26 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
26 | +@SqlDao | |
27 | 27 | public interface TsKvLatestRepository extends CrudRepository<TsKvLatestEntity, TsKvLatestCompositeKey> { |
28 | 28 | |
29 | 29 | List<TsKvLatestEntity> findAllByEntityTypeAndEntityId(String entityType, UUID entityId); | ... | ... |
... | ... | @@ -15,11 +15,11 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.timeseries; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.repository.CrudRepository; |
19 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
20 | 20 | import org.thingsboard.server.dao.model.sql.TsKvCompositeKey; |
21 | 21 | import org.thingsboard.server.dao.model.sql.TsKvEntity; |
22 | 22 | |
23 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
23 | +@SqlDao | |
24 | 24 | public interface TsKvRepository extends CrudRepository<TsKvEntity, TsKvCompositeKey> { |
25 | 25 | } | ... | ... |
... | ... | @@ -16,12 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao.sql.user; |
17 | 17 | |
18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.User; |
23 | 22 | import org.thingsboard.server.common.data.page.TextPageLink; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
25 | 25 | import org.thingsboard.server.dao.model.sql.UserEntity; |
26 | 26 | import org.thingsboard.server.dao.sql.JpaAbstractDao; |
27 | 27 | import org.thingsboard.server.dao.user.UserDao; |
... | ... | @@ -35,7 +35,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
35 | 35 | * @author Valerii Sosliuk |
36 | 36 | */ |
37 | 37 | @Component |
38 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
38 | +@SqlDao | |
39 | 39 | public class JpaUserDao extends JpaAbstractDao<UserEntity, User> implements UserDao { |
40 | 40 | |
41 | 41 | @Autowired | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.user; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.UserEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
... | ... | @@ -27,7 +27,7 @@ import java.util.UUID; |
27 | 27 | /** |
28 | 28 | * @author Valerii Sosliuk |
29 | 29 | */ |
30 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
30 | +@SqlDao | |
31 | 31 | public interface UserRepository extends CrudRepository<UserEntity, UUID> { |
32 | 32 | |
33 | 33 | UserEntity findByEmail(String email); | ... | ... |
... | ... | @@ -16,11 +16,11 @@ |
16 | 16 | package org.thingsboard.server.dao.sql.widget; |
17 | 17 | |
18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.widget.WidgetType; |
23 | 22 | import org.thingsboard.server.dao.DaoUtil; |
23 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
24 | 24 | import org.thingsboard.server.dao.model.sql.WidgetTypeEntity; |
25 | 25 | import org.thingsboard.server.dao.sql.JpaAbstractDao; |
26 | 26 | import org.thingsboard.server.dao.widget.WidgetTypeDao; |
... | ... | @@ -28,13 +28,11 @@ import org.thingsboard.server.dao.widget.WidgetTypeDao; |
28 | 28 | import java.util.List; |
29 | 29 | import java.util.UUID; |
30 | 30 | |
31 | -import static org.thingsboard.server.dao.model.ModelConstants.WIDGET_TYPE_COLUMN_FAMILY_NAME; | |
32 | - | |
33 | 31 | /** |
34 | 32 | * Created by Valerii Sosliuk on 4/29/2017. |
35 | 33 | */ |
36 | 34 | @Component |
37 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
35 | +@SqlDao | |
38 | 36 | public class JpaWidgetTypeDao extends JpaAbstractDao<WidgetTypeEntity, WidgetType> implements WidgetTypeDao { |
39 | 37 | |
40 | 38 | @Autowired | ... | ... |
... | ... | @@ -16,12 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao.sql.widget; |
17 | 17 | |
18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.page.TextPageLink; |
23 | 22 | import org.thingsboard.server.common.data.widget.WidgetsBundle; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
25 | 25 | import org.thingsboard.server.dao.model.sql.WidgetsBundleEntity; |
26 | 26 | import org.thingsboard.server.dao.sql.JpaAbstractSearchTextDao; |
27 | 27 | import org.thingsboard.server.dao.widget.WidgetsBundleDao; |
... | ... | @@ -35,7 +35,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID; |
35 | 35 | * Created by Valerii Sosliuk on 4/23/2017. |
36 | 36 | */ |
37 | 37 | @Component |
38 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
38 | +@SqlDao | |
39 | 39 | public class JpaWidgetsBundleDao extends JpaAbstractSearchTextDao<WidgetsBundleEntity, WidgetsBundle> implements WidgetsBundleDao { |
40 | 40 | |
41 | 41 | @Autowired | ... | ... |
... | ... | @@ -15,9 +15,8 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.widget; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.repository.CrudRepository; |
20 | -import org.thingsboard.server.common.data.widget.WidgetType; | |
19 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
21 | 20 | import org.thingsboard.server.dao.model.sql.WidgetTypeEntity; |
22 | 21 | |
23 | 22 | import java.util.List; |
... | ... | @@ -26,7 +25,7 @@ import java.util.UUID; |
26 | 25 | /** |
27 | 26 | * Created by Valerii Sosliuk on 4/29/2017. |
28 | 27 | */ |
29 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
28 | +@SqlDao | |
30 | 29 | public interface WidgetTypeRepository extends CrudRepository<WidgetTypeEntity, UUID> { |
31 | 30 | |
32 | 31 | List<WidgetTypeEntity> findByTenantIdAndBundleAlias(UUID tenantId, String bundleAlias); | ... | ... |
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.dao.sql.widget; |
17 | 17 | |
18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
19 | 18 | import org.springframework.data.jpa.repository.Query; |
20 | 19 | import org.springframework.data.repository.CrudRepository; |
21 | 20 | import org.springframework.data.repository.query.Param; |
21 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
22 | 22 | import org.thingsboard.server.dao.model.sql.WidgetsBundleEntity; |
23 | 23 | |
24 | 24 | import java.util.List; |
... | ... | @@ -27,7 +27,7 @@ import java.util.UUID; |
27 | 27 | /** |
28 | 28 | * Created by Valerii Sosliuk on 4/23/2017. |
29 | 29 | */ |
30 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true", matchIfMissing = false) | |
30 | +@SqlDao | |
31 | 31 | public interface WidgetsBundleRepository extends CrudRepository<WidgetsBundleEntity, UUID> { |
32 | 32 | |
33 | 33 | WidgetsBundleEntity findWidgetsBundleByTenantIdAndAlias(UUID tenantId, String alias); | ... | ... |
... | ... | @@ -16,12 +16,12 @@ |
16 | 16 | package org.thingsboard.server.dao.tenant; |
17 | 17 | |
18 | 18 | import lombok.extern.slf4j.Slf4j; |
19 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
20 | 19 | import org.springframework.stereotype.Component; |
21 | 20 | import org.thingsboard.server.common.data.Tenant; |
22 | 21 | import org.thingsboard.server.common.data.page.TextPageLink; |
23 | 22 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
25 | 25 | import org.thingsboard.server.dao.model.nosql.TenantEntity; |
26 | 26 | |
27 | 27 | import java.util.Arrays; |
... | ... | @@ -32,7 +32,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
32 | 32 | |
33 | 33 | @Component |
34 | 34 | @Slf4j |
35 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
35 | +@NoSqlDao | |
36 | 36 | public class CassandraTenantDao extends CassandraAbstractSearchTextDao<TenantEntity, Tenant> implements TenantDao { |
37 | 37 | |
38 | 38 | @Override | ... | ... |
... | ... | @@ -25,12 +25,12 @@ import com.google.common.util.concurrent.Futures; |
25 | 25 | import com.google.common.util.concurrent.ListenableFuture; |
26 | 26 | import lombok.extern.slf4j.Slf4j; |
27 | 27 | import org.springframework.beans.factory.annotation.Value; |
28 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
29 | 28 | import org.springframework.stereotype.Component; |
30 | 29 | import org.thingsboard.server.common.data.id.EntityId; |
31 | 30 | import org.thingsboard.server.common.data.kv.*; |
32 | 31 | import org.thingsboard.server.common.data.kv.DataType; |
33 | 32 | import org.thingsboard.server.dao.CassandraAbstractAsyncDao; |
33 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
34 | 34 | import org.thingsboard.server.dao.model.ModelConstants; |
35 | 35 | |
36 | 36 | import javax.annotation.Nullable; |
... | ... | @@ -51,7 +51,7 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.eq; |
51 | 51 | */ |
52 | 52 | @Component |
53 | 53 | @Slf4j |
54 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true") | |
54 | +@NoSqlDao | |
55 | 55 | public class CassandraBaseTimeseriesDao extends CassandraAbstractAsyncDao implements TimeseriesDao { |
56 | 56 | |
57 | 57 | @Value("${cassandra.query.min_aggregation_step_ms}") | ... | ... |
... | ... | @@ -22,6 +22,7 @@ import org.springframework.stereotype.Component; |
22 | 22 | import org.thingsboard.server.common.data.security.UserCredentials; |
23 | 23 | import org.thingsboard.server.dao.CassandraAbstractModelDao; |
24 | 24 | import org.thingsboard.server.dao.DaoUtil; |
25 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
25 | 26 | import org.thingsboard.server.dao.model.ModelConstants; |
26 | 27 | import org.thingsboard.server.dao.model.nosql.UserCredentialsEntity; |
27 | 28 | |
... | ... | @@ -32,7 +33,7 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.select; |
32 | 33 | |
33 | 34 | @Component |
34 | 35 | @Slf4j |
35 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
36 | +@NoSqlDao | |
36 | 37 | public class CassandraUserCredentialsDao extends CassandraAbstractModelDao<UserCredentialsEntity, UserCredentials> implements UserCredentialsDao { |
37 | 38 | |
38 | 39 | @Override | ... | ... |
... | ... | @@ -17,13 +17,13 @@ package org.thingsboard.server.dao.user; |
17 | 17 | |
18 | 18 | import com.datastax.driver.core.querybuilder.Select.Where; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.User; |
23 | 22 | import org.thingsboard.server.common.data.page.TextPageLink; |
24 | 23 | import org.thingsboard.server.common.data.security.Authority; |
25 | 24 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
26 | 25 | import org.thingsboard.server.dao.DaoUtil; |
26 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
27 | 27 | import org.thingsboard.server.dao.model.ModelConstants; |
28 | 28 | import org.thingsboard.server.dao.model.nosql.UserEntity; |
29 | 29 | |
... | ... | @@ -36,7 +36,7 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.select; |
36 | 36 | |
37 | 37 | @Component |
38 | 38 | @Slf4j |
39 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
39 | +@NoSqlDao | |
40 | 40 | public class CassandraUserDao extends CassandraAbstractSearchTextDao<UserEntity, User> implements UserDao { |
41 | 41 | |
42 | 42 | @Override | ... | ... |
... | ... | @@ -17,11 +17,11 @@ package org.thingsboard.server.dao.widget; |
17 | 17 | |
18 | 18 | import com.datastax.driver.core.querybuilder.Select.Where; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.widget.WidgetType; |
23 | 22 | import org.thingsboard.server.dao.CassandraAbstractModelDao; |
24 | 23 | import org.thingsboard.server.dao.DaoUtil; |
24 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
25 | 25 | import org.thingsboard.server.dao.model.nosql.WidgetTypeEntity; |
26 | 26 | |
27 | 27 | import java.util.List; |
... | ... | @@ -33,7 +33,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
33 | 33 | |
34 | 34 | @Component |
35 | 35 | @Slf4j |
36 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
36 | +@NoSqlDao | |
37 | 37 | public class CassandraWidgetTypeDao extends CassandraAbstractModelDao<WidgetTypeEntity, WidgetType> implements WidgetTypeDao { |
38 | 38 | |
39 | 39 | @Override | ... | ... |
... | ... | @@ -17,12 +17,12 @@ package org.thingsboard.server.dao.widget; |
17 | 17 | |
18 | 18 | import com.datastax.driver.core.querybuilder.Select; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
21 | 20 | import org.springframework.stereotype.Component; |
22 | 21 | import org.thingsboard.server.common.data.page.TextPageLink; |
23 | 22 | import org.thingsboard.server.common.data.widget.WidgetsBundle; |
24 | 23 | import org.thingsboard.server.dao.CassandraAbstractSearchTextDao; |
25 | 24 | import org.thingsboard.server.dao.DaoUtil; |
25 | +import org.thingsboard.server.dao.annotation.NoSqlDao; | |
26 | 26 | import org.thingsboard.server.dao.model.nosql.WidgetsBundleEntity; |
27 | 27 | |
28 | 28 | import java.util.Arrays; |
... | ... | @@ -34,7 +34,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.*; |
34 | 34 | |
35 | 35 | @Component |
36 | 36 | @Slf4j |
37 | -@ConditionalOnProperty(prefix = "cassandra", value = "enabled", havingValue = "true", matchIfMissing = false) | |
37 | +@NoSqlDao | |
38 | 38 | public class CassandraWidgetsBundleDao extends CassandraAbstractSearchTextDao<WidgetsBundleEntity, WidgetsBundle> implements WidgetsBundleDao { |
39 | 39 | |
40 | 40 | @Override | ... | ... |
... | ... | @@ -20,9 +20,9 @@ import com.github.springtestdbunit.bean.DatabaseDataSourceConnectionFactoryBean; |
20 | 20 | import org.dbunit.DatabaseUnitException; |
21 | 21 | import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; |
22 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
23 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
24 | 23 | import org.springframework.context.annotation.Bean; |
25 | 24 | import org.springframework.context.annotation.Configuration; |
25 | +import org.thingsboard.server.dao.annotation.SqlDao; | |
26 | 26 | |
27 | 27 | import javax.sql.DataSource; |
28 | 28 | import java.io.IOException; |
... | ... | @@ -32,7 +32,7 @@ import java.sql.SQLException; |
32 | 32 | * Created by Valerii Sosliuk on 5/6/2017. |
33 | 33 | */ |
34 | 34 | @Configuration |
35 | -@ConditionalOnProperty(prefix = "sql", value = "enabled", havingValue = "true") | |
35 | +@SqlDao | |
36 | 36 | public class JpaDbunitTestConfig { |
37 | 37 | |
38 | 38 | @Autowired | ... | ... |