How to run workflow from own code [message #63653] |
Fri, 03 July 2009 12:29  |
Eclipse User |
|
|
|
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 09:40   |
Eclipse User |
|
|
|
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
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02742 seconds