Skip to content

Commit 2f481a6

Browse files
committed
check in source
1 parent c00ced6 commit 2f481a6

6 files changed

Lines changed: 250 additions & 0 deletions

File tree

src/Transformation_ESQL/.project

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Transformation_ESQL</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.ibm.etools.mft.applib.applibbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.ibm.etools.mft.applib.applibresourcevalidator</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>com.ibm.etools.mft.connector.policy.ui.PolicyBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.ibm.etools.mft.applib.mbprojectbuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
<buildCommand>
29+
<name>com.ibm.etools.msg.validation.dfdl.mlibdfdlbuilder</name>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
33+
<buildCommand>
34+
<name>com.ibm.etools.mft.flow.adapters.adapterbuilder</name>
35+
<arguments>
36+
</arguments>
37+
</buildCommand>
38+
<buildCommand>
39+
<name>com.ibm.etools.mft.flow.sca.scabuilder</name>
40+
<arguments>
41+
</arguments>
42+
</buildCommand>
43+
<buildCommand>
44+
<name>com.ibm.etools.msg.validation.dfdl.mbprojectresourcesbuilder</name>
45+
<arguments>
46+
</arguments>
47+
</buildCommand>
48+
<buildCommand>
49+
<name>com.ibm.etools.mft.esql.lang.esqllangbuilder</name>
50+
<arguments>
51+
</arguments>
52+
</buildCommand>
53+
<buildCommand>
54+
<name>com.ibm.etools.mft.map.builder.mslmappingbuilder</name>
55+
<arguments>
56+
</arguments>
57+
</buildCommand>
58+
<buildCommand>
59+
<name>com.ibm.etools.mft.flow.msgflowxsltbuilder</name>
60+
<arguments>
61+
</arguments>
62+
</buildCommand>
63+
<buildCommand>
64+
<name>com.ibm.etools.mft.flow.msgflowbuilder</name>
65+
<arguments>
66+
</arguments>
67+
</buildCommand>
68+
<buildCommand>
69+
<name>com.ibm.etools.mft.decision.service.ui.decisionservicerulebuilder</name>
70+
<arguments>
71+
</arguments>
72+
</buildCommand>
73+
<buildCommand>
74+
<name>com.ibm.etools.mft.pattern.capture.PatternBuilder</name>
75+
<arguments>
76+
</arguments>
77+
</buildCommand>
78+
<buildCommand>
79+
<name>com.ibm.etools.msg.validation.dfdl.dfdlqnamevalidator</name>
80+
<arguments>
81+
</arguments>
82+
</buildCommand>
83+
<buildCommand>
84+
<name>com.ibm.etools.mft.bar.ext.barbuilder</name>
85+
<arguments>
86+
</arguments>
87+
</buildCommand>
88+
<buildCommand>
89+
<name>com.ibm.etools.mft.unittest.ui.TestCaseBuilder</name>
90+
<arguments>
91+
</arguments>
92+
</buildCommand>
93+
</buildSpec>
94+
<natures>
95+
<nature>com.ibm.etools.msgbroker.tooling.applicationNature</nature>
96+
<nature>com.ibm.etools.msgbroker.tooling.messageBrokerProjectNature</nature>
97+
<nature>com.ibm.etools.mft.bar.ext.barnature</nature>
98+
</natures>
99+
</projectDescription>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
CREATE COMPUTE MODULE Transformation_Compute
2+
CREATE FUNCTION Main() RETURNS BOOLEAN
3+
BEGIN
4+
CALL CopyMessageHeaders();
5+
-- CALL CopyEntireMessage();
6+
7+
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC';
8+
-- create references placeholders (the values will be changed later)
9+
DECLARE invoice REFERENCE TO InputRoot.XMLNSC.SaleEnvelope.SaleList.Invoice;
10+
DECLARE statement REFERENCE TO OutputRoot.XMLNSC.SaleEnvelope.SaleList;
11+
DECLARE article REFERENCE TO OutputRoot.XMLNSC.SaleEnvelope.SaleList;
12+
DECLARE amount REFERENCE TO OutputRoot.XMLNSC.SaleEnvelope.SaleList;
13+
DECLARE total DECIMAL 0;
14+
15+
-- while invoice has next element
16+
WHILE LASTMOVE(invoice) DO
17+
-- create the new message
18+
CREATE LASTCHILD OF OutputRoot.XMLNSC.SaleEnvelope.SaleList AS statement Type XMLNSC.Folder Name 'Statement';
19+
SET statement.(XMLNSC.Attribute)Type = 'Monthly';
20+
SET statement.(XMLNSC.Attribute)Style = 'Full';
21+
22+
SET statement.Customer.(XMLNSC.Field)Initials = invoice.Initial[1] || invoice.Initial[2];
23+
SET statement.Customer.(XMLNSC.Field)Name = invoice.Surname;
24+
SET statement.Customer.(XMLNSC.Field)Balance = invoice.Balance;
25+
26+
SET total = 0;
27+
DECLARE items REFERENCE TO invoice.Item;
28+
-- while items has next element
29+
WHILE LASTMOVE(items) DO
30+
-- create new Article
31+
CREATE LASTCHILD OF statement.Purchases AS article Type XMLNSC.Folder Name 'Article';
32+
SET article.(XMLNSC.Field)Desc = items.Description;
33+
SET article.(XMLNSC.Field)Cost = CAST(items.Price AS DECIMAL) * 1.6;
34+
SET article.(XMLNSC.Field)Qty = items.Quantity;
35+
36+
SET total = (CAST(items.Price AS DECIMAL) * 1.6) * CAST(items.Quantity AS INTEGER);
37+
-- go to the next item
38+
MOVE items NEXTSIBLING NAME 'Item';
39+
END WHILE;
40+
41+
SET statement.(XMLNSC.Field)Amount = total;
42+
SET statement.Amount.(XMLNSC.Attribute)Currency = invoice.Currency;
43+
44+
-- go to the next invoice
45+
MOVE invoice NEXTSIBLING NAME 'Invoice';
46+
END WHILE;
47+
48+
RETURN TRUE;
49+
END;
50+
51+
CREATE PROCEDURE CopyMessageHeaders() BEGIN
52+
DECLARE I INTEGER 1;
53+
DECLARE J INTEGER;
54+
SET J = CARDINALITY(InputRoot.*[]);
55+
WHILE I < J DO
56+
SET OutputRoot.*[I] = InputRoot.*[I];
57+
SET I = I + 1;
58+
END WHILE;
59+
END;
60+
61+
CREATE PROCEDURE CopyEntireMessage() BEGIN
62+
SET OutputRoot = InputRoot;
63+
END;
64+
END MODULE;
5.59 KB
Binary file not shown.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ComIbmCompute.msgnode="ComIbmCompute.msgnode" xmlns:ComIbmWSInput.msgnode="ComIbmWSInput.msgnode" xmlns:ComIbmWSReply.msgnode="ComIbmWSReply.msgnode" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:eflow="http://www.ibm.com/wbi/2005/eflow" xmlns:utility="http://www.ibm.com/wbi/2005/eflow_utility" nsURI="Transformation_ESQL.msgflow" nsPrefix="Transformation_ESQL.msgflow">
3+
<eClassifiers xmi:type="eflow:FCMComposite" name="FCMComposite_1">
4+
<eSuperTypes href="http://www.ibm.com/wbi/2005/eflow#//FCMBlock"/>
5+
<translation xmi:type="utility:TranslatableString" key="Transformation_ESQL" bundleName="Transformation_ESQL" pluginId="compute_Transformation"/>
6+
<colorGraphic16 xmi:type="utility:GIFFileGraphic" resourceName="platform:/plugin/compute_Transformation/icons/full/obj16/Transformation_ESQL.gif"/>
7+
<colorGraphic32 xmi:type="utility:GIFFileGraphic" resourceName="platform:/plugin/compute_Transformation/icons/full/obj30/Transformation_ESQL.gif"/>
8+
<composition>
9+
<nodes xmi:type="ComIbmCompute.msgnode:FCMComposite_1" xmi:id="FCMComposite_1_3" location="131,33" computeExpression="esql://routine/#Transformation_Compute.Main">
10+
<translation xmi:type="utility:ConstantString" string="Compute"/>
11+
</nodes>
12+
<nodes xmi:type="ComIbmWSInput.msgnode:FCMComposite_1" xmi:id="FCMComposite_1_5" location="35,37" URLSpecifier="/Transformation_ESQL" messageDomainProperty="XMLNSC">
13+
<translation xmi:type="utility:ConstantString" string="HTTP Input"/>
14+
</nodes>
15+
<nodes xmi:type="ComIbmWSReply.msgnode:FCMComposite_1" xmi:id="FCMComposite_1_1" location="229,34">
16+
<translation xmi:type="utility:ConstantString" string="HTTP Reply"/>
17+
</nodes>
18+
<connections xmi:type="eflow:FCMConnection" xmi:id="FCMConnection_1" targetNode="FCMComposite_1_3" sourceNode="FCMComposite_1_5" sourceTerminalName="OutTerminal.out" targetTerminalName="InTerminal.in"/>
19+
<connections xmi:type="eflow:FCMConnection" xmi:id="FCMConnection_2" targetNode="FCMComposite_1_1" sourceNode="FCMComposite_1_3" sourceTerminalName="OutTerminal.out" targetTerminalName="InTerminal.in"/>
20+
</composition>
21+
<propertyOrganizer/>
22+
<stickyBoard/>
23+
</eClassifiers>
24+
</ecore:EPackage>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:appDescriptor xmlns="http://com.ibm.etools.mft.descriptor.base" xmlns:ns2="http://com.ibm.etools.mft.descriptor.app"><references/></ns2:appDescriptor>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<SaleEnvelope>
3+
<Header>
4+
<SaleListCount>1</SaleListCount>
5+
<TransformationType>compute</TransformationType>
6+
</Header>
7+
<SaleList>
8+
<Invoice>
9+
<Initial>K</Initial>
10+
<Initial>A</Initial>
11+
<Surname>Braithwaite</Surname>
12+
<Item>
13+
<Code>00</Code>
14+
<Code>01</Code>
15+
<Code>02</Code>
16+
<Description>Twister</Description>
17+
<Category>Games</Category>
18+
<Price>00.30</Price>
19+
<Quantity>01</Quantity>
20+
</Item>
21+
<Item>
22+
<Code>02</Code>
23+
<Code>03</Code>
24+
<Code>01</Code>
25+
<Description>The Times Newspaper</Description>
26+
<Category>Books and Media</Category>
27+
<Price>00.20</Price>
28+
<Quantity>01</Quantity>
29+
</Item>
30+
<Balance>00.50</Balance>
31+
<Currency>Sterling</Currency>
32+
</Invoice>
33+
<Invoice>
34+
<Initial>T</Initial>
35+
<Initial>J</Initial>
36+
<Surname>Dunnwin</Surname>
37+
<Item>
38+
<Code>04</Code>
39+
<Code>05</Code>
40+
<Code>01</Code>
41+
<Description>The Origin of Species</Description>
42+
<Category>Books and Media</Category>
43+
<Price>22.34</Price>
44+
<Quantity>02</Quantity>
45+
</Item>
46+
<Item>
47+
<Code>06</Code>
48+
<Code>07</Code>
49+
<Code>01</Code>
50+
<Description>Microscope</Description>
51+
<Category>Miscellaneous</Category>
52+
<Price>36.20</Price>
53+
<Quantity>01</Quantity>
54+
</Item>
55+
<Balance>81.84</Balance>
56+
<Currency>Euros</Currency>
57+
</Invoice>
58+
</SaleList>
59+
<Trailer>
60+
<CompletionTime>12.00.00</CompletionTime>
61+
</Trailer>
62+
</SaleEnvelope>

0 commit comments

Comments
 (0)