package com.megatim.fdxconvert.model; import com.megatim.fdxconvert.pojo.Delimiteur; import com.megatimfx.common.validationgroups.ViewFormValidationGroup; import com.megatim.fdxconvert.enums.DataType; import com.megatim.fdxconvert.model.constraint.DelimiterConstraint; import com.megatim.fdxconvert.model.constraint.SchedulerConstraint; import java.io.Serializable; import java.time.LocalDateTime; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; @Entity @Table(name = "CONVERT_TACHE") @Getter @Setter @SchedulerConstraint(groups = {ViewFormValidationGroup.class}) @DelimiterConstraint(groups = {ViewFormValidationGroup.class}) public class Tache implements Serializable { @Id @NotEmpty(message = "Le libelle est obligatoire", groups = {ViewFormValidationGroup.class}) private String libelle; private boolean active; //PLANNICATION private int heureTache = 0; private int minuteTache = 0; private int intervalleTache = 0; private boolean withoutInterval; private boolean monday; private boolean tuesday; private boolean wednesday; private boolean thursday; private boolean friday; private boolean saturday; private boolean sunday; private int intervalleExecution; private boolean executeOnce; @NotEmpty(message = "Le repertoire source est obligatoire", groups = {ViewFormValidationGroup.class}) private String repertoireSource; @NotEmpty(message = "Le repertoire de destination est obligatoire", groups = {ViewFormValidationGroup.class}) private String repertoireDestination; @NotEmpty(message = "Le repertoire des erreurs est obligatoire", groups = {ViewFormValidationGroup.class}) private String repertoireErreur; @ManyToOne @JoinColumn(name = "typefichier_code") @NotNull(message = "Le typefichier est obligatoire", groups = {ViewFormValidationGroup.class}) private TypeFichier typeFichier; private boolean withHeader; private boolean strictValidation; @Transient private Delimiteur delimiteurLigne; @Transient private Delimiteur delimiteurColonne; private String rowDeliminter; private String colDeliminter; @NotNull(message = "Le format de fichier de données est obligatoire", groups = {ViewFormValidationGroup.class}) private DataType dataType; @CreationTimestamp private LocalDateTime dateCreation; @UpdateTimestamp private LocalDateTime dateMiseAJour; @OneToMany(mappedBy = "tache", fetch = FetchType.EAGER, cascade = CascadeType.ALL) private Set metaAlphaNumeriqueFields = new HashSet<>(); @Override public String toString() { return libelle; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Tache)) { return false; } final Tache other = (Tache) obj; if (this.getLibelle() != null && !this.getLibelle().equals(other.getLibelle())) { return false; } return true; } }