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.ExtractionTypeFilterVO;
28  import net.sumaris.core.extraction.vo.trip.ExtractionTripFilterVO;
29  import net.sumaris.core.vo.technical.extraction.ExtractionProductVO;
30  import org.springframework.transaction.annotation.Propagation;
31  import org.springframework.transaction.annotation.Transactional;
32  
33  import javax.annotation.Nullable;
34  import java.io.File;
35  import java.io.IOException;
36  import java.util.List;
37  
38  /**
39   * @author peck7 on 17/12/2018.
40   */
41  @Transactional
42  public interface ExtractionService {
43  
44      @Transactional(readOnly = true)
45      List<ExtractionTypeVO> findByFilter(@Nullable ExtractionTypeFilterVO filter);
46  
47      @Transactional
48      ExtractionContextVO execute(ExtractionTypeVO type, @Nullable ExtractionFilterVO filter);
49  
50      @Transactional
51      ExtractionResultVO read(ExtractionContextVO context,
52                              @Nullable ExtractionFilterVO filter,
53                              int offset,
54                              int size,
55                              String sort,
56                              SortDirection direction) ;
57  
58      @Transactional
59      ExtractionResultVO executeAndRead(ExtractionTypeVO type,
60                                        @Nullable ExtractionFilterVO filter,
61                                        int offset,
62                                        int size,
63                                        String sort,
64                                        SortDirection direction) ;
65  
66      @Transactional(rollbackFor = IOException.class)
67      File executeAndDump(ExtractionTypeVO type,
68                          ExtractionFilterVO filter) throws IOException;
69  
70      @Transactional
71      File executeAndDumpTrips(ExtractionRawFormatEnum format, ExtractionTripFilterVO filter);
72  
73      @Transactional
74      void clean(ExtractionContextVO context);
75  
76      @Transactional(propagation = Propagation.SUPPORTS)
77      void asyncClean(ExtractionContextVO context);
78  
79      @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
80      ExtractionProductVO toProductVO(ExtractionContextVO context);
81  
82      @Transactional
83      ExtractionTypeVO/../../../net/sumaris/core/extraction/vo/ExtractionTypeVO.html#ExtractionTypeVO">ExtractionTypeVO save(ExtractionTypeVO type, ExtractionFilterVO filter);
84  }