View Javadoc
1   package net.sumaris.core.model.technical.optimization.taxon;
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.model.referential.taxon.ReferenceTaxon;
28  import net.sumaris.core.model.referential.taxon.TaxonGroup;
29  
30  import javax.persistence.*;
31  import java.io.Serializable;
32  import java.util.Date;
33  
34  /**
35   *
36   *
37   * Table technique présentant tous les liens (directs et hérités) entre les groupes de taxons et les références de taxon.
38   *
39   * Cette table est remplie à partir du contenu de TaxonGroupHistoricalRecord, par un procédure stockée à lancer depuis la base de données.
40   *
41   */
42  @Data
43  @FieldNameConstants
44  @Entity
45  @Table(name = "taxon_group2taxon_hierarchy")
46  public class TaxonGroup2TaxonHierarchy implements Serializable {
47  
48      @Id
49      @Column(name = "start_date", nullable = false)
50      private Date startDate;
51  
52      @Column(name = "end_date")
53      private Date endDate;
54  
55      @Column(name="is_inherited", nullable = false)
56      private Boolean isInherited;
57  
58      @Id
59      @ManyToOne(fetch = FetchType.LAZY, targetEntity = TaxonGroup.class, cascade = CascadeType.DETACH)
60      @JoinColumn(name = "parent_taxon_group_fk", nullable = false)
61      private TaxonGroup parentTaxonGroup;
62  
63      @Id
64      @ManyToOne(fetch = FetchType.LAZY, targetEntity = ReferenceTaxon.class, cascade = CascadeType.DETACH)
65      @JoinColumn(name = "child_reference_taxon_fk", nullable = false)
66      private ReferenceTaxon childReferenceTaxon;
67  }