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