invoking workflow with XPandfacade causes problems with primitive types [message #731519] |
Sat, 01 October 2011 15:09  |
st oehm Messages: 79 Registered: October 2009 |
Member |
|
|
hello everbody
i want to invoke my xpand workflow with xpandfacade, to generate code for a uml-model. that works very well, but the problem is, that the primitives types are not recognized, there is only null in the code.
i found here a similar problem
https://bugs.eclipse.org/bugs/show_bug.cgi?id=333605
i tried the workaround but it does not work, maybe someone can help me? the code invoking the workflow is below
//put uml-model in a resource
...
resource = resourceSet.getResource(UMLuri, true);
//output
OutputImpl output = new OutputImpl();
Outlet outlet = new Outlet("src-gen");
outlet.setOverwrite(true);
output.addOutlet(outlet);
//protected regions
ProtectedRegionResolverImpl prs = new ProtectedRegionResolverImpl();
prs.setSrcPathes("src-gen");
//global variables
Map<String,Variable> globalVarsMap = new HashMap<String,Variable>();
Variable v = new Variable("Boolean", true);
globalVarsMap.put("naryAssociationFlag", v);
XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl
(output, prs, globalVarsMap, null, null);
//tries the workaround from the link, but the primitive types are still
//null
execCtx.registerMetaModel(new ExtendedUML2Metamodell());
XpandFacade facade = XpandFacade.create(execCtx);
facade.evaluate("templateMiddle::Template::main",
resource.getContents().get(0));
|
|
|
|
|
|
|
Re: invoking workflow with XPandfacade causes problems with primitive types [message #731567 is a reply to message #731541] |
Sat, 01 October 2011 19:24   |
st oehm Messages: 79 Registered: October 2009 |
Member |
|
|
hi
thanks for your fast replys!
@ed, ah ok version 2.4 has some nice improvements, but for now we can't change the version
@christian
for now i changed the code to this:
ExtendedUML2Metamodell metamodel = new ExtendedUML2Metamodell();
Mapping m1 = new Mapping("UMLPrimitiveTypes::String","ecore::EString");
Mapping m2 = new Mapping("JavaPrimitiveTypes::int","ecore::EInt");
metamodel.addMapping(m1);
metamodel.addMapping(m2);
but it does not work, i tried several other things but they don't work too. i read in the xpand-manual, that the thing ein have to map to depends on the metamodel. in my case this UML, so maybe i have to put "UMLPrimitiveTypes::String" as second parameter, but what is then the first parameter?
btw: it is interesting, when i had my own .mwe-file i could run my codegenerator without problems. the primitiveTypes were all corect, even if i had no mappings in my workflow
[Updated on: Sat, 01 October 2011 19:26] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03072 seconds