Fix RuleChain DAO model
This commit is contained in:
		
							parent
							
								
									10bbeef661
								
							
						
					
					
						commit
						2f89b6d0f3
					
				@ -68,7 +68,7 @@ CREATE TABLE IF NOT EXISTS  thingsboard.rule_chain (
 | 
			
		||||
    name text,
 | 
			
		||||
    search_text text,
 | 
			
		||||
    first_rule_node_id uuid,
 | 
			
		||||
    is_root boolean,
 | 
			
		||||
    root boolean,
 | 
			
		||||
    configuration text,
 | 
			
		||||
    additional_info text,
 | 
			
		||||
    PRIMARY KEY (id, tenant_id)
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS rule_chain (
 | 
			
		||||
    configuration varchar(10000000),
 | 
			
		||||
    name varchar(255),
 | 
			
		||||
    first_rule_node_id varchar(31),
 | 
			
		||||
    is_root boolean,
 | 
			
		||||
    root boolean,
 | 
			
		||||
    search_text varchar(255),
 | 
			
		||||
    tenant_id varchar(31)
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
@ -36,7 +36,7 @@ public class RuleChain extends SearchTextBasedWithAdditionalInfo<RuleChainId> im
 | 
			
		||||
    private TenantId tenantId;
 | 
			
		||||
    private String name;
 | 
			
		||||
    private RuleNodeId firstRuleNodeId;
 | 
			
		||||
    private boolean isRoot;
 | 
			
		||||
    private boolean root;
 | 
			
		||||
    private transient JsonNode configuration;
 | 
			
		||||
    @JsonIgnore
 | 
			
		||||
    private byte[] configurationBytes;
 | 
			
		||||
@ -54,7 +54,7 @@ public class RuleChain extends SearchTextBasedWithAdditionalInfo<RuleChainId> im
 | 
			
		||||
        this.tenantId = ruleChain.getTenantId();
 | 
			
		||||
        this.name = ruleChain.getName();
 | 
			
		||||
        this.firstRuleNodeId = ruleChain.getFirstRuleNodeId();
 | 
			
		||||
        this.isRoot = ruleChain.isRoot();
 | 
			
		||||
        this.root = ruleChain.isRoot();
 | 
			
		||||
        this.setConfiguration(ruleChain.getConfiguration());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -339,7 +339,7 @@ public class ModelConstants {
 | 
			
		||||
    public static final String RULE_CHAIN_TENANT_ID_PROPERTY = TENANT_ID_PROPERTY;
 | 
			
		||||
    public static final String RULE_CHAIN_NAME_PROPERTY = "name";
 | 
			
		||||
    public static final String RULE_CHAIN_FIRST_RULE_NODE_ID_PROPERTY = "first_rule_node_id";
 | 
			
		||||
    public static final String RULE_CHAIN_IS_ROOT_PROPERTY = "is_root";
 | 
			
		||||
    public static final String RULE_CHAIN_ROOT_PROPERTY = "root";
 | 
			
		||||
    public static final String RULE_CHAIN_CONFIGURATION_PROPERTY = "configuration";
 | 
			
		||||
 | 
			
		||||
    public static final String RULE_CHAIN_BY_TENANT_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "rule_chain_by_tenant_and_search_text";
 | 
			
		||||
 | 
			
		||||
@ -52,8 +52,8 @@ public class RuleChainEntity implements SearchTextEntity<RuleChain> {
 | 
			
		||||
    private String searchText;
 | 
			
		||||
    @Column(name = RULE_CHAIN_FIRST_RULE_NODE_ID_PROPERTY)
 | 
			
		||||
    private UUID firstRuleNodeId;
 | 
			
		||||
    @Column(name = RULE_CHAIN_IS_ROOT_PROPERTY)
 | 
			
		||||
    private boolean isRoot;
 | 
			
		||||
    @Column(name = RULE_CHAIN_ROOT_PROPERTY)
 | 
			
		||||
    private boolean root;
 | 
			
		||||
    @Column(name = RULE_CHAIN_CONFIGURATION_PROPERTY, codec = JsonCodec.class)
 | 
			
		||||
    private JsonNode configuration;
 | 
			
		||||
    @Column(name = ADDITIONAL_INFO_PROPERTY, codec = JsonCodec.class)
 | 
			
		||||
@ -70,7 +70,7 @@ public class RuleChainEntity implements SearchTextEntity<RuleChain> {
 | 
			
		||||
        this.name = ruleChain.getName();
 | 
			
		||||
        this.searchText = ruleChain.getName();
 | 
			
		||||
        this.firstRuleNodeId = DaoUtil.getId(ruleChain.getFirstRuleNodeId());
 | 
			
		||||
        this.isRoot = ruleChain.isRoot();
 | 
			
		||||
        this.root = ruleChain.isRoot();
 | 
			
		||||
        this.configuration = ruleChain.getConfiguration();
 | 
			
		||||
        this.additionalInfo = ruleChain.getAdditionalInfo();
 | 
			
		||||
    }
 | 
			
		||||
@ -120,11 +120,11 @@ public class RuleChainEntity implements SearchTextEntity<RuleChain> {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isRoot() {
 | 
			
		||||
        return isRoot;
 | 
			
		||||
        return root;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRoot(boolean isRoot) {
 | 
			
		||||
        this.isRoot = isRoot;
 | 
			
		||||
    public void setRoot(boolean root) {
 | 
			
		||||
        this.root = root;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getSearchText() {
 | 
			
		||||
@ -156,7 +156,7 @@ public class RuleChainEntity implements SearchTextEntity<RuleChain> {
 | 
			
		||||
        if (this.firstRuleNodeId != null) {
 | 
			
		||||
            ruleChain.setFirstRuleNodeId(new RuleNodeId(this.firstRuleNodeId));
 | 
			
		||||
        }
 | 
			
		||||
        ruleChain.setRoot(this.isRoot);
 | 
			
		||||
        ruleChain.setRoot(this.root);
 | 
			
		||||
        ruleChain.setConfiguration(this.configuration);
 | 
			
		||||
        ruleChain.setAdditionalInfo(this.additionalInfo);
 | 
			
		||||
        return ruleChain;
 | 
			
		||||
 | 
			
		||||
@ -55,8 +55,8 @@ public class RuleChainEntity extends BaseSqlEntity<RuleChain> implements SearchT
 | 
			
		||||
    @Column(name = ModelConstants.RULE_CHAIN_FIRST_RULE_NODE_ID_PROPERTY)
 | 
			
		||||
    private String firstRuleNodeId;
 | 
			
		||||
 | 
			
		||||
    @Column(name = ModelConstants.RULE_CHAIN_IS_ROOT_PROPERTY)
 | 
			
		||||
    private boolean isRoot;
 | 
			
		||||
    @Column(name = ModelConstants.RULE_CHAIN_ROOT_PROPERTY)
 | 
			
		||||
    private boolean root;
 | 
			
		||||
 | 
			
		||||
    @Type(type = "json")
 | 
			
		||||
    @Column(name = ModelConstants.RULE_CHAIN_CONFIGURATION_PROPERTY)
 | 
			
		||||
@ -79,7 +79,7 @@ public class RuleChainEntity extends BaseSqlEntity<RuleChain> implements SearchT
 | 
			
		||||
        if (ruleChain.getFirstRuleNodeId() != null) {
 | 
			
		||||
            this.firstRuleNodeId = UUIDConverter.fromTimeUUID(ruleChain.getFirstRuleNodeId().getId());
 | 
			
		||||
        }
 | 
			
		||||
        this.isRoot = ruleChain.isRoot();
 | 
			
		||||
        this.root = ruleChain.isRoot();
 | 
			
		||||
        this.configuration = ruleChain.getConfiguration();
 | 
			
		||||
        this.additionalInfo = ruleChain.getAdditionalInfo();
 | 
			
		||||
    }
 | 
			
		||||
@ -103,7 +103,7 @@ public class RuleChainEntity extends BaseSqlEntity<RuleChain> implements SearchT
 | 
			
		||||
        if (firstRuleNodeId != null) {
 | 
			
		||||
            ruleChain.setFirstRuleNodeId(new RuleNodeId(UUIDConverter.fromString(firstRuleNodeId)));
 | 
			
		||||
        }
 | 
			
		||||
        ruleChain.setRoot(isRoot);
 | 
			
		||||
        ruleChain.setRoot(root);
 | 
			
		||||
        ruleChain.setConfiguration(configuration);
 | 
			
		||||
        ruleChain.setAdditionalInfo(additionalInfo);
 | 
			
		||||
        return ruleChain;
 | 
			
		||||
 | 
			
		||||
@ -668,7 +668,7 @@ CREATE TABLE IF NOT EXISTS  thingsboard.rule_chain (
 | 
			
		||||
    name text,
 | 
			
		||||
    search_text text,
 | 
			
		||||
    first_rule_node_id uuid,
 | 
			
		||||
    is_root boolean,
 | 
			
		||||
    root boolean,
 | 
			
		||||
    configuration text,
 | 
			
		||||
    additional_info text,
 | 
			
		||||
    PRIMARY KEY (id, tenant_id)
 | 
			
		||||
 | 
			
		||||
@ -262,7 +262,7 @@ CREATE TABLE IF NOT EXISTS rule_chain (
 | 
			
		||||
    configuration varchar(10000000),
 | 
			
		||||
    name varchar(255),
 | 
			
		||||
    first_rule_node_id varchar(31),
 | 
			
		||||
    is_root boolean,
 | 
			
		||||
    root boolean,
 | 
			
		||||
    search_text varchar(255),
 | 
			
		||||
    tenant_id varchar(31)
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user