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::technical::configuration::SaleDateControlByProgram
027// Metafacade:   org.andromda.metafacades.uml.Enumeration
028// Stereotype:  Enumeration
029//
030package fr.ifremer.adagio.core.dao.technical.configuration;
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 SaleDateControlByProgram
045    implements Serializable, AdagioEnumerationDef<String>
046{
047    /** TODO: Model Documentation for Enumeration Literal MAX_DAYS_AFTER_FISHING_TRIP value "SIH-OBSMER|3,SIH-OBSVENTE|3" */
048    MAX_DAYS_AFTER_FISHING_TRIP (
049            "adagio.enumeration.SaleDateControlByProgram.MAX_DAYS_AFTER_FISHING_TRIP", 
050            n("adagio.enumeration.SaleDateControlByProgram.MAX_DAYS_AFTER_FISHING_TRIP.description"), 
051            "SIH-OBSMER|3,SIH-OBSVENTE|3");
052
053    /**
054     * The serial version UID of this class. Needed for serialization.
055     */
056    private static final long serialVersionUID = -1392618203912724667L;
057
058    private String key;
059    private String description;
060    private String enumValue;
061
062    private SaleDateControlByProgram(String key, String description, String value)
063    {
064        this.key = key;
065        this.description = description;
066        this.enumValue = value;
067    }
068    
069    @Override
070    public void setValue(String newValue) {
071        if (newValue != null && !this.enumValue.equals(newValue)) {
072            // Update static lists
073            values.remove(this.enumValue);
074            literals.remove(this.enumValue);
075            this.enumValue = newValue;
076            values.put(this.enumValue, this);
077            literals.add(this.enumValue);
078        }
079    }
080    
081
082    @Override
083    public String getValueAsString()
084    {
085        return String.valueOf(this.enumValue);
086    }
087
088    /**
089     * Retrieves an instance of SaleDateControlByProgram from <code>its name</code>.
090     *
091     * @param name the name to create the SaleDateControlByProgram from.
092     * @return The enumeration literal named after the 'name' argument
093     */
094    public static SaleDateControlByProgram fromString(String name)
095    {
096        return SaleDateControlByProgram.valueOf(name);
097    }
098
099    /**
100     * Returns an enumeration literal String <code>value</code>.
101     * Required by JAXB2 enumeration implementation
102     *
103     * @return String with corresponding value
104     */
105    public String value()
106    {
107        return this.enumValue;
108    }
109
110    /**
111     * Returns an instance of SaleDateControlByProgram from String <code>value</code>.
112     * Required by JAXB2 enumeration implementation
113     *
114     * @param value the value to create the SaleDateControlByProgram from.
115     * @return static Enumeration with corresponding value
116     */
117    public static SaleDateControlByProgram fromValue(String value)
118    {
119        for (SaleDateControlByProgram enumName: SaleDateControlByProgram.values())
120        {
121            if (enumName.getValue().equals(value))
122            {
123                return enumName;
124            }
125        }
126        throw new IllegalArgumentException("SaleDateControlByProgram.fromValue(" + value + ')');
127    }
128
129    /**
130     * Gets the underlying value of this type safe enumeration.
131     * This method is necessary to comply with DaoBase implementation.
132     * @return The name of this literal.
133     */
134    public String getValue()
135    {
136        return this.enumValue;
137    }
138    
139    @Override
140    public String getDescription() {
141        return description;
142    }
143    
144    @Override
145    public String getKey() {
146        return key;
147    }
148    
149    @Override
150    public Class<?> getType() {
151        return String.class;
152    }
153    
154    /**
155     * Returns an unmodifiable list containing the literals that are known by this enumeration.
156     *
157     * @return A List containing the actual literals defined by this enumeration, this list
158     *         can not be modified.
159     */
160    public static List<String> literals()
161    {
162        return SaleDateControlByProgram.literals;
163    }
164
165    /**
166     * Returns an unmodifiable list containing the names of the literals that are known
167     * by this enumeration.
168     *
169     * @return A List containing the actual names of the literals defined by this
170     *         enumeration, this list can not be modified.
171     */
172    public static List<String> names()
173    {
174        return SaleDateControlByProgram.names;
175    }
176
177    private static Map<String, SaleDateControlByProgram> values = new LinkedHashMap<String, SaleDateControlByProgram>(1, 1);
178    private static List<String> literals = new ArrayList<String>(1);
179    private static List<String> names = new ArrayList<String>(1);
180    private static List<SaleDateControlByProgram> valueList = new ArrayList<SaleDateControlByProgram>(1);
181
182    /**
183     * Initializes the values.
184     */
185    static
186    {
187        synchronized (SaleDateControlByProgram.values)
188        {
189            SaleDateControlByProgram.values.put(MAX_DAYS_AFTER_FISHING_TRIP.enumValue, MAX_DAYS_AFTER_FISHING_TRIP);
190        }
191        synchronized (SaleDateControlByProgram.valueList)
192        {
193            SaleDateControlByProgram.valueList.add(MAX_DAYS_AFTER_FISHING_TRIP);
194            // For Adagio, lists could be reload from configuration
195            //SaleDateControlByProgram.valueList = Collections.unmodifiableList(valueList);
196        }
197        synchronized (SaleDateControlByProgram.literals)
198        {
199            SaleDateControlByProgram.literals.add(MAX_DAYS_AFTER_FISHING_TRIP.enumValue);
200            // For Adagio, lists could be reload from configuration
201            //SaleDateControlByProgram.literals = Collections.unmodifiableList(literals);
202        }
203        synchronized (SaleDateControlByProgram.names)
204        {
205            SaleDateControlByProgram.names.add("MAX_DAYS_AFTER_FISHING_TRIP");
206            SaleDateControlByProgram.names = Collections.unmodifiableList(names);
207        }
208    }
209    // type-safe-enumeration-object java merge-point
210}