ajouter l'attribut type

This commit is contained in:
Arimihanta 2021-11-15 09:16:17 +01:00
parent 28eee91e47
commit e3619c8d36
2 changed files with 30 additions and 37 deletions

View file

@ -2,14 +2,7 @@ package fr.lirmm.aren.model;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Column; import javax.persistence.*;
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.validation.constraints.Size; import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
@ -18,7 +11,7 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
import javax.persistence.FetchType;
import org.hibernate.annotations.SortNatural; import org.hibernate.annotations.SortNatural;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
@ -32,6 +25,10 @@ import org.hibernate.annotations.Where;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = Debate.class) @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = Debate.class)
public class Debate extends AbstractOwnedEntity implements Serializable { 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") @Column(name = "open_public")
private boolean openPublic = false; private boolean openPublic = false;
@Column(name = "is_carto") @Enumerated(EnumType.STRING)
private boolean carto = false; @Column(name = "type")
private Type type=Type.BASIC ;
/** /**
* *
@ -353,16 +351,16 @@ public class Debate extends AbstractOwnedEntity implements Serializable {
* *
* @return * @return
*/ */
public boolean isCarto() { public Type getType() {
return carto; return type;
} }
/** /**
* *
* @param carto * @param type
*/ */
public void setCarto(boolean carto) { public void setType(Type type) {
this.carto = carto; this.type = type;
} }
/** /**

View file

@ -4,13 +4,7 @@ import java.io.Serializable;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.SortedSet; import java.util.SortedSet;
import javax.persistence.Column; import javax.persistence.*;
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.validation.constraints.Size; import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
@ -59,14 +53,15 @@ public class Document extends AbstractDatedEntity implements Serializable {
@Column(name = "debates_count") @Column(name = "debates_count")
private Integer debatesCount = 0; private Integer debatesCount = 0;
@Column(name = "is_carto") @Enumerated(EnumType.STRING)
private boolean carto = false; @Column(name = "type")
private Debate.Type type= Debate.Type.BASIC ;
@Column(name = "mesh_line") @Column(name = "mesh_line")
private int meshLine = 1; private Integer meshLine = 1;
@Column(name = "mesh_column") @Column(name = "mesh_column")
private int meshColumn = 1; private Integer meshColumn = 1;
@Lob @Lob
@Type(type = "org.hibernate.type.TextType") @Type(type = "org.hibernate.type.TextType")
@ -184,23 +179,23 @@ public class Document extends AbstractDatedEntity implements Serializable {
* *
* @return * @return
*/ */
public boolean isCarto() { public Debate.Type getType() {
return carto; return type;
} }
/** /**
* *
* @param carto * @param type
*/ */
public void setCarto(boolean carto) { public void setType(Debate.Type type) {
this.carto = carto; this.type = type;
} }
/** /**
* *
* @return * @return
*/ */
public int getMeshLine() { public Integer getMeshLine() {
return meshLine; return meshLine;
} }
@ -208,15 +203,15 @@ public class Document extends AbstractDatedEntity implements Serializable {
* *
* @param meshLine * @param meshLine
*/ */
public void setMeshLine(int meshLine) { public void setMeshLine(Integer meshLine) {
this.meshLine = meshLine; this.meshLine = meshLine;
} }
public int getMeshColumn() { public Integer getMeshColumn() {
return meshColumn; return meshColumn;
} }
public void setMeshColumn(int meshColumn) { public void setMeshColumn(Integer meshColumn) {
this.meshColumn = meshColumn; this.meshColumn = meshColumn;
} }