Commit ad48ecabd84f961ebaeefe385d94966077d9a1c4
1 parent
84224067
Was added some of the entity-view constants and refactored code
Showing
3 changed files
with
10 additions
and
11 deletions
@@ -136,7 +136,6 @@ public class ModelConstants { | @@ -136,7 +136,6 @@ public class ModelConstants { | ||
136 | public static final String DEVICE_NAME_PROPERTY = "name"; | 136 | public static final String DEVICE_NAME_PROPERTY = "name"; |
137 | public static final String DEVICE_TYPE_PROPERTY = "type"; | 137 | public static final String DEVICE_TYPE_PROPERTY = "type"; |
138 | public static final String DEVICE_ADDITIONAL_INFO_PROPERTY = ADDITIONAL_INFO_PROPERTY; | 138 | public static final String DEVICE_ADDITIONAL_INFO_PROPERTY = ADDITIONAL_INFO_PROPERTY; |
139 | - | ||
140 | public static final String DEVICE_BY_TENANT_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "device_by_tenant_and_search_text"; | 139 | public static final String DEVICE_BY_TENANT_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "device_by_tenant_and_search_text"; |
141 | public static final String DEVICE_BY_TENANT_BY_TYPE_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "device_by_tenant_by_type_and_search_text"; | 140 | public static final String DEVICE_BY_TENANT_BY_TYPE_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "device_by_tenant_by_type_and_search_text"; |
142 | public static final String DEVICE_BY_CUSTOMER_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "device_by_customer_and_search_text"; | 141 | public static final String DEVICE_BY_CUSTOMER_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "device_by_customer_and_search_text"; |
@@ -152,11 +151,12 @@ public class ModelConstants { | @@ -152,11 +151,12 @@ public class ModelConstants { | ||
152 | public static final String ENTITY_VIEW_TENANT_ID_PROPERTY = TENANT_ID_PROPERTY; | 151 | public static final String ENTITY_VIEW_TENANT_ID_PROPERTY = TENANT_ID_PROPERTY; |
153 | public static final String ENTITY_VIEW_CUSTOMER_ID_PROPERTY = CUSTOMER_ID_PROPERTY; | 152 | public static final String ENTITY_VIEW_CUSTOMER_ID_PROPERTY = CUSTOMER_ID_PROPERTY; |
154 | public static final String ENTITY_VIEW_NAME_PROPERTY = DEVICE_NAME_PROPERTY; | 153 | public static final String ENTITY_VIEW_NAME_PROPERTY = DEVICE_NAME_PROPERTY; |
155 | - public static final String ENTITY_VIEW_TYPE_PROPERTY = "type_entity"; | 154 | + public static final String ENTITY_VIEW_TENANT_AND_NAME_VIEW_NAME = "entity_view_by_tenant_and_name"; |
156 | public static final String ENTITY_VIEW_KEYS_PROPERTY = "keys"; | 155 | public static final String ENTITY_VIEW_KEYS_PROPERTY = "keys"; |
157 | public static final String ENTITY_VIEW_TS_BEGIN_PROPERTY = "ts_begin"; | 156 | public static final String ENTITY_VIEW_TS_BEGIN_PROPERTY = "ts_begin"; |
158 | public static final String ENTITY_VIEW_TS_END_PROPERTY = "ts_end"; | 157 | public static final String ENTITY_VIEW_TS_END_PROPERTY = "ts_end"; |
159 | public static final String ENTITY_VIEW_ADDITIONAL_INFO_PROPERTY = ADDITIONAL_INFO_PROPERTY; | 158 | public static final String ENTITY_VIEW_ADDITIONAL_INFO_PROPERTY = ADDITIONAL_INFO_PROPERTY; |
159 | + public static final String ENTITY_VIEW_BY_TENANT_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "entity_view_by_tenant_and_search_text"; | ||
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Cassandra audit log constants. | 162 | * Cassandra audit log constants. |
@@ -116,8 +116,8 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> { | @@ -116,8 +116,8 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> { | ||
116 | } catch (IOException e) { | 116 | } catch (IOException e) { |
117 | e.printStackTrace(); | 117 | e.printStackTrace(); |
118 | } | 118 | } |
119 | - this.tsBegin = entityView.getTsBegin() != null ? String.valueOf(entityView.getTsBegin()) : "0"; | ||
120 | - this.tsEnd = entityView.getTsEnd() != null ? String.valueOf(entityView.getTsEnd()) : "0"; | 119 | + this.tsBegin = entityView.getStartTs() != null ? String.valueOf(entityView.getStartTs()) : "0"; |
120 | + this.tsEnd = entityView.getEndTs() != null ? String.valueOf(entityView.getEndTs()) : "0"; | ||
121 | this.searchText = entityView.getSearchText(); | 121 | this.searchText = entityView.getSearchText(); |
122 | this.additionalInfo = entityView.getAdditionalInfo(); | 122 | this.additionalInfo = entityView.getAdditionalInfo(); |
123 | } | 123 | } |
@@ -146,8 +146,8 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> { | @@ -146,8 +146,8 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> { | ||
146 | } catch (IOException e) { | 146 | } catch (IOException e) { |
147 | e.printStackTrace(); | 147 | e.printStackTrace(); |
148 | } | 148 | } |
149 | - entityView.setTsBegin(Long.parseLong(tsBegin)); | ||
150 | - entityView.setTsEnd(Long.parseLong(tsEnd)); | 149 | + entityView.setStartTs(Long.parseLong(tsBegin)); |
150 | + entityView.setEndTs(Long.parseLong(tsEnd)); | ||
151 | entityView.setAdditionalInfo(additionalInfo); | 151 | entityView.setAdditionalInfo(additionalInfo); |
152 | return entityView; | 152 | return entityView; |
153 | } | 153 | } |
@@ -34,7 +34,6 @@ import org.thingsboard.server.dao.util.mapping.JsonStringType; | @@ -34,7 +34,6 @@ import org.thingsboard.server.dao.util.mapping.JsonStringType; | ||
34 | import javax.persistence.*; | 34 | import javax.persistence.*; |
35 | import java.io.IOException; | 35 | import java.io.IOException; |
36 | 36 | ||
37 | -import static org.thingsboard.server.dao.model.ModelConstants.AUDIT_LOG_ENTITY_TYPE_PROPERTY; | ||
38 | import static org.thingsboard.server.dao.model.ModelConstants.ENTITY_TYPE_PROPERTY; | 37 | import static org.thingsboard.server.dao.model.ModelConstants.ENTITY_TYPE_PROPERTY; |
39 | 38 | ||
40 | /** | 39 | /** |
@@ -106,8 +105,8 @@ public class EntityViewEntity extends BaseSqlEntity<EntityView> implements Searc | @@ -106,8 +105,8 @@ public class EntityViewEntity extends BaseSqlEntity<EntityView> implements Searc | ||
106 | } catch (IOException e) { | 105 | } catch (IOException e) { |
107 | e.printStackTrace(); | 106 | e.printStackTrace(); |
108 | } | 107 | } |
109 | - this.tsBegin = entityView.getTsBegin() != null ? String.valueOf(entityView.getTsBegin()) : "0"; | ||
110 | - this.tsEnd = entityView.getTsEnd() != null ? String.valueOf(entityView.getTsEnd()) : "0"; | 108 | + this.tsBegin = entityView.getStartTs() != null ? String.valueOf(entityView.getStartTs()) : "0"; |
109 | + this.tsEnd = entityView.getEndTs() != null ? String.valueOf(entityView.getEndTs()) : "0"; | ||
111 | this.searchText = entityView.getSearchText(); | 110 | this.searchText = entityView.getSearchText(); |
112 | this.additionalInfo = entityView.getAdditionalInfo(); | 111 | this.additionalInfo = entityView.getAdditionalInfo(); |
113 | } | 112 | } |
@@ -142,8 +141,8 @@ public class EntityViewEntity extends BaseSqlEntity<EntityView> implements Searc | @@ -142,8 +141,8 @@ public class EntityViewEntity extends BaseSqlEntity<EntityView> implements Searc | ||
142 | } catch (IOException e) { | 141 | } catch (IOException e) { |
143 | e.printStackTrace(); | 142 | e.printStackTrace(); |
144 | } | 143 | } |
145 | - entityView.setTsBegin(Long.parseLong(tsBegin)); | ||
146 | - entityView.setTsEnd(Long.parseLong(tsEnd)); | 144 | + entityView.setStartTs(Long.parseLong(tsBegin)); |
145 | + entityView.setEndTs(Long.parseLong(tsEnd)); | ||
147 | entityView.setAdditionalInfo(additionalInfo); | 146 | entityView.setAdditionalInfo(additionalInfo); |
148 | return entityView; | 147 | return entityView; |
149 | } | 148 | } |