#64-add model and changelog
This commit is contained in:
parent
c85c7e7917
commit
1621e151d9
23
src/main/java/ru/ulstu/extractor/model/AntecedentValue.java
Normal file
23
src/main/java/ru/ulstu/extractor/model/AntecedentValue.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,67 +1,73 @@
|
|||||||
package ru.ulstu.extractor.model;
|
package ru.ulstu.extractor.model;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Rule extends BaseEntity {
|
public class Rule extends BaseEntity {
|
||||||
private String measure1;
|
@ManyToOne
|
||||||
|
private AntecedentValue firstAntecedentValue;
|
||||||
|
|
||||||
private String timeSeries1;
|
@ManyToOne
|
||||||
|
private TimeSeries firstAntecedent;
|
||||||
|
|
||||||
private String measure2;
|
@ManyToOne
|
||||||
|
private AntecedentValue secondAntecedentValue;
|
||||||
|
|
||||||
private String timeSeries2;
|
@ManyToOne
|
||||||
|
private TimeSeries secondAntecedent;
|
||||||
|
|
||||||
private String action;
|
private String consequent;
|
||||||
|
|
||||||
public Rule() {
|
public Rule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rule(String measure1, String timeSeries1, String measure2, String timeSeries2, String action) {
|
public Rule(Integer id, Integer version, AntecedentValue firstAntecedentValue, TimeSeries firstAntecedent, AntecedentValue secondAntecedentValue, TimeSeries secondAntecedent, String consequent) {
|
||||||
this.measure1 = measure1;
|
super(id, version);
|
||||||
this.timeSeries1 = timeSeries1;
|
this.firstAntecedentValue = firstAntecedentValue;
|
||||||
this.measure2 = measure2;
|
this.firstAntecedent = firstAntecedent;
|
||||||
this.timeSeries2 = timeSeries2;
|
this.secondAntecedentValue = secondAntecedentValue;
|
||||||
this.action = action;
|
this.secondAntecedent = secondAntecedent;
|
||||||
|
this.consequent = consequent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMeasure1() {
|
public AntecedentValue getFirstValue() {
|
||||||
return measure1;
|
return firstAntecedentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTimeSeries1() {
|
public void setFirstValue(AntecedentValue firstAntecedentValue) {
|
||||||
return timeSeries1;
|
this.firstAntecedentValue = firstAntecedentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMeasure2() {
|
public TimeSeries getFirstAntecedent() {
|
||||||
return measure2;
|
return firstAntecedent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTimeSeries2() {
|
public void setFirstAntecedent(TimeSeries firstAntecedent) {
|
||||||
return timeSeries2;
|
this.firstAntecedent = firstAntecedent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMeasure1(String measure1) {
|
public AntecedentValue getSecondValue() {
|
||||||
this.measure1 = measure1;
|
return secondAntecedentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeSeries1(String timeSeries1) {
|
public void setSecondValue(AntecedentValue secondAntecedentValue) {
|
||||||
this.timeSeries1 = timeSeries1;
|
this.secondAntecedentValue = secondAntecedentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMeasure2(String measure2) {
|
public TimeSeries getSecondAntecedent() {
|
||||||
this.measure2 = measure2;
|
return secondAntecedent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeSeries2(String timeSeries2) {
|
public void setSecondAntecedent(TimeSeries secondAntecedent) {
|
||||||
this.timeSeries2 = timeSeries2;
|
this.secondAntecedent = secondAntecedent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAction() {
|
public String getConsequent() {
|
||||||
return action;
|
return consequent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAction(String action) {
|
public void setConsequent(String consequent) {
|
||||||
this.action = action;
|
this.consequent = consequent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
47
src/main/resources/db/changelog-20221012_170000-schema.xml
Normal file
47
src/main/resources/db/changelog-20221012_170000-schema.xml
Normal 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>
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user