View Javadoc
1   package net.sumaris.core.extraction.service;
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 net.sumaris.core.dao.technical.SortDirection;
26  import net.sumaris.core.extraction.vo.*;
27  import net.sumaris.core.extraction.vo.filter.AggregationTypeFilterVO;
28  import net.sumaris.core.vo.technical.extraction.ProductFetchOptions;
29  import net.sumaris.core.vo.technical.extraction.ExtractionProductColumnVO;
30  import org.springframework.transaction.annotation.Transactional;
31  
32  import javax.annotation.Nullable;
33  import java.util.List;
34  
35  /**
36   * Create aggregation tables, from a data extraction.
37   * @author benoit.lavenier@e-is.pro
38   * @since 0.12.0
39   */
40  @Transactional
41  public interface AggregationService {
42  
43      @Transactional(readOnly = true)
44      List<AggregationTypeVO> findByFilter(@Nullable AggregationTypeFilterVO filter, ProductFetchOptions fetchOptions);
45  
46      @Transactional(readOnly = true)
47      AggregationTypeVO get(int id, ProductFetchOptions fetchOptions);
48  
49      /**
50       * Do an aggregate
51       * @param type
52       * @param filter
53       */
54      @Transactional
55      AggregationContextVO execute(AggregationTypeVO type,
56                                   @Nullable ExtractionFilterVO filter);
57  
58      @Transactional(readOnly = true)
59      AggregationResultVO read(AggregationTypeVO type,
60                               @Nullable  ExtractionFilterVO filter,
61                               @Nullable AggregationStrataVO strata,
62                               int offset, int size, String sort, SortDirection direction);
63  
64      @Transactional(readOnly = true)
65      AggregationResultVO read(AggregationContextVO context,
66                               @Nullable  ExtractionFilterVO filter,
67                               @Nullable AggregationStrataVO strata,
68                               int offset, int size, String sort, SortDirection direction);
69  
70      @Transactional(readOnly = true)
71      List<ExtractionProductColumnVO> getColumnsBySheetName(AggregationTypeVO type, String sheetName);
72  
73      @Transactional
74      AggregationResultVO executeAndRead(AggregationTypeVO type,
75                                         @Nullable ExtractionFilterVO filter,
76                                         @Nullable AggregationStrataVO strata,
77                                         int offset, int size,
78                                         @Nullable String sort,
79                                         @Nullable SortDirection direction);
80  
81      @Transactional
82      AggregationTypeVO../../../net/sumaris/core/extraction/vo/AggregationTypeVO.html#AggregationTypeVO">AggregationTypeVO save(AggregationTypeVO type, @Nullable ExtractionFilterVO filter);
83  
84      @Transactional
85      void delete(int id);
86  }