View Javadoc
1   /*
2    * Copyright(c) 2002-2013, 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.document.business.workflow;
35  
36  import fr.paris.lutece.portal.service.i18n.I18nService;
37  import fr.paris.lutece.portal.service.i18n.Localizable;
38  import fr.paris.lutece.portal.service.rbac.RBACAction;
39  
40  import java.util.Locale;
41  
42  
43  /**
44   * This class represents the business object DocumentAction
45   */
46  public class DocumentAction implements Localizable, RBACAction
47  {
48      public static final int ACTION_SUBMIT = 3;
49      public static final int ACTION_SUBMIT_CHANGE = 10;
50      public static final int ACTION_VALIDATE = 4;
51      public static final int ACTION_VALIDATE_CHANGE = 12;
52      public static final int ACTION_REFUSE = 6;
53      public static final int ACTION_REFUSE_CHANGE = 11;
54      public static final int ACTION_ARCHIVE = 8;
55      public static final int ACTION_UNARCHIVE = 13;
56  
57      // Variables declarations
58      private int _nIdAction;
59      private String _strUrl;
60      private String _strNameKey;
61      private String _strDescriptionKey;
62      private Locale _locale;
63      private String _strIconUrl;
64      private String _strPermission;
65      private DocumentState _finishDocumentState;
66  
67      /**
68       *
69       * @return the id of the document action
70       */
71      public int getIdAction(  )
72      {
73          return _nIdAction;
74      }
75  
76      /**
77       * set the id of the document action
78       * @param idAction the id of the document action
79       */
80      public void setIdAction( int idAction )
81      {
82          _nIdAction = idAction;
83      }
84  
85      /**
86       *
87       * @return the state of the document  after doing the action
88       */
89      public DocumentState getFinishDocumentState(  )
90      {
91          return _finishDocumentState;
92      }
93  
94      /**
95       * set  the state of the document  after doing the action
96       * @param documentState  the state of the document  after doing the action
97       */
98      public void setFinishDocumentState( DocumentState documentState )
99      {
100         _finishDocumentState = documentState;
101     }
102 
103     /**
104     * Implements Localizable
105     * @param locale The current locale
106     */
107     public void setLocale( Locale locale )
108     {
109         _locale = locale;
110     }
111 
112     /**
113      * Returns the Url
114      *
115      * @return The Url
116      */
117     public String getUrl(  )
118     {
119         return _strUrl;
120     }
121 
122     /**
123      * Sets the Url
124      *
125      * @param strUrl The Url
126      */
127     public void setUrl( String strUrl )
128     {
129         _strUrl = strUrl;
130     }
131 
132     /**
133      * Returns the NameKey
134      *
135      * @return The NameKey
136      */
137     public String getNameKey(  )
138     {
139         return _strNameKey;
140     }
141 
142     /**
143      * Returns the Name
144      *
145      * @return The Name
146      */
147     public String getName(  )
148     {
149         return I18nService.getLocalizedString( _strNameKey, _locale );
150     }
151 
152     /**
153      * Sets the NameKey
154      *
155      * @param strNameKey The NameKey
156      */
157     public void setNameKey( String strNameKey )
158     {
159         _strNameKey = strNameKey;
160     }
161 
162     /**
163      * Returns the DescriptionKey
164      *
165      * @return The DescriptionKey
166      */
167     public String getDescriptionKey(  )
168     {
169         return _strDescriptionKey;
170     }
171 
172     /**
173      * Returns the Description
174      *
175      * @return The Description
176      */
177     public String getDescription(  )
178     {
179         return I18nService.getLocalizedString( _strDescriptionKey, _locale );
180     }
181 
182     /**
183      * Sets the DescriptionKey
184      *
185      * @param strDescriptionKey The DescriptionKey
186      */
187     public void setDescriptionKey( String strDescriptionKey )
188     {
189         _strDescriptionKey = strDescriptionKey;
190     }
191 
192     /**
193      * Returns the IconUrl
194      *
195      * @return The IconUrl
196      */
197     public String getIconUrl(  )
198     {
199         return _strIconUrl;
200     }
201 
202     /**
203      * Sets the IconUrl
204      *
205      * @param strIconUrl The IconUrl
206      */
207     public void setIconUrl( String strIconUrl )
208     {
209         _strIconUrl = strIconUrl;
210     }
211 
212     /**
213      * Returns the permission associated to the action
214      * @return The permission
215      */
216     public String getPermission(  )
217     {
218         return _strPermission;
219     }
220 
221     /**
222      * Sets the Permission
223      *
224      * @param strPermission The Permission
225      */
226     public void setPermission( String strPermission )
227     {
228         _strPermission = strPermission;
229     }
230 }