View Javadoc
1   /*
2    * Copyright (c) 2002-2020, City of 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  package fr.paris.lutece.plugins.campagnebp.service;
35  
36  import java.sql.Timestamp;
37  
38  import fr.paris.lutece.plugins.campagnebp.business.Campagne;
39  
40  /**
41   *
42   */
43  public interface ICampagneService
44  {
45  
46      // Returns the campain the code of which is the SQL 'max'.
47      // Ex : if 6 campagne with 'B0' - 'C' - 'D' - 'G0' - 'GA' - 'G', returns campagne 'GA'.
48  
49      /**
50       * @return Data
51       */
52      public Campagne getLastCampagne( );
53  
54      /**
55       * @param campagne
56       *            Data
57       * @param phase
58       *            Data
59       * @return Data
60       */
61      public boolean isBeforeBeginning( String campagne, String phase ); // ......current < PHASE_BEGINNING
62  
63      /**
64       * @param campagne
65       *            Data
66       * @param phase
67       *            Data
68       * @return Data
69       */
70      public boolean isBeforeEnd( String campagne, String phase ); // ..................................current < PHASE_END
71  
72      /**
73       * @param campagne
74       *            Data
75       * @param phase
76       *            Data
77       * @return Data
78       */
79      public boolean isDuring( String campagne, String phase ); // PHASE_BEGINNING < current < PHASE_END
80  
81      /**
82       * @param campagne
83       *            Data
84       * @param phase
85       *            Data
86       * @return Data
87       */
88      public boolean isAfterBeginning( String campagne, String phase ); // PHASE_BEGINNING < current............................
89  
90      /**
91       * @param campagne
92       *            Data
93       * @param phase
94       *            Data
95       * @return Data
96       */
97      public boolean isAfterEnd( String campagne, String phase ); // PHASE_END < current......
98  
99      /**
100      * @param campagne
101      *            Data
102      * @param phase
103      *            Data
104      * @return Data
105      */
106     public Timestamp start( String campagne, String phase );
107 
108     /**
109      * @param campagne
110      *            Data
111      * @param phase
112      *            Data
113      * @return Data
114      */
115     public Timestamp end( String campagne, String phase );
116 
117     /**
118      * @param campagne
119      *            Data
120      * @param phase
121      *            Data
122      * @param format
123      *            Data
124      * @param withAccents
125      *            Data
126      * @return Data
127      */
128     public String startStr( String campagne, String phase, String format, boolean withAccents );
129 
130     /**
131      * @param campagne
132      *            Data
133      * @param phase
134      *            Data
135      * @param format
136      *            Data
137      * @param withAccents
138      *            Data
139      * @return Data
140      */
141     public String endStr( String campagne, String phase, String format, boolean withAccents );
142 
143     // Same as precedent, for last campagne
144     /**
145      * @param phase
146      *            Data
147      * @return Data
148      */
149     public boolean isBeforeBeginning( String phase );
150 
151     /**
152      * @param phase
153      *            Data
154      * @return Data
155      */
156     public boolean isBeforeEnd( String phase );
157 
158     /**
159      * @param phase
160      *            Data
161      * @return Data
162      */
163     public boolean isDuring( String phase );
164 
165     /**
166      * @param phase
167      *            Data
168      * @return Data
169      */
170     public boolean isAfterBeginning( String phase );
171 
172     /**
173      * @param phase
174      *            Data
175      * @return Data
176      */
177     public boolean isAfterEnd( String phase );
178 
179     /**
180      * @param phase
181      *            Data
182      * @return Data
183      */
184     public Timestamp start( String phase );
185 
186     /**
187      * @param phase
188      *            Data
189      * @return Data
190      */
191     public Timestamp end( String phase );
192 
193     /**
194      * @param phase
195      *            Data
196      * @param format
197      *            Data
198      * @param withAccents
199      *            Data
200      * @return Data
201      */
202     public String startStr( String phase, String format, boolean withAccents );
203 
204     /**
205      * @param phase
206      *            Data
207      * @param format
208      *            Data
209      * @param withAccents
210      *            Data
211      * @return Data
212      */
213     public String endStr( String phase, String format, boolean withAccents );
214 
215     /**
216      * 
217      */
218     // Resets the internal cache of phases
219     public void reset( );
220 
221 }