#3 -- Fix models
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 59s
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 59s
This commit is contained in:
parent
900cfdd036
commit
2d06ca9e24
@ -1,86 +0,0 @@
|
||||
package ru.ulstu.fc.core;
|
||||
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.Version;
|
||||
import java.io.Serializable;
|
||||
|
||||
@MappedSuperclass
|
||||
public abstract class BaseEntity implements Serializable, Comparable<BaseEntity> {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.TABLE)
|
||||
private Integer id;
|
||||
|
||||
@Version
|
||||
private Integer version;
|
||||
|
||||
public BaseEntity() {
|
||||
}
|
||||
|
||||
public BaseEntity(Integer id, Integer version) {
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!getClass().isAssignableFrom(obj.getClass())) {
|
||||
return false;
|
||||
}
|
||||
BaseEntity other = (BaseEntity) obj;
|
||||
if (id == null) {
|
||||
if (other.getId() != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!id.equals(other.getId())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (id == null ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "{" +
|
||||
"id=" + id +
|
||||
", version=" + version +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(BaseEntity o) {
|
||||
return id != null ? id.compareTo(o.getId()) : -1;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.id = null;
|
||||
this.version = null;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ import java.util.Date;
|
||||
|
||||
@Entity
|
||||
public class Project extends BaseEntity {
|
||||
@NotEmpty(message = "Текст новости не может быть пустым")
|
||||
@NotEmpty(message = "Название проекта не может быть пустым")
|
||||
private String name;
|
||||
private Date createDate = new Date();
|
||||
@ManyToOne(cascade = CascadeType.MERGE)
|
||||
|
@ -1,9 +1,12 @@
|
||||
package ru.ulstu.fc.project.model;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ProjectForm {
|
||||
private Integer id;
|
||||
@NotEmpty(message = "Название проекта не может быть пустым")
|
||||
private String name;
|
||||
private Date createDate;
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
package ru.ulstu.fc.rule.model;
|
||||
|
||||
public class AddRuleForm {
|
||||
private String rule;
|
||||
|
||||
public String getRule() {
|
||||
return rule;
|
||||
}
|
||||
|
||||
public void setRule(String rule) {
|
||||
this.rule = rule;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package ru.ulstu.fc.rule.model;
|
||||
|
||||
public class AddTermForm {
|
||||
private String variable;
|
||||
private String term;
|
||||
private String min;
|
||||
private String max;
|
||||
|
||||
public String getVariable() {
|
||||
return variable;
|
||||
}
|
||||
|
||||
public void setVariable(String variable) {
|
||||
this.variable = variable;
|
||||
}
|
||||
|
||||
public String getTerm() {
|
||||
return term;
|
||||
}
|
||||
|
||||
public void setTerm(String term) {
|
||||
this.term = term;
|
||||
}
|
||||
|
||||
public String getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(String min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public String getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(String max) {
|
||||
this.max = max;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package ru.ulstu.fc.rule.model;
|
||||
|
||||
public class AddVariableForm {
|
||||
private Integer id;
|
||||
private String name;
|
||||
|
||||
public AddVariableForm(Variable variable) {
|
||||
this.id = variable.getId();
|
||||
this.name = variable.getName();
|
||||
}
|
||||
|
||||
public AddVariableForm() {
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package ru.ulstu.fc.rule.model;
|
||||
|
||||
import ru.ulstu.fc.core.BaseEntity;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Rule extends BaseEntity {
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package ru.ulstu.fc.rule.model;
|
||||
|
||||
import ru.ulstu.fc.core.BaseEntity;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Term extends BaseEntity {
|
||||
private String name;
|
||||
private double min;
|
||||
private double max;
|
||||
|
||||
public Term() {
|
||||
}
|
||||
|
||||
public Term(String name, double min, double max) {
|
||||
this.name = name;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public double getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(double min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public double getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(double max) {
|
||||
this.max = max;
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package ru.ulstu.fc.rule.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import ru.ulstu.fc.rule.model.Rule;
|
||||
|
||||
public interface RuleRepository extends JpaRepository<Rule, Integer> {
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package ru.ulstu.fc.rule.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import ru.ulstu.fc.rule.model.Term;
|
||||
|
||||
public interface TermRepository extends JpaRepository<Term, Integer> {
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package ru.ulstu.fc.rule.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.fc.rule.model.Rule;
|
||||
import ru.ulstu.fc.rule.repository.RuleRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class RuleService {
|
||||
private final RuleRepository ruleRepository;
|
||||
|
||||
public RuleService(RuleRepository ruleRepository) {
|
||||
this.ruleRepository = ruleRepository;
|
||||
}
|
||||
|
||||
public List<Rule> getRules() {
|
||||
return ruleRepository.findAll();
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package ru.ulstu.fc.rule.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.fc.rule.model.Term;
|
||||
import ru.ulstu.fc.rule.repository.TermRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TermService {
|
||||
private final TermRepository termRepository;
|
||||
|
||||
public TermService(TermRepository termRepository) {
|
||||
this.termRepository = termRepository;
|
||||
}
|
||||
|
||||
public List<Term> getTerms() {
|
||||
return termRepository.findAll();
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package ru.ulstu.fc.rule.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.fc.rule.model.Term;
|
||||
import ru.ulstu.fc.rule.repository.TermRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TermsService {
|
||||
private final TermRepository termRepository;
|
||||
|
||||
public TermsService(TermRepository termRepository) {
|
||||
this.termRepository = termRepository;
|
||||
}
|
||||
|
||||
public List<Term> getTerms() {
|
||||
return termRepository.findAll();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user