Kenmegne
7 days ago 494d349fb67be74da49caae2794fda702f595fb4
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
84
85
86
87
88
/*
 * 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.fdxgenerator.model;
 
import com.megatimfx.common.validationgroups.ViewFormValidationGroup;
import com.megatim.fdxgenerator.enums.DataType;
import com.megatim.fdxgenerator.pojo.Delimiteur;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Range;
 
/**
 *
 * @author STEPHANIE
 */
@Entity
@Getter
@Setter
public class ValidateurFichier implements Serializable {
 
    @Id
    @NotNull(message = "Aucun identifiant spécifié", groups = {ViewFormValidationGroup.class})
    private String id;
 
    @Range(min = 1, message = "Le nombre de position doit être supérieure à 0", groups = {ViewFormValidationGroup.class})
    private int nombrePosition;
 
    //private String typeFichierCode;
    @NotNull(message = "Le type de fichier est obligatoire", groups = {ViewFormValidationGroup.class})
    @ManyToOne
    private TypeFichier typeFichier;
 
    @Transient
    private Delimiteur delimiteurLigne;
 
    @Transient
    private Delimiteur delimiteurColonne;
 
    private String codeDelimiteurLigne;
 
    private String codeDelimiteurColonne;
 
    private boolean headerPresent;
 
    @NotNull(message = "Le format du fichier de données est obligatoire", groups = {ViewFormValidationGroup.class})
    @Enumerated(EnumType.STRING)
    private DataType dataType;
 
    @OneToMany(mappedBy = "validateurFichier", cascade = CascadeType.ALL)
    private Set<StructureLigne> structureLignes = new HashSet<>();
 
    @Override
    public String toString() {
        return this.typeFichier.toString();
    }
 
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof ValidateurFichier)) {
            return false;
        }
        final ValidateurFichier other = (ValidateurFichier) obj;
        if (this.getTypeFichier() != null && !this.getTypeFichier().equals(other.getTypeFichier())) {
            return false;
        }
        return true;
    }
}