View Javadoc
1   /*
2    * Copyright (c) 2002-2023, 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.document.business.attributes;
35  
36  import fr.paris.lutece.portal.service.i18n.I18nService;
37  import fr.paris.lutece.portal.service.i18n.Localizable;
38  
39  import java.util.ArrayList;
40  import java.util.List;
41  import java.util.Locale;
42  
43  /**
44   * This class represents the business object AttributeTypeParameter
45   */
46  public class AttributeTypeParameter implements Localizable
47  {
48      // Variables declarations
49      private String _strName;
50      private String _strLabelKey;
51      private String _strDescriptionKey;
52      private List<String> _listDefaultValue = new ArrayList<String>( );
53      private List<String> _listValues = new ArrayList<String>( );
54      private Locale _locale;
55  
56      /**
57       * Returns the Name
58       *
59       * @return The Name
60       */
61      public String getName( )
62      {
63          return _strName;
64      }
65  
66      /**
67       * Returns the Locale
68       *
69       * @return The Locale
70       */
71      public Locale getLocale( )
72      {
73          return _locale;
74      }
75  
76      /**
77       * Sets the Locale
78       *
79       * @param locale
80       *            The Locale
81       */
82      public void setLocale( Locale locale )
83      {
84          _locale = locale;
85      }
86  
87      /**
88       * Sets the Name
89       *
90       * @param strName
91       *            The Name
92       */
93      public void setName( String strName )
94      {
95          _strName = strName;
96      }
97  
98      /**
99       * Returns the Label
100      *
101      * @return The Label
102      */
103     public String getLabelKey( )
104     {
105         return _strLabelKey;
106     }
107 
108     /**
109      * Sets the Label
110      *
111      * @param strLabelKey
112      *            The Label
113      */
114     public void setLabelKey( String strLabelKey )
115     {
116         _strLabelKey = strLabelKey;
117     }
118 
119     /**
120      * Returns the Description
121      *
122      * @return The Description
123      */
124     public String getDescriptionKey( )
125     {
126         return _strDescriptionKey;
127     }
128 
129     /**
130      * Sets the Description
131      *
132      * @param strDescriptionKey
133      *            The Description
134      */
135     public void setDescriptionKey( String strDescriptionKey )
136     {
137         _strDescriptionKey = strDescriptionKey;
138     }
139 
140     /**
141      * Set the value list
142      * 
143      * @param listValues
144      *            The new list of values
145      */
146     public void setValueList( List<String> listValues )
147     {
148         _listValues.clear( );
149         _listValues.addAll( listValues );
150     }
151 
152     /**
153      *
154      * @return listValues
155      */
156     public List<String> getValueList( )
157     {
158         List<String> returnList = new ArrayList<String>( );
159         returnList.addAll( _listValues );
160 
161         return returnList;
162     }
163 
164     /**
165      * Returns the Label
166      *
167      * @return The Label
168      */
169     public String getLabel( )
170     {
171         return I18nService.getLocalizedString( _strLabelKey, _locale );
172     }
173 
174     /**
175      * Returns the Description
176      *
177      * @return The Description
178      */
179     public String getDescription( )
180     {
181         return I18nService.getLocalizedString( _strDescriptionKey, _locale );
182     }
183 
184     /**
185      * Returns the default value
186      *
187      * @return The default value
188      */
189     public List<String> getDefaultValue( )
190     {
191         List<String> returnList = new ArrayList<String>( );
192         returnList.addAll( _listDefaultValue );
193 
194         return returnList;
195     }
196 
197     /**
198      * Set the default value
199      * 
200      * @param listDefaultValue
201      *            The list of default values
202      */
203     public void setDefaultValue( List<String> listDefaultValue )
204     {
205         _listDefaultValue.clear( );
206         _listDefaultValue.addAll( listDefaultValue );
207     }
208 }