View Javadoc
1   package net.sumaris.core.model.technical.extraction.rdb;
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.dao.technical.schema.DatabaseTableEnum;
29  
30  import javax.persistence.*;
31  import java.io.Serializable;
32  
33  @Data
34  @FieldNameConstants
35  @Entity
36  @Table(name = "p01_rdb_species_length")
37  public class ProductRdbSpeciesLength implements Serializable, IEntity<Integer> {
38  
39      public static final DatabaseTableEnum TABLE = DatabaseTableEnum.P01_RDB_SPECIES_LENGTH;
40  
41      public static final String COLUMN_SAMPLING_TYPE = ProductRdbStation.COLUMN_SAMPLING_TYPE;
42      public static final String COLUMN_VESSEL_FLAG_COUNTRY = ProductRdbStation.COLUMN_VESSEL_FLAG_COUNTRY;
43      public static final String COLUMN_LANDING_COUNTRY = ProductRdbStation.COLUMN_LANDING_COUNTRY;
44      public static final String COLUMN_YEAR = ProductRdbStation.COLUMN_YEAR;
45      public static final String COLUMN_PROJECT = ProductRdbStation.COLUMN_PROJECT;
46      public static final String COLUMN_TRIP_CODE = ProductRdbStation.COLUMN_TRIP_CODE;
47      public static final String COLUMN_STATION_NUMBER = ProductRdbStation.COLUMN_STATION_NUMBER;
48  
49      public static final String COLUMN_SPECIES = ProductRdbSpeciesList.COLUMN_SPECIES;
50      public static final String COLUMN_CATCH_CATEGORY = ProductRdbSpeciesList.COLUMN_CATCH_CATEGORY;
51      public static final String COLUMN_LANDING_CATEGORY = ProductRdbSpeciesList.COLUMN_LANDING_CATEGORY;
52      public static final String COLUMN_COMMERCIAL_SIZE_CATEGORY_SCALE = ProductRdbSpeciesList.COLUMN_COMMERCIAL_SIZE_CATEGORY_SCALE;
53      public static final String COLUMN_COMMERCIAL_SIZE_CATEGORY = ProductRdbSpeciesList.COLUMN_COMMERCIAL_SIZE_CATEGORY;
54      public static final String COLUMN_SUBSAMPLING_CATEGORY = ProductRdbSpeciesList.COLUMN_SUBSAMPLING_CATEGORY;
55      public static final String COLUMN_SEX = ProductRdbSpeciesList.COLUMN_SEX;
56      public static final String COLUMN_INDIVIDUAL_SEX = "individual_sex";
57      public static final String COLUMN_LENGTH_CLASS = "length_class";
58      public static final String COLUMN_NUMBER_AT_LENGTH = "number_at_length";
59  
60      @Id
61      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "p01_rdb_species_length_seq")
62      @SequenceGenerator(name = "p01_rdb_species_length_seq", sequenceName="p01_rdb_species_length_seq")
63      private Integer id;
64  
65      @Column(nullable = false, length = 2, name = COLUMN_SAMPLING_TYPE)
66      private String samplingType;
67  
68      @Column(nullable = false, length = 3, name = COLUMN_LANDING_COUNTRY)
69      private String landingCountry;
70  
71      @Column(nullable = false, length = 3, name = COLUMN_VESSEL_FLAG_COUNTRY)
72      private String vesselFlagCountry;
73  
74      @Column(nullable = false, scale = 4, name = COLUMN_YEAR)
75      private Integer year;
76  
77      @Column(nullable = false, name = COLUMN_PROJECT)
78      private String project;
79  
80      @Column(nullable = false, name = COLUMN_TRIP_CODE, length = 50)
81      private String tripCode;
82  
83      @Column(name = COLUMN_STATION_NUMBER, scale=6)
84      private Integer stationNumber;
85  
86      // TODO: reduce length to 20 (or 4 ?)
87      @Column(nullable = false, length = 100, name = COLUMN_SPECIES)
88      private String species;
89  
90      @Column(nullable = false, length= 25, name = COLUMN_CATCH_CATEGORY)
91      private String catchCategory;
92  
93      @Column(nullable = false, length = 25, name = COLUMN_LANDING_CATEGORY)
94      private String landingCategory;
95  
96      @Column(length = 25, name = COLUMN_COMMERCIAL_SIZE_CATEGORY_SCALE)
97      private String commercialCategoryScale;
98  
99      @Column(length = 25, name = COLUMN_COMMERCIAL_SIZE_CATEGORY)
100     private String commercialCategory;
101 
102     @Column(length = 25, name = COLUMN_SUBSAMPLING_CATEGORY)
103     private String subsamplingCategory;
104 
105     @Column(name = COLUMN_SEX , length=1)
106     private String sex;
107 
108     @Column(name = COLUMN_INDIVIDUAL_SEX , length=1)
109     private String individualSex;
110 
111     @Column(scale = 5, name = COLUMN_LENGTH_CLASS)
112     private Integer lengthClass; // in mm
113 
114     @Column(scale = 5, name = COLUMN_NUMBER_AT_LENGTH)
115     private Integer numberAtLength;
116 }