Skip to content

Commit 68bbf53

Browse files
committed
🗃️ rule engine about thingsboard database
1 parent 3b9ca06 commit 68bbf53

File tree

6 files changed

+109
-0
lines changed

6 files changed

+109
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package iot.technology.thingsboard.ruleengine.dao;
2+
3+
/**
4+
* @author mushuwei
5+
*/
6+
public interface RelationRepository {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package iot.technology.thingsboard.ruleengine.dao;
2+
3+
/**
4+
* @author mushuwei
5+
*/
6+
public interface RuleChainRepository {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package iot.technology.thingsboard.ruleengine.dao;
2+
3+
/**
4+
* @author mushuwei
5+
*/
6+
public interface RuleNodeRepository {
7+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
}

0 commit comments

Comments
 (0)