/* * 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 fields = new ArrayList<>(); }