Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * 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());
    }
}