View Javadoc
1   package net.sumaris.core.extraction.dao.technical.table;
2   
3   /*-
4    * #%L
5    * SUMARiS:: Core Extraction
6    * %%
7    * Copyright (C) 2018 - 2019 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 com.google.common.collect.ImmutableMap;
26  import net.sumaris.core.model.technical.extraction.rdb.*;
27  
28  import java.util.Map;
29  
30  /**
31   * Determine a default order for columns
32   * @author Benoit Lavenier <benoit.lavenier@e-is.pro>
33   */
34  public final class ExtractionTableColumnOrder {
35  
36  
37      public static Map<String, String[]> COLUMNS_BY_TABLE = ImmutableMap.<String, String[]>builder()
38              .put(ProductRdbTrip.TABLE.name(), new String[]{
39                      ProductRdbTrip.COLUMN_SAMPLING_TYPE,
40                      ProductRdbTrip.COLUMN_VESSEL_FLAG_COUNTRY,
41                      ProductRdbTrip.COLUMN_LANDING_COUNTRY,
42                      ProductRdbTrip.COLUMN_YEAR,
43                      ProductRdbTrip.COLUMN_PROJECT,
44                      ProductRdbTrip.COLUMN_TRIP_CODE,
45                      ProductRdbTrip.COLUMN_VESSEL_LENGTH,
46                      ProductRdbTrip.COLUMN_VESSEL_POWER,
47                      ProductRdbTrip.COLUMN_VESSEL_SIZE,
48                      ProductRdbTrip.COLUMN_VESSEL_TYPE,
49                      ProductRdbTrip.COLUMN_HARBOUR,
50                      ProductRdbTrip.COLUMN_NUMBER_OF_SETS,
51                      ProductRdbTrip.COLUMN_DAYS_AT_SEA,
52                      ProductRdbTrip.COLUMN_VESSEL_IDENTIFIER,
53                      ProductRdbTrip.COLUMN_SAMPLING_COUNTRY,
54                      ProductRdbTrip.COLUMN_SAMPLING_METHOD
55              })
56              .put(ProductRdbStation.TABLE.name(), new String[]{
57                      ProductRdbStation.COLUMN_SAMPLING_TYPE,
58                      ProductRdbStation.COLUMN_VESSEL_FLAG_COUNTRY,
59                      ProductRdbStation.COLUMN_LANDING_COUNTRY,
60                      ProductRdbStation.COLUMN_YEAR,
61                      ProductRdbStation.COLUMN_PROJECT,
62                      ProductRdbStation.COLUMN_TRIP_CODE,
63                      ProductRdbStation.COLUMN_STATION_NUMBER,
64                      ProductRdbStation.COLUMN_FISHING_VALIDITY,
65                      ProductRdbStation.COLUMN_AGGREGATION_LEVEL,
66                      ProductRdbStation.COLUMN_CATCH_REGISTRATION,
67                      ProductRdbStation.COLUMN_SPECIES_REGISTRATION,
68                      ProductRdbStation.COLUMN_DATE,
69                      ProductRdbStation.COLUMN_TIME,
70                      ProductRdbStation.COLUMN_FISHING_TIME,
71                      ProductRdbStation.COLUMN_POS_START_LAT,
72                      ProductRdbStation.COLUMN_POS_START_LON,
73                      ProductRdbStation.COLUMN_POS_END_LAT,
74                      ProductRdbStation.COLUMN_POS_END_LON,
75                      ProductRdbStation.COLUMN_AREA,
76                      ProductRdbStation.COLUMN_STATISTICAL_RECTANGLE,
77                      ProductRdbStation.COLUMN_SUB_POLYGON,
78                      ProductRdbStation.COLUMN_MAIN_FISHING_DEPTH,
79                      ProductRdbStation.COLUMN_MAIN_WATER_DEPTH,
80                      ProductRdbStation.COLUMN_NATIONAL_METIER,
81                      ProductRdbStation.COLUMN_EU_METIER_LEVEL5,
82                      ProductRdbStation.COLUMN_EU_METIER_LEVEL6,
83                      ProductRdbStation.COLUMN_GEAR_TYPE,
84                      ProductRdbStation.COLUMN_MESH_SIZE,
85                      ProductRdbStation.COLUMN_SELECTION_DEVICE,
86                      ProductRdbStation.COLUMN_MESH_SIZE_SELECTION_DEVICE
87              })
88              .put(ProductRdbSpeciesList.TABLE.name(), new String[]{
89                      ProductRdbSpeciesList.COLUMN_SAMPLING_TYPE,
90                      ProductRdbSpeciesList.COLUMN_VESSEL_FLAG_COUNTRY,
91                      ProductRdbSpeciesList.COLUMN_LANDING_COUNTRY,
92                      ProductRdbSpeciesList.COLUMN_YEAR,
93                      ProductRdbSpeciesList.COLUMN_PROJECT,
94                      ProductRdbSpeciesList.COLUMN_TRIP_CODE,
95                      ProductRdbSpeciesList.COLUMN_STATION_NUMBER,
96                      ProductRdbSpeciesList.COLUMN_SPECIES,
97                      ProductRdbSpeciesList.COLUMN_SEX,
98                      ProductRdbSpeciesList.COLUMN_CATCH_CATEGORY,
99                      ProductRdbSpeciesList.COLUMN_LANDING_CATEGORY,
100                     ProductRdbSpeciesList.COLUMN_COMMERCIAL_SIZE_CATEGORY_SCALE,
101                     ProductRdbSpeciesList.COLUMN_COMMERCIAL_SIZE_CATEGORY,
102                     ProductRdbSpeciesList.COLUMN_SUBSAMPLING_CATEGORY,
103                     ProductRdbSpeciesList.COLUMN_WEIGHT,
104                     ProductRdbSpeciesList.COLUMN_SUBSAMPLING_WEIGHT,
105                     ProductRdbSpeciesList.COLUMN_LENGTH_CODE
106             })
107             .put(ProductRdbSpeciesLength.TABLE.name(), new String[]{
108                     ProductRdbSpeciesLength.COLUMN_SAMPLING_TYPE,
109                     ProductRdbSpeciesLength.COLUMN_VESSEL_FLAG_COUNTRY,
110                     ProductRdbSpeciesLength.COLUMN_LANDING_COUNTRY,
111                     ProductRdbSpeciesLength.COLUMN_YEAR,
112                     ProductRdbSpeciesLength.COLUMN_PROJECT,
113                     ProductRdbSpeciesLength.COLUMN_TRIP_CODE,
114                     ProductRdbSpeciesLength.COLUMN_STATION_NUMBER,
115                     ProductRdbSpeciesLength.COLUMN_SPECIES,
116                     ProductRdbSpeciesLength.COLUMN_CATCH_CATEGORY,
117                     ProductRdbSpeciesLength.COLUMN_LANDING_CATEGORY,
118                     ProductRdbSpeciesLength.COLUMN_COMMERCIAL_SIZE_CATEGORY_SCALE,
119                     ProductRdbSpeciesLength.COLUMN_COMMERCIAL_SIZE_CATEGORY,
120                     ProductRdbSpeciesLength.COLUMN_SUBSAMPLING_CATEGORY,
121                     ProductRdbSpeciesLength.COLUMN_SEX,
122                     ProductRdbSpeciesLength.COLUMN_INDIVIDUAL_SEX,
123                     ProductRdbSpeciesLength.COLUMN_LENGTH_CLASS,
124                     ProductRdbSpeciesLength.COLUMN_NUMBER_AT_LENGTH
125             })
126             // TODO CA
127             .put(ProductRdbLandingStatistics.TABLE.name(), new String[]{
128                     ProductRdbLandingStatistics.COLUMN_VESSEL_FLAG_COUNTRY,
129                     ProductRdbLandingStatistics.COLUMN_LANDING_COUNTRY,
130                     ProductRdbLandingStatistics.COLUMN_YEAR,
131                     ProductRdbLandingStatistics.COLUMN_QUARTER,
132                     ProductRdbLandingStatistics.COLUMN_MONTH,
133                     ProductRdbLandingStatistics.COLUMN_AREA,
134                     ProductRdbLandingStatistics.COLUMN_STATISTICAL_RECTANGLE,
135                     ProductRdbLandingStatistics.COLUMN_SUB_POLYGON,
136                     ProductRdbLandingStatistics.COLUMN_SPECIES,
137                     ProductRdbLandingStatistics.COLUMN_LANDING_CATEGORY,
138                     ProductRdbLandingStatistics.COLUMN_COMMERCIAL_SIZE_CATEGORY_SCALE,
139                     ProductRdbLandingStatistics.COLUMN_COMMERCIAL_SIZE_CATEGORY,
140                     ProductRdbLandingStatistics.COLUMN_NATIONAL_METIER,
141                     ProductRdbLandingStatistics.COLUMN_EU_METIER_LEVEL5,
142                     ProductRdbLandingStatistics.COLUMN_EU_METIER_LEVEL6,
143                     ProductRdbLandingStatistics.COLUMN_HARBOUR,
144                     ProductRdbLandingStatistics.COLUMN_VESSEL_LENGTH_CATEGORY,
145                     ProductRdbLandingStatistics.COLUMN_UNALLOCATED_CATCH_WEIGHT,
146                     ProductRdbLandingStatistics.COLUMN_AREA_MISREPORTED_CATCH_WEIGHT,
147                     ProductRdbLandingStatistics.COLUMN_OFFICIAL_LANDINGS_WEIGHT,
148                     ProductRdbLandingStatistics.COLUMN_LANDINGS_MULTIPLIER,
149                     ProductRdbLandingStatistics.COLUMN_OFFICIAL_LANDINGS_VALUE
150             })
151             // TODO CE
152             .build();
153 }