View Javadoc
1   package net.sumaris.core.extraction.dao.trip.rdb;
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.dao.technical.SortDirection;
27  import net.sumaris.core.extraction.vo.*;
28  import net.sumaris.core.extraction.vo.trip.rdb.AggregationRdbTripContextVO;
29  import net.sumaris.core.model.technical.extraction.rdb.ProductRdbStation;
30  import net.sumaris.core.util.StringUtils;
31  import net.sumaris.core.vo.technical.extraction.ExtractionProductVO;
32  
33  import java.util.Map;
34  
35  /**
36   * @author Benoit Lavenier <benoit.lavenier@e-is.pro>
37   */
38  public interface AggregationRdbTripDao<C extends AggregationRdbTripContextVO, F extends ExtractionFilterVO, S extends AggregationStrataVO> {
39  
40      String RDB_FORMAT = StringUtils.underscoreToChangeCase(ExtractionRawFormatEnum.RDB.name());
41  
42      String HH_SHEET_NAME = ExtractionRdbTripDao.HH_SHEET_NAME;
43      String SL_SHEET_NAME = ExtractionRdbTripDao.SL_SHEET_NAME;
44      String HL_SHEET_NAME = ExtractionRdbTripDao.HL_SHEET_NAME;
45      String CA_SHEET_NAME = ExtractionRdbTripDao.CA_SHEET_NAME;
46  
47      // Time columns
48      String COLUMN_YEAR  = ProductRdbStation.COLUMN_YEAR;
49      String COLUMN_QUARTER = "quarter";
50      String COLUMN_MONTH = "month";
51  
52      // Space columns
53      String COLUMN_AREA = ProductRdbStation.COLUMN_AREA;
54      String COLUMN_STATISTICAL_RECTANGLE = ProductRdbStation.COLUMN_STATISTICAL_RECTANGLE;
55      String COLUMN_SQUARE = "square";
56  
57      // Agg columns
58      String COLUMN_TRIP_COUNT = "trip_count";
59      String COLUMN_STATION_COUNT = "station_count";
60  
61      ImmutableMap<String, String> COLUMN_ALIAS = ImmutableMap.<String, String>builder()
62          .put("rect", COLUMN_STATISTICAL_RECTANGLE)
63              .build();
64  
65      <R extends C> R aggregate(ExtractionProductVO source, F filter);
66  
67      AggregationResultVO read(String tableName, F filter, S strata, int offset, int size, String sortAttribute, SortDirection sortDirection);
68  }