/*
|
* 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.megatimfx.common.validationgroups.ViewFormValidationGroup;
|
import java.io.Serializable;
|
import java.time.LocalDateTime;
|
import java.util.HashSet;
|
import java.util.Objects;
|
import java.util.Set;
|
import javax.persistence.CascadeType;
|
import javax.persistence.Entity;
|
import javax.persistence.FetchType;
|
import javax.persistence.GeneratedValue;
|
import javax.persistence.Id;
|
import javax.persistence.JoinColumn;
|
import javax.persistence.ManyToOne;
|
import javax.persistence.OneToMany;
|
import javax.validation.constraints.NotNull;
|
import lombok.Getter;
|
import lombok.Setter;
|
|
/**
|
*
|
* @author ASUS
|
*/
|
@Getter
|
@Setter
|
@Entity
|
public class SubObject implements Serializable {
|
|
@Id
|
@GeneratedValue
|
private Long id;
|
|
@NotNull(message = "Le nom de l'objet à définir est obligatoire", groups = {ViewFormValidationGroup.class})
|
private String subObjectName;
|
|
@OneToMany(mappedBy = "fieldOfSubObject", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
private Set<StructureChampJson> listeStructureJson = new HashSet<>();
|
|
@ManyToOne(optional = false)
|
@JoinColumn(name = "modele_json_id")
|
private ModeleJson modeleJson;
|
|
private LocalDateTime dateCreation;
|
|
public SubObject() {
|
dateCreation = LocalDateTime.now();
|
}
|
|
@Override
|
public String toString() {
|
return subObjectName;
|
}
|
|
@Override
|
public int hashCode() {
|
int hash = 3;
|
hash = 97 * hash + Objects.hashCode(this.dateCreation);
|
return hash;
|
}
|
|
@Override
|
public boolean equals(Object obj) {
|
if (this == obj) {
|
return true;
|
}
|
if (obj == null) {
|
return false;
|
}
|
if (getClass() != obj.getClass()) {
|
return false;
|
}
|
final SubObject other = (SubObject) obj;
|
return Objects.equals(this.dateCreation, other.dateCreation);
|
}
|
|
}
|