package com.megatim.fdxcommons.model.referentiel; import java.io.Serializable; import java.time.LocalDateTime; import java.util.Objects; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.ManyToOne; import javax.validation.constraints.NotEmpty; 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.adapters.XmlJavaTypeAdapter; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * * @author ASUS */ @Entity @XmlRootElement(name = "validateurFichierConfigurationList") @XmlAccessorType(XmlAccessType.FIELD) @IdClass(ValidateurFichierConfigurationId.class) @Getter @Setter @NoArgsConstructor public class ValidateurFichierConfiguration implements Serializable { @Id @NotNull(message = "Le type de fichier est obligatoire") @ManyToOne private TypeFichier typeFichier; @Id @NotNull(message = "La configuration du validateur doit être associée à un réfrérentiel en préparation") @ManyToOne private Referentiel referentiel; @NotEmpty(message = "Le fichier de validation est obligatoire") private String fileName; @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) private LocalDateTime dateCreation; @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) private LocalDateTime dateMiseAjour; private String createBy; private String lastModifiedBy; @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ValidateurFichierConfiguration other = (ValidateurFichierConfiguration) o; return referentiel != null && referentiel.equals(other.getReferentiel()) && typeFichier != null && typeFichier.equals(other.getTypeFichier()); } @Override public int hashCode() { int hash = 5; hash = 71 * hash + Objects.hashCode(this.typeFichier); hash = 71 * hash + Objects.hashCode(this.referentiel); return hash; } }