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