View Javadoc
1   package net.sumaris.core.model.data;
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.QualityFlag;
28  import net.sumaris.core.model.referential.location.Location;
29  
30  import javax.persistence.*;
31  import java.util.Date;
32  
33  @Data
34  @FieldNameConstants
35  @Entity
36  @Table(name = "vessel_registration_period")
37  public class VesselRegistrationPeriod implements IWithVesselEntity<Integer, Vessel> {
38  
39      @Id
40      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "VESSEL_REGISTRATION_PERIOD_SEQ")
41      @SequenceGenerator(name = "VESSEL_REGISTRATION_PERIOD_SEQ", sequenceName="VESSEL_REGISTRATION_PERIOD_SEQ")
42      private Integer id;
43  
44      @Column(name = "start_date", nullable = false)
45      private Date startDate;
46  
47      @Column(name = "end_date")
48      private Date endDate;
49  
50      @Column(name = "registration_code", length = 40)
51      private String registrationCode;
52  
53      @Column(name = "int_registration_code", length = 40)
54      private String intRegistrationCode;
55  
56      @Column(name = "rank_order", nullable = false)
57      private Integer rankOrder;
58  
59      @ManyToOne(fetch = FetchType.LAZY)
60      @JoinColumn(name = "vessel_fk", nullable = false)
61      private Vessel vessel;
62  
63      @ManyToOne(fetch = FetchType.LAZY)
64      @JoinColumn(name = "registration_location_fk", nullable = false)
65      private Location registrationLocation;
66  
67      @ManyToOne(fetch = FetchType.LAZY)
68      @JoinColumn(name = "quality_flag_fk", nullable = false)
69      private QualityFlag qualityFlag;
70  
71  }