001/*
002 * #%L
003 * SIH-Adagio
004 * $Id: javaMergeMappings.xml 12002 2014-03-26 10:17:22Z bl05b3e $
005 * $HeadURL: https://forge.ifremer.fr/svn/sih-adagio/tags/adagio-3.5.6/mda/src/main/config/javaMergeMappings.xml $
006 * %%
007 * Copyright (C) 2012 - 2013 Ifremer
008 * %%
009 * This program is free software: you can redistribute it and/or modify
010 * it under the terms of the GNU Affero General Public License as published by
011 * the Free Software Foundation, either version 3 of the License, or
012 * (at your option) any later version.
013 * 
014 * This program is distributed in the hope that it will be useful,
015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017 * GNU General Public License for more details.
018 * 
019 * You should have received a copy of the GNU Affero General Public License
020 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
021 * #L%
022 */
023//
024// Attention: Generated code! Do not modify by hand!
025// Generated by: TypeSafeEnumeration.vsl in andromda-java-cartridge.
026// Model Class:  Data::fr.ifremer.adagio.core.dao::referential::QualityFlagCode
027// Metafacade:   org.andromda.metafacades.uml.Enumeration
028// Stereotype:  Enumeration
029//
030package fr.ifremer.adagio.core.dao.referential;
031
032import fr.ifremer.adagio.core.dao.technical.AdagioEnumerationDef;
033import java.io.Serializable;
034import java.util.ArrayList;
035import java.util.Collections;
036import java.util.LinkedHashMap;
037import java.util.List;
038import java.util.Map;
039import static org.nuiton.i18n.I18n.n;
040
041/**
042 * 
043 */
044public enum QualityFlagCode
045    implements Serializable, AdagioEnumerationDef<String>
046{
047    /** TODO: Model Documentation for Enumeration Literal NOTQUALIFIED value "0" */
048    NOTQUALIFIED (
049            "adagio.enumeration.QualityFlagCode.NOTQUALIFIED", 
050            n("adagio.enumeration.QualityFlagCode.NOTQUALIFIED.description"), 
051            "0"),
052    /** TODO: Model Documentation for Enumeration Literal GOOD value "1" */
053    GOOD (
054            "adagio.enumeration.QualityFlagCode.GOOD", 
055            n("adagio.enumeration.QualityFlagCode.GOOD.description"), 
056            "1"),
057    /** TODO: Model Documentation for Enumeration Literal OUT_OF_STAT value "2" */
058    OUT_OF_STAT (
059            "adagio.enumeration.QualityFlagCode.OUT_OF_STAT", 
060            n("adagio.enumeration.QualityFlagCode.OUT_OF_STAT.description"), 
061            "2"),
062    /** TODO: Model Documentation for Enumeration Literal DOUBTFUL value "3" */
063    DOUBTFUL (
064            "adagio.enumeration.QualityFlagCode.DOUBTFUL", 
065            n("adagio.enumeration.QualityFlagCode.DOUBTFUL.description"), 
066            "3"),
067    /** TODO: Model Documentation for Enumeration Literal BAD value "4" */
068    BAD (
069            "adagio.enumeration.QualityFlagCode.BAD", 
070            n("adagio.enumeration.QualityFlagCode.BAD.description"), 
071            "4"),
072    /** TODO: Model Documentation for Enumeration Literal CORRECTED value "5" */
073    CORRECTED (
074            "adagio.enumeration.QualityFlagCode.CORRECTED", 
075            n("adagio.enumeration.QualityFlagCode.CORRECTED.description"), 
076            "5"),
077    /** TODO: Model Documentation for Enumeration Literal INCOMPLETE value "8" */
078    INCOMPLETE (
079            "adagio.enumeration.QualityFlagCode.INCOMPLETE", 
080            n("adagio.enumeration.QualityFlagCode.INCOMPLETE.description"), 
081            "8"),
082    /** TODO: Model Documentation for Enumeration Literal MISSING value "9" */
083    MISSING (
084            "adagio.enumeration.QualityFlagCode.MISSING", 
085            n("adagio.enumeration.QualityFlagCode.MISSING.description"), 
086            "9");
087
088    /**
089     * The serial version UID of this class. Needed for serialization.
090     */
091    private static final long serialVersionUID = -3907679669908281704L;
092
093    private String key;
094    private String description;
095    private String enumValue;
096
097    private QualityFlagCode(String key, String description, String value)
098    {
099        this.key = key;
100        this.description = description;
101        this.enumValue = value;
102    }
103    
104    @Override
105    public void setValue(String newValue) {
106        if (newValue != null && !this.enumValue.equals(newValue)) {
107            // Update static lists
108            values.remove(this.enumValue);
109            literals.remove(this.enumValue);
110            this.enumValue = newValue;
111            values.put(this.enumValue, this);
112            literals.add(this.enumValue);
113        }
114    }
115    
116
117    @Override
118    public String getValueAsString()
119    {
120        return String.valueOf(this.enumValue);
121    }
122
123    /**
124     * Retrieves an instance of QualityFlagCode from <code>its name</code>.
125     *
126     * @param name the name to create the QualityFlagCode from.
127     * @return The enumeration literal named after the 'name' argument
128     */
129    public static QualityFlagCode fromString(String name)
130    {
131        return QualityFlagCode.valueOf(name);
132    }
133
134    /**
135     * Returns an enumeration literal String <code>value</code>.
136     * Required by JAXB2 enumeration implementation
137     *
138     * @return String with corresponding value
139     */
140    public String value()
141    {
142        return this.enumValue;
143    }
144
145    /**
146     * Returns an instance of QualityFlagCode from String <code>value</code>.
147     * Required by JAXB2 enumeration implementation
148     *
149     * @param value the value to create the QualityFlagCode from.
150     * @return static Enumeration with corresponding value
151     */
152    public static QualityFlagCode fromValue(String value)
153    {
154        for (QualityFlagCode enumName: QualityFlagCode.values())
155        {
156            if (enumName.getValue().equals(value))
157            {
158                return enumName;
159            }
160        }
161        throw new IllegalArgumentException("QualityFlagCode.fromValue(" + value + ')');
162    }
163
164    /**
165     * Gets the underlying value of this type safe enumeration.
166     * This method is necessary to comply with DaoBase implementation.
167     * @return The name of this literal.
168     */
169    public String getValue()
170    {
171        return this.enumValue;
172    }
173    
174    @Override
175    public String getDescription() {
176        return description;
177    }
178    
179    @Override
180    public String getKey() {
181        return key;
182    }
183    
184    @Override
185    public Class<?> getType() {
186        return String.class;
187    }
188    
189    /**
190     * Returns an unmodifiable list containing the literals that are known by this enumeration.
191     *
192     * @return A List containing the actual literals defined by this enumeration, this list
193     *         can not be modified.
194     */
195    public static List<String> literals()
196    {
197        return QualityFlagCode.literals;
198    }
199
200    /**
201     * Returns an unmodifiable list containing the names of the literals that are known
202     * by this enumeration.
203     *
204     * @return A List containing the actual names of the literals defined by this
205     *         enumeration, this list can not be modified.
206     */
207    public static List<String> names()
208    {
209        return QualityFlagCode.names;
210    }
211
212    private static Map<String, QualityFlagCode> values = new LinkedHashMap<String, QualityFlagCode>(8, 1);
213    private static List<String> literals = new ArrayList<String>(8);
214    private static List<String> names = new ArrayList<String>(8);
215    private static List<QualityFlagCode> valueList = new ArrayList<QualityFlagCode>(8);
216
217    /**
218     * Initializes the values.
219     */
220    static
221    {
222        synchronized (QualityFlagCode.values)
223        {
224            QualityFlagCode.values.put(NOTQUALIFIED.enumValue, NOTQUALIFIED);
225            QualityFlagCode.values.put(GOOD.enumValue, GOOD);
226            QualityFlagCode.values.put(OUT_OF_STAT.enumValue, OUT_OF_STAT);
227            QualityFlagCode.values.put(DOUBTFUL.enumValue, DOUBTFUL);
228            QualityFlagCode.values.put(BAD.enumValue, BAD);
229            QualityFlagCode.values.put(CORRECTED.enumValue, CORRECTED);
230            QualityFlagCode.values.put(INCOMPLETE.enumValue, INCOMPLETE);
231            QualityFlagCode.values.put(MISSING.enumValue, MISSING);
232        }
233        synchronized (QualityFlagCode.valueList)
234        {
235            QualityFlagCode.valueList.add(NOTQUALIFIED);
236            QualityFlagCode.valueList.add(GOOD);
237            QualityFlagCode.valueList.add(OUT_OF_STAT);
238            QualityFlagCode.valueList.add(DOUBTFUL);
239            QualityFlagCode.valueList.add(BAD);
240            QualityFlagCode.valueList.add(CORRECTED);
241            QualityFlagCode.valueList.add(INCOMPLETE);
242            QualityFlagCode.valueList.add(MISSING);
243            // For Adagio, lists could be reload from configuration
244            //QualityFlagCode.valueList = Collections.unmodifiableList(valueList);
245        }
246        synchronized (QualityFlagCode.literals)
247        {
248            QualityFlagCode.literals.add(NOTQUALIFIED.enumValue);
249            QualityFlagCode.literals.add(GOOD.enumValue);
250            QualityFlagCode.literals.add(OUT_OF_STAT.enumValue);
251            QualityFlagCode.literals.add(DOUBTFUL.enumValue);
252            QualityFlagCode.literals.add(BAD.enumValue);
253            QualityFlagCode.literals.add(CORRECTED.enumValue);
254            QualityFlagCode.literals.add(INCOMPLETE.enumValue);
255            QualityFlagCode.literals.add(MISSING.enumValue);
256            // For Adagio, lists could be reload from configuration
257            //QualityFlagCode.literals = Collections.unmodifiableList(literals);
258        }
259        synchronized (QualityFlagCode.names)
260        {
261            QualityFlagCode.names.add("NOTQUALIFIED");
262            QualityFlagCode.names.add("GOOD");
263            QualityFlagCode.names.add("OUT_OF_STAT");
264            QualityFlagCode.names.add("DOUBTFUL");
265            QualityFlagCode.names.add("BAD");
266            QualityFlagCode.names.add("CORRECTED");
267            QualityFlagCode.names.add("INCOMPLETE");
268            QualityFlagCode.names.add("MISSING");
269            QualityFlagCode.names = Collections.unmodifiableList(names);
270        }
271    }
272    // type-safe-enumeration-object java merge-point
273}