...
|
...
|
@@ -18,19 +18,15 @@ package org.thingsboard.server.dao.sql; |
18
|
18
|
import com.datastax.driver.core.utils.UUIDs;
|
19
|
19
|
import com.google.common.collect.Lists;
|
20
|
20
|
import com.google.common.util.concurrent.ListenableFuture;
|
21
|
|
-import com.google.common.util.concurrent.ListeningExecutorService;
|
22
|
|
-import com.google.common.util.concurrent.MoreExecutors;
|
23
|
21
|
import lombok.extern.slf4j.Slf4j;
|
24
|
22
|
import org.springframework.data.repository.CrudRepository;
|
25
|
23
|
import org.springframework.transaction.annotation.Transactional;
|
26
|
24
|
import org.thingsboard.server.dao.Dao;
|
27
|
25
|
import org.thingsboard.server.dao.DaoUtil;
|
28
|
26
|
import org.thingsboard.server.dao.model.BaseEntity;
|
29
|
|
-import org.thingsboard.server.dao.model.SearchTextEntity;
|
30
|
27
|
|
31
|
28
|
import java.util.List;
|
32
|
29
|
import java.util.UUID;
|
33
|
|
-import java.util.concurrent.Executors;
|
34
|
30
|
|
35
|
31
|
import static org.springframework.transaction.annotation.Propagation.REQUIRES_NEW;
|
36
|
32
|
|
...
|
...
|
@@ -46,9 +42,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D> |
46
|
42
|
|
47
|
43
|
protected abstract CrudRepository<E, UUID> getCrudRepository();
|
48
|
44
|
|
49
|
|
- protected boolean isSearchTextDao() {
|
50
|
|
- return false;
|
51
|
|
- }
|
|
45
|
+ protected void setSearchText(E entity) {}
|
52
|
46
|
|
53
|
47
|
@Override
|
54
|
48
|
@Transactional(propagation = REQUIRES_NEW)
|
...
|
...
|
@@ -60,9 +54,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D> |
60
|
54
|
log.error("Can't create entity for domain object {}", domain, e);
|
61
|
55
|
throw new IllegalArgumentException("Can't create entity for domain object {" + domain + "}", e);
|
62
|
56
|
}
|
63
|
|
- if (isSearchTextDao()) {
|
64
|
|
- ((SearchTextEntity) entity).setSearchText(((SearchTextEntity) entity).getSearchTextSource().toLowerCase());
|
65
|
|
- }
|
|
57
|
+ setSearchText(entity);
|
66
|
58
|
log.debug("Saving entity {}", entity);
|
67
|
59
|
if (entity.getId() == null) {
|
68
|
60
|
entity.setId(UUIDs.timeBased());
|
...
|
...
|
|