Bug 544487: [Profile Definition] Support Optional Enums & Primitives
https://bugs.eclipse.org/bugs/show_bug.cgi?id=544487

Change-Id: I3e41417a5842c39e02ec63ed98133cd24e236549
Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
diff --git a/examples/org.eclipse.uml2.examples.uml.ui/src/org/eclipse/uml2/examples/uml/ui/dialogs/UML2EcoreConverterOptionsDialog.java b/examples/org.eclipse.uml2.examples.uml.ui/src/org/eclipse/uml2/examples/uml/ui/dialogs/UML2EcoreConverterOptionsDialog.java
index 5c0c0c7..c071b8c 100644
--- a/examples/org.eclipse.uml2.examples.uml.ui/src/org/eclipse/uml2/examples/uml/ui/dialogs/UML2EcoreConverterOptionsDialog.java
+++ b/examples/org.eclipse.uml2.examples.uml.ui/src/org/eclipse/uml2/examples/uml/ui/dialogs/UML2EcoreConverterOptionsDialog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018 IBM Corporation, Embarcadero Technologies, CEA, and others.
+ * Copyright (c) 2005, 2019 IBM Corporation, Embarcadero Technologies, CEA, and others.
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
  * which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
  *   Kenn Hussey (Embarcadero Technologies) - 213218
  *   Kenn Hussey (CEA) - 322715, 535301
  *   Christian W. Damus (CEA) - 409396, 403374, 420338, 405065
- *
+ *   Camille Letavernier (EclipseSource) - 544487
  */
 package org.eclipse.uml2.examples.uml.ui.dialogs;
 
@@ -203,6 +203,22 @@
 			UMLUtil.UML2EcoreConverter.OPTION__OPPOSITE_ROLE_NAMES,
 			new String[]{ignoreChoiceLabel, processChoiceLabel},
 			ignoreChoiceLabel);
+		
+		createOptionArea(
+			parent,
+			UMLExamplesUIPlugin.INSTANCE
+				.getString("_UI_UnsettablePrimitiveAttributes_label"), //$NON-NLS-1$
+			UMLUtil.UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES,
+			new String[]{ignoreChoiceLabel, reportChoiceLabel, processChoiceLabel},
+			ignoreChoiceLabel);
+		
+		createOptionArea(
+			parent,
+			UMLExamplesUIPlugin.INSTANCE
+				.getString("_UI_NullableEnumAttributes_label"), //$NON-NLS-1$
+			UMLUtil.UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES,
+			new String[]{ignoreChoiceLabel, reportChoiceLabel, processChoiceLabel},
+			ignoreChoiceLabel);
 	}
 
 }
diff --git a/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporterApplication.java b/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporterApplication.java
index 7a59a0a..36b04ab 100644
--- a/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporterApplication.java
+++ b/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporterApplication.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018 IBM Corporation, Embarcadero Technologies, CEA, and others.
+ * Copyright (c) 2007, 2019 IBM Corporation, Embarcadero Technologies, CEA, EclipseSource and others.
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
  * which accompanies this distribution, and is available at
@@ -11,7 +11,7 @@
  *   Kenn Hussey (CEA) - 322715
  *   Christian W. Damus (CEA) - 403374, 420338, 405065
  *   Kenn Hussey - 535301
- *
+ *   Camille Letavernier (EclipseSource) - 544487
  */
 package org.eclipse.uml2.uml.ecore.importer;
 
@@ -206,6 +206,10 @@
 			|| UMLUtil.UML2EcoreConverter.OPTION__CAMEL_CASE_NAMES
 				.equalsIgnoreCase(strippedKey)
 			|| UMLUtil.UML2EcoreConverter.OPTION__OPPOSITE_ROLE_NAMES
+				.equalsIgnoreCase(strippedKey)
+			|| UMLUtil.UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES
+				.equalsIgnoreCase(strippedKey)
+			|| UMLUtil.UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES
 				.equalsIgnoreCase(strippedKey);
 	}
 
diff --git a/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java b/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java
index ad653e6..9351684 100644
--- a/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java
+++ b/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015 IBM Corporation, Embarcadero Technologies, CEA, and others.
+ * Copyright (c) 2006, 2019 IBM Corporation, Embarcadero Technologies, CEA, EclipseSource and others.
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
  * which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
  *   Kenn Hussey (Embarcadero Technologies) - 213218
  *   Kenn Hussey (CEA) - 322715, 482214
  *   Christian W. Damus (CEA) - 409396, 403374, 420338, 405065
