Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » How to run workflow from own code
How to run workflow from own code [message #63653] Fri, 03 July 2009 16:29 Go to next message
Durga Prasana Sahoo is currently offline Durga Prasana Sahoo
Messages: 20
Registered: July 2009
Junior Member
Hello All

I have a requirement to run my workflow for XPand generator, from my own
java code.

I found some help on:
http://www.openarchitectureware.org/pub/documentation/4.3.1/ html/contents/workflow_reference.html

It suggests to use a code snippet as follows:

------------------------------------------------------------ ----------

String wfFile =
" C:/Users/Durga/workspace_TMF/org.xtext.samm.Edifice.generato r/src/workflow/EdificeGenerator.mwe ";
Map properties = new HashMap();
Map slotContents = new HashMap();
new WorkflowRunner().run(wfFile ,new NullProgressMonitor(), properties,
slotContents);

------------------------------------------------------------ ----------

But I don't know what the values in the HashMap should be!!
I mean which properties of the workflow.mwe file shall I set into which
hashmap contents.

properties.put(??);
slotContents.put(??);

I need 2 also somehow pass in a component object(entity) into the workflow
from the java code.And the workflow should then XPand a file for the
component attributes by:
------------------------------------------------------------ ---
<expand value="templates::Template::defn_ComplexDataType FOR
somecomponent_object(instead of model
file)/xml_file_representationofEntity"/>

------------------------------------------------------------ ---
Wud anyone pls suggest..

Thanks.

Durga
Re: How to run workflow from own code [message #63764 is a reply to message #63653] Mon, 06 July 2009 13:40 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1767
Registered: July 2009
Senior Member
The first map (the properties) is a Map<String,String> containing all
properties you want to be replaced.
That is if you have something like

<myProp value="${foo}"/>

in your workflow file, you can pass the information what 'foo' means
using the properties map.

The other map (Map<String,Object> slotContens) allows you to put some
preinitialized information into a slot, so that components can use that
information.
This is how you solve your problem, just put an entry into the map,
mapping from a name to the actual object.

Example:

Map<String, Object> slotContents =
Collections.singletonMap("someComponent", myComponent);

can be used like this:

<expand value="templates::Template::defn_ComplexDataType FOR
somecomponent"/>

Cheers,
Sven

Durga Prasana Sahoo schrieb:
> Hello All
>
> I have a requirement to run my workflow for XPand generator, from my own
> java code.
>
> I found some help on:
> http://www.openarchitectureware.org/pub/documentation/4.3.1/ html/contents/workflow_reference.html
>
>
> It suggests to use a code snippet as follows:
>
> ------------------------------------------------------------ ----------
>
> String wfFile =
> " C:/Users/Durga/workspace_TMF/org.xtext.samm.Edifice.generato r/src/workflow/EdificeGenerator.mwe ";
>
> Map properties = new HashMap();
> Map slotContents = new HashMap();
> new WorkflowRunner().run(wfFile ,new NullProgressMonitor(), properties,
> slotContents);
>
> ------------------------------------------------------------ ----------
>
> But I don't know what the values in the HashMap should be!!
> I mean which properties of the workflow.mwe file shall I set into which
> hashmap contents.
>
> properties.put(??);
> slotContents.put(??);
>
> I need 2 also somehow pass in a component object(entity) into the
> workflow from the java code.And the workflow should then XPand a file
> for the component attributes by:
> ------------------------------------------------------------ ---
> <expand value="templates::Template::defn_ComplexDataType FOR
> somecomponent_object(instead of model
> file)/xml_file_representationofEntity"/>
>
> ------------------------------------------------------------ ---
> Wud anyone pls suggest..
>
> Thanks.
>
> Durga
>


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: How to run workflow from own code [message #64024 is a reply to message #63764] Wed, 08 July 2009 21:34 Go to previous message
Durga Prasana Sahoo is currently offline Durga Prasana Sahoo
Messages: 20
Registered: July 2009
Junior Member
Thanks a lot, Sven.
It does work fine.

Durga
Previous Topic:Why does JET not re-create files on jet2java
Next Topic:Problem checking constraints on references with types from ecore meta model
Goto Forum:
  


Current Time: Wed Oct 01 16:23:49 GMT 2014

Powered by FUDForum. Page generated in 0.01688 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software