View Javadoc
1   package fr.ifremer.tutti.persistence.service;
2   
3   /*
4    * #%L
5    * Tutti :: Persistence
6    * %%
7    * Copyright (C) 2012 - 2014 Ifremer
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 fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
26  import fr.ifremer.tutti.persistence.entities.data.Program;
27  import org.springframework.cache.annotation.CacheEvict;
28  import org.springframework.cache.annotation.Cacheable;
29  import org.springframework.transaction.annotation.Transactional;
30  
31  import java.util.List;
32  
33  /**
34   * CRUD of {@link Program} entity.
35   *
36   * @author Tony Chemit - chemit@codelutin.com
37   * @since 0.3
38   */
39  @Transactional(readOnly = true)
40  public interface ProgramPersistenceService extends TuttiPersistenceServiceImplementor {
41  
42      /**
43       * Get all programs.
44       *
45       * <strong>Note:</strong> For each program, his zone is loaded.
46       *
47       * @return the list of programs found in db.
48       */
49      @Cacheable(value = "programs")
50      List<Program> getAllProgram();
51  
52      /**
53       * Get the program for the given {@code id}.
54       *
55       * <strong>Note:</strong> his zone is loaded.
56       *
57       * @param id id of the program to load
58       * @return the loaded program
59       */
60      Program getProgram(String id);
61  
62      @Transactional(readOnly = false)
63      @CacheEvict(value = {"programs", "programZones"}, allEntries = true)
64      Program createProgram(Program bean);
65  
66      @Transactional(readOnly = false)
67      @CacheEvict(value = {"programs", "programZones"}, allEntries = true)
68      Program saveProgram(Program bean);
69  
70  }