package com.megatim.fdxconsultation.model.configuration;
|
|
import com.megatim.fdxcommons.model.enumeration.TypeOperation;
|
import java.io.Serializable;
|
import java.util.Date;
|
import java.util.Objects;
|
import javax.persistence.Column;
|
import javax.persistence.Entity;
|
import javax.persistence.GeneratedValue;
|
import javax.persistence.GenerationType;
|
import javax.persistence.Id;
|
import javax.persistence.SequenceGenerator;
|
import javax.persistence.Table;
|
import javax.persistence.Temporal;
|
import javax.persistence.TemporalType;
|
import javax.persistence.Transient;
|
import lombok.Getter;
|
import lombok.Setter;
|
|
/**
|
*
|
* @author DYNABOOK
|
*/
|
@Getter
|
@Setter
|
@Entity(name = "CodeStatutHttp")
|
@Table(name = "FDX_CODE_STATUT_HTTP")
|
public class CodeStatutHttp implements Comparable<CodeStatutHttp>, Serializable {
|
|
@SequenceGenerator(name = "SEQ_FDX_CODE_STATUT_HTTP",
|
sequenceName = "SEQ_FDX_CODE_STATUT_HTTP",
|
allocationSize = 1,
|
initialValue = 1)
|
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_FDX_CODE_STATUT_HTTP")
|
@Column(name = "ID")
|
@Id
|
private Long id;
|
|
@Column(name = "ID_GENERER")
|
protected String idGenerer;
|
|
@Column(name = "CODE")
|
private String code;
|
|
@Column(nullable = false, name = "LIBELLE")
|
private String libelle;
|
|
@Column(name = "TYPE_OPERATION")
|
private TypeOperation typeOperation = TypeOperation.AJOUTER;
|
|
@Column(name = "DATE_CREATION")
|
@Temporal(TemporalType.TIMESTAMP)
|
private Date dateCreation;
|
|
@Column(name = "USER_CREATION")
|
private String utilisateurCreation;
|
|
@Column(name = "DATE_DERN_MOD")
|
@Temporal(TemporalType.TIMESTAMP)
|
private Date dateDerniereModification;
|
|
@Column(name = "USER_UPDATE")
|
private String utilisateurModification;
|
|
@Column(name = "DATE_SUPPR")
|
@Temporal(TemporalType.TIMESTAMP)
|
private Date dateSuppression;
|
|
@Column(name = "USER_DELETE")
|
private String utilisateurSuppression;
|
|
@Transient
|
private int nbreUtilisateur;
|
|
public CodeStatutHttp() {}
|
|
public CodeStatutHttp(String code, String libelle) {
|
this.code = code;
|
this.libelle = libelle;
|
}
|
|
@Override
|
public int hashCode() {
|
int hash = 7;
|
hash = 11 * hash + Objects.hashCode(this.id);
|
return hash;
|
}
|
|
@Override
|
public boolean equals(Object obj) {
|
if (this == obj) {
|
return true;
|
}
|
if (obj == null) {
|
return false;
|
}
|
if (getClass() != obj.getClass()) {
|
return false;
|
}
|
final CodeStatutHttp other = (CodeStatutHttp) obj;
|
if (!Objects.equals(this.id, other.id)) {
|
return false;
|
}
|
return true;
|
}
|
|
/*
|
* (non-Javadoc)
|
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
*/
|
@Override
|
public int compareTo(CodeStatutHttp parameter) {
|
if (parameter == null) {
|
return -1;
|
}
|
if (parameter.code == null || parameter.code.trim().length() == 0) {
|
return -1;
|
}
|
if (code == null || code.trim().length() == 0) {
|
return 1;
|
}
|
return code.compareTo(parameter.code);
|
}
|
}
|