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