880 likes | 1.01k Views
Day 2 Schedule. Translation Mappings Create a new map Map editor Operations Map tester Filters User Operation Script Overview WSDL Import Wizard Component Flow Editor Overview of features Understanding Message Flow Running the SA Administration Console. Installation Message Formats
E N D
Day 2 Schedule • Translation Mappings • Create a new map • Map editor • Operations • Map tester • Filters • User Operation • Script Overview • WSDL Import Wizard • Component Flow Editor • Overview of features • Understanding Message Flow • Running the SA • Administration Console • Installation • Message Formats • Copy in an XML schema • MDL editor • Create a variable record layout • Format tester • HL7 Editor • X12 Editor • Scheduler • Holiday schedules • Lookup Tables
Installation • Prerequisite: Sun Java 1.5 JDK • Run installer, install to your choice of location • Reboot to allow environment variable changes to take effect • For major versions, if installing to the same location, uninstall previous version before installing new version • Copy in modified ChainBuilderESB-SE-Transformer-1.2.jar
Installed Components • ChainBuilder ESB • Eclipse IDE (IDE + Server install only) • Service Mix JBI Container • Tomcat Web Server • Derby database
Message Formats • HL7 – Healthcare • HL7 Editor • MDL – Message Definition Language • Message Format Editor • Fixed • Variable • Hierarchical • X12 • X12 Editor • XML – import schema
Simple Fixed Record Example – Account Balance • Input Format: Account Number (5), Balance (10) • Sample Data (accountBalance.txt): • 617230000070.00 • 514290000238.31 • 012840007452.99 • 831490000002.35 Message Type File Message Fields
Field Definitions Field Attributes
Test the MDL • Test Dir: C:\<cbesb_home>\ideworkspace\Level1\src\test Move through different lines of sample data
Simple CSV Example – clientAccountNumbers.mdl • Input Data format: first, last, account# • Sample Data (clientAccountNumbers.csv): • Doe,John,61723 • Doe,Jane,51429 • Smith,John,01284 • Johnson,Jim,83149 Message Type Delimiter File Message Fields
Test the MDL Move through different lines of sample data
HL7 Editor • Many common HL7 formats are pre-loaded • HL7 Variants allow for modifications to existing formats
HL7 Editor – Creating a Variant • Add an PID extra field to capture patient email address MSH|^~\&|ADT1|MCM|LABADT|MCM|199008181126|SECURITY|ADT^A01|MSG00001|P|2.3.1| EVN|A01|199008181123|| PID|1||PATID1234^5^M11^ADT1^MR^MCM~123-45-6789^^^USSSA^SS||SMITH^JOHN^A^III||19800101|M||C|100 N MAIN STREET^^COLUMBUS^OH^43125-1020|GL|(614)555-1212|(614)555-3434||S||PATID12345001^2^M10^ADT1^AN^A|123456789|987654^OH|||||||||||patient@patient.com NK1|1|SMITH^JANE^K|WI^WIFE||||NK^NEXT OF KIN PV1|1|I|2000^2012^01||||004444^SMITH^CHARLES^J.|||SUR||||ADM|A0|
HL7 Editor – Creating a Variant • Add an extra field to the end of the PID with Max Length of 50
HL7 Editor – Testing the Variant • Select message Type ADT A01 and run the test
X12 Editor • Many common X12 formats are pre-loaded • X12 Variants allow for modifications to existing formats
Lookup Table Editor • Create from Package Explorer (right click) New -> Lookup File • Simple key-value pair table • Click green plus to add new entry
Lookup Tables • XML file • Named *.tbl • Located in tables dir • Reference from Transform or Java • Example: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>LookUp Table Example general_sample</comment> <entry key=“key1">value1</entry> <entry key=“key2">value2</entry> </properties>
Map Editor • Operations Properties • Source and Target Trees • Operations Tree • Operation Palette
Operations • Combine: concatenate multiple sources • Comment • Block Comment: comment out/uncomment existing operations • Copy: single source to single target • Iterate: looping for repeating elements in data • Lookup • Math
Operations • Send: create outbound message (all in same exchange) • Suppress: prevent automatic creation of message at end of map • If: use java comparators, ex ?1.equals(“string”) • ElseIf • Else • While • User: use a custom map user operation • JDBC: access database during map execution
Map Tester • Must Build the project before testing • Click test button to start • Select input file • Select Read format
Map Tester Results • Source and Target trees with data • Operation Tree • Flip through multiple results Save results to file
Map Example with Iterate • Goal: Create map orders.trn which translates from xml format with repeating item elements to similar format • Source: SingleOrderReportInternational.xsd • Target: SingleOrderReportUSA.xsd
Map Example with Iterate • Use Automap feature to complete most of the map • Click and Drag from Order (Source Tree) to Order (Target Tree) • Automatically creates copy and iterate statements for all fields with identical names
Map Example with Iterate • Note color coding of elements and parentage groups • Indicates that certain fields were not mapped and may need to be manually mapped • PostalCode -> Zip
Map Example with Iterate • Fill in the missing Zip Code COPY operations • Click on a copy not in the iterate (so that the new operations will not be created inside the iterate) • Drag from source field to target
Map Example with Iterate • Test the map • First, save the map and build the project • Test files • Order_International_USA_apoproval.xml • Order_International_USA_denial.xml • Note how the iteration has populated repeating elements in the outbound message
Advanced Iterate Example • Goal: map from xml format with repeating product attributes to csv format that includes one attribute • Create one outbound message (all in a single message exchange) from each iteration, and possible create additional outbound messages based on logic
Advanced Iterate Example • The iterate operation executes only on a single looping structure. If we were mapping to a looping structure on our target format, there would be a nested iterate inside this one
Advanced Iterate Example • Lookup table uses the Source as the key and returns the value in the Target field
Advanced Iterate Example • If statement uses java comparators (select type) • Reference source data elements with ?1, ?2, ?3, etc
Advanced Iterate Example • IF statement with multiple Source fields using Integer compares
Advanced Iterate Example • Math operation allows for multiple Source fields • Uses ?1 type references • Allows for basic mathematical operations
Advanced Iterate Example • Initialize variables • Conditionally populate variables based on attribute name • Create outbound message for each iteration • If we have found height, width, and length then calculate total dimensions and create an additional record • Suppress the automatically created message (to prevent duplication of the last message) • Loop over repeating attribute tags • Locate attribute ID in lookup table
Custom Code • Code can be written in Java or Groovy • Code shells automatically generated • Must Build project
Custom Code Types • Map Filter: single method for string manipulation in map • Map User Operation: custom map operation • TrxId: determination of route name in CBR • Upoc: plug into binding component • Script Component: custom binding component, can be provider or consumer • Custom Component: create custom binding component with wizard screens
Filters • Available on many operations • Typically used for text manipulation • Select Class and Method • Must Build project first • Single String input • Single String output
Map Filter Examples import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Filters { public String trimQuotes (String in) { // removes all double-quote characters (") from input data in = in.replaceAll("\"", ""); return in; } public String replaceSpacesWithUnderscores (String in) { // removes all double-quote characters (") from input data in = in.replaceAll(" ", "_"); return in; } public String getDateTime(String in) { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); return dateFormat.format(date); } }
Map User Operation Example package com.bostechcorp.cbesb.map; import java.util.Map; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import com.bostechcorp.cbesb.runtime.ccsl.lib.ITransformationOperation; publicclass reformatDate implements ITransformationOperation { publicboolean process(String[] arg0, String[] arg1) throws Exception { /* * Takes in a date with a given format at outputs the date in a modified format * input: arg0[0]: input date format arg0[1]: output date format arg0[2]: date to be modified * output: arg1[0]: modified date */ String inputPattern = arg0[0]; String outputPattern = arg0[1]; SimpleDateFormat inputFormatter = new SimpleDateFormat(inputPattern); SimpleDateFormat outputFormatter = new SimpleDateFormat(outputPattern); Date date = (Date)inputFormatter.parse(arg0[2]); String dateStr = outputFormatter.format(date); arg1[0] = dateStr; returntrue; } }
Script Component Example publicvoid run(Log logger, String rootDir, ComponentContext componentContext, DeliveryChannel channel, MessageExchange exchange, Map<String, String> params) throws Exception { /* * This class receives in an inbound message and prints the contents * Then the out message is set to a different value and sent on * Use this class when it is necessary to have an out message (in-out) */ NormalizedMessage inMsg = exchange.getMessage("in"); NormalizedMessageHandler nmhIn = new NormalizedMessageHandler(inMsg); Source record = nmhIn.getRecordAtIndex(0); // assumes that incoming message is a string String inMessage = ((StringSource)record).getText(); logger.info("modifyMessage - inbound message: " + inMessage); NormalizedMessage outMsg = exchange.getMessage("out"); NormalizedMessageHandler nmh = new NormalizedMessageHandler(outMsg); // set new outbound message StringSource strSrc = new StringSource("modified message"); nmh.addRecord(strSrc); nmh.generateMessageContent(); LinkedList sendList = new LinkedList(); sendList.add(exchange); }
WSDL Import Wizard • Access from ChainBuilder ESB menu • Generates a schema from a WSDL • Select source WSDL (must be from a file) and destination directory • Used to create a schema that can be utilized in a map for sending data to a web service
Component Flow Editor • Eclipse Plug-in • Graphical Interface • Drag and drop functionality • Wizard Assistance
Binding Components • HTTP – includes web services • File • FTP • JMS - MQ • TCPIP – Server or Client mode, includes MLP • Script • Custom • Email – POP3 and SMTP
File Binding Component • Read and or Write files • Select Mode Read, Write, or both with check boxes Use CCSL option turns on or off the CCSL configuration screen later in the wizard. Typically leave this to true.
File Binding Component • Source and Stage directories can be full path or relative (esbHome\runtimes\test\SA) • File Pattern – for selecting which input files to read from source directory • Glob or Regex • Basic or advanced schedule
File Binding Component • Read Style • Raw: entire file contents read into single message • Newline: each line read into different message within a single exchange
File Binding Component • Action: delete or archive • Hold: How to handle files in stage directory at startup • Two Pass: whether to check file size twice before reading
File Binding Component • Reply settings • Configured for in-out reader only • Reply is the final out message • Write Style • Raw: each message of exchange written to separate file • Newline: all messages of exchange into single file
File Binding Component • File Pattern – contains literal characters and macros • BASENAME: original file name (without extension) • DATE: system date formatted as yyyymmdd • TIME: system time formatted as hhmmss • COUNT: automatically incremented value, starts at 1 each time the component is started • EXT: original file extension
File Binding Component • Write Mode Properties • Only available if Write was checked on the first screen