1 package fr.ifremer.quadrige3.core.service.administration.program;
2
3 /*-
4 * #%L
5 * Quadrige3 Core :: Quadrige3 Client Core
6 * $Id:$
7 * $HeadURL:$
8 * %%
9 * Copyright (C) 2017 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 import fr.ifremer.quadrige3.core.exception.SaveForbiddenException;
27 import fr.ifremer.quadrige3.core.vo.administration.program.ProgramVO;
28 import org.springframework.transaction.annotation.Transactional;
29
30 import java.util.List;
31 import java.util.Set;
32
33 /**
34 * <p>
35 * ProgramService interface.
36 * </p>
37 *
38 */
39 @Transactional(readOnly = true)
40 public interface ProgramService {
41
42 List<String> getAllProgramCodes();
43
44 /**
45 * Save a list of programs
46 *
47 * @param programs a program list
48 * @return a {@link java.util.List} object.
49 */
50 @Transactional(rollbackFor = {
51 RuntimeException.class,
52 SaveForbiddenException.class
53 })
54 List<ProgramVO> save(List<ProgramVO> programs);
55
56 /**
57 * <p>
58 * save.
59 * </p>
60 *
61 * @param bean a {@link fr.ifremer.quadrige3.core.vo.administration.program.ProgramVO} object.
62 * @return a {@link fr.ifremer.quadrige3.core.vo.administration.program.ProgramVO} object.
63 */
64 @Transactional(rollbackFor = {
65 RuntimeException.class,
66 SaveForbiddenException.class
67 })
68 ProgramVO save(ProgramVO bean);
69
70 /**
71 * <p>
72 * getByCode.
73 * </p>
74 *
75 * @param progCd a {@link java.lang.String} object.
76 * @return a {@link fr.ifremer.quadrige3.core.vo.administration.program.ProgramVO} object.
77 */
78 ProgramVO getByCode(String progCd);
79
80 /**
81 * Get user's programs (program with read rights <u>on data</u>)
82 *
83 * @param quserId a int.
84 * @return a {@link java.util.List} object.
85 */
86 Set<String> getReadableProgramCodesByQuserId(int quserId);
87
88 /**
89 * Get user's programs (program with read/write rights <u>on data</u>)
90 *
91 * @param quserId a int.
92 * @return a {@link java.util.List} object.
93 */
94 Set<String> getWritableProgramCodesByQuserId(int quserId);
95
96 /**
97 * Get user's programs (user has manager rights on program)
98 *
99 * @param quserId a int.
100 * @return a {@link java.util.List} object.
101 */
102 Set<String> getManagedProgramCodesByQuserId(int quserId);
103
104 }