summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFradj Zayen2013-11-07 11:53:55 (EST)
committerStephan Born2013-11-07 11:53:55 (EST)
commit6dfb106e9d76330260f0069a35216553018598de (patch)
treeb9f2157ad79960187340c9eaf4610ed7ce414d8f
parent14d5df3d9de4fd3b50827470453be498436f4f67 (diff)
downloadorg.eclipse.stardust.engine-6dfb106e9d76330260f0069a35216553018598de.zip
org.eclipse.stardust.engine-6dfb106e9d76330260f0069a35216553018598de.tar.gz
org.eclipse.stardust.engine-6dfb106e9d76330260f0069a35216553018598de.tar.bz2
CRNT-31134:Move date type lookup for conversion from Java Script Overlay to Native Object type conversion.
git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/ServicePacks/b_dev_7_2_0_SPx/stardust/engine@68670 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b Signed-off-by: Fradj Zayen <fradj.zayen@sungard.com>
-rw-r--r--stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/DateUtils.java11
-rw-r--r--stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest-context.xml20
-rw-r--r--stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest.java186
-rw-r--r--stardust-engine-camel/src/test/resources/models/JavaScriptOverlayTypeTestModel.xpdl441
4 files changed, 658 insertions, 0 deletions
diff --git a/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/DateUtils.java b/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/DateUtils.java
new file mode 100644
index 0000000..cf400d6
--- /dev/null
+++ b/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/DateUtils.java
@@ -0,0 +1,11 @@
+package org.eclipse.stardust.engine.extensions.camel;
+
+import java.util.Date;
+
+public class DateUtils
+{
+ public static void echo(final Date date)
+ {
+ System.out.println("received Date" + date);
+ }
+}
diff --git a/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest-context.xml b/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest-context.xml
new file mode 100644
index 0000000..e9d8113
--- /dev/null
+++ b/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest-context.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans
+ xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation=
+ "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <import resource="SharedTestContext.xml"/>
+
+ <!-- <camelContext xmlns="http://camel.apache.org/schema/spring" trace="true" >
+ <routeBuilder ref="processEndpointRouteBuilder" />
+ </camelContext> -->
+
+ <!-- <bean id="processEndpointRouteBuilder"
+ class="org.eclipse.stardust.engine.extensions.camel.ProcessEndpointTest"
+ factory-method="createFullRoute"/> -->
+
+</beans> \ No newline at end of file
diff --git a/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest.java b/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest.java
new file mode 100644
index 0000000..0d0f0e4
--- /dev/null
+++ b/stardust-engine-camel/src/test/java/org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest.java
@@ -0,0 +1,186 @@
+package org.eclipse.stardust.engine.extensions.camel;
+
+import static org.eclipse.stardust.engine.extensions.camel.CamelConstants.MessageProperty.PROCESS_INSTANCE_OID;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.eclipse.stardust.engine.api.runtime.ProcessInstance;
+import org.eclipse.stardust.engine.api.runtime.ProcessInstanceState;
+import org.eclipse.stardust.engine.api.runtime.ServiceFactory;
+import org.eclipse.stardust.engine.api.runtime.WorkflowService;
+import org.eclipse.stardust.engine.extensions.camel.util.client.ServiceFactoryAccess;
+import org.eclipse.stardust.engine.extensions.camel.util.data.KeyValueList;
+import org.eclipse.stardust.engine.extensions.camel.util.test.SpringTestUtils;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+
+public class ScriptingOverlayTest
+{
+ // private static final transient Logger LOG =
+ // LoggerFactory.getLogger(ProcessEndpointTest.class);
+ // URI constants
+ private static final String FULL_ROUTE_BEGIN = "direct:startProcessEndpointTestRoute";
+ private static final String FULL_ROUTE_END = "mock:endProcessEndpointTestRoute";
+
+ private static ClassPathXmlApplicationContext ctx;
+ {
+ ctx = new ClassPathXmlApplicationContext(new String[] {
+ "org/eclipse/stardust/engine/extensions/camel/ScriptingOverlayTest-context.xml",
+ "classpath:carnot-spring-context.xml", "classpath:jackrabbit-jcr-context.xml",
+ "classpath:default-camel-context.xml"});
+ camelContext = (CamelContext) ctx.getBean("defaultCamelContext");
+ testUtils = (SpringTestUtils) ctx.getBean("ippTestUtils");
+ serviceFactoryAccess = (ServiceFactoryAccess) ctx.getBean("ippServiceFactoryAccess");
+ try
+ {
+ ClassPathResource resource = new ClassPathResource("models/JavaScriptOverlayTypeTestModel.xpdl");
+ testUtils.setModelFile(resource);
+ testUtils.deployModel();
+ camelContext.addRoutes(createFullRoute());
+ testUtils.deployModel();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ defaultProducerTemplate = camelContext.createProducerTemplate();
+ fullRouteProducerTemplate = camelContext.createProducerTemplate();
+ fullRouteResult = camelContext.getEndpoint(FULL_ROUTE_END, MockEndpoint.class);
+ }
+
+ private static CamelContext camelContext;
+ private static SpringTestUtils testUtils;
+ private static ServiceFactoryAccess serviceFactoryAccess;
+
+ protected static ProducerTemplate defaultProducerTemplate;
+ protected ProducerTemplate fullRouteProducerTemplate;
+ protected static MockEndpoint fullRouteResult;
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testFullRoute() throws Exception
+ {
+ Map<String, Object> sdt = new HashMap<String, Object>();
+ String base = "created";
+ Date createdDt = KeyValueList.getDateFormat().parse("07.11.2013");
+ sdt.put(base, createdDt);
+ sdt.put("aText", "Hello JS OverlayType");
+ Date aDate = KeyValueList.getDateFormat().parse("07.11.2013");
+ sdt.put("aDate", aDate);
+ sdt.put("aDateTime", aDate.getTime());
+ sdt.put("aBoolean", true);
+ sdt.put("aLong", new Long("123456"));
+ sdt.put("anInteger", new Integer("1212"));
+ sdt.put("aDouble", new Double("12.23"));
+ List<Date> aDateList = new ArrayList<Date>();
+ Date aDate1 = KeyValueList.getDateFormat().parse("05.11.2013");
+ Date aDate2 = KeyValueList.getDateFormat().parse("06.11.2013");
+ aDateList.add(aDate1);
+ aDateList.add(aDate2);
+ sdt.put("aDateList", aDateList);
+ List<Long> aDateTimeList = new ArrayList<Long>();
+ Date aDateTime1 = KeyValueList.getDateFormat().parse("05.11.2013");
+ Date aDateTime2 = KeyValueList.getDateFormat().parse("06.11.2013");
+ aDateTimeList.add(aDateTime1.getTime());
+ aDateTimeList.add(aDateTime2.getTime());
+ sdt.put("aDateTimeList", aDateTimeList);
+
+ Map<String, Object> s2 = new HashMap<String, Object>();
+ s2.put("aString", "hello s2");
+ s2.put("aBoolean", true);
+ s2.put("aLong", new Long("123456"));
+ s2.put("anInteger", new Integer("1212"));
+ s2.put("aDouble", new Double("12.23"));
+ s2.put("aDate", KeyValueList.getDateFormat().parse("07.11.2013"));
+ s2.put("aDateTime", KeyValueList.getDateFormat().parse("07.11.2013").getTime());
+
+ Map<String, Object> s3 = new HashMap<String, Object>();
+ s3.put("aString", "hello s3");
+ s3.put("aBoolean", true);
+ s3.put("aLong", new Long("123456"));
+ s3.put("anInteger", new Integer("1212"));
+ s3.put("aDouble", new Double("12.23"));
+ s3.put("aDate", KeyValueList.getDateFormat().parse("07.11.2013"));
+ s3.put("aDateTime", KeyValueList.getDateFormat().parse("07.11.2013").getTime());
+
+ // add s2, s3 to SDT
+ sdt.put("S2", s2);
+ sdt.put("S3", s3);
+ List<Map<String, Object>> s2s = new ArrayList<Map<String, Object>>();
+ s2s.add(s2);
+ s2s.add(s2);
+ s2s.add(s2);
+ s2s.add(s2);
+ s2s.add(s2);
+ sdt.put("S2s", s2s);
+
+ // Map<String,Object> s1 = new HashMap<String,Object>();
+ // s1.put("S1",sdt);
+
+ // send valid input
+ fullRouteProducerTemplate.sendBody(FULL_ROUTE_BEGIN, sdt);
+
+ Exchange exchange1 = fullRouteResult.getReceivedExchanges().get(0);
+ assertNotNull(exchange1);
+ Long piOid = exchange1.getIn().getHeader(PROCESS_INSTANCE_OID, Long.class);
+ assertNotNull(piOid);
+ ServiceFactory sf = serviceFactoryAccess.getDefaultServiceFactory();
+
+ WorkflowService wfService = sf.getWorkflowService();
+ ProcessInstance pi = wfService.getProcessInstance(piOid);
+ assertEquals(ProcessInstanceState.Completed, pi.getState());
+
+ Map<String, Object> reponse = (Map<String, Object>) wfService.getInDataPath(pi.getOID(), "S1");
+ assertNotNull(reponse);
+ assertEquals(reponse.get("aText"), "Hello JS OverlayType");
+ assertNotNull(reponse.get("aDate"));
+ assertTrue(reponse.get("aDate") instanceof Date);
+ assertNotNull(reponse.get("aDateTime"));
+ assertTrue(reponse.get("aDateTime") instanceof Date);
+ assertNotNull(reponse.get("aDateList"));
+ assertNotNull(reponse.get("aDateList") instanceof List);
+ for (Object elt : (List<Map<String,Object>>) reponse.get("aDateList"))
+ assertTrue(elt instanceof Date);
+
+ assertNotNull(((Map<String, Object>) reponse.get("S2")).get("aDate"));
+ assertTrue(((Map<String, Object>) reponse.get("S2")).get("aDate") instanceof Date);
+ assertNotNull(((Map<String, Object>) reponse.get("S2")).get("aDateTime"));
+ assertTrue(((Map<String, Object>) reponse.get("S2")).get("aDateTime") instanceof Date);
+ // S2s
+ assertNotNull(reponse.get("S2s"));
+ assertTrue(reponse.get("S2s") instanceof List);
+ for (Map<String, Object> elt : (List<Map<String, Object>>) reponse.get("S2s"))
+ {
+ assertNotNull(elt.get("aDate"));
+ assertTrue(elt.get("aDate") instanceof Date);
+ assertNotNull(elt.get("aDateTime"));
+ assertTrue(elt.get("aDateTime") instanceof Date);
+ }
+ }
+
+ public static RouteBuilder createFullRoute()
+ {
+ return new RouteBuilder()
+ {
+ @Override
+ public void configure() throws Exception
+ {
+ from(FULL_ROUTE_BEGIN).to("ipp:authenticate:setCurrent?user=motu&password=motu")
+ .to("ipp:process:start?modelId=Model12&processId=ScriptingExample&data=S1::$simple{body}")
+ .to(FULL_ROUTE_END);
+ }
+ };
+ }
+}
diff --git a/stardust-engine-camel/src/test/resources/models/JavaScriptOverlayTypeTestModel.xpdl b/stardust-engine-camel/src/test/resources/models/JavaScriptOverlayTypeTestModel.xpdl
new file mode 100644
index 0000000..5907303
--- /dev/null
+++ b/stardust-engine-camel/src/test/resources/models/JavaScriptOverlayTypeTestModel.xpdl
@@ -0,0 +1,441 @@
+<?xml version="1.0" encoding="UTF-8"?><Package xmlns:carnot="http://www.carnot.ag/xpdl/3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wfmc.org/2008/XPDL2.1" xsi:schemaLocation="http://www.wfmc.org/2008/XPDL2.1 http://www.wfmc.org/standards/docs/bpmnxpdl_31.xsd" Id="Model12" Name="JavaScriptOverlayTypeTestModel">
+ <PackageHeader>
+ <XPDLVersion>2.1</XPDLVersion>
+ <Vendor>SunGard CSA LLC</Vendor>
+ <Created>Thu Nov 07 10:46:11 CET 2013</Created>
+ </PackageHeader>
+ <RedefinableHeader PublicationStatus="UNDER_REVISION">
+ <Author>andreas.mueller</Author>
+ <Version>1</Version>
+ </RedefinableHeader>
+ <ConformanceClass GraphConformance="NON_BLOCKED"/>
+ <xpdl:Script xmlns:xpdl="http://www.wfmc.org/2008/XPDL2.1" xmlns="http://www.carnot.ag/workflowmodel/3.1" Type="text/ecmascript"/>
+ <xpdl:TypeDeclarations xmlns:xpdl="http://www.wfmc.org/2008/XPDL2.1" xmlns="http://www.carnot.ag/workflowmodel/3.1">
+ <xpdl:TypeDeclaration Id="S1" Name="S1">
+ <xpdl:SchemaType>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bas="http://www.infinity.com/bpm/model/Model12/Base" xmlns:s1="http://www.infinity.com/bpm/model/Model12/S1" xmlns:s2="http://www.infinity.com/bpm/model/Model12/S2" xmlns:s3="http://www.infinity.com/bpm/model/Model12/S3" targetNamespace="http://www.infinity.com/bpm/model/Model12/S1">
+ <xsd:import namespace="http://www.infinity.com/bpm/model/Model12/Base" schemaLocation="urn:internal:Base"/>
+ <xsd:import namespace="http://www.infinity.com/bpm/model/Model12/S3" schemaLocation="urn:internal:S3"/>
+ <xsd:import namespace="http://www.infinity.com/bpm/model/Model12/S2" schemaLocation="urn:internal:S2"/>
+ <xsd:complexType name="S1">
+ <xsd:complexContent>
+ <xsd:extension base="bas:Base">
+ <xsd:sequence>
+ <xsd:element name="aText" type="xsd:string"/>
+ <xsd:element name="aDate" type="xsd:date"/>
+ <xsd:element name="aDateTime" type="xsd:dateTime"/>
+ <xsd:element name="aBoolean" type="xsd:boolean"/>
+ <xsd:element name="aLong" type="xsd:long"/>
+ <xsd:element name="anInteger" type="xsd:int"/>
+ <xsd:element name="aDouble" type="xsd:double"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="aDateList" type="xsd:date"/>
+ <xsd:element name="aDateTimeList" type="xsd:dateTime"/>
+ <xsd:element name="S2" type="s2:S2"/>
+ <xsd:element maxOccurs="unbounded" name="S3" type="s3:S3"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="S2s" type="s2:S2"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="S1" type="s1:S1"/>
+ </xsd:schema>
+ </xpdl:SchemaType>
+ </xpdl:TypeDeclaration>
+ <xpdl:TypeDeclaration Id="S2" Name="S2">
+ <xpdl:SchemaType>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s1="http://www.infinity.com/bpm/model/Model12/S1" xmlns:s2="http://www.infinity.com/bpm/model/Model12/S2" targetNamespace="http://www.infinity.com/bpm/model/Model12/S2">
+ <xsd:import namespace="http://www.infinity.com/bpm/model/Model12/S1" schemaLocation="urn:internal:S1"/>
+ <xsd:complexType name="S2">
+ <xsd:sequence>
+ <xsd:element name="aString" type="xsd:string"/>
+ <xsd:element name="aBoolean" type="xsd:boolean"/>
+ <xsd:element name="aLong" type="xsd:long"/>
+ <xsd:element name="anInteger" type="xsd:int"/>
+ <xsd:element name="aDouble" type="xsd:double"/>
+ <xsd:element name="aDate" type="xsd:date"/>
+ <xsd:element name="aDateTime" type="xsd:dateTime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="S2" type="s2:S2"/>
+ </xsd:schema>
+ </xpdl:SchemaType>
+ </xpdl:TypeDeclaration>
+ <xpdl:TypeDeclaration Id="S3" Name="S3">
+ <xpdl:SchemaType>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s3="http://www.infinity.com/bpm/model/Model12/S3" targetNamespace="http://www.infinity.com/bpm/model/Model12/S3">
+ <xsd:complexType name="S3">
+ <xsd:sequence>
+ <xsd:element name="aString" type="xsd:string"/>
+ <xsd:element name="aBoolean" type="xsd:boolean"/>
+ <xsd:element name="aLong" type="xsd:long"/>
+ <xsd:element name="anInteger" type="xsd:int"/>
+ <xsd:element name="aDouble" type="xsd:double"/>
+ <xsd:element name="aDate" type="xsd:date"/>
+ <xsd:element name="aDateTime" type="xsd:dateTime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="S3" type="s3:S3"/>
+ </xsd:schema>
+ </xpdl:SchemaType>
+ </xpdl:TypeDeclaration>
+ <xpdl:TypeDeclaration Id="Base" Name="Base">
+ <xpdl:SchemaType>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bas="http://www.infinity.com/bpm/model/Model12/Base" targetNamespace="http://www.infinity.com/bpm/model/Model12/Base">
+ <xsd:complexType name="Base">
+ <xsd:sequence>
+ <xsd:element name="created" type="xsd:date"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Base" type="bas:Base"/>
+ </xsd:schema>
+ </xpdl:SchemaType>
+ </xpdl:TypeDeclaration>
+ </xpdl:TypeDeclarations>
+ <Participants>
+ <Participant Id="Administrator" Name="Administrator">
+ <ParticipantType Type="ROLE"/>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:Role Oid="25"/>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </Participant>
+ </Participants>
+ <Applications>
+ <Application Id="scriptingExample" Name="scriptingExample">
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:Application Oid="86" Type="camelSpringProducerApplication">
+ <carnot:ApplicationContexts/>
+ <carnot:AccessPoints>
+ <carnot:AccessPoint Oid="104" Id="Input" Name="Input" Direction="IN" Type="struct">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:dataType" Value="S1"/>
+ <carnot:Attribute Name="carnot:engine:path:separator" Value="/"/>
+ <carnot:Attribute Name="carnot:engine:data:bidirectional" Value="true" Type="boolean"/>
+ <carnot:Attribute Name="documentation:comments" Value="{&quot;comments&quot;:[]}"/>
+ </carnot:Attributes>
+ </carnot:AccessPoint>
+ <carnot:AccessPoint Oid="105" Id="Output" Name="Output" Direction="OUT" Type="struct">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:dataType" Value="S1"/>
+ <carnot:Attribute Name="carnot:engine:path:separator" Value="/"/>
+ <carnot:Attribute Name="carnot:engine:data:bidirectional" Value="true" Type="boolean"/>
+ <carnot:Attribute Name="documentation:comments" Value="{&quot;comments&quot;:[]}"/>
+ </carnot:Attributes>
+ </carnot:AccessPoint>
+ </carnot:AccessPoints>
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:camel::applicationIntegrationOverlay" Value="scriptingIntegrationOverlay"/>
+ <carnot:Attribute Name="carnot:engine:camel::supportsMultipleAccessPoints" Value="true" Type="boolean"/>
+ <carnot:Attribute Name="carnot:engine:camel::camelContextId" Value="defaultCamelContext"/>
+ <carnot:Attribute Name="carnot:engine:camel::routeEntries" Value="&lt;to uri=&quot;bean:bpmTypeConverter?method=toNativeObject&quot; /&gt;&lt;setHeader headerName=&quot;CamelLanguageScript&quot;&gt;&lt;constant&gt;function setOutHeader(key, output){&#10;exchange.out.headers.put(key,output);}&#10;function convertStringToDate(format, input){&#10;return new java.text.SimpleDateFormat(format).parse(input);&#10;}&#10;function isArray(obj) {&#10;&#9;if (Array.isArray) {&#10;&#9;&#9;return Array.isArray(obj);&#10;&#9;} else {&#10;&#9;return Object.prototype.toString.call(obj) === '[object Array]';&#10;&#9;}&#10;}&#10;function visitMembers(obj, callback) {&#10;&#9;var i = 0, length = obj.length;&#10;&#9;if (isArray(obj)) {&#10;&#9;&#9;for(; i &amp;lt; length; i++) {&#10;&#9;&#9;obj[i]= callback(i, obj[i]);&#10;&#9;&#9;}&#10;} else {&#10;&#9;&#9;for (i in obj) {&#10;&#9;&#9;obj[i]= callback(i, obj[i]);}&#10;&#9;}&#10;&#9;return obj;&#10;}&#10;function recursiveFunction(key, val) {&#10;&#9;if (val instanceof Object || isArray(val)) {&#10;&#9;&#9;return visitMembers(val, recursiveFunction);&#10;&#9;} else {&#10;&#9;&#9;return actualFunction(val, typeof val);&#10;&#9;}&#10;}&#10;function actualFunction(value, type) {&#10;&#9;var dataAsLong;&#10;&#9;if (type === 'string') {&#10;&#9;&#9;dataAsLong =/\/Date\((\d*)\)\//.exec(value);&#10;&#9;if (dataAsLong) {&#10;&#9;&#9;return new java.util.Date(+dataAsLong[1]);&#10;&#9;}&#10;}&#10;return value;&#10;}&#10;var Input;&#10;if(request.headers.get('Input')!=null){&#10;Input = eval('(' + request.headers.get('Input')+ ')');&#10;Input=visitMembers(Input, recursiveFunction);&#10;}&#10;var Output = {&#10; &quot;aDateList&quot;: [&#10; &quot;&quot;&#10; ],&#10; &quot;S2&quot;: {},&#10; &quot;S3&quot;: [&#10; {}&#10; ],&#10; &quot;S2s&quot;: [&#10; {}&#10; ]&#10;};&#10;importClass(org.eclipse.stardust.engine.extensions.camel.DateUtils);&#10;Output.aText=Input.aText;&#10;DateUtils.echo(Input.aDate); &#10;Output.aDate=Input.aDate;&#10;DateUtils.echo(Input.aDateTime);&#10;Output.aDateTime=Input.aDateTime;&#10;Output.aDateList=Input.aDateList;&#10;//S2&#10;DateUtils.echo(Input.S2.aDate); &#10;Output.S2.aDate=Input.S2.aDate;&#10;DateUtils.echo(Input.S2.aDateTime);&#10;Output.S2.aDateTime=Input.S2.aDateTime;&#10;//S2s&#10;&#10;Output.S2s[0]=[];&#10;DateUtils.echo(Input.S2s[0].aDate); &#10;Output.S2s[0].aDate=Input.S2s[0].aDate;&#10;DateUtils.echo(Input.S2s[0].aDateTime);&#10;Output.S2s[0].aDateTime=Input.S2s[0].aDateTime;&#10;&#10;&#10;Output.S2s[1]=[];&#10;Output.S2s[1].aDate=Input.S2s[1].aDate;&#10;DateUtils.echo(Input.S2s[1].aDateTime);&#10;Output.S2s[1].aDateTime=Input.S2s[1].aDateTime;&#10;setOutHeader('Output',Output);&lt;/constant&gt;&lt;/setHeader&gt;&lt;to uri=&quot;language:rhino-nonjdk&quot; /&gt;&lt;to uri=&quot;bean:bpmTypeConverter?method=fromNativeObject&quot; /&gt;&#10;"/>
+ <carnot:Attribute Name="stardust:scriptingOverlay::language" Value="JavaScript"/>
+ <carnot:Attribute Name="stardust:scriptingOverlay::scriptCode" Value="importClass(org.eclipse.stardust.engine.extensions.camel.DateUtils);&#10;Output.aText=Input.aText;&#10;DateUtils.echo(Input.aDate); &#10;Output.aDate=Input.aDate;&#10;DateUtils.echo(Input.aDateTime);&#10;Output.aDateTime=Input.aDateTime;&#10;Output.aDateList=Input.aDateList;&#10;//S2&#10;DateUtils.echo(Input.S2.aDate); &#10;Output.S2.aDate=Input.S2.aDate;&#10;DateUtils.echo(Input.S2.aDateTime);&#10;Output.S2.aDateTime=Input.S2.aDateTime;&#10;//S2s&#10;&#10;Output.S2s[0]=[];&#10;DateUtils.echo(Input.S2s[0].aDate); &#10;Output.S2s[0].aDate=Input.S2s[0].aDate;&#10;DateUtils.echo(Input.S2s[0].aDateTime);&#10;Output.S2s[0].aDateTime=Input.S2s[0].aDateTime;&#10;&#10;&#10;Output.S2s[1]=[];&#10;Output.S2s[1].aDate=Input.S2s[1].aDate;&#10;DateUtils.echo(Input.S2s[1].aDateTime);&#10;Output.S2s[1].aDateTime=Input.S2s[1].aDateTime;"/>
+ </carnot:Attributes>
+ </carnot:Application>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </Application>
+ </Applications>
+ <DataFields>
+ <DataField Id="PROCESS_ID" Name="Process OID" IsArray="FALSE">
+ <DataType>
+ <BasicType Type="INTEGER"/>
+ </DataType>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:DataField Oid="20" Type="primitive" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:type" Value="int" Type="org.eclipse.stardust.engine.core.pojo.data.Type"/>
+ </carnot:Attributes>
+ </carnot:DataField>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </DataField>
+ <DataField Id="ROOT_PROCESS_ID" Name="Root Process OID" IsArray="FALSE">
+ <DataType>
+ <BasicType Type="INTEGER"/>
+ </DataType>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:DataField Oid="21" Type="primitive" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:type" Value="int" Type="org.eclipse.stardust.engine.core.pojo.data.Type"/>
+ </carnot:Attributes>
+ </carnot:DataField>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </DataField>
+ <DataField Id="PROCESS_PRIORITY" Name="Process Priority" IsArray="FALSE">
+ <DataType>
+ <BasicType Type="INTEGER"/>
+ </DataType>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:DataField Oid="22" Type="primitive" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:type" Value="int" Type="org.eclipse.stardust.engine.core.pojo.data.Type"/>
+ </carnot:Attributes>
+ </carnot:DataField>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </DataField>
+ <DataField Id="CURRENT_LOCALE" Name="Current Locale" IsArray="FALSE">
+ <DataType>
+ <BasicType Type="STRING"/>
+ </DataType>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:DataField Oid="23" Type="primitive" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:type" Value="String" Type="org.eclipse.stardust.engine.core.pojo.data.Type"/>
+ </carnot:Attributes>
+ </carnot:DataField>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </DataField>
+ <DataField Id="CURRENT_DATE" Name="Current Date" IsArray="FALSE">
+ <DataType>
+ <BasicType Type="DATETIME"/>
+ </DataType>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:DataField Oid="24" Type="primitive" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:type" Value="Calendar" Type="org.eclipse.stardust.engine.core.pojo.data.Type"/>
+ </carnot:Attributes>
+ </carnot:DataField>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </DataField>
+ <DataField Id="S1" Name="S1" IsArray="FALSE">
+ <DataType>
+ <DeclaredType Id="S1"/>
+ </DataType>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:DataField Oid="39" Type="struct">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:path:separator" Value="/"/>
+ <carnot:Attribute Name="carnot:engine:data:bidirectional" Value="true" Type="boolean"/>
+ </carnot:Attributes>
+ </carnot:DataField>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </DataField>
+ </DataFields>
+ <WorkflowProcesses>
+ <WorkflowProcess Id="ScriptingExample" Name="ScriptingExample" AccessLevel="PRIVATE">
+ <ProcessHeader/>
+ <Activities>
+ <Activity Id="scriptingExample1" Name="scriptingExample 1">
+ <Implementation>
+ <Task>
+ <TaskApplication Id="scriptingExample">
+ <ActualParameters>
+ <ActualParameter>S1</ActualParameter>
+ <ActualParameter>S1</ActualParameter>
+ </ActualParameters>
+ </TaskApplication>
+ </Task>
+ </Implementation>
+ <StartMode>
+ <Automatic/>
+ </StartMode>
+ <FinishMode>
+ <Automatic/>
+ </FinishMode>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:Activity Oid="95" Implementation="Application">
+ <carnot:EventHandlers/>
+ <carnot:QualityCodes/>
+ <carnot:DataFlows>
+ <carnot:DataFlow Oid="102" Id="S1" Name="S1" Direction="IN" Context="application">
+ <carnot:DataRef Id="S1"/>
+ <carnot:AccessPointRef Id="Input"/>
+ </carnot:DataFlow>
+ <carnot:DataFlow Oid="103" Id="S1" Name="S1" Direction="OUT" Context="application">
+ <carnot:DataRef Id="S1"/>
+ <carnot:AccessPointRef Id="Output"/>
+ </carnot:DataFlow>
+ </carnot:DataFlows>
+ </carnot:Activity>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </Activity>
+ </Activities>
+ <Transitions/>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:WorkflowProcess Oid="26">
+ <carnot:Triggers/>
+ <carnot:DataPaths>
+ <carnot:DataPath Oid="69" Id="S1" Name="S1" Direction="IN" IsDescriptor="false" IsKey="false">
+ <carnot:DataRef Id="S1"/>
+ </carnot:DataPath>
+ <carnot:DataPath Oid="71" Id="S11" Name="S1" Direction="OUT" IsDescriptor="false" IsKey="false">
+ <carnot:DataRef Id="S1"/>
+ </carnot:DataPath>
+ </carnot:DataPaths>
+ <carnot:EventHandlers/>
+ <carnot:Diagrams>
+ <carnot:Diagram Oid="29" Name="Diagram 1" Orientation="Vertical" Mode="MODE_4_5_0">
+ <carnot:Symbols>
+ <carnot:Symbol Kind="POOL" Oid="28" Id="_default_pool__1" Name="Default Pool" X="0" Y="0" Width="431" Height="670" Orientation="Vertical">
+ <carnot:Symbols>
+ <carnot:Symbol Kind="LANE" Oid="27" Id="DefaultLane" Name="Default Lane" X="12" Y="32" Width="397" Height="600" Orientation="Vertical" ParticipantReference="Administrator" ParentLane="28">
+ <carnot:Symbols>
+ <carnot:Symbol Kind="DATA" Oid="40" X="30" Y="143" Width="100" Height="70" ModelElement="S1"/>
+ <carnot:Symbol Kind="ACTIVITY" Oid="96" X="133" Y="149" Width="180" Height="50" ModelElement="scriptingExample1"/>
+ </carnot:Symbols>
+ <carnot:Connections/>
+ </carnot:Symbol>
+ </carnot:Symbols>
+ <carnot:Connections>
+ <carnot:Connection Kind="DATA_FLOW" Oid="98" SourceSymbol="40" TargetSymbol="96" SourceAnchor="bottom" TargetAnchor="left"/>
+ </carnot:Connections>
+ </carnot:Symbol>
+ </carnot:Symbols>
+ <carnot:Connections/>
+ </carnot:Diagram>
+ </carnot:Diagrams>
+ </carnot:WorkflowProcess>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+ </WorkflowProcess>
+ </WorkflowProcesses>
+ <ExtendedAttributes>
+ <ExtendedAttribute Name="CarnotExt">
+ <carnot:Package Oid="0" CarnotVersion="7.3.0" ModelOid="0">
+ <carnot:MetaTypes>
+ <carnot:DataTypes>
+ <carnot:DataType Oid="1" Id="primitive" Name="Primitive Data" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.core.pojo.data.PrimitiveAccessPathEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.core.pojo.data.PrimitiveValidator"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ <carnot:DataType Oid="2" Id="serializable" Name="Serializable Data" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.core.pojo.data.JavaBeanAccessPathEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.core.pojo.data.SerializableValidator"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ <carnot:DataType Oid="3" Id="entity" Name="Entity Bean" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.extensions.ejb.data.EntityBeanEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.ejb.data.EntityBeanValidator"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ <carnot:DataType Oid="4" Id="plainXML" Name="XML Document" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.extensions.xml.data.XPathEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.xml.data.XMLValidator"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ <carnot:DataType Oid="5" Id="struct" Name="Structured Data" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataXPathEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataXMLValidator"/>
+ <carnot:Attribute Name="carnot:engine:dataFilterExtension" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataFilterExtension"/>
+ <carnot:Attribute Name="carnot:engine:dataLoader" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataLoader"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ <carnot:DataType Oid="6" Id="dmsDocument" Name="Document" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.extensions.dms.data.VfsDocumentAccessPathEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.dms.data.VfsDocumentValidator"/>
+ <carnot:Attribute Name="carnot:engine:dataFilterExtension" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataFilterExtension"/>
+ <carnot:Attribute Name="carnot:engine:dataLoader" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataLoader"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ <carnot:DataType Oid="7" Id="dmsDocumentList" Name="Document List" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.extensions.dms.data.VfsDocumentListAccessPathEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.dms.data.VfsDocumentListValidator"/>
+ <carnot:Attribute Name="carnot:engine:dataFilterExtension" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataFilterExtension"/>
+ <carnot:Attribute Name="carnot:engine:dataLoader" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataLoader"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ <carnot:DataType Oid="8" Id="dmsFolder" Name="Folder" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.extensions.dms.data.VfsDocumentAccessPathEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.dms.data.VfsDocumentValidator"/>
+ <carnot:Attribute Name="carnot:engine:dataFilterExtension" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataFilterExtension"/>
+ <carnot:Attribute Name="carnot:engine:dataLoader" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataLoader"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ <carnot:DataType Oid="9" Id="dmsFolderList" Name="Folder List" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:evaluator" Value="org.eclipse.stardust.engine.extensions.dms.data.VfsDocumentListAccessPathEvaluator"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.dms.data.VfsDocumentListValidator"/>
+ <carnot:Attribute Name="carnot:engine:dataFilterExtension" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataFilterExtension"/>
+ <carnot:Attribute Name="carnot:engine:dataLoader" Value="org.eclipse.stardust.engine.core.struct.spi.StructuredDataLoader"/>
+ </carnot:Attributes>
+ </carnot:DataType>
+ </carnot:DataTypes>
+ <carnot:ApplicationTypes>
+ <carnot:ApplicationType Oid="10" Id="sessionBean" Name="Session Bean Application" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:accessPointProvider" Value="org.eclipse.stardust.engine.extensions.ejb.app.SessionBeanAccessPointProvider"/>
+ <carnot:Attribute Name="carnot:engine:applicationInstance" Value="org.eclipse.stardust.engine.extensions.ejb.app.SessionBeanApplicationInstance"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.ejb.SessionBeanValidator"/>
+ </carnot:Attributes>
+ </carnot:ApplicationType>
+ <carnot:ApplicationType Oid="11" Id="plainJava" Name="Plain Java Application" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:accessPointProvider" Value="org.eclipse.stardust.engine.core.pojo.app.PlainJavaAccessPointProvider"/>
+ <carnot:Attribute Name="carnot:engine:applicationInstance" Value="org.eclipse.stardust.engine.core.pojo.app.PlainJavaApplicationInstance"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.core.pojo.app.PlainJavaValidator"/>
+ </carnot:Attributes>
+ </carnot:ApplicationType>
+ <carnot:ApplicationType Oid="12" Id="jms" Name="JMS Application" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:applicationInstance" Value="org.eclipse.stardust.engine.extensions.jms.app.JMSApplicationInstance"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.jms.app.JMSValidator"/>
+ </carnot:Attributes>
+ </carnot:ApplicationType>
+ <carnot:ApplicationType Oid="13" Id="webservice" Name="Web Service Application" IsPredefined="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:applicationInstance" Value="org.eclipse.stardust.engine.extensions.jaxws.app.WebserviceApplicationInstance"/>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.jaxws.app.WebserviceApplicationValidator"/>
+ </carnot:Attributes>
+ </carnot:ApplicationType>
+ <carnot:ApplicationType Oid="47" Id="camelSpringProducerApplication" Name="Camel Producer Application" IsPredefined="true" IsSynchronous="true">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.extensions.camel.app.CamelProducerSpringBeanValidator"/>
+ <carnot:Attribute Name="carnot:engine:accessPointProvider" Value="org.eclipse.stardust.engine.extensions.camel.app.CamelProducerSpringBeanAccessPointProvider"/>
+ <carnot:Attribute Name="carnot:engine:applicationInstance" Value="org.eclipse.stardust.engine.extensions.camel.app.CamelProducerSpringBeanApplicationInstance"/>
+ </carnot:Attributes>
+ </carnot:ApplicationType>
+ </carnot:ApplicationTypes>
+ <carnot:ApplicationContextTypes>
+ <carnot:ApplicationContextType Oid="14" Id="default" Name="Default Context" IsPredefined="true" HasApplicationPath="false" HasMappingId="true"/>
+ <carnot:ApplicationContextType Oid="15" Id="engine" Name="Engine Context" IsPredefined="true" HasApplicationPath="true" HasMappingId="false"/>
+ <carnot:ApplicationContextType Oid="16" Id="externalWebApp" Name="External Web Application" IsPredefined="true" HasApplicationPath="true" HasMappingId="false"/>
+ <carnot:ApplicationContextType Oid="17" Id="application" Name="Noninteractive Application Context" IsPredefined="true" HasApplicationPath="true" HasMappingId="false"/>
+ <carnot:ApplicationContextType Oid="18" Id="processInterface" Name="Process Interface Context" IsPredefined="true" HasApplicationPath="true" HasMappingId="false"/>
+ </carnot:ApplicationContextTypes>
+ <carnot:TriggerTypes>
+ <carnot:TriggerType Oid="19" Id="manual" Name="Manual Trigger" IsPredefined="true" IsPullTrigger="false">
+ <carnot:Attributes>
+ <carnot:Attribute Name="carnot:engine:validator" Value="org.eclipse.stardust.engine.core.extensions.triggers.manual.ManualTriggerValidator"/>
+ </carnot:Attributes>
+ </carnot:TriggerType>
+ </carnot:TriggerTypes>
+ <carnot:EventConditionTypes/>
+ <carnot:EventActionTypes/>
+ <carnot:LinkTypes/>
+ </carnot:MetaTypes>
+ <carnot:Modelers/>
+ <carnot:Diagrams/>
+ <carnot:Views/>
+ <carnot:Attributes>
+ <carnot:Attribute Name="ipp:model:modified" Value="Thu Nov 07 17:31:47 WAT 2013"/>
+ </carnot:Attributes>
+ </carnot:Package>
+ </ExtendedAttribute>
+ </ExtendedAttributes>
+</Package>