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