diff --git a/src/main/java/ru/ulstu/admin/model/IndicatorForm.java b/src/main/java/ru/ulstu/admin/model/IndicatorForm.java index 3750a2c..19605a1 100644 --- a/src/main/java/ru/ulstu/admin/model/IndicatorForm.java +++ b/src/main/java/ru/ulstu/admin/model/IndicatorForm.java @@ -1,6 +1,7 @@ package ru.ulstu.admin.model; import ru.ulstu.indicator.model.Course; +import ru.ulstu.indicator.model.Indicator; import java.util.ArrayList; import java.util.List; @@ -16,6 +17,16 @@ public class IndicatorForm { private List courses = new ArrayList<>(); + public IndicatorForm() { + } + + public IndicatorForm(Indicator indicator) { + this.name = indicator.getName(); + this.max = indicator.getMax(); + this.proofDocuments = indicator.getProofDocuments(); + this.courses = indicator.getCourses(); + } + public String getName() { return name; } diff --git a/src/main/java/ru/ulstu/admin/service/AdminIndicatorService.java b/src/main/java/ru/ulstu/admin/service/AdminIndicatorService.java index dc38e2f..cb8b608 100644 --- a/src/main/java/ru/ulstu/admin/service/AdminIndicatorService.java +++ b/src/main/java/ru/ulstu/admin/service/AdminIndicatorService.java @@ -21,7 +21,7 @@ public class AdminIndicatorService { public void saveIndicator(IndicatorForm indicatorForm) { Indicator indicator = indicatorForm.getId() == null - ? new Indicator(indicatorForm) + ? new Indicator() : indicatorService.getIndicatorById(indicatorForm.getId()); indicator.setName(indicatorForm.getName()); indicator.setMax(indicatorForm.getMax()); diff --git a/src/main/java/ru/ulstu/indicator/model/Indicator.java b/src/main/java/ru/ulstu/indicator/model/Indicator.java index 1944119..2c2a806 100644 --- a/src/main/java/ru/ulstu/indicator/model/Indicator.java +++ b/src/main/java/ru/ulstu/indicator/model/Indicator.java @@ -9,7 +9,6 @@ import jakarta.persistence.Lob; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; -import ru.ulstu.admin.model.IndicatorForm; import ru.ulstu.model.BaseEntity; import java.util.ArrayList; @@ -37,13 +36,6 @@ public class Indicator extends BaseEntity { public Indicator() { } - public Indicator(IndicatorForm indicatorForm) { - this.name = indicatorForm.getName(); - this.max = indicatorForm.getMax(); - this.proofDocuments = indicatorForm.getProofDocuments(); - this.courses = indicatorForm.getCourses(); - } - public String getName() { return name; }