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.administration.user.Department;
28  import net.sumaris.core.model.referential.QualityFlag;
29  
30  import javax.persistence.*;
31  import java.util.Date;
32  
33  @Data
34  @FieldNameConstants
35  @Entity(name = "vessel_position")
36  public class VesselPosition implements IDataEntity<Integer> {
37  
38      @Id
39      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "VESSEL_POSITION_SEQ")
40      @SequenceGenerator(name = "VESSEL_POSITION_SEQ", sequenceName="VESSEL_POSITION_SEQ")
41      private Integer id;
42  
43      @Column(name = "update_date")
44      @Temporal(TemporalType.TIMESTAMP)
45      private Date updateDate;
46  
47      @ManyToOne(fetch = FetchType.LAZY)
48      @JoinColumn(name = "recorder_department_fk", nullable = false)
49      private Department recorderDepartment;
50  
51      @Column(name="control_date")
52      @Temporal(TemporalType.TIMESTAMP)
53      private Date controlDate;
54  
55      @Column(name="validation_date")
56      @Temporal(TemporalType.TIMESTAMP)
57      private Date validationDate;
58  
59      @Column(name="qualification_date")
60      @Temporal(TemporalType.TIMESTAMP)
61      private Date qualificationDate;
62  
63      @Column(name="qualification_comments", length = LENGTH_COMMENTS)
64      private String qualificationComments;
65  
66      @ManyToOne(fetch = FetchType.LAZY, targetEntity = QualityFlag.class)
67      @JoinColumn(name = "quality_flag_fk", nullable = false)
68      private QualityFlag qualityFlag;
69  
70      @Column(name = "date_time", nullable = false)
71      private Date dateTime;
72  
73      @Column(nullable = false)
74      private Double latitude;
75  
76      @Column(nullable = false)
77      private Double longitude;
78  
79      // Link to parent
80  
81      @ManyToOne(fetch = FetchType.LAZY)
82      @JoinColumn(name = "operation_fk")
83  
84      private Operation operation;
85  
86  }