View Javadoc
1   /*
2     * #%L
3     * Quadrige2 Core
4     * %%
5     * Copyright (C) 2017 Ifremer
6     * %%
7     * This program is free software: you can redistribute it and/or modify
8     * it under the terms of the GNU Affero General Public License as published by
9     * the Free Software Foundation, either version 3 of the License, or
10    * (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    * GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU Affero General Public License
18    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19    * #L%
20    */
21  //
22  // Attention: Generated code! Do not modify by hand!
23  // Generated by: TypeSafeEnumeration.vsl in andromda-java-cartridge.
24  // Model Class:  Données::fr.ifremer.quadrige2.core::dao::system::rule::RuleControlEntity
25  // Metafacade:   org.andromda.metafacades.uml.Enumeration
26  // Stereotype:  Enumeration
27  //
28  package fr.ifremer.quadrige2.core.dao.system.rule;
29  
30  import fr.ifremer.quadrige2.core.dao.technical.Quadrige2EnumerationDef;
31  import java.io.Serializable;
32  import java.util.ArrayList;
33  import java.util.Collections;
34  import java.util.LinkedHashMap;
35  import java.util.List;
36  import java.util.Map;
37  import static org.nuiton.i18n.I18n.n;
38  
39  /**
40   * 
41   */
42  public enum RuleControlEntity
43      implements Serializable, Quadrige2EnumerationDef<String>
44  {
45      SURVEY_REEF_DB (
46  			"quadrige2.enumeration.RuleControlEntity.SURVEY_REEF_DB",
47  			n("quadrige2.enumeration.RuleControlEntity.SURVEY_REEF_DB.description"),
48  			"Observation"),
49      SAMPLING_OPERATION_REEF_DB (
50  			"quadrige2.enumeration.RuleControlEntity.SAMPLING_OPERATION_REEF_DB",
51  			n("quadrige2.enumeration.RuleControlEntity.SAMPLING_OPERATION_REEF_DB.description"),
52  			"Replicat"),
53      MEASUREMENT_REEF_DB (
54  			"quadrige2.enumeration.RuleControlEntity.MEASUREMENT_REEF_DB",
55  			n("quadrige2.enumeration.RuleControlEntity.MEASUREMENT_REEF_DB.description"),
56  			"Mesures"),
57      SURVEY (
58  			"quadrige2.enumeration.RuleControlEntity.SURVEY",
59  			n("quadrige2.enumeration.RuleControlEntity.SURVEY.description"),
60  			"Passage"),
61      SAMPLING_OPERATION (
62  			"quadrige2.enumeration.RuleControlEntity.SAMPLING_OPERATION",
63  			n("quadrige2.enumeration.RuleControlEntity.SAMPLING_OPERATION.description"),
64  			"Prélèvement"),
65      MEASUREMENT (
66  			"quadrige2.enumeration.RuleControlEntity.MEASUREMENT",
67  			n("quadrige2.enumeration.RuleControlEntity.MEASUREMENT.description"),
68  			"Résultat_de_mesure"),
69      TAXON_MEASUREMENT (
70  			"quadrige2.enumeration.RuleControlEntity.TAXON_MEASUREMENT",
71  			n("quadrige2.enumeration.RuleControlEntity.TAXON_MEASUREMENT.description"),
72  			"Résultat_de_mesure_sur_taxon");
73  
74      /**
75       * The serial version UID of this class. Needed for serialization.
76       */
77      private static final long serialVersionUID = 4496195833262270046L;
78  
79      private String key;
80      private String description;
81      private String enumValue;
82  
83      /**
84       * The constructor with enumeration literal value allowing
85       * super classes to access it.
86       */
87      private RuleControlEntity(String key, String description, String value)
88      {
89      	this.key = key;
90      	this.description = description;
91          this.enumValue = value;
92      }
93      
94      @Override
95       /**
96        * Setter for value. Use to override value, from configuration
97        */
98       public void setValue(String newValue) {
99  		if (newValue != null && !this.enumValue.equals(newValue)) {
100 			// Update static lists
101 	    	values.remove(this.enumValue);
102 	    	literals.remove(this.enumValue);
103 	    	this.enumValue = newValue;
104 	    	values.put(this.enumValue, this);
105 	    	literals.add(this.enumValue);
106 		}
107     }
108     
109 
110     @Override
111     public String getValueAsString()
112     {
113         return String.valueOf(this.enumValue);
114     }
115 
116     /**
117      * Retrieves an instance of RuleControlEntity from <code>its name</code>.
118      *
119      * @param name the name to create the RuleControlEntity from.
120      * @return The enumeration literal named after the 'name' argument
121      */
122     public static RuleControlEntity fromString(String name)
123     {
124         return RuleControlEntity.valueOf(name);
125     }
126 
127     /**
128      * Returns an enumeration literal String <code>value</code>.
129      * Required by JAXB2 enumeration implementation
130      *
131      * @return String with corresponding value
132      */
133     public String value()
134     {
135         return this.enumValue;
136     }
137 
138     /**
139      * Returns an instance of RuleControlEntity from String <code>value</code>.
140      * Required by JAXB2 enumeration implementation
141      *
142      * @param value the value to create the RuleControlEntity from.
143      * @return static Enumeration with corresponding value
144      */
145     public static RuleControlEntity fromValue(String value)
146     {
147         for (RuleControlEntity enumName: RuleControlEntity.values())
148         {
149             if (enumName.getValue().equals(value))
150             {
151                 return enumName;
152             }
153         }
154         throw new IllegalArgumentException("RuleControlEntity.fromValue(" + value + ')');
155     }
156 
157     /**
158      * Gets the underlying value of this type safe enumeration.
159      * This method is necessary to comply with DaoBase implementation.
160      * @return The name of this literal.
161      */
162     public String getValue()
163     {
164         return this.enumValue;
165     }
166     
167     @Override
168     public String getDescription() {
169     	return description;
170     }
171     
172     @Override
173     public String getKey() {
174     	return key;
175     }
176     
177     @Override
178     public Class<?> getType() {
179     	return String.class;
180     }
181     
182     /**
183      * Returns an unmodifiable list containing the literals that are known by this enumeration.
184      *
185      * @return A List containing the actual literals defined by this enumeration, this list
186      *         can not be modified.
187      */
188     public static List<String> literals()
189     {
190         return RuleControlEntity.literals;
191     }
192 
193     /**
194      * Returns an unmodifiable list containing the names of the literals that are known
195      * by this enumeration.
196      *
197      * @return A List containing the actual names of the literals defined by this
198      *         enumeration, this list can not be modified.
199      */
200     public static List<String> names()
201     {
202         return RuleControlEntity.names;
203     }
204 
205     private static Map<String, RuleControlEntity> values = new LinkedHashMap<String, RuleControlEntity>(7, 1);
206     private static List<String> literals = new ArrayList<String>(7);
207     private static List<String> names = new ArrayList<String>(7);
208     private static List<RuleControlEntity> valueList = new ArrayList<RuleControlEntity>(7);
209 
210     /**
211      * Initializes the values.
212      */
213     static
214     {
215         synchronized (RuleControlEntity.values)
216         {
217             RuleControlEntity.values.put(SURVEY_REEF_DB.enumValue, SURVEY_REEF_DB);
218             RuleControlEntity.values.put(SAMPLING_OPERATION_REEF_DB.enumValue, SAMPLING_OPERATION_REEF_DB);
219             RuleControlEntity.values.put(MEASUREMENT_REEF_DB.enumValue, MEASUREMENT_REEF_DB);
220             RuleControlEntity.values.put(SURVEY.enumValue, SURVEY);
221             RuleControlEntity.values.put(SAMPLING_OPERATION.enumValue, SAMPLING_OPERATION);
222             RuleControlEntity.values.put(MEASUREMENT.enumValue, MEASUREMENT);
223             RuleControlEntity.values.put(TAXON_MEASUREMENT.enumValue, TAXON_MEASUREMENT);
224         }
225         synchronized (RuleControlEntity.valueList)
226         {
227             RuleControlEntity.valueList.add(SURVEY_REEF_DB);
228             RuleControlEntity.valueList.add(SAMPLING_OPERATION_REEF_DB);
229             RuleControlEntity.valueList.add(MEASUREMENT_REEF_DB);
230             RuleControlEntity.valueList.add(SURVEY);
231             RuleControlEntity.valueList.add(SAMPLING_OPERATION);
232             RuleControlEntity.valueList.add(MEASUREMENT);
233             RuleControlEntity.valueList.add(TAXON_MEASUREMENT);
234             // For Quadrige2, lists could be reload from configuration (see method 'setValue')
235             //RuleControlEntity.valueList = Collections.unmodifiableList(valueList);
236         }
237         synchronized (RuleControlEntity.literals)
238         {
239             RuleControlEntity.literals.add(SURVEY_REEF_DB.enumValue);
240             RuleControlEntity.literals.add(SAMPLING_OPERATION_REEF_DB.enumValue);
241             RuleControlEntity.literals.add(MEASUREMENT_REEF_DB.enumValue);
242             RuleControlEntity.literals.add(SURVEY.enumValue);
243             RuleControlEntity.literals.add(SAMPLING_OPERATION.enumValue);
244             RuleControlEntity.literals.add(MEASUREMENT.enumValue);
245             RuleControlEntity.literals.add(TAXON_MEASUREMENT.enumValue);
246             // For Quadrige2, lists could be reload from configuration (see method 'setValue')
247             //RuleControlEntity.literals = Collections.unmodifiableList(literals);
248         }
249         synchronized (RuleControlEntity.names)
250         {
251             RuleControlEntity.names.add("SURVEY_REEF_DB");
252             RuleControlEntity.names.add("SAMPLING_OPERATION_REEF_DB");
253             RuleControlEntity.names.add("MEASUREMENT_REEF_DB");
254             RuleControlEntity.names.add("SURVEY");
255             RuleControlEntity.names.add("SAMPLING_OPERATION");
256             RuleControlEntity.names.add("MEASUREMENT");
257             RuleControlEntity.names.add("TAXON_MEASUREMENT");
258             RuleControlEntity.names = Collections.unmodifiableList(names);
259         }
260     }
261     // type-safe-enumeration-object java merge-point
262 }