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.business;
35  
36  import java.io.Serializable;
37  import java.util.List;
38  
39  import javax.validation.constraints.Size;
40  
41  import org.hibernate.validator.constraints.NotEmpty;
42  
43  import fr.paris.lutece.portal.business.file.File;
44  
45  /**
46   * This is the business class for the object Campagne
47   */
48  public class Campagne implements Serializable
49  {
50      private static final long serialVersionUID = 1L;
51  
52      /**
53       * Scope values
54       */
55      public enum Scope
56      {
57          SCOPE_CITY( "city" ),
58          SCOPE_DISTRICT( "district" );
59  
60          private final String strCode;
61  
62          Scope( String strCode )
63          {
64              this.strCode = strCode;
65          }
66  
67          public String getCode( )
68          {
69              return this.strCode;
70          }
71      }
72  
73      // Variables declarations
74      private int _nId;
75  
76      @NotEmpty( message = "#i18n{ideation.validation.campagne.Code.notEmpty}" )
77      @Size( max = 50, message = "#i18n{ideation.validation.campagne.Code.size}" )
78      private String _strCode;
79  
80      @NotEmpty( message = "#i18n{ideation.validation.campagne.Title.notEmpty}" )
81      @Size( max = 255, message = "#i18n{ideation.validation.campagne.Title.size}" )
82      private String _strTitle;
83  
84      private boolean _bActive;
85  
86      @NotEmpty( message = "#i18n{ideation.validation.campagne.CodeModerationType.notEmpty}" )
87      @Size( max = 50, message = "#i18n{ideation.validation.campagne.CodeModerationType.size}" )
88      private String _strCodeModerationType;
89  
90      @NotEmpty( message = "#i18n{ideation.validation.campagne.Description.notEmpty}" )
91      private String _strDescription;
92  
93      private int _nModerationDuration;
94  
95      private String _strScope;
96  
97      private List<File> _listImgs;
98  
99      /**
100      * Returns the Id
101      * 
102      * @return The Id
103      */
104     public int getId( )
105     {
106         return _nId;
107     }
108 
109     /**
110      * Sets the Id
111      * 
112      * @param nId
113      *            The Id
114      */
115     public void setId( int nId )
116     {
117         _nId = nId;
118     }
119 
120     /**
121      * Returns the Code
122      * 
123      * @return The Code
124      */
125     public String getCode( )
126     {
127         return _strCode;
128     }
129 
130     /**
131      * Sets the Code
132      * 
133      * @param strCode
134      *            The Code
135      */
136     public void setCode( String strCode )
137     {
138         _strCode = strCode;
139     }
140 
141     /**
142      * Returns the Title
143      * 
144      * @return The Title
145      */
146     public String getTitle( )
147     {
148         return _strTitle;
149     }
150 
151     /**
152      * Sets the Title
153      * 
154      * @param strTitle
155      *            The Title
156      */
157     public void setTitle( String strTitle )
158     {
159         _strTitle = strTitle;
160     }
161 
162     /**
163      * Returns the Active
164      * 
165      * @return The Active
166      */
167     public boolean getActive( )
168     {
169         return _bActive;
170     }
171 
172     /**
173      * Sets the Active
174      * 
175      * @param bActive
176      *            The Active
177      */
178     public void setActive( boolean bActive )
179     {
180         _bActive = bActive;
181     }
182 
183     /**
184      * Returns the CodeModerationType
185      * 
186      * @return The CodeModerationType
187      */
188     public String getCodeModerationType( )
189     {
190         return _strCodeModerationType;
191     }
192 
193     /**
194      * Sets the CodeModerationType
195      * 
196      * @param strCodeModerationType
197      *            The CodeModerationType
198      */
199     public void setCodeModerationType( String strCodeModerationType )
200     {
201         _strCodeModerationType = strCodeModerationType;
202     }
203 
204     /**
205      * Returns the Description
206      * 
207      * @return The Description
208      */
209     public String getDescription( )
210     {
211         return _strDescription;
212     }
213 
214     /**
215      * Sets the Description
216      * 
217      * @param strDescription
218      *            The Description
219      */
220     public void setDescription( String strDescription )
221     {
222         _strDescription = strDescription;
223     }
224 
225     /**
226      * Returns the ModerationDuration
227      * 
228      * @return The ModerationDuration
229      */
230     public int getModerationDuration( )
231     {
232         return _nModerationDuration;
233     }
234 
235     /**
236      * Sets the ModerationDuration
237      * 
238      * @param nModerationDuration
239      *            The ModerationDuration
240      */
241     public void setModerationDuration( int nModerationDuration )
242     {
243         _nModerationDuration = nModerationDuration;
244     }
245 
246     /**
247      * @return the Imgs
248      */
249     public List<File> getImgs( )
250     {
251         return _listImgs;
252     }
253 
254     /**
255      * @param Imgs
256      *            the Imgs to set
257      */
258     public void setImgs( List<File> Imgs )
259     {
260         this._listImgs = Imgs;
261     }
262 
263     /**
264      * Returns the scope of the campaign.
265      * 
266      * @return The scope ('city' or 'whole'), or null if not scoped
267      */
268     public String getScope( )
269     {
270         return _strScope;
271     }
272 
273     /**
274      * Sets the scope of the campaign.
275      * 
276      * @param nModerationDuration
277      *            The scope ('city' or 'whole'), or null if not scoped
278      */
279     public void setScope( String strScope )
280     {
281     	_strScope = strScope;
282     }
283 
284 }