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
/*
 * 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.fdxcommons.model.dataproduction.metadata;
 
import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction;
import com.megatim.fdxcommons.model.dataproduction.metadata.constraint.ProductionMetaDataConstraint;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CollectionTable;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
 
/**
 *
 * @author ASUS
 */
@Getter
@Setter
@NoArgsConstructor
@ProductionMetaDataConstraint
@Entity
public class ProductionMetaData implements Serializable {
 
    @NotNull(message = "L'identifiant de la production est obligatoire")
    @Id
    private Long productionId;
 
    @NotNull(message = "Le type de production est obligatoire")
    private String dataProductionType;
 
    private Long startIndex; //Index de debut dans le cas d'un ADD
 
    @NotNull(message = "Le nombre d'éléments de la production est obligatoire")
    private Long nbreElts;
 
    @Transient
    private CommonDataProduction dataProduction;
 
    @ElementCollection(targetClass = Long.class, fetch = FetchType.EAGER)
    @CollectionTable(
            name = "productionMetaData_indexes", // Name of the table for the collection
            joinColumns = {
                @JoinColumn(name = "productionId")
            } // Foreign key column in the collection table
    )
    private final Set<Long> indexes = new HashSet<>();//Liste des indexes dans le cas d'un Update
 
    public ProductionMetaData(Long productionId, Long nbreElts) {
        this.productionId = productionId;
        this.nbreElts = nbreElts;
    }
 
    public ProductionMetaData(Long productionId, Long startIndex, Long nbreElts) {
        this.productionId = productionId;
        this.startIndex = startIndex;
        this.nbreElts = nbreElts;
    }
 
    public ProductionMetaData(CommonDataProduction dataProduction) {
        this.dataProduction = dataProduction;
    }
 
}