View Javadoc
1   /*
2    * Copyright (c) 2002-2019, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  
35  package fr.paris.lutece.plugins.atelieraba.business;
36  
37  import java.sql.Timestamp;
38  import java.util.List;
39  import java.util.Map;
40  
41  import fr.paris.lutece.portal.service.plugin.Plugin;
42  import fr.paris.lutece.util.ReferenceList;
43  
44  /**
45   * ICoursDAO Interface
46   */
47  public interface ICoursDAO
48  {
49      /**
50       * Insert a new record in the table.
51       *
52       * @param cours
53       *            instance of the Cours object to insert
54       * @param plugin
55       *            the Plugin
56       */
57      void insert( Cours cours, Plugin plugin );
58  
59      /**
60       * Update the record in the table
61       *
62       * @param cours
63       *            the reference of the Cours
64       * @param plugin
65       *            the Plugin
66       */
67      void store( Cours cours, Plugin plugin );
68  
69      /**
70       * Delete a record from the table
71       *
72       * @param nKey
73       *            The identifier of the Cours to delete
74       * @param plugin
75       *            the Plugin
76       */
77      void delete( int nKey, Plugin plugin );
78  
79      ///////////////////////////////////////////////////////////////////////////
80      // Finders
81  
82      /**
83       * Load the data from the table
84       *
85       * @param nKey
86       *            The identifier of the cours
87       * @param plugin
88       *            the Plugin
89       * @return The instance of the cours
90       */
91      Cours load( int nKey, Plugin plugin );
92  
93      /**
94       * Load the data of all the cours objects and returns them as a list
95       *
96       * @param plugin
97       *            the Plugin
98       * @return The list which contains the data of all the cours objects
99       */
100     List<Cours> selectCourssList( Plugin plugin );
101 
102     /**
103      * Load the id of all the cours objects and returns them as a list
104      *
105      * @param plugin
106      *            the Plugin
107      * @return The list which contains the id of all the cours objects
108      */
109     List<Integer> selectIdCourssList( Plugin plugin );
110 
111     /**
112      * Load the data of all the cours objects and returns them as a referenceList
113      *
114      * @param plugin
115      *            the Plugin
116      * @return The referenceList which contains the data of all the cours objects
117      */
118     ReferenceList selectCourssReferenceList( Plugin plugin );
119 
120     /**
121      * Load the data from the table
122      *
123      * @param nKey
124      *            The identifier of the cours
125      * @param plugin
126      *            the Plugin
127      * @return The instance of the cours
128      */
129     Cours selectByCode( String discipline, String atelier, String creneau, Plugin plugin );
130 
131     /**
132      * Load the names of the disciplines and returns them as a list
133      *
134      * @param plugin
135      *            the Plugin
136      * @return The list which contains the names of the disciplines
137      */
138     List<String> selectDisciplinesList( Plugin plugin );
139 
140     /**
141      * Load the names of the ateliers and returns them as a list
142      *
143      * @param plugin
144      *            the Plugin
145      * @return The list which contains the names of the ateliers
146      */
147     List<String> selectAteliersList( Plugin plugin );
148 
149     /**
150      * Load the names of the creneaux and returns them as a list
151      *
152      * @param plugin
153      *            the Plugin
154      * @return The list which contains the names of the creneaux
155      */
156     List<String> selectCreneauxList( Plugin plugin );
157 
158     /**
159      * Count the number of Inscrits by State and by Cours and returns them as a Map
160      *
161      * @param plugin
162      *            the Plugin
163      * @return The Map which contains the number of Inscrits by State and by Cours
164      */
165     Map<Integer, CoursCounter> selectNbInscritsByStateByCours( Plugin plugin );
166 
167     /**
168      * Count the number of Places Vivantes by Cours and returns them as a Map
169      *
170      * @param plugin
171      *            the Plugin
172      * @return The Map which contains the number of Places Vivantes by Cours
173      */
174     Map<Integer, Integer> countPlacesVivantesList( Plugin plugin );
175 
176     /**
177      * Return true (Places disponibles) else false (Places en attente)
178      *
179      * @param plugin
180      *            the Plugin
181      * @param dateInscription
182      *            the subscription date of the Inscrit
183      * @param idCours
184      *            the id of the Cours
185      * @return true (Places disponibles) else false (Places en attente)
186      */
187     boolean accesPlacesDisponibles( Plugin plugin, Timestamp dateInscription, int idCours );
188 }