- *
+ *   Camille Letavernier (EclipseSource) - 544487
  */
 package org.eclipse.uml2.uml.ecore.importer.ui;
 
@@ -286,6 +286,18 @@
 			UMLUtil.UML2EcoreConverter.OPTION__OPPOSITE_ROLE_NAMES,
 			new String[]{ignoreChoiceLabel, processChoiceLabel},
 			ignoreChoiceLabel);
+		addOptionControl(
+			optionsComposite,
+			UMLImporterPlugin.INSTANCE.getString("_UI_UnsettablePrimitiveAttributes_label"), //$NON-NLS-1$
+			UMLUtil.UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES,
+			new String[]{ignoreChoiceLabel, reportChoiceLabel, processChoiceLabel},
+			ignoreChoiceLabel);
+		addOptionControl(
+			optionsComposite,
+			UMLImporterPlugin.INSTANCE.getString("_UI_NullableEnumAttributes_label"), //$NON-NLS-1$
+			UMLUtil.UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES,
+			new String[]{ignoreChoiceLabel, reportChoiceLabel, processChoiceLabel},
+			ignoreChoiceLabel);
 
 		scrolledComposite.setContent(optionsComposite);
 		scrolledComposite.setExpandHorizontal(true);
diff --git a/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/Profile2EPackageConverterOptionsDialog.java b/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/Profile2EPackageConverterOptionsDialog.java
index ce80593..a6bec71 100644
--- a/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/Profile2EPackageConverterOptionsDialog.java
+++ b/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/Profile2EPackageConverterOptionsDialog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018 IBM Corporation, CEA, and others.
+ * Copyright (c) 2007, 2019 IBM Corporation, CEA, EclipseSource and others.
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
  * which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
  *   Kenn Hussey (CEA) - 322715, 163556
  *   Christian W. Damus (CEA) - 409396, 403374, 420338, 405065
  *   Kenn Hussey - 535301
- *
+ *   Camille Letavernier (EclipseSource) - 544487
  */
 package org.eclipse.uml2.uml.editor.dialogs;
 
@@ -193,5 +193,19 @@
 			UMLUtil.UML2EcoreConverter.OPTION__OPPOSITE_ROLE_NAMES,
 			new String[]{ignoreChoiceLabel, processChoiceLabel},
 			ignoreChoiceLabel);
+		
+		createOptionArea(
+			parent,
+			UMLEditorPlugin.INSTANCE.getString("_UI_UnsettablePrimitiveAttributes_label"), //$NON-NLS-1$
+			UMLUtil.UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES,
+			new String[]{ignoreChoiceLabel, reportChoiceLabel, processChoiceLabel},
+			ignoreChoiceLabel);
+		
+		createOptionArea(
+			parent,
+			UMLEditorPlugin.INSTANCE.getString("_UI_NullableEnumAttributes_label"), //$NON-NLS-1$
+			UMLUtil.UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES,
+			new String[]{ignoreChoiceLabel, reportChoiceLabel, processChoiceLabel},
+			ignoreChoiceLabel);
 	}
 }
diff --git a/plugins/org.eclipse.uml2.uml/META-INF/MANIFEST.MF b/plugins/org.eclipse.uml2.uml/META-INF/MANIFEST.MF
index c7d5bc5..95d87f9 100644
--- a/plugins/org.eclipse.uml2.uml/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.uml2.uml/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.uml2.uml; singleton:=true
-Bundle-Version: 5.5.0.qualifier
+Bundle-Version: 5.6.0.qualifier
 Bundle-ClassPath: .
 Bundle-Activator: org.eclipse.uml2.uml.UMLPlugin$Implementation
 Bundle-Vendor: %providerName
diff --git a/plugins/org.eclipse.uml2.uml/plugin.properties b/plugins/org.eclipse.uml2.uml/plugin.properties
index 4c3ffe9..aea308f 100644
--- a/plugins/org.eclipse.uml2.uml/plugin.properties
+++ b/plugins/org.eclipse.uml2.uml/plugin.properties
@@ -80,6 +80,8 @@
 _UI_UML2EcoreConverter_ReportSuperClassOrder_diagnostic = The super classes of class ''{0}'' should be re-ordered for optimal code generation.
 _UI_UML2EcoreConverter_ReportAnnotationDetails_diagnostic = Model element ''{0}'' should be annotated with details from source ''{1}''.
 _UI_UML2EcoreConverter_ReportUntypedProperty_diagnostic = Feature ''{0}'' has no type specified.
