1 package net.sumaris.core.model.technical.history; 2 3 /*- 4 * #%L 5 * SUMARiS:: Core 6 * %% 7 * Copyright (C) 2018 SUMARiS Consortium 8 * %% 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as 11 * published by the Free Software Foundation, either version 3 of the 12 * License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public 20 * License along with this program. If not, see 21 * <http://www.gnu.org/licenses/gpl-3.0.html>. 22 * #L% 23 */ 24 25 import lombok.Data; 26 import lombok.experimental.FieldNameConstants; 27 import net.sumaris.core.dao.technical.model.IEntity; 28 import net.sumaris.core.model.referential.ProcessingStatus; 29 import net.sumaris.core.model.referential.ProcessingType; 30 31 import javax.persistence.*; 32 import java.util.Date; 33 34 /** 35 * Historique des traitements, qu’il s’agisse de flux (comme historiquement la table HIS_FLUX) ou non 36 * (traitement d’agrégation, CQ auto, etc.). 37 * 38 * Permet donc de conserver l'historique des traitements qui se sont exécutés sur le système, notamment ceux qui ont 39 * impactés la base de données brutes (Adagio). 40 * 41 * L’exécution des traitements en erreur peuvent également être tracée. 42 */ 43 @Data 44 @FieldNameConstants 45 @Entity 46 @Table(name = "processing_history") 47 public class ProcessingHistory implements IEntity<Integer> { 48 49 @Id 50 @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PROCESSING_HISTORY_SEQ") 51 @SequenceGenerator(name = "PROCESSING_HISTORY_SEQ", sequenceName="PROCESSING_HISTORY_SEQ") 52 private Integer id; 53 54 /** 55 * Nom du traitement, unique pour un type de traitement donné. 56 * Par exemple, pour un traitement d'importation le nom du flux est le nom du fichier reçu par mail. 57 * Ce fichier peut lui même référencer plusieurs fichiers qui composent le flux (Exemple : flux IDROLE). 58 */ 59 @Column(length = 100) 60 private String name; 61 62 @Column(name = "processing_date", nullable = false) 63 private Date date; 64 65 /** 66 * S'il s'agit d'un traitement manipulant des données (importation ou exportation) : 67 * Type de transfert des données. valeurs possibles : MAIL, FTP, ETL 68 */ 69 @Column(name="data_transfert_type") 70 private String dataTransfertType; 71 72 /** 73 * S'il s'agit d'un traitement manipulant des données (importation ou exportation) : Information permettant de 74 * retrouver l'origine de la donnée. 75 * 76 * Par exemple : l'email de l'émetteur, l'adresse FTP du fichier, etc. 77 */ 78 @Column(name="data_transfert_address") 79 private String dataTransfertAddress; 80 81 /** 82 * S'il s'agit d'un traitement manipulant des données (importation ou exportation) : Date du transfert des données 83 * vers de destinataire (pour les flux en EXPORT) ou vers la base (pour les flux en IMPORT). 84 */ 85 @Column(name="data_transfert_date") 86 private Date dataTransfertDate; 87 88 /** 89 * Configuration du traitement, par exemple les paramètres utilisés dans la ligne de commande. 90 */ 91 @Column(name="configuration") 92 private String configuration; 93 94 /** 95 * La configuration, sous forme XML (utilisé par les traitements CQ automatique) 96 */ 97 @Column(name="xml_configuration", length = 3000) 98 private String xmlConfiguration; 99 100 /** 101 * Use to store execution reports 102 */ 103 @Column(name="xml_report", length = 3000) 104 private String xmlReport; 105 106 /* -- quality insurance -- */ 107 108 @Column(name = "update_date") 109 @Temporal(TemporalType.TIMESTAMP) 110 private Date updateDate; 111 112 113 @ManyToOne(fetch = FetchType.LAZY, targetEntity = ProcessingType.class) 114 @JoinColumn(name = "processing_type_fk", nullable = false) 115 private ProcessingType processingType; 116 117 @ManyToOne(fetch = FetchType.LAZY, targetEntity = ProcessingStatus.class) 118 @JoinColumn(name = "processing_status_fk", nullable = false) 119 private ProcessingStatus processingStatus; 120 121 /* -- child entities -- */ 122 123 // @OneToMany(fetch = FetchType.LAZY, targetEntity = BatchSortingMeasurement.class, mappedBy = BatchSortingMeasurement.PROPERTY_BATCH) 124 // @Cascade(org.hibernate.annotations.CascadeType.DELETE) 125 // private List<BatchSortingMeasurement> sortingMeasurements = new ArrayList<>(); 126 // 127 // @OneToMany(fetch = FetchType.LAZY, targetEntity = BatchQuantificationMeasurement.class, mappedBy = BatchQuantificationMeasurement.PROPERTY_BATCH) 128 // @Cascade(org.hibernate.annotations.CascadeType.DELETE) 129 // private List<BatchQuantificationMeasurement> quantificationMeasurements = new ArrayList<>(); 130 131 }