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.administration.user.Person;
29  import net.sumaris.core.model.referential.QualityFlag;
30  import net.sumaris.core.model.referential.location.Location;
31  import org.hibernate.annotations.Cascade;
32  
33  import javax.persistence.*;
34  import java.util.ArrayList;
35  import java.util.Date;
36  import java.util.List;
37  
38  @Data
39  @FieldNameConstants
40  @Entity
41  @Table(name = "vessel_features")
42  public class VesselFeatures implements IDataEntity<Integer>,
43          IWithRecorderPersonEntity<Integer, Person>,
44          IWithRecorderDepartmentEntity<Integer, Department> {
45  
46      @Id
47      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "VESSEL_FEATURES_SEQ")
48      @SequenceGenerator(name = "VESSEL_FEATURES_SEQ", sequenceName="VESSEL_FEATURES_SEQ")
49      private Integer id;
50  
51      @Column(name = "creation_date", nullable = false)
52      @Temporal(TemporalType.TIMESTAMP)
53      private Date creationDate;
54  
55      @Column(name = "update_date")
56      @Temporal(TemporalType.TIMESTAMP)
57      private Date updateDate;
58  
59      @ManyToOne(fetch = FetchType.LAZY)
60      @JoinColumn(name = "recorder_person_fk")
61      private Person recorderPerson;
62  
63      @ManyToOne(fetch = FetchType.LAZY)
64      @JoinColumn(name = "recorder_department_fk", nullable = false)
65      private Department recorderDepartment;
66  
67      @Column(length = LENGTH_COMMENTS)
68      private String comments;
69  
70      @Column(name="control_date")
71      @Temporal(TemporalType.TIMESTAMP)
72      private Date controlDate;
73  
74      @Column(name="validation_date")
75      @Temporal(TemporalType.TIMESTAMP)
76      private Date validationDate;
77  
78      @Column(name="qualification_date")
79      @Temporal(TemporalType.TIMESTAMP)
80      private Date qualificationDate;
81  
82      @Column(name="qualification_comments", length = LENGTH_COMMENTS)
83      private String qualificationComments;
84  
85      @ManyToOne(fetch = FetchType.LAZY, targetEntity = QualityFlag.class)
86      @JoinColumn(name = "quality_flag_fk", nullable = false)
87      private QualityFlag qualityFlag;
88  
89      @ManyToOne(fetch = FetchType.LAZY, targetEntity = Vessel.class)
90      @JoinColumn(name = "vessel_fk", nullable = false)
91      private Vessel vessel;
92  
93      @Column(name = "start_date", nullable = false)
94      private Date startDate;
95  
96      @Column(name = "end_date")
97      private Date endDate;
98  
99      private String name;
100 
101     @Column(name = "exterior_marking")
102     private String exteriorMarking;
103 
104     @Column(name = "length_over_all")
105     private Integer lengthOverAll;
106 
107     @Column(name = "administrative_power")
108     private Integer administrativePower;
109 
110     @Column(name = "gross_tonnage_grt")
111     private Integer grossTonnageGrt;
112 
113     @Column(name = "gross_tonnage_gt")
114     private Integer grossTonnageGt;
115 
116     @ManyToOne(fetch = FetchType.LAZY)
117     @JoinColumn(name="base_port_location_fk", nullable = false)
118     private Location basePortLocation;
119 
120     /* -- measurements -- */
121 
122     @OneToMany(fetch = FetchType.LAZY, targetEntity = VesselPhysicalMeasurement.class, mappedBy = VesselPhysicalMeasurement.Fields.VESSEL_FEATURES)
123     @Cascade(org.hibernate.annotations.CascadeType.DELETE)
124     private List<VesselPhysicalMeasurement> measurements = new ArrayList<>();
125 
126 }