package com.megatim.fdxcommons.model.referentiel; import com.fasterxml.jackson.annotation.JsonIgnore; import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; import java.io.Serializable; import java.time.LocalDateTime; import java.util.HashSet; import java.util.Objects; import java.util.Set; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; /** * * @author ASUS */ @Entity @Getter @Setter @NoArgsConstructor @XmlRootElement(name = "referentielList") @XmlAccessorType(XmlAccessType.FIELD) public class Referentiel implements Serializable { @Id @NotBlank(message = "La version est obligatoire") @CriteriaEntitySearch(libelle = "Version", rang = 1) private String version; @NotBlank(message = "La description est obligatoire") @CriteriaEntitySearch(libelle = "Description", rang = 2) private String description; @NotNull(message = "Le statut du référentiel est obligatoire") @Enumerated(EnumType.STRING) @CriteriaEntitySearch(libelle = "Statut Referentiel", rang = 3) private StatutReferentiel statutReferentiel; @OneToMany(mappedBy = "referentiel") @XmlTransient @JsonIgnore private Set extensionFichiers = new HashSet<>(); @OneToMany(mappedBy = "referentiel") @XmlTransient @JsonIgnore private Set applicationSources = new HashSet<>(); @XmlTransient @OneToMany(mappedBy = "referentiel") @JsonIgnore private Set routages = new HashSet<>(); @XmlTransient @OneToMany(mappedBy = "referentiel") @JsonIgnore private Set pays = new HashSet<>(); @XmlTransient @OneToMany(mappedBy = "referentiel") @JsonIgnore private Set participants = new HashSet<>(); @XmlTransient @OneToMany(mappedBy = "referentiel") @JsonIgnore private Set validateurFichierConfigurations = new HashSet<>(); @XmlTransient @OneToMany(mappedBy = "referentiel") @JsonIgnore private Set noeuds = new HashSet<>(); @XmlTransient @OneToMany(mappedBy = "referentiel") @JsonIgnore private Set groupeParticipants = new HashSet<>(); @XmlTransient @OneToMany(mappedBy = "referentiel") @JsonIgnore private Set groupeNoeuds = new HashSet<>(); @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) private LocalDateTime dateCreation; @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) private LocalDateTime dateMiseAjour; private String createBy; private String lastModifiedBy; @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) private LocalDateTime dateGeneration; @Override public String toString() { return this.getVersion(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Referentiel other = (Referentiel) obj; if (this.getVersion() != null && !this.getVersion().equals(other.getVersion())) { return false; } return true; } @Override public int hashCode() { int hash = 3; hash = 61 * hash + Objects.hashCode(this.version); return hash; } }