View Javadoc
1   package fr.ifremer.quadrige3.core.service.data.survey;
2   
3   /*-
4    * #%L
5    * Quadrige3 Core :: Quadrige3 Server 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.DataLockedException;
27  import fr.ifremer.quadrige3.core.vo.data.survey.CampaignVO;
28  import org.springframework.transaction.annotation.Propagation;
29  import org.springframework.transaction.annotation.Transactional;
30  
31  import java.util.List;
32  
33  /**
34   * <p>
35   * Campaign service interface.
36   * </p>
37   * 
38   */
39  @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
40  public interface CampaignService {
41  
42  	/**
43  	 * <p>
44  	 * save a campaign
45  	 * </p>
46  	 *
47  	 * @param bean
48  	 *            a {@link CampaignVO} object.
49  	 * @return a {@link CampaignVO} object.
50  	 */
51  	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = { RuntimeException.class, DataLockedException.class })
52  	CampaignVO save(CampaignVO bean);
53  
54  	/**
55  	 * <p>
56  	 * save a list of campaigns
57  	 * </p>
58  	 *
59  	 * @param bean
60  	 *            a {@link CampaignVO} object.
61  	 * @return a {@link CampaignVO} object.
62  	 */
63  	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = { RuntimeException.class, DataLockedException.class })
64  	List<CampaignVO> save(List<CampaignVO> bean);
65  
66  	/**
67  	 * Delete a list of campaign
68  	 *
69  	 * @param campaignIds the campaign ids
70  	 */
71  	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = { RuntimeException.class, DataLockedException.class })
72  	void delete(List<Integer> campaignIds);
73  
74  	/**
75  	 * <p>
76  	 * getByCode.
77  	 * </p>
78  	 *
79  	 * @param campaignId
80  	 *            a {@link Integer} object.
81  	 * @return a {@link CampaignVO} object.
82  	 */
83  	CampaignVO getById(int campaignId);
84  
85  	/**
86  	 * <p>
87  	 * Get campaign ids, where user has write permission.
88  	 * </p>
89  	 *
90  	 * @param campaignId
91  	 *            user id
92  	 * @return Array of campaign id
93  	 */
94  	boolean isCampaignUsedBySurvey(int campaignId);
95  
96  }