From c85c7e7917c7b68f21625558dd04c6c731658d3b Mon Sep 17 00:00:00 2001 From: BarminaA Date: Sun, 9 Oct 2022 08:01:10 +0400 Subject: [PATCH 1/2] #64-add model for rule --- .../java/ru/ulstu/extractor/model/Rule.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/main/java/ru/ulstu/extractor/model/Rule.java diff --git a/src/main/java/ru/ulstu/extractor/model/Rule.java b/src/main/java/ru/ulstu/extractor/model/Rule.java new file mode 100644 index 0000000..2c249e7 --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/model/Rule.java @@ -0,0 +1,67 @@ +package ru.ulstu.extractor.model; + +import javax.persistence.Entity; + +@Entity +public class Rule extends BaseEntity { + private String measure1; + + private String timeSeries1; + + private String measure2; + + private String timeSeries2; + + private String action; + + public Rule() { + } + + public Rule(String measure1, String timeSeries1, String measure2, String timeSeries2, String action) { + this.measure1 = measure1; + this.timeSeries1 = timeSeries1; + this.measure2 = measure2; + this.timeSeries2 = timeSeries2; + this.action = action; + } + + public String getMeasure1() { + return measure1; + } + + public String getTimeSeries1() { + return timeSeries1; + } + + public String getMeasure2() { + return measure2; + } + + public String getTimeSeries2() { + return timeSeries2; + } + + public void setMeasure1(String measure1) { + this.measure1 = measure1; + } + + public void setTimeSeries1(String timeSeries1) { + this.timeSeries1 = timeSeries1; + } + + public void setMeasure2(String measure2) { + this.measure2 = measure2; + } + + public void setTimeSeries2(String timeSeries2) { + this.timeSeries2 = timeSeries2; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } +} From 1621e151d91abfbbf1a85d74bf7e4dd83c1e3c8d Mon Sep 17 00:00:00 2001 From: BarminaA Date: Thu, 13 Oct 2022 15:18:34 +0400 Subject: [PATCH 2/2] #64-add model and changelog --- .../extractor/model/AntecedentValue.java | 23 +++++++ .../java/ru/ulstu/extractor/model/Rule.java | 68 ++++++++++--------- .../db/changelog-20221012_170000-schema.xml | 47 +++++++++++++ src/main/resources/db/changelog-master.xml | 1 + 4 files changed, 108 insertions(+), 31 deletions(-) create mode 100644 src/main/java/ru/ulstu/extractor/model/AntecedentValue.java create mode 100644 src/main/resources/db/changelog-20221012_170000-schema.xml diff --git a/src/main/java/ru/ulstu/extractor/model/AntecedentValue.java b/src/main/java/ru/ulstu/extractor/model/AntecedentValue.java new file mode 100644 index 0000000..1ed3473 --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/model/AntecedentValue.java @@ -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; + } +} diff --git a/src/main/java/ru/ulstu/extractor/model/Rule.java b/src/main/java/ru/ulstu/extractor/model/Rule.java index 2c249e7..699e621 100644 --- a/src/main/java/ru/ulstu/extractor/model/Rule.java +++ b/src/main/java/ru/ulstu/extractor/model/Rule.java @@ -1,67 +1,73 @@ package ru.ulstu.extractor.model; import javax.persistence.Entity; +import javax.persistence.ManyToOne; @Entity 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(String measure1, String timeSeries1, String measure2, String timeSeries2, String action) { - this.measure1 = measure1; - this.timeSeries1 = timeSeries1; - this.measure2 = measure2; - this.timeSeries2 = timeSeries2; - this.action = action; + 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 String getMeasure1() { - return measure1; + public AntecedentValue getFirstValue() { + return firstAntecedentValue; } - public String getTimeSeries1() { - return timeSeries1; + public void setFirstValue(AntecedentValue firstAntecedentValue) { + this.firstAntecedentValue = firstAntecedentValue; } - public String getMeasure2() { - return measure2; + public TimeSeries getFirstAntecedent() { + return firstAntecedent; } - public String getTimeSeries2() { - return timeSeries2; + public void setFirstAntecedent(TimeSeries firstAntecedent) { + this.firstAntecedent = firstAntecedent; } - public void setMeasure1(String measure1) { - this.measure1 = measure1; + public AntecedentValue getSecondValue() { + return secondAntecedentValue; } - public void setTimeSeries1(String timeSeries1) { - this.timeSeries1 = timeSeries1; + public void setSecondValue(AntecedentValue secondAntecedentValue) { + this.secondAntecedentValue = secondAntecedentValue; } - public void setMeasure2(String measure2) { - this.measure2 = measure2; + public TimeSeries getSecondAntecedent() { + return secondAntecedent; } - public void setTimeSeries2(String timeSeries2) { - this.timeSeries2 = timeSeries2; + public void setSecondAntecedent(TimeSeries secondAntecedent) { + this.secondAntecedent = secondAntecedent; } - public String getAction() { - return action; + public String getConsequent() { + return consequent; } - public void setAction(String action) { - this.action = action; + public void setConsequent(String consequent) { + this.consequent = consequent; } } diff --git a/src/main/resources/db/changelog-20221012_170000-schema.xml b/src/main/resources/db/changelog-20221012_170000-schema.xml new file mode 100644 index 0000000..76ad715 --- /dev/null +++ b/src/main/resources/db/changelog-20221012_170000-schema.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index e2afa54..dfde9f7 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -14,4 +14,5 @@ +