Merge pull request '64-model-rule' (#65) from #64-model-rule into master

Reviewed-on: #65
This commit is contained in:
romanov73 2022-10-13 15:34:05 +04:00
commit ac239d796c
4 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package ru.ulstu.extractor.model;
import javax.persistence.Entity;
@Entity
public class AntecedentValue extends BaseEntity {
private String antecedentValue;
public AntecedentValue() {
}
public AntecedentValue(String antecedentValue) {
this.antecedentValue = antecedentValue;
}
public String getAntecedentValue() {
return antecedentValue;
}
public void setAntecedentValue(String antecedentValue) {
this.antecedentValue = antecedentValue;
}
}

View File

@ -0,0 +1,73 @@
package ru.ulstu.extractor.model;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
@Entity
public class Rule extends BaseEntity {
@ManyToOne
private AntecedentValue firstAntecedentValue;
@ManyToOne
private TimeSeries firstAntecedent;
@ManyToOne
private AntecedentValue secondAntecedentValue;
@ManyToOne
private TimeSeries secondAntecedent;
private String consequent;
public Rule() {
}
public Rule(Integer id, Integer version, AntecedentValue firstAntecedentValue, TimeSeries firstAntecedent, AntecedentValue secondAntecedentValue, TimeSeries secondAntecedent, String consequent) {
super(id, version);
this.firstAntecedentValue = firstAntecedentValue;
this.firstAntecedent = firstAntecedent;
this.secondAntecedentValue = secondAntecedentValue;
this.secondAntecedent = secondAntecedent;
this.consequent = consequent;
}
public AntecedentValue getFirstValue() {
return firstAntecedentValue;
}
public void setFirstValue(AntecedentValue firstAntecedentValue) {
this.firstAntecedentValue = firstAntecedentValue;
}
public TimeSeries getFirstAntecedent() {
return firstAntecedent;
}
public void setFirstAntecedent(TimeSeries firstAntecedent) {
this.firstAntecedent = firstAntecedent;
}
public AntecedentValue getSecondValue() {
return secondAntecedentValue;
}
public void setSecondValue(AntecedentValue secondAntecedentValue) {
this.secondAntecedentValue = secondAntecedentValue;
}
public TimeSeries getSecondAntecedent() {
return secondAntecedent;
}
public void setSecondAntecedent(TimeSeries secondAntecedent) {
this.secondAntecedent = secondAntecedent;
}
public String getConsequent() {
return consequent;
}
public void setConsequent(String consequent) {
this.consequent = consequent;
}
}

View File

@ -0,0 +1,47 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="barmina" id="20221012-170000-1">
<createTable tableName="antecedent_value">
<column name="id" type="integer">
<constraints nullable="false"/>
</column>
<column name="version" type="integer"/>
<column name="antecedent_value" type="text">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="id" constraintName="pk_antecedent_value" tableName="antecedent_value"/>
<createTable tableName="rule">
<column name="id" type="integer">
<constraints nullable="false"/>
</column>
<column name="version" type="integer"/>
<column name="first_antecedent_value_id" type="integer"/>
<column name="first_antecedent_id" type="integer"/>
<column name="second_antecedent_value_id" type="integer"/>
<column name="second_antecedent_id" type="integer"/>
<column name="consequent" type="text">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="id" constraintName="pk_rule" tableName="rule"/>
<addForeignKeyConstraint baseTableName="rule" baseColumnNames="first_antecedent_value_id"
constraintName="fk_first_antecedent_value"
referencedTableName="antecedent_value"
referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="rule" baseColumnNames="first_antecedent_id"
constraintName="fk_first_time_series"
referencedTableName="time_series"
referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="rule" baseColumnNames="second_antecedent_value_id"
constraintName="fk_second_antecedent_value"
referencedTableName="antecedent_value"
referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="rule" baseColumnNames="second_antecedent_id"
constraintName="fk_second_time_series"
referencedTableName="time_series"
referencedColumnNames="id"/>
</changeSet>
</databaseChangeLog>

View File

@ -14,4 +14,5 @@
<include file="db/changelog-20210412_100000-schema.xml"/> <include file="db/changelog-20210412_100000-schema.xml"/>
<include file="db/changelog-20220422_120000-schema.xml"/> <include file="db/changelog-20220422_120000-schema.xml"/>
<include file="db/changelog-20220621_120000-schema.xml"/> <include file="db/changelog-20220621_120000-schema.xml"/>
<include file="db/changelog-20221012_170000-schema.xml"/>
</databaseChangeLog> </databaseChangeLog>