Home
PDF now
Contents
1. Calling External J ava or Native Programs Calling Java programs Java programs can be called directly from custom plugin service provided the class path has been set in Adeptia server environment To know how to set the path in Adeptia Server environment refer to the section Dependency Custom plugin service also needs to add import for the classes to be used in the custom plugin service Adeptia Developer s Reference Guide Ver 1 0 12 A ADEPTIA Creating Java Packages Steps to create J ava packages 1 Create java packages to create classes in particular class hierarchy For example folders can be created in hierarchy samples javaprograms 2 Create a java program package samples javaprogram public class sampleJavaProgram public String hello String name return Hello name 3 Create samples jar of this class and put in folder ServerKernel Samples 4 Set jar path in launcher properties Add line samples samples jar 5 Restart Adeptia Kernel server Importing J ava Packages into Custom plugin service The sample code used to import Java Packages is outlined below import samples javaprogram sampleJavaProgram String username String context get username try sampleJavaProgram cjp new sampleJavaProgram String greeting cjp hello username System out println Result gt username context put result username catch Exception e c
2. 1 You need to select the SQL Query radio button This activates the SQL Query field 2 Define a valid SQL Query that uses the Aggregate function which always returns one value 3 Mark the Check Condition checkbox as checked Define the conditional value E Defining the Poling Frequency You need to define a polling frequency This is the frequency on the basis of which the data in the table gets updated If you think data is getting updated on an average every minute then you can define the polling frequency as 1 minute This implies that the select query will get executed every minute Triggering of Event Adeptia Developer s Reference Guide Ver 1 0 46 A ADEPTIA 1 On activating the Database Event the event will execute the select query after each polling time interval 2 If that query returns a value that matches the conditional value specified in the Database Event activity then the process flow gets triggered Else an error is logged and the process flow is not triggered Passing the I nformation to the Process Flow In this case no data is passed from the event to the process flow It works like a plain trigger Example Case You have a table named CustomerPolicy in the database This table maintains all policy information and also records information such as the status whether the customer has paid premium amount or not Your company monitors the number of customers who have not paid their premium
3. OB CCUG ia 4 PrS TO QUISO ii 4 Custom J ava Development with Adeptia ocmococcooconconcnnnnncanrannnnnnnanos 5 Adeptia Services That Can Be Extended For Custom J ava DV op Mia A 5 Using Adeptia Custom Plugin SEerVIiCe w wemmmmemmammmnmowa 5 Interacting With the Service Variables and Predefined Methods 6 Interacting With StreamsS oooononconocicnnonocconcnnononncnnononnonnnaonnconoonrono noo ncnno nooo 6 Interacting With Context Varlables oococcionnnnnncnnonncconornnncnnonocnnnnonos 9 Data Handling and Transformation lt lt wswswwwewewememememamamamama 11 Calling External Java or Native Programs cooccnccncncccnonoconononnnononinononos 12 LOGGING in 14 Exception Handling siii 14 Dei A a i 15 EXAM leS rado 15 Custom API For Custom J ava Development oococccoconconcnnnoncannnncannnnas 24 Java API for Adeptia Product oooccoconconcoconnconinonncinoninonornnonncnnrnncnnonncnnncnnnnonos 24 Java APIs For Third Party Libraries oooooconoconnconoconnnonnoncnnrnnononno nono 24 Adan 25 ASOLDB ad 25 Castor me AA AA AA AA AA AA AA 26 LI N 26 A ee ee 26 ME S reestr isan caesar AA Wa Ma wa KA KA 27 Java MLA PI aria 27 Design Parte risas 29 ODJEVEN R 29 Business Sc narios aiii 29 Developing Complex GUI for Human Workflow 31 ODJ ECUV E an Ri 31 Requires cd 31 A A PRT eo UR OR oe Se San eee 31 USE of c stom J S Pi
4. and amount gt 10000 the rowid of the inserted record is added in Adeptia s temporary table called dbeventtriggertable The Database event is triggered as per the polling frequency specified in the Database Event activity It triggers the bound process flow if an entry corresponding to the Database Event is found in the dbeventtriggertable Different process flows are triggered for each entry in the dbeventtriggertable and the Where Clause Where rowid lt rowid of the inserted record gt of the INSERT statement of the trigger body is set in the context This information set in the context overrides the Where clause of the Database source activity if its EventContextenabled property is selected as True Adeptia Developer s Reference Guide Ver 1 0 54 ADEPTIA Advantages SOL Trigger enables you to keep a track of the data inserted update or deleted from a table Limitations SQL Trigger creation is supported by limited databases only These databases are outlined as Oracle SQL Server Sybase Problem Scenarios where both SQL Query or SQL Trigger serve as solutions In some problem scenarios both the SQL Query or SQL Trigger methods can be used as solutions A few such cases are described below Triggering the process per record bases and process that record in process flow In such a case if the database and Adeptia support SQL Trigger creation then it is recommended to use the SQL Trigger optio
5. left gt lt xsl choose gt lt xsliwhen test string length sourceParam lt length gt lt xsl call template name paddingTemplate gt lt xsl with param name sourceParam select concat padChar sourceParam gt lt xsl with param name padChar select padChar gt lt xsl with param name length select length gt lt xsl with param name paddingSide select padding3ide gt New Template IL Save Template Delete Template Close Figure Creating XSL Template 2 Click Save Template and then Close to save the template and return to the Data Mapper screen Using XSL Template 1 Click the Name field in the Target panel It appears in the Mapping Graph Area 2 Double click the Name field in the Source panel It appears in the Mapping Graph Area 3 Define three constants for creating the parameters as Constant Data Type lt String 25 Number Left String 4 Click paddingTemplate from the Parameters Panel It appears in the Mapping Graph Area 5 Map the Name field source and the constants to the XSL template and thereon to the Name field target by dragging the fields and clicking the Apply Mapping button see Figure below Adeptia Developer s Reference Guide Ver 1 0 59 A ADEPTIA gt ADEPTIA Data Mapper customer File View Actions Help EB XML Mapper Mapping xsi 8 Simulate H0O Current Ele
6. service write bytes Stream2 if Note Stream2 should be output stream this can be ji checked in PD for current custom plugin service activity zin close Example 2 Getting XML as input stream and sending the data to one output stream Description Stream coming from Schema type activity or File Source XML File activity and parsing and creating DOM parser object to do specific task and then sending data to output stream Setup 1 Custom plugin service should have one incoming input stream and one output stream Adeptia Developer s Reference Guide Ver 1 0 16 A ADEPTIA 2 Check PD for current custom plugin service activity for attribute Source Stream for input and Stream Names for output Code import javax xml parsers DocumentBuilder import javax xml parsers DocumentBuilderFactory import org w3c dom Document import org w3c dom NamedNodeMap import org w3c dom Node import org w3c dom NodeList getting factory instance DocumentBuilderFactory factory DocumentBuilderFactory newInstance getting parser DocumentBuilder parser factory newDocumentBuilder getting document Document doc parser parse inputStream getting all employ nodes NodeList nlist doc getElementsByTagName Employee int length nlist getLength getting employ nam for int i 0 i lt length i Node node nlist item i NamedNodeMap nodeMap n
7. Register the process flow with its corresponding Database Event using the Adeptia Event Registry Activating the Database Event On activating the Database event the select query is executed and the value of the first object obtained from the result is compared with the conditional value as per the relational operator selected Hence the process flow gets triggered only once If no row is returned then the system logs the information but does not trigger a process flow Advantages It is easy to use as it is simple to write and implement t is supported by all databases t can be used to trigger the same process flow multiple times depending upon the number of rows returned by the query Limitations When you use the SQL Query to match a conditional value then it checks only the first value returned by the query For example in the SQL query where Select EmplD from EMP which returns more than one row Check Condition checkbox is marked as checked Relational Operator is selected as Equal To Conditional value is entered as 10 When the event is activated then only the first value retuned by the query is matched with the conditional value If it matches then the process flow gets trigger otherwise not Using SQL Trigger A SQL Trigger is a set of SQL statements that get executed when data in a table is changed due to any Insert Update Delete operation If the database supports SQL Trigger creation then it is r
8. input and Stream Names for output Code Zipl import java import java import java Entry ze which is Af ZipInputStream zin new ZipInputStream new BufferedInputStream inputStream io BufferedInputStream util zip ZipInputStream util zip ZipEntry null Reading the input data inputStream represents the input data Stream implicitly available to Script Any data processing logic Adeptia Developer s Reference Guide Ver 1 0 15 A ADEPTIA while ze zin getNextEntry null if ze getName equals FirstFile txt getting size int filesize int ze getSize byte bytes new byte n zin read bytes 0 n es Writing output data to output stream read by another If activity service this is the Custom plugin service Service object which is also available implicitly to the soript service write bytes Streaml Note Streaml should be output stream this can be IT checked in PD for current custom plugin service activity if ze getName equals SecondFile txt ia getting size int filesize int ze getSize byte bytes new byte n zin read bytes 0 n Writing output data to output stream read by another FL CAGE if service this is the Custom plugin service Service object ie which is also available implicitly to the SCEIpt
9. ris readRecord null check if header record is present if headerRecordCheck headerRecordCheck false continue if getting field values String name String record getObject name String age String record getObject age String salary String record getObject Salary service write Name name getBytes Streaml service write Age age getBytes Streaml service write Salary salary getBytes Streaml new line service write n getBytes Streaml catch EOFException e end of record stream reached service write End of records n getBytes Streaml catch Exception e error in stream handling throw e Example 4 Getting Records from input record stream and sending the data to output stream as XML output Adeptia Developer s Reference Guide Ver 1 0 19 A ADEPTIA Description A Schema type activity can send record stream to custom plugin service Attributes of Schema activity check PD for schema activity namely Transformer Type and Format can be set to SchemaStream2IntermediateTransformer and NATIVE respectively Custom plugin service will read the record stream and it will convert it to XML stream Setup 1 Custom plugin service should have one incoming input stream and one output stream 2 Check PD for current custom plugin service
10. 0 26 ADEPTIA Website http jasperforge org Download Link ltemid 277 VFS Jar Files Required commons vfs 1 0 dev jar commons httpclient 2 0 2 jar commons net 1 4 1 jar jsch 0 1 5 jar jakarta slide webdavlib 2 1 jar jdom 1 0 jar jdom 1 0b8 jar jcifs 1 2 9 jar License Type Apache 2 0 License http www apache org licenses LI CENSE 2 0 Website http jakarta apache org commons vfs Download Link http jakarta apache org commons vfs download html Java Mail API Jar Files Required mail jar License Type http www java com en download license jsp Adeptia Developer s Reference Guide Ver 1 0 27 ADEPTIA Website http java sun com products javamail Download Link http java sun com products javamail downloads index html Adeptia Developer s Reference Guide Ver 1 0 28 A ADEPTIA DESIGN PATTERNS A design pattern offers readymade solutions to standard business scenarios encountered while developing complex solutions OBJ ECTI VE Provide readymade solutions to standard problems Identify which service to use in a business scenario Provide guidelines on how to use a service in a business scenario Provide comprehensive information associated with using a service BUSINESS SCENARI OS Business scenarios refer to the standard problems that are commonly encountered by a developer while developing complex s
11. Character Separates the different output streams Streaml Name of the target stream sending data from custom plugin service to target activity Stream2 Name of the target stream sending data from custom plugin service to target activity Stream5 Name of the target stream sending data from custom plugin service to target activity The following code snippet gives the information to access output stream imports import com adeptia indigo services transform ScriptedService import java io OutputStream type casting service to ScriptedService instance ScriptedService myscriptedService ScriptedService service to write data on stream default myscriptedService write data to send getBytes Streaml1 alternative way to get outstream is OutputStream os service getOutputStream Streaml Interacting With Context Variables Context is process flow context Process flow variables can be accessed created through it To get a Context Variable s value from a Process Flow The following code snippet gives the information to access Process flow variables Adeptia Developer s Reference Guide Ver 1 0 9 A ADEPTIA To get value of process flow variable orderName String orderNam context get orderName To get value of filePath attribute of FileSource activity after its execution Here filesourcel is of FileSource t
12. The free Type 4 drivers that can be downloaded from the web are listed in the table below A list of the standard Type 4 Drivers with their class name and jar files and the Server URL required for Database Info supported by a Database Event are outlined in the table below Adeptia Developer s Reference Guide Ver 1 0 40 ADEPTIA Database Name Driver Main Class Name Driver J ar Files Server URL MSSQL com microsoft jdbc sqls erver SQLServerDriver msbase jar mssqlserver jar msutil jar Bundled with Adeptia jdbc microsoft sqlser ver lt databaseServ erName gt lt portNumb er gt DatabaseName lt DatabaseName gt SQL using J TDS net sourceforge jtds jd bc Driver jtds 1 2 jar jdbc jtds sqlserver lt databaseServerName gt lt portNumber gt Datab aseName lt DatabaseName gt oracle jdbc driver Oracl classes12 jar jdbc oracle thin lt da Oracle eDriver tabaseServerName gt Bundled with lt portNumber gt lt datab Adeptia aseName gt DB2 com ibm db2 jcc DB2Dr db2jcc jar jdbc db2 lt database iver ServerName gt lt portNumber gt lt data baseName gt HSQLDB Org hsqldb jdbcDriver hsqldb 1 8 0 1 jar jdbc hsqldb hsql lt da Bundled with tabaseServerName gt lt Adeptia portNumber gt Sybase com sybase jdbc2 jdbc jconn2 jar jdbc sybase Tds lt ser SybDriver verName gt lt portNum ber gt j
13. WHERE empname empname END Sybase CREATE TRIGGER mytrig on EMP for insert update as declare name varchar begin set name select NAME from inserted INSERT INTO dbeventtriggertable VALUES Query WHERE NAME name END When the trigger is fired the Where clause will be updated to Where NAME Smith where Smith is the inserted value in the NAME field of the EMP table The syntax of the trigger varies for each database It is outlined in the table below Database Trigger Definition Reference Name Oracle CREATE OR REPLACE http infolab stanford edu ullman fcdb orac TRIGGER lt trigger_name gt BEFORE AFTER INSERT DELETE UPDATE ON lt table_name gt REFERENCING NEW AS lt new_row_name gt OLD AS lt old_row_name gt FOR EACH ROW WHEN lt trigger_condition gt lt trigger_body gt End lt lt trigger_name gt le or triggers html basic 20trigger 20syntax Adeptia Developer s Reference Guide Ver 1 0 50 A ADEPTIA SQI Server CREATE TRIGGER trigger_name ON table view WITH ENCRYPTION FOR AFTER INSTEAD OF INSERT UPDATE DELETE WITH APPEND NOT FOR REPLICATION AS IF UPDATE column AND OR UPDATE column n IF COLUMNS UPDATED bitwise_operator updated_bitmask comparison_operator colum
14. from the Input XML Schema drop down list This XML Schema corresponds to the XML Input provided by Web Service consumer activity In this scenario it will be the schema defined for Auto Insurance Policy Application Select the Output XML Schema from the Output XML Schema drop down list In this scenario it will be the schema defined for Policy Quote Enter the Input and Output Variables in the Input Variable and Output variable fields respectively The variable name should be same as that of the parameterName value of context source and context target respectively Select the Security Policy activity from the Security Policy drop down list The data entry is displayed in the Figure below D If any security policy is not selected then the web service is published in anonymous mode i e the web service published is not secure and any web service client can invoke the published Web service without any Adeptia authentication H Standard properties Name GeneratePolictyQuote_WsService Description veb service to generate policy quote Asynchronous v Request Service Name ReqSevice AA Response Service Name ResSewice AA Process Flow Name GeneratePolicyQuote Process flow to generate y OuputSchema Policy quote M Output XML Schema Input Variable Name WsSericeRequest Output Variable Name WsSericeResponse Security Policy None Input XML Schema Adeptia Developer s R
15. policy at regular intervals Each time this number exceeds 100 you need to notify the senior management and send all details of the customers You need to do this within one hour of this number reaching 100 The CustomerPolicy table exists in MSAccess database Solution In such a case you need to create a Database event using a SQL query that will trigger a process flow each time the number of customers who have not paid their premium amount exceeds 100 The process flow will send an email to the senior management with the customer details Defining Database Event For this you define the SQL query by performing the following steps 1 Enter a select query Select Count CustomerPolicy where Premium_Status notPaid in the SQL Query field This query returns the total number of customers who have not paid their premium amount 2 Mark the Check Condition checkbox as checked 3 Select the Relational operator as Greater Than from the Operator drop down list 4 Enter the conditional value as 100 in the Value field 5 Select the polling frequency as 60 minutes from the Polling Frequency drop down list Defining Process flow Define a process flow for processing the record Please ensure that the Database Source activity in the process flow should be created with the EventContextEnabled property selected as True Registering Process Flow with Database Event Adeptia Developer s Reference Guide Ver 1 0 47 A ADEPTIA
16. put filePath c mypath myfile txt context put filesourcel params map The activity s attribute can be set before its execution by following convention Map map Map context get lt ActivityName gt params map put lt AttributeName gt c mypath myfile txt context put lt ActivityName gt params map Its parameters are outlined in the table below Parameter Description ActivityName Name of the activity like fileSourcel AttributeName Name of the attribute like filePath The following code snippet gives the information to set the value in the process flow variable To set value in process flow variable import java io Map import java io HashMap Map mymap new HashMap mymap put customerName John mymap put customerld 34344 context put customerMap mymap The created process flow variables may not be available in PD GUI But D these can be accessed through Put Context Variable Data Handling and Transformation Custom plugin service can get two types of input streams XML Plain Streams An XML stream can be generated by schema type activity and can be passed to current custom plugin service It can also be generated by file source activity if the file source activity is pointing to an XML file Data into XML stream are passed into XML format For example FileSource gt Tex
17. the fields and clicking the Apply Mapping button Example Case You need to map the Name and Salary fields from Text schema source to Positional schema target The length of the Name field in the Text schema is 4 characters whereas it is 25 characters in the Positional schema Similarly the field length of Salary is 6 characters in the Text schema whereas it is 10 characters in the Positional schema Since the target schema is a Positional schema the field length is fixed and for mapping it requires the field in the source schema to be of the same length Solution You need to pad the Name and Salary fields in the Text schema to increase their length to the desired length in the Positional schema You can pad it with the space character You can pad the Name field in the left direction and the Salary field in the right direction Creating XSL Template 1 Enter the details in the Manage XSL Template screen as shown in the figure below Adeptia Developer s Reference Guide Ver 1 0 58 A ADEPTIA Manage XSL Template 29 Templates Name paddingTemplate Parameter List TE padChar length paddingSide XSL Template lkxsl template name paddingTemplate gt lt xsl param name sourceParam gt lt xsl param name padChar gt lt xsliparam name length gt lt xsliparam name paddingSide gt lt template code starts gt lt xsl choose gt lt xsliwhen test SpaddingSide
18. 2000 osName equalsIgnoreCase WINDOWS NT osName equalslgnoreCase WINDOWS XP commandstr cmd ja To get window directory command output creating command string ej String cmd new String 4 cmd 0 commandStr emd 1 c Carries out the command specified by string and then terminates cmd 2 dir Path to exe bat file emd 3 c XX argument can be passed from context context get argl getting runtime object for more detail see java docs for java lang Runtime Runtime rt Runtime getRuntime executing command Process p rt exec cmd starting error and outputstream streams in separate threads final BufferedReader outputStream new BufferedReader new InputStreamReader p getInputStream final BufferedReader errorStream new BufferedReader new InputStreamReader p getErrorStream Thread errorThread new Thread new Runnable void run EXY A String err_str while err_str errorStream readLine null errorResult append err_str An catch IOException e System err println e Adeptia Developer s Reference Guide Ver 1 0 22 A ADEPTIA Da les starting error thread errorThread start Thread outputThread new Thread new Runnable void run ERY A String out_str T capturing process output while out_str outputStream readLine nul
19. 31 Working with Web Service Publisher oocococcononcnicconncnnoconoonconononocnno nono 34 SS CES aia 34 TASKS O E 34 A E 34 Appendix A Input XML schema cccocccnccnoconocononacinonacononanonocanonacnnonacino nacos 38 Adeptia Developer s Reference Guide Ver 1 0 2 ADEPTIA Appendix B Output XML schema oococccncoccccccocococcconononaconononncnnononnnnnos 39 Using Database Event orinar ii 40 ODISCIMO naaa 40 Tasks For Using Database EVEeNt wmememmnmmenmomenzmma mnno 40 Creating Database Drivers and Database Info c 40 Creating Database EVEN ccccccscssecscsssessesecssesecssesecssecsessscsseseens 42 Using SOL QUESTY ida 42 O e Seon 48 LINUS O 48 Using SOL Trigger ai 48 Database Name ninas 49 A A te tyre MAA SENET eae FE NAA UNA TOM PEt ten AFIA 49 Trigger DST rai 49 Database Nana 50 Trigger DST ARON iia 50 FRETS PPP A A 50 AdvantageS ii 55 Limitation iia 55 Problem Scenarios where both SQL Query or SQL Trigger serve aS SEN tas 55 Appendix Li espe ee aoe 55 Using XSL Template for Padding in MappIiNd wwwwwewmmemememmea 56 ODIO tennis 56 o A A WAUA SA ARI MBUTA MENINA AWA 56 Adeptia Developer s Reference Guide Ver 1 0 3 A ADEPTIA OBJ ECTI VE This document describes the scope and the topics covered in Technical Documentation for Developer It acts as a reference guide for developers while developing solutions using the Adepti
20. A ADEPTIA Adeptia Developer s Reference Guide Version 1 0 Release Date Jan 18 2012 343 West Erie Suite 440 Chicago IL 60654 USA Phone 312 229 1727 x111 Fax 312 229 1736 A ADEPTIA Copyright Copyright 2000 2007 Adeptia Inc All rights reserved Trademarks The Adeptia logo and Manage Automate and Optimize Business Processes are trademarks of Adeptia Inc Statement of Conditions Adeptia Inc provides this publication as is without warranty of any kind either express or implied In no event shall Adeptia be liable for any loss of profits loss of business loss of use or data interruption of business or for indirect special punitive incidental or consequential damages of any kind No part of this work covered by copyright herein may be reproduced in any form or by any means graphic electronic or mechanical including photocopying recording taping or storage in an information retrieval system without prior written permission of the copyright owner This publication is subject to replacement by a later edition To determine if a later edition exists contact www adeptia com Contact Information In case of any queries please contact us at Contact For Email ID Sales sales adeptia com Support support adeptia com For more information you can visit us at www adeptia com Adeptia Developer s Reference Guide Ver 1 0 ADEPTIA Table of Contents
21. Objective This document describes the method of publishing a business process as a web service Tasks 1 Creating a process flow 2 Creating a security policy optional 3 Creating a WsProvider Example Case You have a business process that takes the Auto Insurance Policy application and returns back the Policy Quote You want to publish this process as a web service Solution To publish the process as a web service you need to design a process from perspective that it is similar to a function that takes input processes it and generates output While designing you need to remember Web service always takes input as XML data Web service always generate output as XML data You need to define both XML data formats the one that the web service will take as input and the format that the web service will generate as output You can do this using the Adeptia XML schema activity You need to define input and output XML schemas Creating process flow Based on function analogy a process flow will have four parts 1 Defining input and output XML schemas 2 Getting input data from client request 3 Data processing logic 4 Sending output back as response to client Defining Input and Output XML schema You need to use Adeptia XML schema activity to define XML schemas for input and output To do that you need to define Adeptia Developer s Reference Guide Ver 1 0 34 A ADEPTIA The XSD for the input XML For e
22. Source should be set to true If the EventContextEnabled property is true then where clause of the Database Source gets overridden by the where clause of the Database Event set in the process flow context In the current scenario the Where clause of the Database source gets overridden by Where NAME Smith and this makes sure that the database source picks up the same record for which the event was triggered If the database event is deactivated then the system deletes the polling D frequency value and the complete trigger Examples Case 1 You have a table named EMP in the Oracle database in your company When a new employee joins your company a new record gets added in this table When a new record is inserted in the table you have to initiate a few transactions Solution In such a case you need to create a Database event using a SQL Trigger that will trigger a process flow each time a new employee record is inserted in the EMP table The event will then pass this Employee record to the process flow for processing Defining Database event For this you define the SQL Trigger by performing the following steps 1 Enter the SQL Trigger as CREATE OR REPLACE TRIGGER trig After insert or update on emp for each row begin INSERT INTO dbeventtriggertable VALUES Query WHERE rowid new rowid END trig The rowid field is used to identify the row for which the trigger is fired YA The in
23. VE respectively Setup 1 Custom plugin service should have one incoming input stream and one output stream 2 Check PD for current custom plugin service activity for attribute w Source Stream for input and Stream Names for output Record stream is coming from Text Schema having three fields name age and salary having format string number and number respectively Record Format A record can have multiple fields and each field has a value This value can be used to create java lang String java util Date or java lang Double objects Generic method to get object Object obj record getObject field_name Code import com adeptia indigo io RecordStreamFactory import com adeptia indigo io RecordInputStream import com adeptia indigo io Record import java io EOFException ja getting record stream by using RecordStreamFactory s following static method public static RecordInputStream createInputStream InputStream Adeptia Developer s Reference Guide Ver 1 0 18 A ADEPTIA inputStream Schema schema String format RecordInputStream ris RecordStreamFactory createInputStream inputStream null RecordStreamFactory NATIVE_FORMA e Record record null try header present boolean headerRecordCheck false writing to output stream service write Writing record n getBytes Streaml reading record while record
24. XmlEncoder OutputStream ostream String characterSetEncoding xme new XmlEncoder scriptedService getOutputStream Streaml TSO 8859 1 ah writing xml header xme writeProlog Ed reading record while record ris readRecord null ES writing record xme writeRecord record catch EOFException e end of record stream reached xme close catch Exception e error in stream handling throw e Example 5 Calling a native program and passing input parameters and getting result back Description A native program can be called from java program and result can be used back in program Setup 1 A native program exe bat should accessible 2 Custom plugin service generates an output stream Stream1 and consume no stream Code import java io BufferedReader import java io InputStreamReader store the result in string buffer final StringBuffer result new StringBuffer final StringBuffer errorResult new StringBuffer Adeptia Developer s Reference Guide Ver 1 0 21 A ADEPTIA String osName System getProperty os name System out println OS name osName String commandStr null for windows 2000 use cmd and for windows 95 use command for command shell 7 if osName equalsIgnoreCase WINDOWS 95 commandStr command else if osName equalsIgnoreCase WINDOWS
25. a product It is complementary to the User Guide The current product documentation does not provide sufficient information to develop complex solutions using the product Thus there is need to provide Documentation for Custom Java development with Adeptia product Adeptia services that can be extended for custom Java development Custom API for Adeptia Java API for Adeptia Product Java API for Third Party Libraries Example Code segments Design patterns that cover the readymade solutions to standard business scenarios that a developer encounters while developing complex solutions It guides the developer as in what to use for what situation and how to use it PRE REQUISITES Before reading this document it is assumed that you have conformed to the following pre requisites Complete knowledge of Java Familiarity with the Adeptia product Undertaken a 2 day training of the Adeptia product preferred Read the User Guide Adeptia Developer s Reference Guide Ver 1 0 4 ADEPTIA CUSTOM J AVA DEVELOPMENT WITH ADEPTIA This section describes all the Adeptia features that can be extended using custom J ava coding It provides Java API reference that can be used for coding ADEPTIA SERVICES THAT CAN BE EXTENDED FOR CUSTOM J AVA DEVELOPMENT The Adeptia services that can be enhanced for custom Java coding are outlined below Custom Plugin You can develop Java code to create and execute customized
26. activity for attribute 3 Source Stream for input and Stream Names for output 4 Record stream is coming from Text Schema having three fields name age and salary having format string number and number respectively Record Format A record can have multiple fields and each field has a value This value can be used to create java lang String java util Date or java lang Double objects Generic method to get object Object obj record getObject field_name Object obj record getObject field_name Code import com adeptia indigo io Record import com adeptia indigo io RecordInputStream import com adeptia indigo io RecordStreamFactory import com adeptia indigo io XmlEncoder import com adeptia indigo services transform ScriptedService getting the current custom plugin service instance ScriptedService scriptedService ScriptedService service getting record stream by using RecordStreamFactory s following Static method public static RecordInputStream createInputStream InputStream inputStream Schema schema String format ad RecordInputStream ris RecordStreamFactory createInputStream inputStream null RecordStreamFactory NATIVE_FORMAT lt se Record record null Adeptia Developer s Reference Guide Ver 1 0 20 A ADEPTIA XmlEncoder xme null try creating instance of XmlEncoder to send XML data use constructor public
27. adeptiaAPI zip in a java doc format Following APIs are included in this version com adeptia indigo utils MBeanUtils com adeptia com adeptia com adeptia com adeptia com adeptia com adeptia com adeptia J AVA API s FOR THIRD PARTY LIBRARIES In addition to the inbuilt Java APIs Adeptia supports These are outlined in the table below indigo system ndigoConfig indigo system Context indigo storage EntityManager indigo storage EntityManagerFactory indigo storage TypedEntityld indigo logging Logger indigo utils Transaction nformation certain external APIs for custom coding Third Party API Version Source Description JRE 1 5 Sun It is the Java runtime environment HSQLDB 1 8 SourceForge It is used as an embedded database It is a relational database management system written in J ava Castor 0 9 6 Codehaus It is used for Java to SQL persistence with JDO approach It is an Open Source data binding framework for Java tm It s the shortest path between Java objects XML documents and relational tables Castor provides J ava to XML binding J ava to SQL persistence and more Log4 1 2 8 Apache It is a Java based logging utility and is used for logging Jasper 4 0 4 SourceForge Jasper Reports is a powerful open source Adeptia Developer s Reference Guide Ver 1 0 24 ADEPTIA Java reporting tool that has the ability to delive
28. arameterMame WsServiceRequest Mail Source Ex treamilames ll WebdavSource Synch true Eid CopyActivity Type ContextSource FW Target E a 1 9 WebServices hd 4 gt Figure Adding context source activity and defining it in process flow Data Processing logic The input data is then processed to generate a required output The data processing logic can include data transformation activity and other Adeptia activity or group of activities To process the input data it will use input XML schema activity It will use output XML schema activity to generate output data in XML format The output generated after processing the input data is set in the Process flow context through contextTarget Sending Output back as response to client In the process flow you need to use ContextTarget as activity You need to define a parameterName Web service client output data will be assigned to this parameterName Adeptia Developer s Reference Guide Ver 1 0 35 A ADEPTIA The ContextTarget will take data from the data processing activity and assign to the parameterName defined above This is displayed in the Figure below The D parameterName WsProvider activity as output variable name user here will be used while defining the BPMN Events Panel eS ContextTarget Activities Panel 3 D Notification FA iy Polling 2 RepeaterNode ed Schema EA S
29. connect_versi on 5 In addition to the listed Type 4 drivers you can also use other Type D 4 drivers that are available for these databases J DBC ODBC Drivers A JDBC ODBC bridge driver enables a Java application to communicate with any ODBC complaint database ODBC represents open database connectivity Currently mostly all databases are ODBC complaint Pre requisites Before creating a JDBC ODBC Driver you need to ensure that the following pre requisites are conformed to The database and Adeptia product must be installed on the same machine The DSN must be created on the client machine D For details on creating a DSN refer to Appendix 1 Adeptia Developer s Reference Guide Ver 1 0 41 ADEPTIA A list of JDBC ODBC Drivers with their class name and jar files and the Server URL required for Database Info supported by a Database event are outlined in the table below Database Driver Driver Main Class Name Driver J ar Server URL Files MS Access sun jdbc odbc JdbcOdbcDr NA jdbc odbc lt DSN name gt ivers jdbc odbc Driver Microsoft Access Driver mdb DBBQ lt Microsoft Access DB filename mdb with full path gt MS Excel sun jdbc odbc JdbcOdbcDr NA jdbc odbc Driver Microsoft ivers Access Driver xls DBQ lt Microsoft Excel filename xls with full path gt An example Server URL for each database
30. correction Usage of PutContextVar Common problems that occur when using PutContextVar are outlined as Dynamically overriding activity parameters Dynamically overriding activity Dynamically overriding activities in a process flow Common problems that occur when dynamically overriding activities in a process flow are outlined as Overriding schema to handle various data format Overriding Source to decide data source at run time Overriding target to decide data target at run time for dynamic content routing Overriding Mapping to apply transformation as per incoming data format Dynamically assigning a human workflow task to a user Adeptia Developer s Reference Guide Ver 1 0 30 A ADEPTIA DEVELOPING COMPLEX GUI FOR HUMAN WORKFLOW Objective This document describes methods to create complex forms in Human Workflow Requirements To allow a user to review the data in a simple layout in the browser To allow a user to update the data in Browse after review and send it back to the process To allow a user to add new data fields in Browser insert value in data fields and send it back to the process To organize the data in two layouts Grid Layout It supports Flat data t supports Hierarchical data Form Layout Form layout supports navigation from one page to another Form can have pre populated values that comes from database based on parameters passed from process flow App
31. dChar select SpadChar gt lt xsl with param name length select Slength gt lt xsl with param name paddingSide select SpaddingSide gt lt xsl call template gt lt xsl when gt lt xsl otherwise gt lt xsl value of select substring sourceParam string length sourceParam Slength 1 gt lt xsl otherwise gt lt xsl choose gt lt xsl if gt lt xsl otherwise gt lt xsl choose gt lt xsl template gt Figure XSL Code 4 Save the template For details on creating an XSL Template refer to Using XSL Template D section in the User Guide Using XSL Template Once you have created the XSL template you need to use it to map the fields from the source schema to the target schema The newly created template appears in the Parameters Panel Adeptia Developer s Reference Guide Ver 1 0 57 A ADEPTIA To use the XSL template to map the fields 1 Click the field that is to be mapped in the target schema It appears in the Mapping Graph Area 2 Double click the field to be mapped in the source schema It appears in the Mapping Graph Area 3 Define three constants for creating the padding character target length and padding side parameters 4 Click the newly created XSL template for the padding It appears in the Mapping Graph Area 5 Map the source field and the constants to the XSL template and thereon to the target field by dragging
32. ecommended to use the SQL Trigger method to trigger a process flow whenever any DML Insert Update Delete operation is performed on a database table Many databases support SQL Trigger creation but Adeptia supports SQL Trigger creation for the listed databases Oracle SOL Server Sybase In the current release Adeptia supports these databases In future D releases it will support all databases that support SQL Trigger creation Adeptia Developer s Reference Guide Ver 1 0 48 A ADEPTIA When to use SQL Trigger There are certain scenarios in which you can use only the SQL Trigger method to define the database event These are outlined as DML Operation in a Database You need to trigger a process flow whenever a record is inserted updated or deleted in a table and process that record in the process flow For example you want to process an order whenever a new record is added into the Order table But the database does not have any column like status or timestamp that enables you to identify if the record is new Process a record that matches the SQL Where condition condition on column value Trigger a process if the value from Aggregate function in the SQL query satisfies the condition in event definition How to use SQL Trigger Using the SQL Trigger includes the following steps 1 Defining the SQL Trigger 1 Triggering the Database Event 2 Passing the information to the Process Fl
33. eference Guide Ver 1 0 37 A ADEPTIA Figure Creating WsProvider Execution of WsProvider Any Web service client can be used to invoke the Adeptia Process flow published as a Web service To invoke the published web service the client requires the path where the WSDL is stored The user can get the http path of the WSDL through the manage page of Web service Provider activity see Figure below New Web Service Provider i Ad m 1 Action WSDL 1 GeneratePolictyQuote_Ws Web service to generate Revision Dependent Service to post Service policy quote IEW History Activities Edit Delete apa ViewDownload Service to receive data ViewDownload admin administrators 12 51 55 12 51 55 03 07 2007 03 07 2007 Figure Manage Web Service Provider The ViewDownload link can be used to know the WSDL path User can save the WSDL in his local system and access the web service through that location 7 Adeptia server can also be used to invoke the published web service through the Web service Consumer activity For details on creating Web Service Consumer activity refer to the Creating Web Service Consumer Activity section in the User Manual Appendix A Input XML schema Definition of input XML Schema is displayed in the Figure below lt xml version 1 0 encoding UTF 8 gt lt xs schema xmlns xs http www w3 org 2001 XMLSchema elementFormDefault qualified attributeFormDefa
34. elector H A Source B Target 0 Adv Database Targe E a ContextTarget o Conte 0 Database Target G E File Target 2S FTP Target Native Service ContextTarget Start Event End Event ey Properties i OnException Scripts x Errors 3 Process Flow Variables 3 Comments Name Value Document Repository False M ho ContextTarget ContextTarget WsServiceResponse parameterName bource El HTTP Target E JMS Target E LAN File Target E Mail Target E WebdavTarget FH WebServices E Action 4 btreamNames Synch Type true bd ContextTarget al Figure Adding contextTarget activity and defining it in process flow Once you connect all these activities in the process flow you can publish the process flow Creating Security Policy Optional Since Web Services expose crucial business information Web services security is critically important A Web service can be secured using Security Policy activity If you want to secure the web service then you need to create an appropriate security policy before publishing the Web Service using the Web service provider 7 Creating WsProvider For details on creating Security Policy refer to the Creating Security Policy Activity for Web Service section in the User Manual Web Service Provider is used to publish a process flow that Web Service Client can access Once a Web Service i
35. ervice The following code snippet provides an example of how to access these streams import import com adeptia indigo services transform ScriptedService type casting service to ScriptedService instance ScriptedService scriptedService ScriptedService service getting input streams first stream is also default stream InputStream inl scriptedService getSourceStream ActivityNamel InputStream in2 scriptedservice getSourceStream ActivityName2 stream2 InputStream in3 scriptedService getSourceStream ActivityName3 mystream Interacting With Output Stream Output streams are the data streams which are passed from current custom plugin service activity to target activities Data can be written to any stream by following method exposed by custom plugin service write byte b String streamName Its parameters are outlined in the table below Parameter Description b Byte Array Adeptia Developer s Reference Guide Ver 1 0 8 ADEPTIA streamName Name of output stream If no stream exists with name given above then exception will be thrown In PD check the attribute StreamNames for custom plugin service activity This attribute can take the value such as Stream1 Stream2 Stream5 Its parameters are outlined in the table below Parameter Description
36. formation Where rowid lt rowid of the inserted record gt is passed to the process flow to make sure that process flow processes the same record This information overrides the Where clause of the Adeptia Database Source activity if its EventContextenabled property is selected as True If the database does not support rowid then you can define any other column as the primary key 3 Select the polling frequency as 1minute from the Polling Frequency drop down list Adeptia Developer s Reference Guide Ver 1 0 52 A ADEPTIA Defining Process flow Define a process flow for processing the record Please ensure that the Database Source activity in the process flow should be created with the EventContextEnabled property selected as True Registering Process flow with Database Event Register the process flow with its corresponding Database Event using the Adeptia Event Registry Activating the Database Event 1 If the trigger syntax is valid then the trigger is created in the backend database else it throws an exception and the Database event is not activated Once the Database event is activated the trigger is created in the database If a new record is inserted in the table the rowid of the inserted record is added in Adeptia s temporary table called dbeventtriggertable The Database event is triggered as per the polling frequency specified in the Database event activity It triggers the bound process flow
37. ide Ver 1 0 53 A ADEPTIA IF NEW ORDER _STATUS NEW AND NEW AMOUNT gt 10000 THEN INSERT INTO DBEVENTTRIGGERTABLE VALUES QUERY WHERE ROWID NEW ROWID END IF END MYTRIG The rowid field is used to identify the row for which the trigger is fired The information Where rowid lt rowid of the inserted record gt is passed to the process flow to make sure that process flow processes the same record This information overrides the Where clause of the Adeptia Database Source activity if its EventContextenabled property is selected as True If the database does not support rowid then you can define any other column as the primary key Select the polling frequency as 1minute from the Polling Frequency drop down list Defining Process flow Define a process flow for processing the record Please ensure that the Database Source activity in the process flow should be created with the EventContextEnabled property selected as True Registering Process flow with Database Event Register the process flow with its corresponding Database Event using the Adeptia Event Registry Activating the Database Event 1 If the trigger syntax is valid then the trigger is created in the backend database else it throws an exception and the Database event is not activated Once the Database event is activated the trigger is created in the database If a new record is inserted in the table with order_status new
38. if an entry corresponding to the Database event is found in the dbeventtriggertable Different process flows are triggered for each entry in the dbeventtriggertable and the Where clause Where rowid lt rowid of the inserted record of the INSERT statement of the trigger body is set in the context This information set in the context overrides the Where clause of the Database Source activity if its EventContextenabled property is selected as True Case 2 You have a table named Order in the Oracle database in your company When an order is placed a new record gets added in this table When a new record is inserted in the table the order_status field is populated with the value of new Your company has a business policy to process those orders which have the order amount higher than 10000 You want to automate the processing of the orders Additionally you want that whenever a new order is placed its processing should start within one minute Solution In such as case you need to create a Database event using a SQL Trigger that will trigger a process flow each time an order higher than an amount of 10000 is placed The event will then pass this order to the process flow for processing Defining Database event For this you define the SQL Trigger by performing the following steps 1 Enter the SQL Trigger as CREATE OR REPLACE TRIGGER MYTRIG AFTER INSERT ON ORDERTABLE FOR EACH ROW BEGIN Adeptia Developer s Reference Gu
39. imes the database being used does not support trigger creation or the database supports trigger creation but Adeptia may not have added support for it In such cases you need to create the Database event using the SQL Query option D For details on databases supported by Adeptia refer to the SQL Trigger section Process record that matches the SQL Where condition Condition on column value If you want to process an individual record when a certain column value is matching some criterion then using SQL query is the only option You cannot use SQL Trigger in this case as it just notes that a record has been added updated or deleted but does not check its value For example When a new order is added into the Order table the business process shall process that order generate invoice and send it The SQL Query for adding the order is defined as Select from Order where order_status new When a new order is added in the Order table you want to process this order only if its value is higher than 500 You will define the SQL Query for this as Select from Order where order_status new and order amount gt 500 When you want to synchronize the processing of a record such as inserting a new record into the table and processing them based on some business logic that will update the status of the record in the table you define the SQL Query as Select from synchronize where status ReadyToProce
40. ing Frequency You need to define a polling frequency This is the frequency on the basis of which the data in the table gets updated If you think data is getting updated on an average every minute then you can define the polling frequency as 1 minute This implies that the select query will get executed every minute D The recommended minimum Polling Frequency is 30 seconds The actual minimum Polling Frequency is 1 second Triggering of Event 1 On activating the Database Event the event will execute the select query after each polling time interval Adeptia Developer s Reference Guide Ver 1 0 44 A ADEPTIA 2 If that query returns one or more records the process flow bound to the Database Event will get triggered one or more times respectively one time for each row returned by the query In case no row is retuned then the system will log the information but will not trigger a process flow Passing I nformation to the Process Flow Pre requisite The process flow registered to the Database Event must contain Adeptia Database Schema and Database Source activities The EventContextEnabled property of the Adeptia Database Source must be set to True The passing of information to the Process Flow involves the following steps 1 When the Database event is triggered the record for which the process flow is fired is set in the process flow context with the context variable ROW The complete record is
41. ions at one time 3 Assign values to these parameters and define the XSL code for the padding Enter the XSL code shown below in the XSL Template field lt xsl template name paddingTemplate gt lt xsl param name sourceParam gt lt xsl param name padChar gt lt xsl param name length gt lt xsl param name paddingSide gt Adeptia Developer s Reference Guide Ver 1 0 56 A ADEPTIA lt xsl choose gt lt xsl when test SpaddingSide left gt lt xsl choose gt lt xsl when test string length SsourceParam amp lt S length gt lt xsl call template name paddingTemplate gt lt xsl with param name sourceParam select concat padChar sourceParam gt lt xsl with param name padChar select S padChar gt lt xsl with param name length select Slength gt lt xsl with param name paddingSide select SpaddingSide gt lt xsl call template gt lt xsl when gt lt xsl otherwise gt lt xsl value of select substring sourceParam string length sourceParam Slength 1 gt lt xsl otherwise gt lt xsl choose gt lt xsl when gt lt xsl otherwise gt lt xsl if test SpaddingSide right gt lt xsl choose gt lt xsl when test string length SsourceParam amp lt Slength gt lt xsl call template name paddingTemplate gt lt xsl with param name sourceParam select concat sourceParam padChar gt lt xsl with param name pa
42. is outlined in the table below Database Server URL MS Access Database jdbc odbc Driver MicroSoft Access Driver mdb DBQ dbserver project1 projectl mdb MS Excel Database jdbc odbc Driver MicroSoft Excel Driver xls DBBQ dbserver project1 project1 xls There are a few limitations in accessing Excel data with J DBC ODBC bridge drivers These are outlined as You cannot update the data into target excel sheet D This driver is not recommended for production scenarios If you are using paid drivers you have to manually update the Driver D Class Name and Server URL fields Creating Database Event Database event can be created in two ways Using SQL Query Using SQL Trigger When creating a Database event you need to ensure that the User ID D and password must be defined with appropriate permissions They should be assigned Read Only permission when using SQL Query and Read and Create permissions for SQL Trigger Using SQL Query Adeptia Developer s Reference Guide Ver 1 0 42 A ADEPTIA A SQL query is a command that is defined using a valid SQL statement It is used to define trigger criteria in a process flow When to use SQL Query There are certain scenarios in which you can use only the SQL Query method to define the Database event These are outlined as Trigger Creation is not supported by the Database or by Adeptia At t
43. l result append out_strt n catch IOException e System err println e EZ starting output thread outputThread start Le waiting for process to end int k p waitFor Process status k Process output n result Error Stream n errorResult System out println System out println System out println anana System out println End We if k gt 0 id if process status is greater than zero then this could be an error depending upon the called application 27 throw exception if necessary throw new Exception errorResult toString setting result in context context put result result writing to output stream service write result toString getBytes Streaml case of error occurs Some applications do not send error to the error data streams but they send them to the output stream D Some applications do not set process status to greater than zero in Adeptia Developer s Reference Guide Ver 1 0 23 A ADEPTIA CUSTOM API FOR CUSTOM J AVA DEVELOPMENT Adeptia uses custom APIs for custom J ava development They can be categorized as Java API for Adeptia product Java API for Third Party Libraries A few of these APIs are covered in this document More APIs will be added in future versions J AVA API FOR ADEPTIA PRODUCT Java APIs for the Adeptia product are available in a separate document
44. lesheet href css ui css type text css gt lt table width 100 border 0 background images top streach gif cellspacing 0 cellpadding 0 gt lt tr gt Adeptia Developer s Reference Guide Ver 1 0 32 A ADEPTIA lt td gt lt img src images adeptia logo gif width 354 height 37 gt lt td gt lt tr gt lt table gt lt br gt lt table width 100 border 0 cellspacing 0 cellpadding 0 gt lt tr gt lt td height 18 class headings gt Template Review lt td gt lt tr gt lt table gt lt br gt lt br gt lt a href javascript review gt lt font color blue gt Review lt font gt lt a gt lt table width 100 border 0 gt lt tr height 10 gt lt td gt lt tr gt lt tr gt lt td gt lt form name HTMLForm gt lt TABLE gt lt TR gt lt td gt Processflow DomainId lt td gt lt td gt lt input type text name PID readOnly gt lt TD gt lt TR gt lt TR gt lt TD colspan 2 gt lt input type button name partialSubmit value Save Task gt lt input type button name fullSubmit value Complete Task gt lt TD gt lt TR gt lt TABLE gt lt form gt lt td gt lt tr gt lt table gt lt Form gt lt script gt function review var pid document HTMLForm PID value var vWinTrans window open Review jsp PID pid _blank toolbar yes location no directories no status no menubar yes scrollbars yes resizable yes copyhist
45. ment NAME 4 Open Source Schema 2 Structure_of_source_XSD A Root EvalScript_TextSchema 9 Record NAME string M 9 ADDRESS string EMAILID string 9 PHONENO integer 9 DATEOFBIRTH date 9 DEPARTMENT string 9 SALARY integer 9 DATEOFJOINING date 9 DESIGNATION string 9 AGE integer y 42 Open Target Schema ee Math String Date Aggregation Conditional Axis Boolean Context XSL Template Structure_of_destination_XSD 9 A Root EvalRec_PositionalSchema 9 Record NAME string 25 M 9 ADDRESS string 17 9 EMAIL ID string 25 9 PHONE_NO integer 22 9 DOB date 10 9 DEPT string 20 SALARY integer 12 9 DOJ date 12 9 DESIGNATION string 17 9 AGE integer 10 I gt Mapping Rules Textual Rules Local Variables Lis Properties 4 9 Parameters Global Node gt i 9 Global Variables 9 Local Variables 9 Custom Methods Keys 9 Context Variables 9 9 Templates A paddingTemplate sou Figure Using XSL Template 6 Similarly pad the Salary field The constants will be defined as outlined in the table below Constant Data Type E String 10 Number right String D You can test the mapping using Simulate tab Adeptia Developer s Reference Guide Ver 1 0 60
46. n Appendix 1 The Variables passed by the Event to the process flow context are listed below Context Variable Name Context Value Eventi d Event Activity Id EventName Event Activity Name Adeptia Developer s Reference Guide Ver 1 0 55 A ADEPTIA Usi NG XSL TEMPLATE FOR PADDING I N MAPPING Objective To map fields from source schema to target schema where the length of the field of the target schema is fixed If the field length of the source schema is lesser then you need to pad the field using a padding character You can define an XSL template for the padding Tasks 1 Creating XSL Template 2 Using XSL Template Creating XSL Template To create an XSL template for padding a field 1 Enter the name of the template in the Name field 2 Define four parameters for the padding in the XSL template These are outlined in the table below Parameter Description Field Name to be padded Field name of source schema that is to be padded Padding Character Character used to pad the field This can be a lt space character gt amp or any other character Target length of the field The target length that is to be achieved by the padding This is the fixed length of the field of the target schema Padding Side Direction in which the field is to be padded It can be padded either in the left or right direction However you cannot pad a field in both direct
47. n_bitmask n il sql_statement n END http www devbuilder org asp dev_article as p aspid 16 Sybase CREATE TRIGGER lowner trigger_name ON Eee able_name FOR INSERT UPDATE DELETE AS SQL_statements FOR INSERT UPDATE AS IF UPDATE column name IKAnd OR UPDATE column namej ji SOL statements http manuals sybase com onlinebooks grou p as asg1250e sqlug Generic__ BookTextView 48018 hf 0 Triggering of Event Once the developer defines the SQL trigger he executes it to trigger the Database event A Process flow can be bound to the Database event using the Event Registry activity The above Database event is triggered for each row inserted or updated in the EMP table and this executes the associated Process Flow Passing the I nformation to the Process Flow Once the Database event is fired the required information is passed to the process flow This is done in the backend The lt where clause gt which keeps the track of the NAME field of EMP table of the row inserted or updated is passed to the Process Flow context For example in this case Where NAME Smith is passed to the Process flow context Adeptia Developer s Reference Guide Ver 1 0 51 A ADEPTIA Pre requisites The process flow registered to the Database event should contain an Adeptia Database Source activity The EventContextEnabled property of the Adeptia Database
48. ng context variable Data handling and Transformation Calling external native programs Loggin Exception handling Dependency WA O A Os oT e Examples Interacting With the Service Variables and Predefined Methods A custom plugin service provides an interface to write a java code The following variables methods will be available for the java code Java code can directly access these variables by name Variables Context Context variables are variables whose values can be accessed in a Process Flow context for the purpose of using these values in conditional control flows passing values as parameters to another activity or in other Process Flow related functions Inputstream InputStream variables contain data streams that can be used in a custom plugin service Service Service refers to current custom plugin service instance Methods public void write byte b String streamName throws IOException This method is used to write data to output streams public Logger getLogger This method is used to obtain logger instance D The usage of these methods is covered in the following section Interacting With Streams Like other services custom plugin service can receive data from other service s and generate data to send to other service s While interacting with streams you need to note the following points Adeptia Developer s Reference Guide Ver 1 0 6 A ADEPTIA Custom
49. nput stream int i 0 while i inputStream read 1 data manipulation Default stream can also be accessed using following code imports import com adeptia indigo services transform ScriptedService type casting service to ScriptedService instance ScriptedService scriptedService ScriptedService servic to get default stream which is first stream as input InputStream default scriptedService getSourceStream int i 0 while i default read 1 YA data manipulation For more details refer to the section Examples Accessing Any Input Stream Adeptia Developer s Reference Guide Ver 1 0 7 A ADEPTIA Since the input streams are assigned with a name to custom plugin service so these can be accessed by name To check how many streams are assigned to custom plugin service check Source Stream attribute for custom plugin service in PD This attribute can take the value such as ActivityNamel ActivityName2 stream2 ActivityName3 mystream Its parameters are outlined in the table below Parameter Description Character Separates the different input streams ActivityNamel Name of source activity sending the default stream to custom plugin service ActivityName2 Name of source activity sending the stream2 stream to custom plugin service ActivityName3 Name of source activity sending the mystream stream to custom plugin s
50. ode getAttributes Node nameNode nodeMap getNamedltem name String name nameNode getNodeValue writing employ names service write Employee i name n getBytes streaml Input XML Data lt xml version 1 0 encoding ISO 8859 1 gt lt Root xmlns java http xml apache org xslt java gt lt Record gt lt Employee name John age 22 salary 6000 gt lt Record gt lt Record gt lt Employ name Peter age 35 salary 12000 gt lt Record gt lt Record gt lt Employ name James age 45 salary 8000 gt lt Record gt lt Record gt lt Employee name Ricky age 21 salary 10000 gt Adeptia Developer s Reference Guide Ver 1 0 17 A ADEPTIA lt Employ name Robert age 25 salary 5000 gt lt Record gt lt Employee name Nick age 35 salary 6000 gt lt R lt Reco lt Employ name Mike age 42 salary 9000 gt lt Record gt lt Root gt 0 Q BO 5 Q Vv Example 3 Getting Records from input record stream and sending the data to output stream Description A Schema type activity can send record stream to custom plugin service Attributes of Schema activity check PD for schema activity namely Transformer Type and Format can be set to SchemaStream2IntermediateTransformer and NATI
51. olutions These can be divided into the different groups A few scenarios are described in this version More scenarios will be covered in future versions The scenarios are divided into the following groups Developing complex GUI for Human workflow Publishing a process flow as Web Service Event Triggered Process Flows This section covers common problems that occur when triggering a process flow on an event One such problem and its solution is described in this version Others will be covered in future version Triggering a process flow on database trigger Database Event Triggering a process flow on File Modified event on FTP FTP Event Triggering a process flow on File Modified event on local system File Event Triggering a process flow on email Triggering a process flow on HTTP event Mapping Complex scenarios Common problems that occur when mapping fields are outlined as Using XSL template for padding fields JTA Rollback Common problems that occur when using J TA Rollback are outlined as Using same database related tables under Transaction Adeptia Developer s Reference Guide Ver 1 0 29 A ADEPTIA Using different database tables under Transaction Stored Procedure Common problems that occur when using stored procedures are outlined as Using Stored procedure in Database source for SQL Server Jasper report design and generation Resubmitting erroneous records after
52. ory no lt script gt Execution of Human Workflow While executing the Human Workflow activity a task will be added to user task To execute this task 1 Login into Adeptia 2 Go to the Task Manager and execute the task A basic page Framework page is displayed This page can be design quite well with HTML expertise 3 Invoke the custom jsp as a popup in a new window by clicking the URL on the page 4 Once you have navigated through required custom pages you can close them 5 To complete the Human Workflow activity you need to take the control back to Framework page and click the Complete Task button the Framework page can be treated as the Adeptia Home page It is just one design best practice D In complex Human Workflow activities where multiple forms are used Enhancements in Adeptia Allow session to pass the process flow domain ID to any custom JSP invoked from Human Workflow Html form Allow Human Workflow Html form to keep value for hidden variables so that it can be passed to the custom JSP invoked from Human Workflow Html form Adeptia Developer s Reference Guide Ver 1 0 33 A ADEPTIA WORKING WITH WEB SERVICE PUBLISHER A business process can be treated as service and can be made available in Enterprise The most interoperable way is to make it available as web service Adeptia provides WsProvider to publish any business process as web service
53. ow Defining the SQL Trigger This step is performed by the developer To define the SQL Trigger 1 Select the SQL Trigger option A sample Trigger code is seen in the SQL Trigger field The words present in anklet bracket i e lt WHERE CLAUSE gt of the Insert statement can only be replaced by a correct WHERE clause and rest of the Insert Statement should be as it is In this scenario we consider an EMP table and we assume that a NAME column in it is unique or primary Key This Name field is taken to identify the row for which the trigger is fired This information is passed to process flow to make sure that process flow process the same record A sample trigger for above mentioned scenario is displayed below Database Name Task Trigger Definition Oracle Add a new row in the CREATE OR REPLACE TRIGGER trigger database table trig After insert or update or when a record is delete on emp inserted updated or for each row deleted in the emp table begin INSERT INTO When a new row is dbeventtriggertable VALUES added into the Query WHERE rowid dbeventtrigger table a new rowid END trig process flow is triggered Adeptia Developer s Reference Guide Ver 1 0 49 ADEPTIA Sql Server create trigger trigtest on emp for insert update delete as declare empname varchar begin set empname select empname from inserted INSERT INTO dbeventtriggertable VALUES Query
54. plugin service can have 0 or more input streams Custom plugin service can have 0 or more output streams These streams can be set in the Process Designer applet To know how to set these streams refer to the section Using Multiple Stream under Process Designer chapter of the User Guide For 0 input stream the attribute Consume Stream for custom plugin service activity in Process Designer must be set to false For O output stream the attribute Generate Stream for custom plugin service activity in Process Designer must be set to false By default it generates one output stream and consumes no stream Streams are closed when current custom plugin service execution is completed So you need not close the streams in java code Interacting With Input Stream Input streams are the data streams that are passed from source activity to the current custom plugin service activity Data from these streams can be parsed transformed or transmitted to other activities Default Stream Custom plugin service can have one or more input streams The first stream which is connected to the custom plugin service activity is called default stream To access the default stream the variable inputStream can be used in java code This variable will be instance of java io l nputStream Input streams other than default stream are accessed by their names The following code snippet provides an example of how to access default i
55. r a process flow each time an order higher than an amount of 10000 is placed The event will then pass this order to the process flow for processing Defining Database Event Adeptia Developer s Reference Guide Ver 1 0 45 A ADEPTIA For this you define the SQL query by performing the following steps 1 Enter a select query Select from Order where order _status new and order_amount gt 10000 in the SQL Query field 2 Mark the Check Condition checkbox as unchecked 3 Select the polling frequency as 1 minute from the Polling Frequency drop down list Defining Process flow Define a process flow for processing the record Please ensure that the Database Source activity in the process flow should be created with the EventContextEnabled property selected as True Registering Process Flow with Database Event Register the process flow with its corresponding Database Event using the Adeptia Event Registry Activating the Database Event On activating the Database event the select query is executed and the value of the first object obtained from the result is compared with the conditional value as per the relational operator selected Hence the process flow gets triggered only once If no row is returned then the system logs the information but does not trigger a process flow Trigger the process if the value from Aggregate function in SQL Query satisfies the condition in the Event definition Defining the SQL Query
56. r rich content onto the screen to the printer or into PDF HTML XLS CSV and XML files VFS 1 Apache The Commons VFS provides a single API for accessing various different file systems Java Mail API NA Sun This is the Java API for mail JRE Jar Files Required No jar files are required for this API License Type http www java com en download license jsp Website http www java com en download manual jsp Download Link http www java com en download manual jsp HSQLDB Jar Files Required hsqidb 1 7 1 jar jtds 1 2 jar License Type Based on BSD License http hsqidb org web hsqlLicense html Website http hsqidb org Download Link Adeptia Developer s Reference Guide Ver 1 0 25 ADEPTIA Castor Jar Files Required castor 0 9 6 jar License Type Apache 2 0 License http www apache org licenses LI CENSE 2 0 Website http www castor org index html Download Link http www castor org download html Log4 Jar Files Required log4j 1 2 8 jar log4j jdbcplus jar License Type Apache 2 0 License http www apache org licenses LI CENSE 2 0 Website http logging apache org log4j docs index html Download Link http logging apache org log4j docs download html Jasper Jar Files Required jasper compiler 4 0 4 jar jasper runtime 4 0 4 jar Adeptia Developer s Reference Guide Ver 1
57. roaches Most of the practical scenarios can not be addressed by dynamic HTML only You require additional dynamic behavior of the web pages and interaction with server end to get the required information Adeptia BPM platform supports this and allows a user to integrate the web application that user has created using JSP or AJAX using GWT outside the product in standard editor Use of custom J SP This approach is described with the help of an example Example scenario Case You have a business process that gets data in excel format Data is validated and verified and the correct data is loaded into the database The data records that are erroneous are to be reviewed and updated online and integrated as Human Workflow activity in the business process Assumptions A dummy table ERROR DATA is created to capture the error records All the error record is populated in table The table has additional column to store process flow domain ID PID Adeptia Developer s Reference Guide Ver 1 0 31 A ADEPTIA The PID is set in process flow context using Custom Plugin scripted service Example code import com adeptia indigo system ObjectAddress obj ObjectAddress context get TransactionAddress String pid obj getTransactionPid context put PID pid Creating J SP 1 Get the process flow Domain ID This will be passed from process flow String PID request get PID Query the database to get all
58. ror in the java code Custom plugin service is aborted on the first compilation If there are checked exceptions like FileNotFoundException add them to handle in the code Runtime Errors Runtime errors can be caught by java try catch block But it is recommended to re throw the error after adding customized message try catch Exception e throw new Exception message e Adeptia Developer s Reference Guide Ver 1 0 14 A ADEPTIA Dependency If customized code has dependency upon external classes or jar files then path of those classes or jar files needs to be set in the Adeptia Server environment Steps to set the path in the Adeptia Server environment 1 Open launcher properties file from AdeptiaServer4 6 serverkernel etc folder Here first two dots represent drive letter and second two dots represent the folder where Adeptia Server is installed 2 Add the absolute path or relative path with respect to serverkernel folder of the external class or the jar files 3 Save the file and close it 4 Restart the Adeptia Server kernel Examples Examplel Sending Input Stream Data to two Output Streams Description Stream coming from File Source zip file and extracting two files and sending it two output streams Setup 1 Custom plugin service should have one incoming input stream and two output streams 2 Check PD for current custom plugin service activity for attribute Source Stream for
59. s published it creates a WSDL and makes it available to the Adeptia Server users You can use this WSDL to invoke the Web Service The Web Service can be published in two modes Synchronous In case the Web Service is published in synchronous mode the consumer waits for the completion of the process flow and hence for the output of the process flow Asynchronous In case the Web Service is published in asynchronous mode the consumer does not wait for the process flow to be completed Thus consumer gets Adeptia Developer s Reference Guide Ver 1 0 36 A ADEPTIA only a Co relation ID not the output of the process flow Later on using this Co relation ID consumer can get the output To create Web Service Provider 1 Enter the name and description of the new Web Service Provider activity in the Name and Description fields respectively Uncheck the Asynchronous checkbox if you want to publish Web Service in Synchronous mode or else the Web Service will be published in asynchronous mode Enter the request service name and response service name in the Request Service Name and Response Service Name respectively The Web Service will be published with the respective service name given in Request Response Service Name field Select the process flow which you want to publish as Web Service from the Process Flow Name drop down list In this scenario the process flow will be the above created Process flow Select Input XML Schema
60. services in a process flow Rec2Rec Transformer You can develop customize services to process data individually record by record and add it in a process flow Java expression in decision node You can develop Java conditional logic and use it as a Boolean condition in a decision node in a process flow Custom JSP You can develop customized GUI with Java Server Pages JSP and incorporate it in the Adeptia GUI to develop its workflow GUI Java function support in Mapping You can develop customized data processing rules in Java and use them in Adeptia s Mapping feature Inbuilt Code segment and library You can develop code segments that can be used for custom Java development For example you can develop a code segment for Get Connection from DBI nfo will document others later D In this version of document only Custom Plugin is documented We USING ADEPTI A CUSTOM PLUGIN SERVICE A custom plugin service enables you to create customized services apart from the standard Adeptia server services A developer can write custom java code to process the data as required Writing a custom plugin service involves the following steps 1 Interacting with the service variables and predefined methods 2 Interacting with streams Input Stream Output Stream 3 Interacting with Context variables Getting context variable Adeptia Developer s Reference Guide Ver 1 0 5 ADEPTIA Setti
61. ss Trigger process if the value from Aggregate function in SQL Query satisfy the condition in event definition Examples of such a scenario are outlined below You want to trigger a process flow whenever the count of people who have not paid their premium goes beyond 50 For this you define the SQL Query as Adeptia Developer s Reference Guide Ver 1 0 43 A ADEPTIA If Select Count customer where premium_status notPaid gt 50 You want to trigger a process flow if the average Inventory level goes below the reorder level of 100 For this you define the SQL Query as If Select Avg Quantity from Inventory lt 100 How to use SQL Query Creating a SQL Query is a four step process 1 Defining the SQL Query 2 Defining the Polling Frequency 3 Triggering of Event 4 Passing the information to the Process Flow Using a SQL Query varies based on the task to be performed These tasks are outlined as Process Record that matches the SQL Where condition Condition on column value Trigger process if the value from Aggregate function in SQL query satisfies the condition in event definition Process Record that matches the SQL where condition Condition on column value Defining the SQL Query 1 You need to select the SQL Query radio button This activates the SQL Query field 2 Define a valid SQL Query that has Where clause on one or more columns in the table Defining the Pol
62. stored in the form of name and its value Name Value and it is set in this variable ROW 2 The values set in the context variable ROW are passed to the Database Source of the process flow 3 The Database Source does not execute the SQL Query defined in it The record set in the context variable ROW gets assigned to the output result set of the SQL Query specified in the Database Source 4 This result set is converted into an XML record This is generated as output by the Database Source activity and is sent to the process flow for further processing You can also access the ROW context variable from the context variable D option instead of the Database source in the process flow For details on other values passed by the Database event refer to Appendix 1 Example Case You have a table named Order in the database When an order is placed a new record gets added in this table When a new record is inserted in the table the order_status field is populated with the value of new Your company has a business policy to process those orders which have the order amount higher than 10000 You want to automate the processing of the orders Additionally you want that whenever a new order is placed its processing should start within one minute The database in which the Order table exists does not support SQL trigger Solution In such a case you need to create a Database event using a SQL query that will trigge
63. t xs element gt lt xs schema gt Adeptia Developer s Reference Guide Ver 1 0 39 A ADEPTIA Usi NG DATABASE EVENT A Database event enables you to schedule a process flow to be triggered when a record is inserted updated or deleted in a database table Objective To analyze the various methods of providing solutions when using Database event in business scenarios on different database servers To configure settings for different servers and their drivers to be used when using Database event To identify the advantages and limitations of using a particular method to create Database event Tasks For Using Database Event The tasks involved in using a Database event are outlined as Creating Database Drivers and Database Info activities Creating Database Event Creating Process Flow Registering Database Event Activating Database Event Creating Database Drivers and Database I nfo The Database Driver and Database Info activities need to be created before creating the Database event Database drivers that are used for a database event can be classified as Standard Type 4 Drivers JDBC ODBC Drivers Standard Type 4 Drivers Type 4 drivers are pure Java drivers They are database specific which implies that each database type has a separate dedicated Type 4 driver Some of these drivers are available for free on the web whereas some need to be purchased under a commercial license
64. tSchema gt ScriptedService gt Target The Text Schema activity has the attribute TransfomerType which has value Stream2XML Adeptia Developer s Reference Guide Ver 1 0 11 A ADEPTIA Plain stream can be generated by Source Type activity except XML Source and can be passed to current custom plugin service No transformation is done in Plain stream For example FileSource gt ScriptedService gt Target These streams are accessible by accessing input streams mentioned in section 2 Record Streams A record stream is a stream where records are written one by one This stream can be accessed the same way as mentioned in section 2 but with minor changes import com adeptia indigo io RecordStreamFactory import com adeptia indigo io RecordInputStream import com adeptia indigo io Record getting record stream by using RecordStreamFactory s static method public static RecordInputStream createlnputStream InputStream inputStream Schema schema String format RecordInputStream ris RecordStreamFactory createlnputStream inputStream null RecordStreamFactory NATIVE_FORMAT Record rec null while rec ris ReadRecord null1 code For example Record stream can be generated by TextSchema FileSource gt TextSchema gt ScriptedService gt Target Here TextSchema activity has following attributes values Transformer Type SchemaStream2IntermediateSchema Format Native
65. the error records for this PFID String dbInfolD 12334455566677778 This is an ID of the Databasel nfo activity that has been defined in the Adeptia Sever It captures all the parameters to connect to database Use Adeptia API to read all database connectivity parameter and write JDBC code to query database Select from ERROR_DATA where PFDID PFID Render the result set in required layout for example grid Keep all the values that can be updated as editable Give user a submit button that he can use after review and update The update data is pushed back to database using Insert query For example you have created Review jsp Integrating with Adeptia 1 Deploy the JSP by copying the jsp to ServerKernel web repository Pass the information from process flow context to custom J SP for example Review jsp Define all the context variables that need to be passed to custom JSP in Human Workflow activity form Call the script function in HTML of Human Workflow activity For example in the given case you need to pass PID to custom JSP You have already set PID value in context Use the following HTML code The Review jsp is invoked through review link in java script function Write a Java script function is mandatory because it will allow passing dynamic parameters to custom JSP through URL rewriting PID is passed to custom JSP You can pass any number of variables lt link rel sty
66. ult unqualified gt lt xs element name Auto Insurance Policy gt lt xs complexType gt lt xs sequence gt lt xs element name AgentName gt lt xs element name AgentEmail gt lt xs element name CustomerName gt lt xs element name CustomerState gt lt xs element name DriverRecord gt lt xs element name VehicleType gt lt xs element name VehicleModel gt lt xs element name VINNumber gt lt xs element name VehicleValue gt lt xs sequence gt Adeptia Developer s Reference Guide Ver 1 0 38 ADEPTIA lt xs complexType gt lt xs element gt lt xs schema gt Appendix B Output XML schema Definition of output XML Schema is displayed in the Figure below lt xml version 1 0 encoding UTF 8 gt lt xs schema xmlns xs http www w3 org 2001 XMLSchema elementFormDefault qualified attributeFormDefault unqualified gt lt xs element name Policy Quote gt lt xs complexType gt lt xs sequence gt lt xs element name AgentName gt lt xs element name AgentEmail gt lt xs element name CustomerName gt lt xs element name CustomerState gt lt xs element name DriverRecord gt lt xs element name VehicleType gt lt xs element name VehicleModel gt lt xs element name VINNumber gt lt xs element name VehicleValue gt lt xs element name Premium gt lt xs element gt lt xs sequence gt lt xs complexType gt l
67. ustomize exception message throw new Exception e Calling Native programs Native programs can be called by Custom plugin service using the following command Runtime getRuntime exec executable command For more details read java docs for java lang Runtime class For example Process Child Runtime getRuntime exec ADD exe 44 56 DatalnputStream dis new DatalnputStream child getl nputStream String sum dis readline Adeptia Developer s Reference Guide Ver 1 0 13 A ADEPTIA Here executable file name is ADD exe and arguments are 44 and 56 Logging Log instance is available with custom plugin service instance This can be accessed by the following command import com adeptia indigo logging Logger getting logger for the current custom plugin service Logger log service getLogger following type of message can be sent debug message log debug msg The debug message will not appear in log messages if log level is set to INFO or ERROR info message log info msg Info message will not appear in log messages if log level is set to ERROR error message log error msg Exception Handling Custom plugin service can be written to have complex logic There are two types of errors associated with java code Compile Time Errors Compile time errors are those errors which are related to syntax of the code as well as handling of exception If there is any Compile time er
68. xample in given scenario you have an Auto Insurance Policy application as an input whose XML schema is defined in Appendix A The XSD for the output XML For example in given scenario the output generated is the Policy Quote The output XML schema is defined in Appendix B Getting I nput Data from Client Request In the process flow you need to use ContextSource as activity You need to define a parameterName in the ContextSource property Web service client input data will be assigned to this parameter The context source will read it from this parameterName and pass the data to any further activity for data processing This is displayed in the Figure below The parameterName user here will be used while defining the 2 WsProvider activity as input variable name Activities Panel Native Service Fe O y D Notification ContextSource iy Polling Start Event End Event E 2 RepeaterNode E a Schema gt E Selector 4 Pa El Source D Adv Database Sourc z Properties SD OnException Scripts E Errors 3 Process Flow Variables 3 Comments E a ContextSource beg ComtentSource Document Repository False D gt Database Source JeventContextEnabled False W E File Source Format PLAIN_TYPE H 2 FTP Source jo D HTTP Source Label ContextSource EA JMS Source Name ContextSource El LAN File Source p
69. ype String activityl_filePath context get Service filesourcel filePath The activity s attribute can be accessed after its execution by following convention Service lt ActivityName gt lt AttributeName gt Like Service filesourcel filePath Its parameters are outlined in the table below Parameter Description Service literal specifying the service filesourcel Name of the FileSource type activity filePath Name of the attribute in the filePath The following code snippet gives the information to get the value of the Process flow variables myMap and FirstValue To get value of process flow variables myMap and FirstValue import java io Map import java io Hashtable Map map java io Map context get myMap Hashtable ht Hashtable context get FirstValue To set a context variable s value in process flow The following code snippet gives the information to set the context variable s value in the process flow To set value in process flow variable orderName context put orderName purchaseOrder To set value of filePath attribute of FileSource activity before its execution Here filesourcel is of FileSource type import java io Map Map map Map context get filesourcel params Adeptia Developer s Reference Guide Ver 1 0 10 A ADEPTIA map
Download Pdf Manuals
Related Search
Related Contents
Samsung HC-R4741W User Manual 取扱説明書 - ワイズギア Benutzerhandbuch オープンカウンター方式による見積合せの公示 IVI-F47-DN1 DeviceNet USER MANUAL Mode d`emploi Copyright © All rights reserved.
Failed to retrieve file