Kenmegne
6 days ago 908e81dd173f380879d5fabeb5794d5b7a76df0e
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
/*
 * 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.fdxconvert.model;
 
import com.megatim.dynamicjsonparser.enums.TypeDonnee;
import com.megatim.fdxconvert.pojo.Delimiteur;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import lombok.Getter;
import lombok.Setter;
 
/**
 *
 * @author ASUS
 */
@Getter
@Setter
@Entity
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class JsonStructure implements Serializable {
 
    @Id
    @SequenceGenerator(name = "SEQ_TYPE_FICHIER_JSON", sequenceName = "SEQ_TYPE_FICHIER_JSON", allocationSize = 1, initialValue = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_TYPE_FICHIER_JSON")
    @XmlTransient
    private Long id;
 
    @NotNull(message = "Le type de données est obligatoire")
    @Enumerated(EnumType.STRING)
    @XmlAttribute
    private TypeDonnee typeDonnee;
 
    @NotNull(message = "Le nom est obligatoire")
    @XmlAttribute
    private String name;
 
    @Min(value = 1, message = "La taille doit être supérieure à 0")
    @XmlAttribute
    private int lengthh;
 
    @XmlAttribute
    private boolean required;
 
    @XmlAttribute
    private boolean collection;
 
    @XmlAttribute
    private String formatDate;
 
    @Transient
    @XmlTransient
    private Delimiteur delimiteurDate;
 
    @XmlAttribute
    private String codeDelimiteurDate;
 
    @OneToOne
    @XmlTransient
    private TypeFichierJson typeFichierJson;
 
    @ManyToOne
    @XmlTransient
    private JsonStructure parent;
 
    @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true)
    @XmlElement(name = "jsonStructure") 
    private List<JsonStructure> fields = new ArrayList<>();
 
}