View Javadoc
1   /*
2    * Copyright (c) 2002-2014, 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  package fr.paris.lutece.plugins.quiz.business;
35  
36  /**
37   * This is the business class for the object QuestionGroup
38   */
39  public class QuestionGroup
40  {
41      // Variables declarations
42      private int _nIdGroup;
43      private String _strLabelGroup;
44      private String _strSubject;
45      private int _nIdQuiz;
46      private int _nPositionGroup;
47      private boolean _bIsFreeHtml;
48      private String _strHtmlContent;
49      private int _nIdImage;
50      private boolean _bDisplayScore;
51  
52      /**
53       * Returns the IdGroup
54       * @return The IdGroup
55       */
56      public int getIdGroup( )
57      {
58          return _nIdGroup;
59      }
60  
61      /**
62       * Sets the IdGroup
63       * @param nIdGroup The IdGroup
64       */
65      public void setIdGroup( int nIdGroup )
66      {
67          _nIdGroup = nIdGroup;
68      }
69  
70      /**
71       * Returns the LabelGroup
72       * @return The LabelGroup
73       */
74      public String getLabelGroup( )
75      {
76          return _strLabelGroup;
77      }
78  
79      /**
80       * Sets the LabelGroup
81       * @param strLabelGroup The LabelGroup
82       */
83      public void setLabelGroup( String strLabelGroup )
84      {
85          _strLabelGroup = strLabelGroup;
86      }
87  
88      /**
89       * Returns the Subject
90       * @return The Subject
91       */
92      public String getSubject( )
93      {
94          return _strSubject;
95      }
96  
97      /**
98       * Sets the Subject
99       * @param strSubject The Subject
100      */
101     public void setSubject( String strSubject )
102     {
103         _strSubject = strSubject;
104     }
105 
106     /**
107      * Returns the identifier of this Quiz.
108      * @return _nIdQuiz The Quiz identifier
109      */
110     public int getIdQuiz( )
111     {
112         return _nIdQuiz;
113     }
114 
115     /**
116      * Sets the identifier of the quiz to the specified integer.
117      * @param nIdQuiz The quiz identifier
118      */
119     public void setIdQuiz( int nIdQuiz )
120     {
121         _nIdQuiz = nIdQuiz;
122     }
123 
124     /**
125      * Returns the identifier of this Quiz.
126      * @return _nIdQuiz The Quiz identifier
127      */
128     public int getPositionGroup( )
129     {
130         return _nPositionGroup;
131     }
132 
133     /**
134      * Sets the identifier of the quiz to the specified integer.
135      * @param nPositionGroup The group position
136      */
137     public void setPositionGroup( int nPositionGroup )
138     {
139         _nPositionGroup = nPositionGroup;
140     }
141 
142     /**
143      * Check if this group is a group with free HTML
144      * @return True if this group is a group with free HTML, false if it has
145      *         questions
146      */
147     public boolean getIsFreeHtml( )
148     {
149         return _bIsFreeHtml;
150     }
151 
152     /**
153      * Set this group free HTML group or a question group
154      * @param bIsFreeHtml True if this group is a group with free HTML, false if
155      *            it has questions
156      */
157     public void setIsFreeHtml( boolean bIsFreeHtml )
158     {
159         this._bIsFreeHtml = bIsFreeHtml;
160     }
161 
162     /**
163      * Get the HTMl content of this group, or null if this group is not a free
164      * HTML group
165      * @return the HTMl content of this group, or null if this group is not a
166      *         free HTML group
167      */
168     public String getHtmlContent( )
169     {
170         return _strHtmlContent;
171     }
172 
173     /**
174      * Set the HTMl content of this group, or null if this group is not a free
175      * HTML group
176      * @param strHtmlContent the HTMl content of this group, or null if this
177      *            group is not a free HTML group
178      */
179     public void setHtmlContent( String strHtmlContent )
180     {
181         this._strHtmlContent = strHtmlContent;
182     }
183 
184     /**
185      * Get the id of the image
186      * @return the id of the image
187      */
188     public int getIdImage( )
189     {
190         return _nIdImage;
191     }
192 
193     /**
194      * Set the id of the image
195      * @param nIdImage the id of the image
196      */
197     public void setIdImage( int nIdImage )
198     {
199         _nIdImage = nIdImage;
200     }
201 
202     /**
203      * Check if the score of the quiz should be displayed in this group. Only
204      * free HTML group can display scores
205      * @return True if the group should display the score of the quiz, false
206      *         otherwise.
207      */
208     public boolean getDisplayScore( )
209     {
210         return _bIsFreeHtml && _bDisplayScore;
211     }
212 
213     /**
214      * Indicates that this group must display the score of the quiz or not
215      * @param bDisplayResult True if the group must display the score of the
216      *            quiz, false otherwise
217      */
218     public void setDisplayScore( boolean bDisplayResult )
219     {
220         _bDisplayScore = bDisplayResult;
221     }
222 }