Hi all!
I have an xmi file with an uml class diagram.
Some attributes have following types:
<type xmi:type="uml:PrimitiveType" href="http:||schema.omg.org/spec/UML/2.1/uml.xml#Integer"/>
After the import these attributes have the type PrimitiveTypeImpl.
ToString of the variable "type" returns:
org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@6d23f66c (eProxyURI: http:||schema.omg.org/spec/UML/2.1/uml.xml#Integer)
When I programmatically convert the uml model to ecore, the attributes have the type: EDataTypeImpl.
BUT: when I import the xmi file into an EMF Project via UI the resulting model contains attributes with type EInt. This is what I want to do programmatically, too.
I am using following code for import and conversion to ecore:
ResourceSet resourceSet = new ResourceSetImpl();
Registry packageRegistry = resourceSet.getPackageRegistry();
packageRegistry.put("http:||schema.omg.org/spec/XMI/2.1", UMLPackage.eINSTANCE);
packageRegistry.put("http:||schema.omg.org/spec/UML/2.1", UMLPackage.eINSTANCE);
Map<String, Object> extensionToFactoryMap = resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap();
extensionToFactoryMap.put(XMI2UMLResource.FILE_EXTENSION, new UMLResourceFactoryImpl());
resourceSet.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
URI uri = URI.createURI("model.xmi");
Package root = UML2Util.load(resourceSet, uri, UMLPackage.Literals.PACKAGE);
Set<EPackage> result = Sets.newHashSet();
result.addAll(UMLUtil.convertToEcore(root, null));
Am I doing something wrong?