+_UI_UML2EcoreConverter_ReportOptionalPrimitiveAttribute_diagnostic = The optional primitive attribute ''{0}'' is not unsettable; it will always have a value.
+_UI_UML2EcoreConverter_ReportOptionalEnumAttribute_diagnostic = The optional enum attribute ''{0}'' is not nullable; it will always have a value.
 
 _UI_Ecore2UMLConverter_ProcessEcoreTaggedValue_diagnostic = Applied Ecore tag ''{1}'' with value of ''{2}'' to element ''{0}''.
 _UI_Ecore2UMLConverter_ProcessRedefinesAnnotation_diagnostic = Made ''{0}'' redefine ''{1}'' based on an annotation.
@@ -87,6 +89,8 @@
 _UI_Ecore2UMLConverter_ProcessUnionAnnotation_diagnostic = Made ''{0}'' a union based on an annotation.
 _UI_Ecore2UMLConverter_ProcessAnnotationDetails_diagnostic = Annotated element ''{0}'' with details from source ''{1}''.
 _UI_Ecore2UMLConverter_ProcessOppositeRoleName_diagnostic = Property ''{0}'' association-owned opposite has been named ''{1}''.
+_UI_UML2EcoreConverter_ProcessOptionalPrimitiveAttribute_diagnostic = Optional primitive attribute ''{0}}'' has been made unsettable.
+_UI_UML2EcoreConverter_ProcessOptionalEnumAttribute_diagnostic = Optional enum attribute ''{0}'' has been typed with a nullable enumeration.
 
 _UI_Ecore2UMLConverter_ReportEcoreTaggedValue_diagnostic = Element ''{0}'' should have an Ecore tag ''{1}'' with value of ''{2}''.
 _UI_Ecore2UMLConverter_ReportRedefinesAnnotation_diagnostic = ''{0}'' should redefine ''{1}'' based on an annotation.
@@ -207,6 +211,8 @@
 _UI_Comments_label = Comments
 _UI_UntypedProperties_label = Untyped Properties
 _UI_OppositeRoleNames_label = Opposite Role Names
+_UI_UnsettablePrimitiveAttributes_label = Unsettable Primitive Attributes
+_UI_NullableEnumAttributes_label = Nullable Enum Attributes
 
 _UI_RedefinesAnnotations_label = Redefines Annotations
 _UI_SubsetsAnnotations_label = Subsets Annotations
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
index 8bc9cc0..9bba684 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018 IBM Corporation, Embarcadero Technologies, CEA, Christian W. Damus, and others.
+ * Copyright (c) 2005, 2019 IBM Corporation, Embarcadero Technologies, CEA, Christian W. Damus, EclipseSource and others.
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
  * which accompanies this distribution, and is available at
@@ -16,7 +16,7 @@
  *   E.D.Willink - 420338, 512439
  *   Christian W. Damus - 444588, 497359, 501740
  *   Camille Letavernier - 528925, 529564
- *
+ *   Camille Letavernier (EclipseSource) - 544487
  */
 package org.eclipse.uml2.uml.util;
 
@@ -44,6 +44,7 @@
 import org.eclipse.emf.common.util.ECollections;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.common.util.Enumerator;
 import org.eclipse.emf.common.util.TreeIterator;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.common.util.UniqueEList;
@@ -4162,6 +4163,25 @@
 		 * @since 5.0
 		 */
 		public static final String OPTION__LINE_SEPARATOR = "LINE_SEPARATOR"; //$NON-NLS-1$
+		
+		/**
+		 * The option for converting optional UML properties to unsettable Ecore attributes,
+		 * when they are typed with primitives.
+		 * Supported choices are <code>OPTION__IGNORE</code>, <code>OPTION__REPORT</code>
+		 * and <code>OPTION__PROCESS</code>.
+		 * 
+		 * @since 5.6
+		 */
+		public static final String OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES = "UNSETTABLE_PRIMITIVE_ATTRIBUTES"; //$NON-NLS-1$
+		
+		/**
+		 * The option for converting optional UML properties typed with an Enumeration
+		 * to nullable Ecore attributes. Supported choices are <code>OPTION__IGNORE</code>, 
+		 * <code>OPTION__REPORT</code> and <code>OPTION__PROCESS</code>.
+		 * 
+		 * @since 5.6
+		 */
+		public static final String OPTION__NULLABLE_ENUM_ATTRIBUTES = "NULLABLE_ENUM_ATTRIBUTES"; //$NON-NLS-1$
 
 		private static final int DIAGNOSTIC_CODE_OFFSET = 2000;
 
