/*
|
* 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;
|
}
|
|
}
|