From e3619c8d363533c4bfc4c970fabac476e6a0747e Mon Sep 17 00:00:00 2001 From: Arimihanta Date: Mon, 15 Nov 2021 09:16:17 +0100 Subject: [PATCH] ajouter l'attribut type --- src/main/java/fr/lirmm/aren/model/Debate.java | 30 +++++++-------- .../java/fr/lirmm/aren/model/Document.java | 37 ++++++++----------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/main/java/fr/lirmm/aren/model/Debate.java b/src/main/java/fr/lirmm/aren/model/Debate.java index dfbe03a..6a18d86 100644 --- a/src/main/java/fr/lirmm/aren/model/Debate.java +++ b/src/main/java/fr/lirmm/aren/model/Debate.java @@ -2,14 +2,7 @@ package fr.lirmm.aren.model; import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.Table; +import javax.persistence.*; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlTransient; @@ -18,7 +11,7 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators; import java.time.ZonedDateTime; import java.util.SortedSet; import java.util.TreeSet; -import javax.persistence.FetchType; + import org.hibernate.annotations.SortNatural; import org.hibernate.annotations.Where; @@ -32,6 +25,10 @@ import org.hibernate.annotations.Where; @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = Debate.class) public class Debate extends AbstractOwnedEntity implements Serializable { + public enum Type{ + BASIC, + CARTO + } /** * @@ -99,8 +96,9 @@ public class Debate extends AbstractOwnedEntity implements Serializable { @Column(name = "open_public") private boolean openPublic = false; - @Column(name = "is_carto") - private boolean carto = false; + @Enumerated(EnumType.STRING) + @Column(name = "type") + private Type type=Type.BASIC ; /** * @@ -353,16 +351,16 @@ public class Debate extends AbstractOwnedEntity implements Serializable { * * @return */ - public boolean isCarto() { - return carto; + public Type getType() { + return type; } /** * - * @param carto + * @param type */ - public void setCarto(boolean carto) { - this.carto = carto; + public void setType(Type type) { + this.type = type; } /** diff --git a/src/main/java/fr/lirmm/aren/model/Document.java b/src/main/java/fr/lirmm/aren/model/Document.java index 8c03b8f..f965af5 100644 --- a/src/main/java/fr/lirmm/aren/model/Document.java +++ b/src/main/java/fr/lirmm/aren/model/Document.java @@ -4,13 +4,7 @@ import java.io.Serializable; import java.util.TreeSet; import java.util.SortedSet; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.Table; +import javax.persistence.*; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlTransient; @@ -59,14 +53,15 @@ public class Document extends AbstractDatedEntity implements Serializable { @Column(name = "debates_count") private Integer debatesCount = 0; - @Column(name = "is_carto") - private boolean carto = false; + @Enumerated(EnumType.STRING) + @Column(name = "type") + private Debate.Type type= Debate.Type.BASIC ; @Column(name = "mesh_line") - private int meshLine = 1; + private Integer meshLine = 1; @Column(name = "mesh_column") - private int meshColumn = 1; + private Integer meshColumn = 1; @Lob @Type(type = "org.hibernate.type.TextType") @@ -184,23 +179,23 @@ public class Document extends AbstractDatedEntity implements Serializable { * * @return */ - public boolean isCarto() { - return carto; + public Debate.Type getType() { + return type; } /** - * - * @param carto + * + * @param type */ - public void setCarto(boolean carto) { - this.carto = carto; + public void setType(Debate.Type type) { + this.type = type; } /** * * @return */ - public int getMeshLine() { + public Integer getMeshLine() { return meshLine; } @@ -208,15 +203,15 @@ public class Document extends AbstractDatedEntity implements Serializable { * * @param meshLine */ - public void setMeshLine(int meshLine) { + public void setMeshLine(Integer meshLine) { this.meshLine = meshLine; } - public int getMeshColumn() { + public Integer getMeshColumn() { return meshColumn; } - public void setMeshColumn(int meshColumn) { + public void setMeshColumn(Integer meshColumn) { this.meshColumn = meshColumn; }