@@ -4278,7 +4298,23 @@
 		 * @since 5.0
 		 */
 		public static final int PROPERTY_DEFAULT_EXPRESSION = DIAGNOSTIC_CODE_OFFSET + 19;
-
+		
+		/**
+		 * The diagnostic code for cases where optional attributes are not
+		 * marked as unsettable.
+		 * 
+		 * @since 5.6
+		 */
+		public static final int OPTIONAL_ATTRIBUTE = DIAGNOSTIC_CODE_OFFSET + 20;
+		
+		/**
+		 * The diagnostic code for cases where optional enum attributes are not
+		 * marked as nullable.
+		 * 
+		 * @since 5.6
+		 */
+		public static final int OPTIONAL_ENUM_ATTRIBUTE = DIAGNOSTIC_CODE_OFFSET + 21;
+		
 		protected static final Pattern ANNOTATION_PATTERN = Pattern
 			.compile("\\G\\s*((?>\\\\.|\\S)+)((?:\\s+(?>\\\\.|\\S)+\\s*+=\\s*(['\"])((?>\\\\.|.)*?)\\3)*)"); //$NON-NLS-1$
 
@@ -4291,6 +4327,8 @@
 
 		protected final Map<Element, EModelElement> elementToEModelElementMap = new LinkedHashMap<Element, EModelElement>();
 
+		protected final Map<EEnum, EDataType> enumToDataType = new LinkedHashMap<EEnum, EDataType>();
+
 		protected Collection<org.eclipse.uml2.uml.Package> packages = null;
 
 		protected Map<String, String> options = null;
@@ -4836,6 +4874,22 @@
 
 				setName(eEnum, enumeration);
 
+				if (options != null && OPTION__PROCESS
+							.equals(options.get(OPTION__NULLABLE_ENUM_ATTRIBUTES))) {
+					// Also generate the corresponding EDataType, for Optional Enums
+					// https://wiki.eclipse.org/EMF/Recipes#Recipe:_Generating_enumeration-based_attributes_that_support_null
+					EDataType enumType = EcoreFactory.eINSTANCE.createEDataType();
+					enumToDataType.put(eEnum, enumType);
+					ePackage.getEClassifiers().add(enumType);
+	
+					// XXX EMF Recipe recommends using the same name, but that's not required;
+					// Using a different name will probably make it easier to generate Java and
+					// the validation isn't going to complain that 2 classifiers have the same name
+					enumType.setName(eEnum.getName()+"_Optional");
+					enumType.setInstanceTypeName(Enumerator.class.getName());
+					ExtendedMetaData.INSTANCE.setBaseType(enumType, eEnum);
+				}
+
 				defaultCase(enumeration);
 
 				return eEnum;
@@ -5351,6 +5405,68 @@
 				}
 
 				caseMultiplicityElement(property);
