0% found this document useful (0 votes)
31 views14 pages

BW406 25 LabK Using Java Code

Uploaded by

benlama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
31 views14 pages

BW406 25 LabK Using Java Code

Uploaded by

benlama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 14
ot Lab K: Using Java Code Lab K Using Java Code Overview In this lab you will examine the various ways in which Java code can be integrated into your BusinessWorks solution. You will first import the JMS Java code into your application so you can close the Java project you had created earlier. Objectives 18 Importing Bxisting Code, page 360 = Get OrderID and Price, page 364 Prerequisites ‘= The following software installed and configured on your EDUCLT machine: @ TIBCO ActiveMatrix BusinessWorks 6.2 1& Previous lab has been completed Directions = Complete the exercises that follow TIBCO Software Inc. Page 359 ‘BW406: Developing Solutions with TIBCO Active Matrix BusinessWorks™ 6.x 7 -_ Pa Lab K - Exercise 1: Importing = Existing Code - —— tw Overview Im this exercise you will import the existing JMS code into your application ~ Steps 1. Update your application to have a Java nature, 1 Launch Business Studio for workspace: /home/tibco/BNSEDU/myworkspace ‘9 In Project Explorer, browse to ACMEAppModule Rightlick and choose Configure > Convert to Java Project Expand the ACMEAppModule folder © Notice new folders sre and lib have been added [+ & ACMEAppModule @ Processes §B Service Descriptors ‘@ Resources @ Schemas ‘W Module Descriptors 8 ste BA JRE System Library [1.7.0] Bi Plug-in Dependencies Sib @ build properties © The JRE system libraries are also included © Inaddition, there is a new Plug-in Dependencies folder as well ail ble and cae Page 360 TIBCO Education Programs Lab K: Using Java Code Copy and paste NewOrderACME java program to your application. 1 Expand the Java Project created earlier -JMSNewOrder> sre Right-click on com.tihco.ibedu,jmstest and choose Copy ‘@ IMSNewOrder 4 @ src (iB comiibootibeduyisteal » B NewOrderACMEjava_ © Browse to ACMEAppModule > sre © Right-click on sre folder and click Paste thatthe package and java program have been copied over ‘© There are errors in the code, to be resolved soon 7 ACMEAppModule » @ Processes » IB Service Descriptors ‘@ Resources » <@ Schemas » Module Descriptors sid comtibco.tibedujmstest 6B NewOrderACME java 3. Close the original java project. @ Right-click on JMSNewOrder project, © Choose Close Project “© The project icon changes, indicating it is closed © build properties TIBCO Software Ine. Page 361 ‘BYV406: Developing Solutions with TIBCO ActiveMatric BusinessWorks™ 6.x. 4. Resolve errors with the imported Java code by adding required dependencies. Browse to ACMEAppModule > Module Descriptors % Double-click Dependencies to open details |: Dependencies Required Modules Specify the ist of Busine mles requ ‘or the operation oft Ose! Required Palettes The list of BusinessWorks palettes required for the ‘operation of this module, GAcMEShared (1.00) | [FAddases) [General Activities [imported Packages ‘Specify packages on which this plug-in depends without explicitly identifying their originating plug- in "In Imported Packages, click Add. In the pop-up window, type javax,j the list of packages appears ~ Select javax.jms (1.1.100) and click OK Similarly, add com.tibeo.tibjms.naming.tibjmsnaming (63.100) imported Packages ‘Specity packages on which this plug-in depends without explicitly identifying their originating plug-in, ‘8 javaxjms (1.1100) '|@ Save your changes, and all errors with your Java code should be resolved | Close module properties view Page 362 TIBCO Bdweation Programs Lab K: Using Java Code 5. Update the project settings and run the Java code. | Attempt to run the Java code that you just imported. © Right-click sre > com.tibco.tibedu.jmstest > NewOrderACME java © Sclect Run As>Java Application _- ‘@ The program runs, but does not send any messages, as it is missing arguments [Pseee: Java NewOrderACME '= Provide arguments to the program ‘® From the top menu, choose Run > Run Configurations... © Browse to Java Application > NewOrderACME(1) © Choose Arguments tab and enter these arguments cusT1 1001 1 1002 2 a ee ‘CUSTL 1001110022 + $l BusinessWorks Application ‘$I BWApplication @ Eclipse Application @ Eclipse Data Tools F2 Java Applet Apply changes and click Run to test the application again '@- Verify it runs by observing the console window (0} IMSExpiration=(0} INSPriority=(4) *UTE-8"2> Processes > acmeappmodule © Double-click NewOrderProcess.bwp to open it 2. Adda mapper activity to hold an OrderlD schema element. Drag a Mapper activity and place it between placeOrderOpIn and Log activity © Configure it as follows: © Name: GenerateOrder1D © Input Editor ~ Sclect Input Element and choose Create New Schema aes jae 1B ACMEAppModule i a ——— P| {© Workspace © Current and Dependent Modules © Current Module | bisplay an xSD elements [Elinclude Process Intine Schemas oa ae 2 Page 364 TIBCO Education Programs [xtoreet =.) iM im eee amm mo —l i 7m Se Be Es IF it) IB) 2 Bes 5 bes == Par tag ia a ‘Se Eee Wr a = le! Gs tae i Lab K: Using Java Code 3. Define the new schema to hold the generated OrderID. = Resource Name: Order IDSchema ® Workspace Location: /ACMEAppModule/Schemas © Select MapperInputType ~ Click Add Primitive Element (citcled)/ ~ This adds an element below MapperlaputType ~ Expand it to locate the element + Mapperinput {Mapperinputlypel 4 1B] MapperinputType © Change Blement name to OrderID (Hit enter to apply changes) Resource Name: | OrderiDSchema Workspace Locatic| /ACMEAppModule/Schemas ‘Schema Element + Bi Mapperinput (MapperinputTypel 1H MapperinputType _ fi] Prdend +i (Sting = |[Sting =] 12 Select the MapperInput [MapperInputType] ‘@ Now you can click OK = Save changes TIBCO Software Ine Page 365 | ‘BHY406: Developing Solutions with TIBCO ActiveMatrix BusinessWorks™ 6.x 4. Complete the mapper activity to generate a unique Order after the request is received, = For Generate OrderID - Properties, '@ Input for OrderID: concat ("ACME-", $placeOrderOpIn/input /ns :NewOrdexInfo/n: | omerID, "=", format-dateTime(current-dateTime() ," (¥] [¥] [0] (h] {m] [3] ")) ‘GenerateOrderiD-input ust. [concat("ACME-, | ‘SplaceOrderOpin/input/nsNewOrderinfo/nsCustomerD,| ~*, format-dateTime(current-dateTime0,"{YIIMIIDIIh) Emits) Save changes 5.__Add another mapper activity to calculate the TotalAmount after update inventory. ‘= Click Mapper activity and place it between updateltems and Inventory activity = Configure it as follows: @ Name: Caletotalamount ® Input Editor - Select Input Element ~ Choose Create New Schema ~ Resource Name: Total Amount Schema ~~ Workspace Location: /ACMEAppModule/Schemas Resource Name: TotalAmountSchema ‘Workspace Locati’/ACMEAppModule/Schemas Page 366 TIBCO kducation Programs Lab K: Using Java Code 6, Add the totalAmount element as a decimal type. Choose MapperinputType © Click Add Primitive Element = Change Element name to TotalAmount, Type: Decimal - Double — Hit Enter to apply the changes Resource Name: TotalAmountSchema Workspace Locatic /ACMEAppModule/Schemas Schema Element Tl Mapperinput {MapperlnputType] Bi MapperinputType — | [Decimat_=[Doubte|=]/4 [1 1=] fol Total ‘Browse up to MapperInput [MapperinputType] Click OK and Save changes 7. Calculate the total amount based on prices retumed by update inventory sub-process. = In CaleTotalAmount - Properties > Input ‘& Set TotalAmount using this formula: sum (for $currItem in $Updatertems/input /ne:LinextemsList/ns:LineTtemDetail return $curritem/ns:Quantity * $currItem/ns:Price) © Use mapper check and repair to resolve any namespace mismatch issues [Bg CalcTotalAmount-input ‘$Updateltems/input/ns-LineltemsList/nstLineltemDetail return Scurtitem/nsQuantity * Scuritem/nsPrice) TIBCO Software Inc. Page 367 BIV406: Developing Solutions with TIBCO ActiveMatrx business Works™ 6. Update the Log activity to record the total order amount. a Update the Inventory log activity as shown below: Update Message: concat ("Item Inventory Processing Completed, total order amount: « xsd:string ($CalcTotalAmount /Totalamount)) = Use Mapper check and repair to add the string conversion function ty Processing Completed, total 4 order amount: ", ‘xsdstring($CalcTotalAmount/TotalAmount)) 5. Run te solution to vey that OrderiD and TotlAmount are gonented ropaiy. 7 ‘= Inthe top menu of Business Studio '@ Click on Debug icon (shown below) and select 1 BWApplication Aller the BusinessWorks Applicaton starts, Click Debug icon and select 2 NewOrderAcme(1) "= Confirm that both are executed successfully ‘@ Toggle between two consoles using the icon inthe debug console view : mx | Bs 8 By Page 368 TIBCO Education Programs - (gl z E run rin Be Lab K: Using Java Code 10. Examine the details for the generated OrderID and Total Amount ‘= In the debug details window (top left), locate the NewOrderProcess and examine its execution details '@ Click on GenerateOrderID and view Job Data ‘© Confirm that OrderID is generated properly a Ma 8 2T2.| GonerateOrderID » @ iesiersNewOrderRESTChent owt, - » @ services Ordering {bw0a103} - (Ci) Input + @ acmeappmodule NewOrderProce & placeOrderOpin [bw00194.3) - | ~ GenerateOrdeiD (bn 0019883), = loa tow00i945}- one) ‘Click on Updateltems and examine the Output LineltemDetail [1 Export > Studio Projects to Archive © Save as BW406LabK.zip = Exit Business Studio Page 370 TIBCO Education Programs Lab K: Using Java Code Notes TIBCO Software Ine. Page 371 BWA06: Developing Solutions with TIBCC Active Matrix BusinessWorks™ 6:2 Notes eee Page 372 TIBCO Education Programs

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy