Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
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
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.megatim.fdxconsultation.model.stats;
 
import com.megatim.fdxcommons.model.search.CriteriaEntitySearch;
import com.megatim.fdxconsultation.model.base.BaseEntity;
import com.megatim.fdxcommons.model.enumeration.FonctionAggregation;
import com.megatim.fdxconsultation.model.enums.TypeResultatConfiguration;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
 
/**
 *
 * @author ASUS
 */
@Getter
@Setter
@Entity
@NoArgsConstructor
public class TableConfiguration extends BaseEntity implements Serializable {
 
    @Id
    @SequenceGenerator(name = "SEQ_TABLE_CONF",
            sequenceName = "SEQ_TABLE_CONF",
            allocationSize = 1,
            initialValue = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_TABLE_CONF")
    private Long id;
 
    @NotEmpty(message = "Le libellé est obligatoire")
    private String libelle;
 
    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "targeted_column_id", referencedColumnName = "id")
    private TableauBordColumn targetedColumn;
 
    @OneToMany(mappedBy = "tableConfiguration", cascade = CascadeType.ALL)
    private Set<TableauBordColumn> groupingColumns = new HashSet<>();
 
    @Enumerated(EnumType.STRING)
    @NotNull(message = "La fonction d'aggrégation est obligatoire")
    private FonctionAggregation fonctionAggregation;
 
    @Enumerated(EnumType.STRING)
    @CriteriaEntitySearch(libelle = "Type de Résultat")
    private TypeResultatConfiguration typeResultatConfiguration;
 
    @ManyToOne
    @JoinColumn(name = "tableaubord_id", referencedColumnName = "id")
    private TableauBord tableauBord;
 
    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "criterion_id", referencedColumnName = "id")
    private CriteriaEntityPersisted criterion;
 
    private String color = "#527ccc";
 
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "fonctionAggCriterion_id", referencedColumnName = "id")
    private FonctionAggregationCriterion fonctionAggregationCriterion;
 
    @Override
    public int hashCode() {
        int hash = 3;
        hash = 71 * hash + Objects.hashCode(this.libelle);
        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 TableConfiguration other = (TableConfiguration) obj;
        return Objects.equals(this.libelle, other.libelle);
    }
}