/* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package com.megatim.fdxcommons.model.referentiel.natureproduction; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; import com.megatim.fdxcommons.model.referentiel.LocalDateTimeAdapter; import com.megatim.fdxcommons.model.referentiel.Referentiel; import com.megatim.fdxcommons.model.referentiel.TypeFichier; import java.io.Serializable; import java.time.LocalDateTime; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.ManyToOne; 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.Setter; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; /** * * @author ASUS */ @Entity @IdClass(NatureProductionFichierId.class) @Getter @Setter @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) @JsonInclude(JsonInclude.Include.NON_EMPTY) public class NatureProductionFichier implements Serializable { @Id @NotNull(message = "Le type de fichier est obligatoire") @ManyToOne private TypeFichier typeFichier; @Id @NotNull(message = "L'élement doit être associé à un réfrérentiel en préparation") @ManyToOne private Referentiel referentiel; @NotNull(message = "La nature de la production est obligatoire") @Enumerated(value = EnumType.STRING) private NatureProduction natureProduction; @JsonFormat(pattern = "dd/MM/yyyy HH:mm:ss") @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) @CreationTimestamp private LocalDateTime dateCreation; @JsonFormat(pattern = "dd/MM/yyyy HH:mm:ss") @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) @UpdateTimestamp 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; } NatureProductionFichier natureProductionFichier = (NatureProductionFichier) o; return referentiel != null && referentiel.equals(natureProductionFichier.getReferentiel()) && typeFichier != null && typeFichier.equals(natureProductionFichier.getTypeFichier()); } }