1 package fr.ifremer.dali.service.extraction;
2
3 /*
4 * #%L
5 * Dali :: Core
6 * $Id:$
7 * $HeadURL:$
8 * %%
9 * Copyright (C) 2014 - 2015 Ifremer
10 * %%
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Affero General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU Affero General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * #L%
24 */
25
26
27 import fr.ifremer.dali.dto.system.extraction.ExtractionDTO;
28 import fr.ifremer.dali.dto.system.extraction.FilterTypeDTO;
29 import org.springframework.security.access.prepost.PreAuthorize;
30 import org.springframework.transaction.annotation.Transactional;
31
32 import java.io.File;
33 import java.util.Collection;
34 import java.util.List;
35
36 /**
37 * Created by Ludovic on 02/12/2015.
38 */
39 @Transactional(readOnly = true)
40 public interface ExtractionService {
41
42 /**
43 * <p>getFilterTypes.</p>
44 *
45 * @return a {@link java.util.List} object.
46 */
47 List<FilterTypeDTO> getFilterTypes();
48
49 /**
50 * Return all extraction for combo list (no filter, no parameter)
51 *
52 * @return a {@link java.util.List} object.
53 */
54 List<ExtractionDTO> getAllLightExtractions();
55
56 /**
57 * <p>getExtractions.</p>
58 *
59 * @param extractionId a {@link java.lang.Integer} object.
60 * @param programCode a {@link java.lang.String} object.
61 * @return a {@link java.util.List} object.
62 */
63 List<ExtractionDTO> getExtractions(Integer extractionId, String programCode);
64
65 /**
66 * Load all filtered elements in extraction
67 *
68 * @param extraction a {@link fr.ifremer.dali.dto.system.extraction.ExtractionDTO} object.
69 */
70 void loadFilteredElements(ExtractionDTO extraction);
71
72 /**
73 * <p>saveExtractions.</p>
74 *
75 * @param extractions a {@link java.util.Collection} object.
76 */
77 @Transactional()
78 @PreAuthorize("hasPermission(null, T(fr.ifremer.quadrige3.core.security.QuadrigeUserAuthority).USER)")
79 void saveExtractions(Collection<? extends ExtractionDTO> extractions);
80
81 /**
82 * <p>deleteExtractions.</p>
83 *
84 * @param idExtractionToDelete a {@link java.util.List} object.
85 */
86 @Transactional()
87 @PreAuthorize("hasPermission(null, T(fr.ifremer.quadrige3.core.security.QuadrigeUserAuthority).USER)")
88 void deleteExtractions(List<Integer> idExtractionToDelete);
89
90 /**
91 * <p>duplicateExtraction.</p>
92 *
93 * @param extraction a {@link fr.ifremer.dali.dto.system.extraction.ExtractionDTO} object.
94 * @return a {@link fr.ifremer.dali.dto.system.extraction.ExtractionDTO} object.
95 */
96 ExtractionDTO duplicateExtraction(ExtractionDTO extraction) throws CloneNotSupportedException;
97
98 /**
99 * Export extraction definition and parameter to a file
100 *
101 * @param extraction extraction to export
102 * @param exportFile destination file
103 */
104 void exportExtraction(ExtractionDTO extraction, File exportFile);
105
106 /**
107 * Import an extraction from a file
108 *
109 * @param importFile source file
110 * @return the imported extraction
111 */
112 ExtractionDTO importExtraction(File importFile);
113 }