File tree Expand file tree Collapse file tree 6 files changed +109
-0
lines changed
IOT-Guide-RuleEngine-ThingsBoard/src/main/java/iot/technology/thingsboard/ruleengine Expand file tree Collapse file tree 6 files changed +109
-0
lines changed Original file line number Diff line number Diff line change 1+ package iot .technology .thingsboard .ruleengine .common ;
2+
3+ /**
4+ * @author mushuwei
5+ */
6+ public class ModelConstants {
7+
8+ private ModelConstants () {
9+
10+ }
11+
12+ public static final String RELATION_COLUMN_FAMILY_NAME = "relation" ;
13+ public static final String RELATION_FROM_ID_PROPERTY = "from_id" ;
14+ public static final String RELATION_FROM_TYPE_PROPERTY = "from_type" ;
15+ public static final String RELATION_TO_ID_PROPERTY = "to_id" ;
16+ public static final String RELATION_TO_TYPE_PROPERTY = "to_type" ;
17+ public static final String RELATION_TYPE_PROPERTY = "relation_type" ;
18+ public static final String RELATION_TYPE_GROUP_PROPERTY = "relation_type_group" ;
19+ }
Original file line number Diff line number Diff line change 1+ package iot .technology .thingsboard .ruleengine .dao ;
2+
3+ /**
4+ * @author mushuwei
5+ */
6+ public interface RelationRepository {
7+ }
Original file line number Diff line number Diff line change 1+ package iot .technology .thingsboard .ruleengine .dao ;
2+
3+ /**
4+ * @author mushuwei
5+ */
6+ public interface RuleChainRepository {
7+ }
Original file line number Diff line number Diff line change 1+ package iot .technology .thingsboard .ruleengine .dao ;
2+
3+ /**
4+ * @author mushuwei
5+ */
6+ public interface RuleNodeRepository {
7+ }
Original file line number Diff line number Diff line change 1+ package iot .technology .thingsboard .ruleengine .dao .model ;
2+
3+ import lombok .AllArgsConstructor ;
4+ import lombok .Data ;
5+ import lombok .NoArgsConstructor ;
6+
7+ import javax .persistence .Transient ;
8+ import java .io .Serializable ;
9+
10+ /**
11+ * @author mushuwei
12+ */
13+ @ NoArgsConstructor
14+ @ AllArgsConstructor
15+ @ Data
16+ public class RelationCompositeKey implements Serializable {
17+
18+ @ Transient
19+ private static final long serialVersionUID = -4089175869616037592L ;
20+
21+ private Long fromId ;
22+ private String fromType ;
23+ private Long toId ;
24+ private String toType ;
25+ private String relationType ;
26+ private String relationTypeGroup ;
27+
28+ }
Original file line number Diff line number Diff line change 1+ package iot .technology .thingsboard .ruleengine .dao .model ;
2+
3+ import lombok .Data ;
4+
5+ import javax .persistence .*;
6+
7+ import static iot .technology .thingsboard .ruleengine .common .ModelConstants .*;
8+
9+ /**
10+ * @author mushuwei
11+ */
12+ @ Data
13+ @ Entity
14+ @ Table (name = RELATION_COLUMN_FAMILY_NAME )
15+ @ IdClass (RelationCompositeKey .class )
16+ public class RelationEntity {
17+
18+ @ Id
19+ @ Column (name = RELATION_FROM_ID_PROPERTY )
20+ private Long fromId ;
21+
22+ @ Id
23+ @ Column (name = RELATION_FROM_TYPE_PROPERTY )
24+ private String fromType ;
25+
26+ @ Id
27+ @ Column (name = RELATION_TO_ID_PROPERTY )
28+ private Long toId ;
29+
30+ @ Id
31+ @ Column (name = RELATION_TO_TYPE_PROPERTY )
32+ private String toType ;
33+
34+ @ Id
35+ @ Column (name = RELATION_TYPE_GROUP_PROPERTY )
36+ private String relationTypeGroup ;
37+
38+ @ Id
39+ @ Column (name = RELATION_TYPE_PROPERTY )
40+ private String relationType ;
41+ }
You can’t perform that action at this time.
0 commit comments