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