+				
+				if (eStructuralFeature.getEType() != null && eStructuralFeature instanceof EAttribute 
+						&& eStructuralFeature.getLowerBound() == 0 && eStructuralFeature.getUpperBound() == 1) {
+					EAttribute eAttribute = (EAttribute)eStructuralFeature;
+					
+					Class<?> instanceClass = eAttribute.getEType().getInstanceClass();
+					if (instanceClass != null && (instanceClass.isPrimitive() || instanceClass == String.class)) { // Optional Primitives + Strings
+						// Note: we need String as well, because EMF/Ecore is inconsistent regarding Optional 
+						// Strings that aren't unsettable, when they have a default value. The null value will 
+						// be kept in memory, but not persisted, causing the value to change (from null to 
+						// default) when the model is reloaded.
+						if (options != null
+								&& OPTION__PROCESS.equals(options.get(OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES))){
+							((EAttribute)eAttribute).setUnsettable(true);
+							if (diagnostics != null) {
+								diagnostics.add(new BasicDiagnostic(Diagnostic.INFO,
+										UMLValidator.DIAGNOSTIC_SOURCE, OPTIONAL_ATTRIBUTE, UMLPlugin.INSTANCE
+										.getString(
+												"_UI_UML2EcoreConverter_ProcessOptionalPrimitiveAttribute_diagnostic", //$NON-NLS-1$
+												getMessageSubstitutions(context, property)),
+										new Object[]{eAttribute}));
+							}
+						} else if (options != null 
+								&& OPTION__REPORT.equals(options.get(OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES))) {
+							// UML Multiplicity is 0..1 but the EAttribute is not unsettable; 
+							// warn about the semantic inconsistency
+							diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
+									UMLValidator.DIAGNOSTIC_SOURCE, OPTIONAL_ATTRIBUTE, UMLPlugin.INSTANCE
+									.getString(
+											"_UI_UML2EcoreConverter_ReportOptionalPrimitiveAttribute_diagnostic", //$NON-NLS-1$
+											getMessageSubstitutions(context, property)),
+									new Object[]{eAttribute}));
+						}
+					} else if (eAttribute.getEType() instanceof EEnum) { // Optional Enums 
+						if (options != null 
+							&& OPTION__PROCESS.equals(options.get(OPTION__NULLABLE_ENUM_ATTRIBUTES))){
+							EEnum eEnum = (EEnum)eAttribute.getEType();
+							EDataType enumType = enumToDataType.get(eEnum);
+							eAttribute.setEType(enumType); // Use the Optional Enum type
+							eAttribute.setUnsettable(true); // Make unsettable, so EMF can distinguish Null (NIL) from Default
+							
+							if (diagnostics != null) {
+								diagnostics.add(new BasicDiagnostic(Diagnostic.INFO,
+									UMLValidator.DIAGNOSTIC_SOURCE, OPTIONAL_ENUM_ATTRIBUTE, UMLPlugin.INSTANCE
+										.getString(
+											"_UI_UML2EcoreConverter_ProcessOptionalEnumAttribute_diagnostic", //$NON-NLS-1$
+											getMessageSubstitutions(context, property)),
+									new Object[]{eAttribute}));
+							}
+						} else if (options != null 
+								&& OPTION__REPORT.equals(options.get(OPTION__NULLABLE_ENUM_ATTRIBUTES))) {
+							// UML Multiplicity is 0..1 but the EAttribute is not a Nullable Enum; 
+							// warn about the semantic inconsistency
+							diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
+									UMLValidator.DIAGNOSTIC_SOURCE, OPTIONAL_ENUM_ATTRIBUTE, UMLPlugin.INSTANCE
+									.getString(
+											"_UI_UML2EcoreConverter_ReportOptionalEnumAttribute_diagnostic", //$NON-NLS-1$
+											getMessageSubstitutions(context, property)),
+									new Object[]{eAttribute}));
+						}
+					}
+				}
 
 				defaultCase(property);
 
@@ -12940,6 +13056,22 @@
 				UML2EcoreConverter.OPTION__PROPERTY_DEFAULT_EXPRESSIONS,
 				OPTION__IGNORE);
 		}
+		
+		if (!options
+				.containsKey(UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES)) {
+
+				options.put(
+					UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES,
+					OPTION__IGNORE);
+		}
+		
+		if (!options
+				.containsKey(UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES)) {
+
+				options.put(
+					UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES,
+					OPTION__IGNORE);
+		}
 
 		return convertToEcore(package_, options, null, null);
 	}
@@ -13089,6 +13221,14 @@
 				UML2EcoreConverter.OPTION__PROPERTY_DEFAULT_EXPRESSIONS,
 				OPTION__REPORT);
 		}
+		
+		if (!options.containsKey(UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES)) {
+			options.put(UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES, OPTION__REPORT);
+		}
+		
+		if (!options.containsKey(UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES)) {
+			options.put(UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES, OPTION__REPORT);
+		}
 
 		@SuppressWarnings("unchecked")
 		Collection<EPackage> ePackages = (Collection<EPackage>) new UML2EcoreConverter()
@@ -13227,6 +13367,14 @@
 				UML2EcoreConverter.OPTION__PROPERTY_DEFAULT_EXPRESSIONS,
 				OPTION__IGNORE);
 		}
+		
+		if (!options.containsKey(UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES)) {
+			options.put(UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES, OPTION__IGNORE);
+		}
+		
+		if (!options.containsKey(UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES)) {
+			options.put(UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES, OPTION__IGNORE);
+		}
 
 		return convertToEcore(profile, options, null, null);
 	}
@@ -13359,6 +13507,14 @@
 				UML2EcoreConverter.OPTION__PROPERTY_DEFAULT_EXPRESSIONS,
 				OPTION__REPORT);
 		}
+		
+		if (!options.containsKey(UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES)) {
+			options.put(UML2EcoreConverter.OPTION__UNSETTABLE_PRIMITIVE_ATTRIBUTES, OPTION__REPORT);
+		}
+		
+		if (!options.containsKey(UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES)) {
+			options.put(UML2EcoreConverter.OPTION__NULLABLE_ENUM_ATTRIBUTES, OPTION__REPORT);
+		}
 
 		@SuppressWarnings("unchecked")
 		Collection<EPackage> ePackages = (Collection<EPackage>) new Profile2EPackageConverter()