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::referential::pmfm::MatrixId 027// Metafacade: org.andromda.metafacades.uml.Enumeration 028// Stereotype: Enumeration 029// 030package fr.ifremer.adagio.core.dao.referential.pmfm; 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 MatrixId 045 implements Serializable, AdagioEnumerationDef<Integer> 046{ 047 /** TODO: Model Documentation for Enumeration Literal GEAR value 3 */ 048 GEAR ( 049 "adagio.enumeration.MatrixId.GEAR", 050 n("adagio.enumeration.MatrixId.GEAR.description"), 051 3), 052 /** TODO: Model Documentation for Enumeration Literal VESSEL value 5 */ 053 VESSEL ( 054 "adagio.enumeration.MatrixId.VESSEL", 055 n("adagio.enumeration.MatrixId.VESSEL.description"), 056 5), 057 /** TODO: Model Documentation for Enumeration Literal FISHING_METIER value 6 */ 058 FISHING_METIER ( 059 "adagio.enumeration.MatrixId.FISHING_METIER", 060 n("adagio.enumeration.MatrixId.FISHING_METIER.description"), 061 6), 062 /** TODO: Model Documentation for Enumeration Literal OPERATION value 21 */ 063 OPERATION ( 064 "adagio.enumeration.MatrixId.OPERATION", 065 n("adagio.enumeration.MatrixId.OPERATION.description"), 066 21), 067 /** TODO: Model Documentation for Enumeration Literal PRODUCE_BATCH value 1 */ 068 PRODUCE_BATCH ( 069 "adagio.enumeration.MatrixId.PRODUCE_BATCH", 070 n("adagio.enumeration.MatrixId.PRODUCE_BATCH.description"), 071 1); 072 073 /** 074 * The serial version UID of this class. Needed for serialization. 075 */ 076 private static final long serialVersionUID = -8226044327079439135L; 077 078 private String key; 079 private String description; 080 private Integer enumValue; 081 082 private MatrixId(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 MatrixId from <code>its name</code>. 110 * 111 * @param name the name to create the MatrixId from. 112 * @return The enumeration literal named after the 'name' argument 113 */ 114 public static MatrixId fromString(String name) 115 { 116 return MatrixId.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 MatrixId from Integer <code>value</code>. 132 * Required by JAXB2 enumeration implementation 133 * 134 * @param value the value to create the MatrixId from. 135 * @return static Enumeration with corresponding value 136 */ 137 public static MatrixId fromValue(Integer value) 138 { 139 for (MatrixId enumName: MatrixId.values()) 140 { 141 if (enumName.getValue().equals(value)) 142 { 143 return enumName; 144 } 145 } 146 throw new IllegalArgumentException("MatrixId.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 MatrixId.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 MatrixId.names; 195 } 196 197 private static Map<Integer, MatrixId> values = new LinkedHashMap<Integer, MatrixId>(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<MatrixId> valueList = new ArrayList<MatrixId>(5); 201 202 /** 203 * Initializes the values. 204 */ 205 static 206 { 207 synchronized (MatrixId.values) 208 { 209 MatrixId.values.put(GEAR.enumValue, GEAR); 210 MatrixId.values.put(VESSEL.enumValue, VESSEL); 211 MatrixId.values.put(FISHING_METIER.enumValue, FISHING_METIER); 212 MatrixId.values.put(OPERATION.enumValue, OPERATION); 213 MatrixId.values.put(PRODUCE_BATCH.enumValue, PRODUCE_BATCH); 214 } 215 synchronized (MatrixId.valueList) 216 { 217 MatrixId.valueList.add(GEAR); 218 MatrixId.valueList.add(VESSEL); 219 MatrixId.valueList.add(FISHING_METIER); 220 MatrixId.valueList.add(OPERATION); 221 MatrixId.valueList.add(PRODUCE_BATCH); 222 // For Adagio, lists could be reload from configuration 223 //MatrixId.valueList = Collections.unmodifiableList(valueList); 224 } 225 synchronized (MatrixId.literals) 226 { 227 MatrixId.literals.add(GEAR.enumValue); 228 MatrixId.literals.add(VESSEL.enumValue); 229 MatrixId.literals.add(FISHING_METIER.enumValue); 230 MatrixId.literals.add(OPERATION.enumValue); 231 MatrixId.literals.add(PRODUCE_BATCH.enumValue); 232 // For Adagio, lists could be reload from configuration 233 //MatrixId.literals = Collections.unmodifiableList(literals); 234 } 235 synchronized (MatrixId.names) 236 { 237 MatrixId.names.add("GEAR"); 238 MatrixId.names.add("VESSEL"); 239 MatrixId.names.add("FISHING_METIER"); 240 MatrixId.names.add("OPERATION"); 241 MatrixId.names.add("PRODUCE_BATCH"); 242 MatrixId.names = Collections.unmodifiableList(names); 243 } 244 } 245 // type-safe-enumeration-object java merge-point 246}