TIBCO ActiveMatrix® BPM Business Data Services

Software Release 1.2 September 2011

Important Information
SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITED ADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLED SOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FOR ANY OTHER PURPOSE. USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF A LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSE AGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USER LICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THE SOFTWARE (AND WHICH IS DUPLICATED IN THE LICENSE FILE) OR IF THERE IS NO SUCH SOFTWARE LICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATED IN THE “LICENSE” FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMS AND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND AN AGREEMENT TO BE BOUND BY THE SAME. This document contains confidential information that is subject to U.S. and international copyright laws and treaties. No part of this document may be reproduced in any form without the written authorization of TIBCO Software Inc. TIB, TIBCO, TIBCO Adapter, Predictive Business, Information Bus, The Power of Now, TIBCO ActiveMatrix, TIBCO ActiveMatrix Administrator, TIBCO Business Studio, TIBCO Enterprise Message Service, TIBCO Spotfire, and TIBCO Silver are either registered trademarks or trademarks of TIBCO Software Inc. in the United States and/or other countries. All other product and company names and marks mentioned in this document are the property of their respective owners and are mentioned for identification purposes only. THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALL OPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAME TIME. SEE THE README FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFIC OPERATING SYSTEM PLATFORM. THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANY TIME. THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY OR INDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES. Copyright © 2005-2011 TIBCO Software Inc. ALL RIGHTS RESERVED. TIBCO Software Inc. Confidential Information

| iii

Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Changes from the Previous Release of this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Business Data Services Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Connecting with TIBCO Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv How to Join TIBCOmmunity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv How to Access All TIBCO Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv How to Contact TIBCO Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv

Chapter 1 Introduction to BDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Business Data Services (BDS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Chapter 2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5
Object Orientation (OO). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 BOM Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Business Object Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Business Object Creation by Factory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Retrieving and Setting Business Object Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Invoking Operations on Business Object Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 BOM Relationships and Process Local Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Specialization and Generalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Assignment by Value and by Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 BOM Native Type or Primitive Type Object to Business Object Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Assigning a Business Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Assigning a Basic Type Object to a Process Data Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 The Significance of the Script Boundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Chapter 3 Business Data Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
UML Relationships Supported by Process Local Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 BOM Native Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Business Data Services Guide

iv

|

Contents

Value Spaces for BOM Native Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Creating a Business Object Model (BOM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating User-defined BOMs in the Business Objects Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Importing XSDs and WSDLs into Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Importing WSDLs into the Service Descriptors Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Importing a WSDL when Defining a Web Service Task. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Generating a WSDL for a Web Service You Are Creating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BOM Design-time Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Primitive Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Regular Expression Patterns for Text Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multiplicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Size Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Default Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BOM Labels and Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Label to Name Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BOM Class Label and Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BOM Attribute Label and Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BOM Package Label and Name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reserved Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Name Clashes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 25 25 26 28 28 29 29 29 32 32 33 34 35 36 37 37 38 39

Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM . . . . . . . . . . . . . . . . . . . 40
BDS Plug-in Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 BDS Design-time Validations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Validations in BOM Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Process Validations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 BDS Runtime Validations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 BOM Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Process Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Compatible Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Using BDS in Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . User Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Script Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Web Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 50 50 50 51

Business Data Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Supplying xsi:type Information in XML Sent to TIBCO BPM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Chapter 5 Business Data Scripting by Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Factories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

Business Data Services Guide

. . . . . . . 102 Working with Enumerated Types (ENUMs) . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Business Data Services Guide . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Working with Basic Decimal Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Scripting on Business Objects That Use Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Dates and Times . . . . . . . . . . . . 80 Scripting Containment Relationships . . . . . . . . . . . . . 65 Using Content Assist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Working with Booleans . . . . . . . . . . . . . . . . 84 Removing an Item from a List or a Containment Relationship . . 115 parseInt() . . . . . .Contents v | Creating a New Business Object . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Chapter 6 Advanced Scripting Examples . . . . . . . . . . . . . . . . . . . . . . . 118 Working with Fixed Decimals (BigDecimal) . . . . . . . . . . . . . . . . . . . . . . . . . 67 Working with Single Instance Attributes of Business Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Using the Special Value Null . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Working with Temporary Variables and Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Assigning a Null Value . . . . . . . . . . . . . . . 70 In a BOM Class Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Working with Basic Integer Numbers. . . . . . . . . . . . . . . . . . . . . . . 108 Scripting with Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 In a Process Data Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Return Values from Scripts . . . . . . . . . 59 Create a Copy of a Business Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Passing Arrays to Web Services. . . . . . . . . . . . . . . . . . . . . 97 Working with Dates and Times . . . . . . . 100 Using Date and Time Types with Durations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Multiple Instances of a BOM Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Working with Primitive Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Using the List set() Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Looping Through Lists and Copying Elements in Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Comparing Dates and Times . 115 parseFloat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Working with Strings or Text Fields . . . . . . . . . . 76 Loops Within Scripts . . . . . . . . . . . . . . . . . . . . 59 Create an Instance of a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Checking for Null Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Working with Fixed Length Integers (BigInteger) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Parse Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Durations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . 131 Object BOM Native Type and ScriptUtil. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Attribute and Variable Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Use the Process Debugger . . . . . . . . . . . . . . BDS Classes Do Not Appear or Changes Do Not Appear. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . escape() and unescape() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Catch Exceptions . . . . . . . . . . . . . . . . . .setObject() . . . . Break Script into Smaller Scripts . . . . . . . . . . . 137 Choose Appropriate Data Types . . 138 Use Sub-Packages to Aggregate Related Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Reference a Common Business Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Additional Javascript Global Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 122 123 126 Object BOM Native Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simple Operations . . . . . . . . 140 BOM Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Do Not Split a Namespace Across Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Process Data Field Granularity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Using the Object BOM Native Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . encodeURI() and decodeURI() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Check for Nulls. . . . . . . . . . . . . . . . . . . . . . . . . . . 151 151 151 151 152 153 153 154 Business Data Services Guide . . . . . . . . . . . . . . . . Use Constant First when Comparing a Constant with a Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 146 146 146 146 146 Chapter 8 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Viewing BDS-generated BDS Plug-in Hidden Projects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Business Data Scripting Best Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Write Variable Values and Progress Updates from the Script to the BPM Log File . . . . . . . . . . . . . . . Rounding . 148 BDS Plug-in Generation Problems . . . . . . Examine the Server Logs . . . . . . . . . . . . Comparing Fixed Decimals and BigDecimals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . encodeURIComponent() and decodeURIComponent() . . . . . . . . . . . . . . . . . Ensure Business Objects Are Valid Before Scripts Complete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . eval() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . .vi | Contents Creating and Initializing Fixed Decimal Values . . . . Keep the Scripts Small. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Use Comments in Scripts . . . . . . . . . . . . . . . . . . . . . . . . 150 Troubleshooting BDS Scripting . . . . . . . 134 134 134 135 Chapter 7 Business Data Modeling Best Practice. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Do Not Modify Generated BOMs . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 BOM Native Type to BDS Type Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Data Mapping . . . . . . . . . 162 Unsupported XSD Constructs . . 164 BDS and Forms . . . . . . . . . . . . . . . 202 Business Data Services Guide . . . . . . . . . . . . . . . . . 166 Restrictions between Complex Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 JavaScript RegExp Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 BOM Native Type Methods . . . . . Time. . . . . . . . . . . . . . . . . . . . . . 182 DateTimeUtil . . . . . . . . . . . . . . . . . 182 ScriptUtil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Multiplicity at the Sequence or Choice Level . . . . . . . . . . 160 Process Primitive Data Type Mapping . . . . . . . . . . . . . 164 Fixed Attribute Overwrite . . . . . . . . . . 191 Fixed Point Decimal (BigDecimal) Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 Converting Values Between Different BOM Attribute Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 Mapping to or from Process Basic Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 try/catch Statement. . . . . . . . . . . . 180 Appendix B Business Data Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Fixed Length Integer (BigInteger) Methods . . . . . . . . 164 Simple Type Default Values . . . . 192 Date. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . and While Expressions . . . . . 167 Recurring Elements in Sequence . . . . . . . . . . . and String Functions . . 177 Switch Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 JDBC Database Type to BOM Data Type Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 BDS Limitations . . . . . . . . . .155 Data Type Mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Datetime and Datetimetz (XMLGregorianCalendar) Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Contents vii | Appendix A Supplemental Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Date and Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Using If. . . . . . . . . . . . . . . . . . . . . . . . . . . 176 JavaScript Features not Supported in TIBCO BPM Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 xsd:any "##local" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181 Static Factory Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 The "block" Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 New Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 IpeScriptUtil (and ScriptUtil) Conversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 "==="operator . . . 165 Group Multiplicity . . . 179 Reserved Words in Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . For. . . . . . . 197 Duration Methods . . . . . . . . . 165 Nested xsd:any in Sequences . . 178 JavaScript Arrays . . . . . . . . . 156 XSD Type to BDS Type Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 JavaScript Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . 214 WorkItem. . . . . . . . . . . . . . 213 WorkManagerFactory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 List Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Process Instance Attributes and Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Appendix D Work Item Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 ListIterator Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Business Data Services Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Glossary . . . . . . . . . .viii | Contents Text (String) Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Math Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Other Supported Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Other JavaScript Functions . . . . . . . . . . . . . . . . . . . . 215 OrgModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Appendix C Process Scripting . . . . . . . . . . . . . . . . . . . . . .

This guide does not cover the following: • • Forms Scripting – a different scripting variant used when running forms (client-side scripting). a component of TIBCO ActiveMatrix® BPM.2. • • For more information on these types of scripting. The focus of this guide is on the Business Data aspects of server-side scripting. refer to Related Documentation. Process Scripting for a summary). page x Related Documentation. OrgModel Scripting – an extension that allows access to the Organization Model (see Appendix D. Topics • • • • Changes from the Previous Release of this Guide. Work Item Scripting for a summary). page xii Connecting with TIBCO Resources. Work Item Scripting – an extension that allows access to the attributes of and control over a work item (see Appendix D. This guide describes the use of TIBCO ActiveMatrix BPM and TIBCO Business Studio 3. The following areas are covered only briefly: • Process Scripting – an extension that allows access to the attributes of and control over a process instance (see Appendix C. Resource Query Language – a different scripting language used for selecting which resources are assigned to a User Task. page xiv Business Data Services Guide .5. page xi Typographical Conventions.| ix Preface This guide describes how to use Business Data Services (BDS). Work Item Scripting for a summary).

x | Preface Changes from the Previous Release of this Guide This section itemizes the major changes from the previous release of this guide. Work Item Attributes Additional customizable work item attributes have been added. See WorkItem on page 215. See Assigning a Null Value on page 65. Additional Support Addition of more construct and xsd type support. Business Data Services Guide . Assigning the Value Null Additional information has been added about assigning the special value null to attributes.

These documents also contain lists of known issues and closed issues for the release.Related Documentation xi | Related Documentation This section lists documentation resources you may find useful. Read the release notes for the various products for lists of new and changed features. Business Data Services Guide . TIBCO Business Studio™ BPM Implementation Read this manual to learn how to implement business processes (including using scripts). Business Data Services Documentation The following documents are related to BDS: • • • TIBCO Business Studio™ Business Object Modeler Read this manual to learn how to model data.

Business Data Services Guide . code examples. In command syntax. MyCommand is enabled: MyCommand [enable | disable] italic font Italic font is used in the following ways: • • • To indicate a document title. to indicate what a user types. and output displayed in a command window. Code font identifies commands. For example. For example: MyCommand PathName Key combinations Key names separated by a plus sign indicate keys pressed simultaneously. Table 1 General Typographical Conventions Convention TIBCO_HOME Use Many TIBCO products must be installed within the same home directory. Portlets are mini-applications that run in a portal. on Windows systems. the default value is C:\Program Files\tibco\. Key names separated by a comma and space indicate keys pressed one after the other. For example: Esc. The note icon indicates information that is of special interest or importance. pathnames. for example. To introduce new terms. For example. For example: Use MyCommand to start the foo process. To indicate a variable in a command or code syntax that you must replace. filenames. code font bold code font Bold code font is used in the following ways: • • • In procedures. to indicate the parts of the sample that are of particular interest. This directory is referenced in documentation as TIBCO_HOME. The value of TIBCO_HOME depends on the operating system.xii | Preface Typographical Conventions The following typographical conventions are used in this manual. For example: Ctrl+C. an additional action required only in certain circumstances. For example: A portal page may contain several portlets. For example: Type admin. For example: See TIBCO ActiveMatrix BusinessWorks Concepts. to indicate the default parameter for a command. if no parameter is specified. In large code samples. Ctrl+Q.

for example. for example. data loss or corruption if certain steps are taken or not taken. Business Data Services Guide .Typographical Conventions xiii | Table 1 General Typographical Conventions (Cont’d) Convention Use The tip icon indicates an idea that could be useful. The warning icon indicates the potential for a damaging situation. a way to apply the information provided in the current section to achieve a specific result.

and resident experts.tibco.com.com Entry to this site requires a username and password. visit this site: http://www. blogs. and information about getting started with TIBCO Support.tibco. To register. a place to share and access the collective experience of the TIBCO community. visit this site: https://support. go to http://www.xiv | Preface Connecting with TIBCO Resources How to Join TIBCOmmunity TIBCOmmunity is an online destination for TIBCO customers.tibco.com/services/support • If you already have a valid maintenance or support contract. TIBCOmmunity offers forums. and access to a variety of resources.com/TibcoDoc How to Contact TIBCO Support For comments or problems with this manual or the software it addresses. If you do not have a username. How to Access All TIBCO Documentation After you join TIBCOmmunity.tibcommunity. contact TIBCO Support as follows: • For an overview of TIBCO Support. you can request one. Business Data Services Guide . you can access the documentation for all supported product versions here: http://docs. partners.

Topics • • Overview. page 2 Business Data Services (BDS). page 3 Business Data Services Guide .|1 Chapter 1 Introduction to BDS This chapter provides an introduction to the Business Data Services component and how it is used.

A fundamental part of developing a business process is to understand the data that the process manipulates and depends upon. Business Data Services Guide . that allows you to build up a description of the types of objects the processes will manipulate. Business Object Modeler. their attributes. TIBCO Business Studio provides a tool for this purpose. The resulting Business Object Model (BOM) contains the different types of objects that the business uses. and their relationships to each other. and manage business process management applications.2 | Chapter 1 Introduction to BDS Overview TIBCO ActiveMatrix BPM provides a configurable set of tools that can be used to develop. see TIBCO Business Studio Business Object Modeler. execute. For more information on using Business Object Modeler. deploy.

script task. a user task. For more information about EMF. BDS converts the design-time BOM definitions into BDS Plug-ins that act as the runtime model for Business Data.org/modeling/emf/ You can interact with Business Data (any BOM-based data) from any activity in a Process (for example. and so on). database task. consider a claims handling system. Use TIBCO Business Studio Business Object Modeler to define a BOM.eclipse. the data of which might be modeled as follows: The following business process shows the tasks that handle a claim: Business Data Services Guide . The BDS Plug-ins are based on the Eclipse Modelling Framework (EMF). For example.Business Data Services (BDS) 3 | Business Data Services (BDS) Business Data Services (BDS) is the component responsible for handling Business Data in TIBCO ActiveMatrix BPM. This automatically results in an indirect interaction with BDS Component. see: http://www.

4 | Chapter 1 Introduction to BDS In this example. the user interacts with BDS in each of the activities: • • • In the Create Claim script task. a claims handler validates whether the details are correct. In the Update Claims Management System with Claim Details service task. Business Data Services Guide . In the Validate Claim Details user task. the script constructs the Business Objects. details of the claim are persisted to a database.

page 7 Business Objects.Concepts 5 | Chapter 2 Concepts This chapter outlines the main concepts that underlie the BDS component and its use. page 10 Assignment by Value and by Reference. page 8 BOM Relationships and Process Local Data. Topics • • • • • Object Orientation (OO). page 14 Business Data Services Guide . page 6 BOM Class.

Business Data Services Guide . as is the scripting environment that supports it. One of the best ways to understand these concepts is to learn by example. This section describes the implications of this OO design.6 | Chapter 2 Concepts Object Orientation (OO) The BPM runtime is an Object Oriented (OO) system. It is important to understand the concepts described in this section to achieve the desired behavior from your scripts. If you have difficulty understanding this section. and then return to this section. refer to the examples in later sections.

and defines what the different objects will be like. This template is called a BOM class. for each type of object we want to process. before we can have objects we must create a template. Objects are created to represent real world things such as a customer or an order. Creating BOM classes for your application is a design-time activity. the whole focus of OO is on objects. which would model real world customers and orders. you can define a Customer BOM class and an Order BOM class. However. For example. Business Data Services Guide . or pattern.BOM Class 7 | BOM Class As the name implies.

For example. which are instances of the class: cl ass: Cu sto me r N am e N um be r i nstan ce : Cu stom er N am e: Fre d B log s N um be r: 10 00 01 in stan ce : Cu stom er N am e: Joh n S mith N um be r: 10 00 02 in stan ce: Cu stom er Na m e: Alb er t B ro wn Nu m be r: 1 00 0 12 Business Object Scope The life span of a Business Object is typically bounded by the Process Instance in which it is created. The structure of the database table may match one of the normal BOM classes. Business Data Services Guide . generally all Customers have the same set of attributes.8 | Chapter 2 Concepts Business Objects At runtime. instances of these BOM classes are created to represent particular instances of the generic BOM class. or the data in one of the normal BOM classes may have to be mapped into a Business Object that matches the database table structure depending on the implementation. the Customer BOM class can have two Business Objects to represent two actual customers. Although Customer attributes differ from Order attributes. or read from. and an Order may have attributes that include Customer and DateCreated. The diagram below shows a simple Customer class and three Business Objects. It is possible in a service task to write information out to. a database. a Customer may have attributes that include a name and number. John Smith and Fred Blogs. This is called Process Local Scope. For example. Each of these BOM classes and Business Objects have attributes. These instances are referred to as Business Objects.

Retrieving and Setting Business Object Attributes Using Business Data Scripting capabilities.toLowerCase(). methods can return values. lowercaseName = customer.the attributes of a customer instance.name was "Fred Blogs". This happens implicitly when objects are created within User Tasks. In other cases. uppercaseName = customer. methods can alter some of the attributes of the instance. There is a factory method for each class (for example. and the second assignment would set the uppercaseName variable to the value FRED BLOGS. BOM. then the first assignment would set the lowercaseName variable to the value fred blogs. if the Text attribute customer. Two of it’s methods are toUpperCase() and toLowerCase(). Invoking Operations on Business Object Attributes As well as attributes.name. and sub-package within the BOM.name. For example. the String class is used to represent a Text attribute’s value. In this example. It is important to know how the methods behave when you are using them.toUpperCase(). createOrder.name. createCustomer. The factory methods have to be used when a Business Object is created. You can set the value of a Business Object attribute as follows: customerInstance.Business Objects 9 | Business Object Creation by Factory Business Objects are created by factories. such as the example cited above.name = "Clint Hill". and so on). retrieving Business Object attributes. such as the name of a customer. See Business Data Scripting by Example on page 55 for more information about factories. is as simple as running the following script: var custName = customerInstance. for example. but has to be done explicitly when an object is created in a script. Business Data Services Guide . some classes have methods which perform operations on the object. In some cases.

these two approaches are treated identically. those Widgets cannot be components with other Car objects. Business Data Services Guide . it will no longer exist in Business Object A. there is a line drawn between the Car and Widgets. In the second example. Composition The Composition relationship is used to model the concept that “X is composed of Y”. it would no longer exist in the original car. if a Business Object contained in Business Object A is added to Business Object B. there is a "parts" attribute in the Car class. This can be drawn in either of the following ways in the Business Object Modeler: • • In the first example. For example. The Composition relationship is also known as the Containment relationship. It does not matter which is used.10 | Chapter 2 Concepts BOM Relationships and Process Local Data This section describes how BOM relationships are honored by process local data. if a Car object is composed of a number of Widget objects. a Car is made up of a number of Widgets. This makes sense if you consider the example of a steering wheel. It cannot be in two cars at the same time. which is labelled "parts". if the steering wheel from one car was installed into another car. Also. Similarly. At runtime. It is important to understand that in this kind of relationship.

(Also. and telephone). a supplier can give them a Cat or a Dog because they both satisfy the "is-a" Mammal requirement. For example. Fish. In the Business Object Modeler. a Goldfish is-an Animal). you can create a Person class that holds the common attributes of Customer and Employee (for example. this means that a Mammal is a specialization of an Animal. Cat. you may discover that some classes have some things in common. and Dog. name. email. a Cat is-an Animal and a Dog is-an Animal). both classes representing a person. When modeling this. these relationships would be represented like this: In OO terms. For example. and a Cat is a specialization of a Mammal. However. If someone wants a pet. as a hamster "is-a" Mammal. Mammal. providing a Goldfish does not satisfy the "is-a" Mammal requirement. (Also. Goldfish. and they specify that they want a Mammal.BOM Relationships and Process Local Data 11 | Specialization and Generalization Another useful aspect of OO technology that can be used in BOM and scripting is Specialization and Generalization. A Mammal is-an Animal. and so on. A Dog is-a Mammal. A Cat is-a Mammal. A Fish is-an Animal. or they can even be given a Hamster. consider the following terms: Animal. Looking at these terms you can see that we can link some of them with the phrase "is-a" (or "is-an") as follows: • • • • • A Goldfish is-a Fish. there might be a Customer and an Employee class. Business Data Services Guide . While building up the model of what objects a business deals with.

if you had a Customer business object. we can say that the Customer and Employee classes are specializations of the Person class. Alternatively. The relationship between these classes can be represented in the BOM as shown below: Assigning a Subtype to a Super Type It is always acceptable to assign a subtype to a super type. adding the extra attributes that only a customer has (for example. it is possible in a process to create a list of all the Customers and Employees that have been involved in a particular Order by creating a list of Person instances (each instance of which could either be a Customer or an Employee). customerNumber).12 | Chapter 2 Concepts The Customer class can then specialize the Person class. by adding any attributes that only the Employee had (for example. Business Data Services Guide . Similarly. Generalization is the reverse of specialization (looking at the same relationship from the opposite direction). the Employee class can specialize the Person class. Using the previous diagram as an example. We can say that the Person class is a generalization of the Customer and Employee classes. manager and so on). Having done this. as its BOM class is a subtype of the Person class. department. you can assign the Customer business object to a business object attribute of type Person (because you can say that the Customer "is-a" Person).

In other words. If the Person attribute is referring to a Business Object of the generic Person.BOM Relationships and Process Local Data 13 | Assigning a Super Type to a Subtype The converse (a super type to a subtype) is acceptable when the super type actually refers to an instance of the subtype (or one of its subtypes). it will only work if the Person attribute is actually referring to an instance of the Customer BOM class. For example. it passes the "is-a" test. or the Employee BOM classes then it will not work. as they do not satisfy the "is-a Customer" requirement. if you have a Business Object Attribute of the Customer subtype that you want to assign from another attribute of the Person type. Business Data Services Guide .

it will be removed from that containment automatically because it is impossible for an object to be contained by two containers at the same time.of type. By value. See BOM Native Type or Primitive Type Object to Business Object Attribute.. For efficiency’s sake.. but always behaves like by value. changes in one place do not affect the other... This results in two independent objects..behaves as follows: Effectively by value. For an assignment by reference. See Assigning a Business Object. See Assigning a Business Object. If this is not the desired behavior.. the entity to which the assignment is made refers to the entity being assigned. BOM Class Business Data Services Guide . In other words. BOM Native or Primitive Type . a copy of the assigned entity is made. subsequent changes to the entity by either the new or existing reference is reflected in both places (there is only one entity. However. By reference.14 | Chapter 2 Concepts Assignment by Value and by Reference Assignments can be made either by reference or by value. Process Data Field BOM Class Basic Type By reference... Business Object attribute or composition . See Assigning a Basic Type Object to a Process Data Field. Therefore. objects are only copied where they are mutable (where their internal value can be changed). Table 2: Assignment Conventions Assignment to. In other words. and that is what is applied to the entity receiving the assignment. it isn’t copied). for a by value assignment. make a copy of the object first. by reference behavior is sometimes used. Important note: If the BOM Object being assigned is already contained by another BOM object’s containment.

person2.make = "Ford" // will not affect car.make.dob = person1.age = person2.// Will not increment person1. person2.age = person2.dob // is still 1968-01-04 Business Data Services Guide .make = bus.dob.createDate("1968-01-04").age person1. bus. person1.age + 1.dob.age. person2.setYear(1970). // Value now 1970-01-04.dob = DateTimeUtil.Assignment by Value and by Reference 15 | BOM Native Type or Primitive Type Object to Business Object Attribute Assigning a BOM Native Type or Primitive Type object to a Business Object attribute is by value: car.make person1.

name = "Bob". see Create a Copy of a Business Object on page 61. Business Data Services Guide .owner = owner.age var tempPerson = personDataField. It is impossible for an object to be contained by two containers at the same time.16 | Chapter 2 Concepts Assigning a Business Object Assigning a Business Object is by reference: personDataField = car.name var owner = com_example_refval_Factory. but is already contained in another Business Object’s containment. If a Business Object is assigned. it is automatically removed from that containment.// Also affects personDataField. // Also affects car.copy(…) utility. make a copy of the object first using the ScriptUtil.// Business Object assigned to // local variable by reference tempPerson.age = 25.owner. owner.owner. car. If this is not the desired behavior.createPerson().name. // Also affects car. // Business Object assigned to data // field by reference personDataField.name = "Ludwig".owner.

copy(…). // Creates an independent Address Assigning a Basic Type Object to a Process Data Field Assigning a Basic Type object to a process Data Field is by value: var greeting="Hello". greetingDataField = "Goodbye". // Will not affect local variable // greeting Business Data Services Guide . account and customer end up with independent copies of the address: var address = com_example_refval_Factory. account. the final line of the script removes the Address from Customer.address = ScriptUtil. although all assignments are by reference (there is only ever one Address).address = address.address = address. customer. // Removes address from // customer If this script is modified to use ScriptUtil.createAddress().Assignment by Value and by Reference 17 | In the next example.address. leaving Customer with no Address: var address = com_example_refval_Factory.address = customer.copy(customer. greetingDataField = greeting.address).createAddress(). customer. account.

all process Data Fields are independently converted to a form that can be stored in a database.age = 40. // This affects both data fields Script 2: // Each data field now refers to an independent Person object personDataField1. modifying a value in one place never affects the other. operating on the same process Data Fields: Script 1: personDataField1.age = 20. // will not affect // personDataField2. which can be assumed to run one after the other. in a later script.age = 35. personDataField2 = personDataField1.18 | Chapter 2 Concepts The Significance of the Script Boundary When a script completes.age (still 35) Business Data Services Guide . regardless of whether a by reference assignment occurred in an earlier script. Therefore. This is illustrated by the following two scripts. // Both data fields now // refer to same object personDataField1.

and the types of data it supports.Business Data Definition 19 | Chapter 3 Business Data Definition This chapter describes how you define business data in TIBCO Business Studio Object Model Editor. Topics • • • • UML Relationships Supported by Process Local Data. page 29 Business Data Services Guide . page 21 Creating a Business Object Model (BOM). page 25 BOM Design-time Model. page 20 BOM Native Types.

so an understanding of UML can be useful. these relationships cannot be used in processes. Although in TIBCO Business Studio BOM Editor also supports Association and Aggregation relationships. BDS and Process Local Data support Generalization and Specialization relationships and Uni-directional Composition relationships. Business Data Services Guide .20 | Chapter 3 Business Data Definition UML Relationships Supported by Process Local Data The Business Object Modeler uses terms and notation similar to UML (Unified Modeling Language).

these BOM Native Types can be used to generate Primitive Types that have some application-specific restrictions. Business Data Services Guide . 4 sub-types of Object (xsd:any. for example. Therefore. xsd:anySimpleType and xsd:anyAttribute)..BOM Native Types 21 | BOM Native Types The following BOM Native Types are supported by BOM Editor: • • • • • • • • • • • • • Attachment Boolean Date Datetime Datetimetz Decimal Duration ID Integer Object Text Time URI There are also: • • • two Decimal sub-types (Fixed Point and Floating Point) two Integer sub-types (Fixed Length and Signed Integer). xsd:anyType. Using Business Object Modeler. in total. if you include the sub-types as types. a range or a regular expression that it must match. The Attachment type is not currently supported by the BPM runtime. there are 18 different types.

22 | Chapter 3 Business Data Definition Value Spaces for BOM Native Types The value space of the different BOM Native Types is shown in the following table.31] (dependent on month & year) For example: "2011-12-31" Datetime Date fields according to Date type above Time fields according to Time type below Optional timezone offset in range [-14:00 .225E-307 0 Positive values between 2.999] Month in range [1 – 12] Day in range [1 .+14:00 or Z for Zero offset] For example: "2011-12-31T23:59:59" or "2011-12-31T23:59:59-05:00" Datetimetz Date and Time fields according to Datetime type above.79769E+308. Table 3: Value Spaces for BOM Native Types BOM Native Type Attachment Boolean Date Value Space N/A true. For example: 1.23 Business Data Services Guide .99. but timezone is mandatory For example: "2011-12-31T23:59:59Z" or "2011-12-31T23:59:59+05:00" Decimal – Fixed Point An arbitrarily long integer number with the which has its decimal point moved to the left or right by up to 231 places.225E-307 and 1.999.999 – 999.1234567890 Decimal – Floating Point • • • Negative numbers between -1. For example: 1234567890.79769E+308 and -2. false Year in range [-999.

147. second and sign attributes.647 For example: 123456789 Object – xsd:any A block of XML satisfying xsd:anySimpleType schema definition.483.w3.147. See http://www. See http://www.483. minute. A block of XML satisfying xsd:anyAttribute schema definition.648 to 2.BOM Native Types 23 | Table 3: Value Spaces for BOM Native Types BOM Native Type Duration Value Space A duration consists of year.org/TR/1999/REC-xml-names-19990114/#NT-NC Name for more details. day. See http://www.1.".org/TR/2004/REC-xmlschema-1-20041028/.w3.org/TR/2004/REC-xmlschema-1-20041028/.647].w3. numbers. month.xsd:anyAttribute Object . it is fetched from the object as an integer and the sign can be "+" or "-". This can also be given the value of a BOM Primitive A block of XML satisfying xsd:anyType schema definition See http://www. Starts with a letter or "_". or they can be null if not set. or combinations of characters and extenders.79769E+308] although. That is. A block of XML satisfying xsd:anySimpleType schema definition See http://www.147. This can also be given the value of a Business Object or the value of a BOM Primitive.483. ". Arbitrary length of long text string of Unicode characters For example: Fred Blogs Object . "-". For example: P3DT2H for 3 days and 2 hours ID Non-colonized name.xsd:anySimpleType Object . and may be followed by more letters.xsd:anyType Text Business Data Services Guide . This can also be given the value of a Business Object. "_". For example: ID1234 Integer – Fixed Length Arbitrarily large length integer For example: 12345678901234567890 Integer – Signed Integers in the range -2. The first 5 fields are non-negative integers.org/TR/2004/REC-xmlschema-1-20041028/.org/TR/2004/REC-xmlschema-1-20041028/.w3. hour. they can have values in the range [0 2. The seconds field is a non-negative decimal (or null) in the range [0 .w3.

w3.24 | Chapter 3 Business Data Definition Table 3: Value Spaces for BOM Native Types BOM Native Type Time Value Space Hour in range [0 – 24] (for value 24 minutes and seconds must be 0) Minute in range [0 – 59] Second in range [0 – 60] (NB 60 only allowed for a leap second) For example: 12:34:56 URI Refers to xsd:anyURI. XML Linking Language (XLink) available at: http://www. See World Wide Web Consortium.tibco.org/TR/2001/REC-xlink-20010627/ For example: http://www.com Business Data Services Guide .

If you intend to call the interfaces. although there cannot be circular references (dependencies) between BOMs. Importing XSDs and WSDLs into Business Objects If your processes need to manipulate structured data whose structure is defined in XSD files or WSDL files. This is only done on WSDL files if you are not going to call the interfaces in the web service defined in the WSDL file. as shown in the following figure: User-defined BOMs can be found in the Business Objects folder of the TIBCO Business Studio project. Structured data can also be manipulated in scripts in the same way as user-defined BOMs. • • Manually in the Business Object Modeler. By importing existing XSD or WSDL files that contain data definitions used by existing applications. you can explore the data structures that have been imported in the Business Objects folder. the structure of the data can be imported into the Business Objects folder. Business Data Services Guide . Once the import has completed. import the WSDL as described in Importing WSDLs into the Service Descriptors Folder on page 26. BOMs are created from the context menu in the Business Objects folder in the Project Explorer. There can be multiple BOMs with cross-references between them. Creating User-defined BOMs in the Business Objects Folder You can create a new BOM during or after creating a project.Creating a Business Object Model (BOM) 25 | Creating a Business Object Model (BOM) There are two ways to create a BOM. by one who knows the structure of the data that the business uses.

the WSDL defining that service can be imported into the Service Descriptors folder. This is done by right-clicking the Service Descriptors folder of a TIBCO Business Studio project. Once the data structure in the XSD (or WSDL) file has been imported into a BOM. Importing WSDLs into the Service Descriptors Folder If you have a web service that you want to invoke. then imported and extended to cope with known and future requirements. The following is an example of how this might be used: If you have an existing database.26 | Chapter 3 Business Data Definition If you modify these imported BOMs. and selecting Import. this mismatch is normal if you have data types that are defined in an external system. This allows you to import a WSDL file from a number of sources. including a file or a URL. which can then be imported into TIBCO Business Studio. web services can be defined and WSDLs generated for other applications to invoke the new web services that use the structured data from the imported files. The information about the table structure can be used in tasks that interact with the database. then Service Import Wizard. causing TIBCO Business Studio to display the following warning: Despite the warning. the copy of the definitions in TIBCO Business Studio will differ from the source that they came from. the structure of it’s tables can be exported into an XSD file. Business Data Services Guide .

a warning is generated: TIBCO recommends that you do not change a generated file. you can view the services defined by the WSDL file. Business Data Services Guide . Script tasks and user tasks can process business objects created from the structured data imported from the WSDL file in the same way as the structured data defined in the user-defined BOMs.Creating a Business Object Model (BOM) 27 | Once imported. a BOM is generated that contains all the structured data definitions used by the web service. In order to call a web service. if you attempt to change one of the generated BOMs. a service task must be added to a BPM process and the Task Type must be set to Web Service. Then the operation must be selected from the operations that were imported from the WSDL file by clicking the Select button in the Service Task General Properties tab. as you risk losing changes if the file is regenerated. for example: As part of the importing of the WSDL file. These Business Objects can then be mapped onto the input and output parameters of the Web Service task that is being called. This generated BOM will be created in the Generated Business Objects folder and can be viewed in the same way as the user-defined BOMs above. However.

If the WSDL does not exist yet. see Scripting with Web Services on page 109. you can use the Generate WSDL button in the Web Service General Properties tab to generate a WSDL file that you can use to define the contract that the Web Service provides. there is an Import WSDL option in the Properties tab to import the definition of the web service from a WSDL file (if the WSDL file has not already been imported into the project as described previously).28 | Chapter 3 Business Data Definition Importing a WSDL when Defining a Web Service Task When a web service task is created in a process. Once the WSDL file has been imported it can be viewed in the Service Descriptors folder of the TIBCO Business Studio project to explore the different services provided by the web service. the data types used by the web service are defined in a BOM created in the Generated Business Objects folder. because it has not yet been produced). Generating a WSDL for a Web Service You Are Creating If you do not have a WSDL file for a web service (for example. Business Data Services Guide . As previously explained. The Properties tab for a web service task has buttons for: • • • Selecting an existing WSDL service Importing a WSDL if the WSDL has not already been imported Generating a WSDL. it can be created here For a more detailed overview of defining Web Services.

text fields can be constrained to match certain patterns. for example. Usually. For example. the value space of a user-defined Primitive Type is restricted in some way. then you can specify this by using a Pattern in the Advanced Property Sheet for the Primitive Type: Business Data Services Guide .BOM Design-time Model 29 | BOM Design-time Model Primitive Types In a BOM. it is possible to define your own Primitive Types. The sub-type and restrictions are defined on the Advanced Property tab for Primitive Types: Regular Expression Patterns for Text Fields When defining a Primitive Type. which are specializations of BOM Native Types. a type called Hour can be defined. where "N" represents a digit. if you want an OrderId type to be formatted as ORD-NNNNNN. based on the Integer(Signed) type with the values restricted to numbers between 0 and 23.

The "+" after it means one or more.Bye.234 The "^" at the start of a range refers to characters outside the allowable range. the "a-f" means any letter in the range "a" to "f" and the "0-9" means any digit. Incorrect: Hello.12345678 Incorrect: 1. The "+" means one or more. so "[^. in this case it must be escaped. because "." normally matches any character.30 | Chapter 3 Business Data Definition In the pattern shown in the above example.". In this case. any number of lowercase hex digits may be used. the "\d" represents any digit and the "{6}" means there must be 6 of the preceding element (in this case. and "\S" sequences inverse character sets. The asterisk means zero or more of the previous element. you can use "\w" for any word character and "\s" for any white space character. "\d" means any digit. The "\D". "\. and must be followed by a "." matches a ".\d{8} Correct: 1. "\W". As in the previous example.3}" means between 1 and 3 repetitions of the previous element. \d{1.". Business Data Services Guide . the square brackets may contain any hex digit.12345678 123. In other words. "{1.". a digit).]" matches any character apart from ". Description The content in the square brackets may include any number or lowercase letter of the alphabet. Similar to the "\d" sequence.3}\. Table 4: Regular Expression Example Patterns Pattern ID-[0123456789abcd ef]* Examples Correct: ID-deadbeef IDID-1234 ID-0fff1234 Incorrect: ID ID-0A ID-[a-f0-9]+ Correct: ID-0000dead Incorrect: IDID-0000DEAD [^. Correct: Hello. However. Additional example patterns that can be used are listed below.]+.

BOM Design-time Model 31 | Table 4: Regular Expression Example Patterns Pattern \i\c* Examples Correct: xml:schema :schema Incorrect: 0xml:schema -schema [\i-[:]][\c-[:]]* Correct: xmlschema _schema Incorrect: xml:schema :schema [-+]?\d+(\. adding "–[aeiou]" at the end removes the vowels from the set of letters that are matched. The whole group is optional because of the "?" at the end.info/xml.\d+)? Correct: 0.xmlschemareference.1 -2. Similarly. then decimal digits must follow in this example. The example on the left removes ":" from the "\i" and "\c" lists of characters so the pattern now matches non-colonized names. "[a-z-[aeiou]] a-z"matches any lowercase letter. and "\c" matches any character that can appear after the initial character.html http://www.w3.com/regularExpression.org/TR/xmlschema-2/#regexs http://www. the "\I" and "\C" are the negations. You can read more about regular expressions at: • • • http://www. as it has a special meaning if not the first character. The "?" indicates that the previous element is optional.html Business Data Services Guide . If you want to include a "-" in a range.34 +3 Incorrect: 4. The parenthesis mark form a group. then it should be the first character.regular-expressions. Description "\i" matches the initial character of any valid XML name. If a decimal point appears.

the List methods must be used. the length for the attribute is specified in the Advanced Property sheet.3 4 4. they have a maximum size defined. then the attribute being defined will be a List. the number of decimals for the attribute is set. This can be changed in the attribute’s Advanced Property tab. Business Data Services Guide . content assist is available by typing Ctrl-SPACE. When defining the multiplicity for an attribute. the developer can define how many values the attribute can or must have. however. Therefore. Additionally. that multiplicity can have other values.32 | Chapter 3 Business Data Definition Multiplicity When BOM class attributes and compositions are defined.. You can then select one of the following options: It should be noted. such as the following: Multiplicity 2. when referenced in scripts.* Meaning There must be 2 or 3 There must be 4 There must be 4 or more If there can be more than one element. Size Restrictions When Text attributes are defined. for the Fixed Length Decimal sub-type.. When Fixed Length sub-types of Integer and Decimal attributes are defined.

this is done through the attribute’s Advanced Property tab. it might be given a default value of 1 in the Advanced Property tab as shown below: When an instance of this class is created. then as soon as an instance of the class that it is an attribute of is created. if a class has an integer type attribute called quantity. Business Data Services Guide . Again.BOM Design-time Model 33 | For all Integer and Decimal sub-types. upper and lower bounds can be set on the value that the attribute can take. the quantity attribute will be 1. This is done through the Advanced tab in the Properties. For example: Default Values Default values can be used when defining attributes for BOM classes. For example. the attribute has that value. If an attribute has a default value.

34 | Chapter 3 Business Data Definition If you attempt to set a default on an optional attribute. BOM classes. the following warning is generated: BOM Labels and Names BOM packages. the following warning is generated: If you attempt to set a default on an attribute with a multiplicity greater than 1. one with a potential multiplicity of zero. A Label is a free format field that is designed to be a user-friendly description of the attribute or class. and BOM attributes have a Label as well as a Name. for example. The label text is displayed by the BOM editor as shown below: Business Data Services Guide .

and the underscore character "_" are valid characters for use as a name's first-character. You can see that the spaces.listPrice + delivery + tax. the attribute name is used. For example: var engineSize = car. Therefore. Only characters used in ASCII A-Z (excluding accented characters). Space and most punctuation is removed. a-z. and currency symbol have all been ignored when the names were generated. a name is defined for each class and attribute. The characters that are valid for subsequent characters in the name are the same as the initial character.BOM Design-time Model 35 | And by the default Forms: However. The default name is generated by using the characters from the label that are allowed in names.engineCapacitycc. For example. Label to Name Algorithm All characters in the label that are not valid characters in the name are removed when the label is converted to the default name. brackets. the names that can be used to refer to attributes are considerably constrained. var carPrice = car. The screenshot of the form above shows the names as well as the labels for the different fields. In scripting. Business Data Services Guide . with the addition of digit characters (ASCII digits 0-9 only). as in scripting. the Label cannot be used with the entire product.

Because the Name is used in scripts. . in which case the name must then be manually changed. including the following: Character . you can see the quotation marks and spaces in the Label are removed in the Name: The Label is used in BOM diagrams and the Name is used in scripts. The following example shows a Label and Name pair where only lowercase letters are used Compared that to the following: The Name field is generated from the Label field whenever the label is changed unless the Name field has been manually set. any illegal name characters are ignored.36 | Chapter 3 Business Data Definition Spaces and punctuation characters are not allowed in names. For example: Business Data Services Guide . Character Description Dot Comma Hyphen BOM Class Label and Name Any characters are valid in a label. it is easier to read if initial capital letters are used for each separate word. as in the example above. As the label is converted to the class name. In the following example.

BOM Design-time Model 37 | BOM Attribute Label and Name For the names of class attributes. there is a requirement that the first two characters of the name must use the same case. and must avoid reserved words in a similar manner as BOM class names. To meet this requirement. a single letter word as the first word. and if possible. do not use. it is recommend that you use uppercase letters for the initial letter of each word in the label. The names will follow the camelcase convention. each beginning with a letter or underscore and containing only letters. and numbers. Business Data Services Guide . Each BOM must have a unique name across all other projects in the TIBCO Business Studio workspace. as shown in the following examples: When creating attributes for BOM classes. underscores. ("Camelcase" names have lots of "humps"!) BOM Package Label and Name The BOM top-level package or model name must be made up of dot-separated segments. the software automatically uses lowercase letters for the first two characters if they are of different cases.

as shown in the following example: Reserved Words There are certain reserved words that cannot be used as Names. The Label is displayed in the BOM editor. which is also a dot-separated name in the same format. as they would cause problems when running the Java script that referenced the class or attribute. and by default is the same as the name of the BOM. Words that are keywords in Java or JavaScript cannot be used as Class or Attribute names.38 | Chapter 3 Business Data Definition The BOM package name must differ from the TIBCO Business Studio project lifecycle ID. meaning it can be any text that you want to display. A full list of reserved words can be found in Reserved Words in Scripts on page 180. The project lifecycle ID can be viewed by right-clicking on the Project and selecting Properties > Lifecycle: The BOM Label is free format text. but there are no such restrictions for Labels. Business Data Services Guide .

BOM Design-time Model 39 | Name Clashes If two classes or attributes end up with the same name after the Label to Name mapping has been done. For example. if another attribute is added with the name "thmonth". Because of the internal workings of BDS. there are further restrictions on names that can cause other clashes. as shown below: Business Data Services Guide . as shown below: This is a generic BOM problem and has to be fixed manually. attribute and class names must be unique and ignore case and underscores. Therefore. then BDS generates the following errors indicating a name clash: This problem marker has a quick fix which can automatically rename an attribute to resolve any clashes. an error is generated against the BOM: Errors can be found in the Problems tab or by using the red-cross marker.

ScriptTask. BDS Plug-ins contain POJO (Plain Old Java Object) classes that are capable of being serializedand deserialized to or from XML very easily. ScriptTask and Web-ServiceTask use JavaScript as the script grammar for interacting with Business Objects. page 50 Business Data Scripting. For example. page 46 Process Migration. BDS Plug-ins are based on Eclipse Modeling Framework (EMF). page 45 BOM Versions. you can create Business Objects from a variety of tasks in a BPM Process. page 41 BDS Design-time Validations. page 53 Business Data Services Guide . UserTask. and so on. WebServiceTask. Using TIBCO BPM. page 42 BDS Runtime Validations. page 47 Using BDS in Tasks. Topics • • • • • • • BDS Plug-in Generation.40 | Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM Business Data Services generate BDS Plug-ins from BOM Definitions.

the BDS Generator generates BDS Plug-ins that correspond to the BOM.com. Business Data Services Guide .businessobjectmodel. The BDS Plug-ins will be generated in a hidden project whose name corresponds to a BOM root package.BDS Plug-in Generation 41 | BDS Plug-in Generation When a Business Object Model is saved.example. if the BOM root package com.example. BDS Plug-ins are generated in a project named .businessobjectmodel. For example.bds.

Concerning the Model (Top-Level Package) • Name must be dot-separated segments. underscores and numbers. Business Data Services Guide . if you have duplicate Names. Enumerations. Name must not be a reserved word. TIBCO Business Studio’s Problems view may show various errors and warnings from BDS. underscores and numbers. each beginning with a letter or underscore and containing only letters. Validations in BOM Editor While BOM Editor is being used to produce a BOM. or reserved names for Classes or Attributes. Errors are shown with a red marker and will prevent application deployment until they are resolved. Name must not contain reserved words. underscores and numbers. whereas warnings. avoiding reserved words. and Primitive Types • • • • Name must begin with a letter or underscore and contain only letters. This section lists the validation messages that may be seen. are merely advisory. Concerning Classes. Name must not match the first segment of the fully-qualified package name. For example. ’modelname’ cannot be the same name as the project life cycle id. it can help you solve the problem through Quick Fixes. Names are considered to clash even when the case differs. • • Concerning Sub-Packages • • Name must begin with a letter or underscore and contain only letters. it will resolve the problem names by adding a numerical suffix. For many of the issues. as well as processes that use BOMs. Each problem is classified as either an error or a warning. avoiding reserved words. Unless otherwise noted. the messages listed in this section are errors.42 | Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM BDS Design-time Validations During BOM creation. shown with a yellow marker. Another type has the same name. Duplicate model name ’modelname’. it checks to make sure that the BOM you have created is valid and alerts you to any problems that have been found.

Attribute name must begin with a letter or underscore and contain only letters. Concerning Enumeration Literals • Enumeration Literal name must begin with an upper-case letter and contain only upper-case letters and numbers. Generated Java interface name 'name’ will conflict with the EMF package interface for package 'packagename’. Generated Java interface name 'name’ will conflict with the EMF package implementation class for package 'packagename'. Business Data Services Guide . Generated Java interface name 'name’ will conflict with the EMF factory interface for package 'packagename'. Attribute name must not be a reserved word. underscores and numbers. Concerning Enumerations • Enumeration must contain at least one literal. Generated Java interface name 'name’ will conflict with the EMF factory implementation class for package 'packagename'. The Attachment type is not supported. Default values are ignored for attributes with a multiplicity greater than one [warning].BDS Design-time Validations 43 | • • • • • • Generated Java interface name ’name’ will conflict with the implementation class for 'nameofsomethingelse'. Generated Java interface name 'name’ will conflict with an EMF utility class for package 'packagename>'. Concerning Attributes • • • • Another attribute has the same name. • • Concerning Primitive Types • The Attachment type is not supported. as it will always apply [warning]. Names are considered to clash even when the case differs. they must be of the same case. If it starts with two letters. It makes no sense having a default value for an optional attribute.

Activities responsible for generating WSDL operations cannot have array parameters associated. Business Data Services Guide . please create a Class to contain the array. Document literal type bindings must have formal parameters of type external reference.44 | Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM Process Validations BDS performs a number of validations on Processes that make use of BOMs: • • • • Primitive Types cannot be used for Data Fields or Parameters Enumeration Types cannot be used for Data Fields or Parameters. Instead.

BDS Runtime Validations 45 | BDS Runtime Validations When a task completes. an exception is raised. lengths of Text and Fixed Length Numeric fields. It does this by verifying that all constraints that exist on the fields are satisfied. and regular expressions for Text fields are all checked when each task completes. Similarly. Business Data Services Guide . For example. if a field has a multiplicity of 3. then an exception is generated if the field has more than 6 values or less than 3 values as specified by the multiplicity rule. the BDS ensures that all BDS data is in a valid state.. ranges of numeric fields. If there are any problems.6.

it is possible to change or create new versions of the BOM if you find later that other processes need the BOM to be changed or extended. Business Data Services Guide . they are independent of each other. therefore. or redeployed. Each time a TIBCO Business Studio project is deployed. there are restrictions if you want to migrate Process Instances between different versions of a Process Template. See the next section for details. However. any change can be made to the BOM between deployments without affecting existing projects that make use of the BOM. As each deployed project has its own copy of the BOM artifacts.46 | Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM BOM Versions Once you have created a BOM and have started using it from deployed TIBCO Business Studio projects. it will be deployed with a copy of the BDS plug-ins from each BOM that the project references.

you can only make compatible changes to the BOM. annotated. or increasing the length of a text attribute from 50 to 60 characters. Therefore. A compatible change adds a new entity to the BOM. Compatible Changes General Changes Any BOM entity’s label can be changed (as long as the name remains the same). or adding a maximum value to an integer attribute that was previously unrestricted. and so on. you have to ensure that the BOM used by the two versions of the TIBCO Business Studio project is compatible. for example. As much of the structure of the data comes from the BOM.. Business Data Services Guide . as long as they are optional (for example. Examples of ‘incompatible changes’ include removal of a class. This means that the BOM used by the process template that you are migrating from must be a subset of the BOM used by the process template that you are migrating to. If incompatible changes are made to the BOM. you will need to make sure that the data in the first process template is compatible with the second process template version. Changes Within the BOM’s Top-Level or Sub-Package • • Changes to a Class • Addition of new attributes and composition attributes. such as 0.Process Migration 47 | Process Migration If you want to be able to migrate a process instance from one version of a process template to a later one. primitive type or enumeration. Addition of a sub-package. or makes an existing entity less restrictive. there is a possibility that process instances will not be able to be migrated to the new version of the process templates. they must have multiplicity with a lower bound of zero. Addition of a new class. the addition of a new class.1 or "*"). if you want to be able to migrate process instances from the old process template to the new version of the process template. making an optional attribute mandatory. Diagrams can be rearranged.

. Table 6: Attribute Type Change Restrictions Restriction Default value Lower limit Upper limit Lower limit inclusive Upper limit inclusive Maximum text length Number length Decimal places Business Data Services Guide Permitted Change May be changed May be decreased or removed if a former lower limit was set May be increased or removed if a former upper limit was set May be changed from false to true May be changed from false to true May be increased May be increased May be increased (if length increased by the same amount or more) . its restrictions may be altered. Table 5: Examples of Compatible Change Rules From 1.increase in multiplicity Yes – made optional No (cannot change from single to many) No (cannot change from single to many) No (might have zero) No (might have zero) No (might have less than 4) The attribute type cannot be changed..1 * 1.8 0.* 1 4. it either increases the upper bound and decreases the lower bound) and it does not change between being a maximum multiplicity of 1 and greater than 1...1 * To 1.* Valid? Yes .48 | Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM Changes to Class Attributes and Composition Relationships The multiplicity of an attribute or composition relationship may be changed..1 1 * 0..5 1 0.. If an attribute’s type remains the same.. as long as they are less restrictive than the old restrictions. Examples are given in the following table.* 1. as long as it makes it less restrictive (for example.

Business Data Services Guide . page 48. Permitted Change Can be removed Change to a Primitive Type When the type has a BOM Native Type as its superclass. it may be altered subject to the compatible change rules described in Changes to Class Attributes and Composition Relationships.Process Migration 49 | Table 6: Attribute Type Change Restrictions Restriction Pattern Changes to an Enumeration • Addition of new enumeration literals.

See Creating a New Business Object on page 59 and the following sections for more details on using BOM fields in Script Tasks. Each field that is specified in the Interface tab is specified to be one of the following: • • • In Out In / Out These specifications define whether the value is input or output to the script. and using Scripts in general. There is also a Mandatory flag that can be specified. which controls whether the field has to have a value.50 | Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM Using BDS in Tasks General All Tasks have an Interface tab that can be used to restrict which fields the task has access to. and therefore need to be initialized using the factory method before any of the attributes can be referenced. If the Interface tab is used. which means there are no restrictions and the Task has access to all the fields in the process. no fields are listed. After a User Task has been completed. the new field will not be available in the Task until it is added to the Interface. Business Data Services Guide . By default. and a new field is added to the process. User Task BOM fields can be displayed and updated in User Task steps. all the BOM fields that are In / Out or Out fields will be initialized Script Task Any BOM fields that have not been initialized by a previous task have a null value.

click Select to select the service to be called. type Service 2. if the process has a variable with the same structure as the response message. you need to map the input and output data from the web service call. If not. do the following: 1. then the Mediation feature should be used. Set the Service Type to Web Service. as it supports more WSDL features and is capable of mediation with other systems. In the General tab of the Properties view. If you need to call a web service that uses WSDL features not supported by TIBCO BPM. it can be mapped straight across on the Input To Service properties sheet. Having defined the webservice to call.Using BDS in Tasks 51 | Web Services There are some restrictions as to what types of webservices the Web Service Task can invoke. click Import WSDL to import it. If the process that is calling the webservice has a field of the same structure that the webservice takes as an input parameter. Similarly. the fields can be mapped individually. If the WSDL has already been imported. The following example shows input fields being mapped: Business Data Services Guide . 3. To define a webservice task. Task in the Lable fiel. then it can be mapped on the Output From Service property sheet. If the WSDL has not been imported.

and a Business Object and all its attributes: Business Data Services Guide .52 | Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM The following example shows output fields being mapped.

The following section gives an example of how to use Business Data Scripting in practice in TIBCO BPM. you must provide an xsi:type when using extended types.w3schools. it must contain an xsi:type as illustrated below: <tns1:PersonElement xmlns:tns1="http://example.org/math/types/" xsi:type="tns1:Customer"> <name>Fred</name> <email>fred@myemail. this data is fully compliant with the use of xsi:type as described in the specifications.com/. are encouraged to first learn the basics of JavaScript before progressing onto TIBCO BPM Scripting. wherever possible. or who are struggling with the syntax. This means that.com</email> <phone>01234 567890</phone> <custNumber>44556677</custNumber> </tns1:PersonElement > TIBCO BPM adds an xsi:type value to XML data passed to external systems in a verbose manner. Business Data Services Guide . You can learn more about JavaScript from many sources. It does not include a full description of the syntax of the JavaScript language. This is described in the specification: http://www. the xsi:type is present.org/TR/xmlschema-1/#xsi_type An example of this is shown below: This example shows that if you wish to pass an XML into an interface that is expecting a Person from a Customer. Those not familiar.Business Data Scripting 53 | Business Data Scripting Scripting in BDS uses a script language that is based on JavaScript with extensions to support the different aspects of BDS. A useful introduction to JavaScript can be found at the W3Schools web site http://www.w3. For clarity. Supplying xsi:type Information in XML Sent to TIBCO BPM When using external clients to pass XML representing BOM information to TIBCO BPM.

54 | Chapter 4 BDS Generation and Business Data Usage in TIBCO BPM Business Data Services Guide .

page 82 Scripting on Business Objects That Use Inheritance. page 57 Creating a New Business Object. page 59 Using the Special Value Null. page 76 Loops Within Scripts. page 99 Working with Enumerated Types (ENUMs). page 69 Multiple Instances of a BOM Class. page 108 Scripting with Web Services. page 70 Working with Temporary Variables and Types. page 104 Working with Primitive Types. page 115 Business Data Services Guide . page 56 Factories. page 91 Working with Booleans. page 94 Working with Basic Decimal Numbers. Topics • • • • • • • • • • • • • • • • • • • • • • Overview.Business Data Scripting by Example 55 | Chapter 5 Business Data Scripting by Example This chapter illustrates how to write BDS server-side scripts by using examples. page 93 Working with Basic Integer Numbers. page 78 Looping Through Lists and Copying Elements in Lists. page 97 Working with Dates and Times. page 80 Scripting Containment Relationships. page 109 Parse Functions. page 106 Return Values from Scripts. page 67 Working with Single Instance Attributes of Business Objects. page 87 Working with Strings or Text Fields. page 63 Using Content Assist.

there are some places where the processes require custom processing of the data beyond the direct mapping of attributes. both within and between processes. This chapter illustrates how to write BDS server-side scripts. complete. through a number of examples. or attributes of one object can be mapped onto attributes of another object in graphical ways using the mappers. open. can sometimes be mapped as whole objects from one process to another. the scripting capabilities can be used.56 | Chapter 5 Business Data Scripting by Example Overview The data objects that are passed around the system. initiate. The scripting described in this section is provided by the Business Data Services (BDS) component that allows process definers to manipulate the data objects defined within the BOM. all of which are described later in this guide. In these cases. but has some unique restrictions and extensions. Business Data Services Guide . submit and close) Timer Scripts . The BPM Script scripting covered in this guide can be used in a lot of places within BPM processes by selecting JavaScript as the script grammar. However. timeout. cancel.used to calculate a deadline or duration of a task within a process Condition Scripts – used to determine which direction flow should take within a process Loop Scripts – control how many times loops are executed within processes The BPM Script is based on the JavaScript language. for example: • • • • • Script tasks within processes Action Scripts that are run on particular events related to tasks (for example.

example.createDate() DateTimeUtil. the following two ScriptUtil factory methods are used: • • ScriptUtil.createDatetime() DateTimeUtil.Factories 57 | Factories At runtime.createCustomer() Business Data Services Guide . for a BOM with a package name com.createDatetimetz() DateTimeUtil. or the result of an expression (such as (2 == value)). there would be the following factory methods: • • • com_example_ordermodel_Factory. Only values for attributes of the following types do not need to be created with Factories: • • • • Boolean Text Integer (Signed integer sub-type) Decimal (Floating point decimal sub-type) The primitive field types that represent measurements of time are created by DateTimeUtil factory methods: • • • • • DateTimeUtil.createOrderLine() com_example_ordermodel_Factory. For example if the BOM contained Classes called Order. a Factory method needs to be used to create the object instead of using the new keyword that is usually used in JavaScript.createBoolean() can be used. However.createBigDecimal() Boolean fields can be assigned with the keywords true and false. OrderLine. for example. if you want to convert a text value true or false to a Boolean.createBigInteger() ScriptUtil.ordermodel the factory class would be called com_example_ordermodel_Factory. and there would be methods in the factory called createClassname for each class in the BOM. The factory methods for BOM classes can be found in Factory classes whose names matches the package name of the BOM.createDuration() To create fixed integer and fixed decimal object instances. and Customer. then the ScriptUtil.createOrder() com_example_ordermodel_Factory. when a new object needs to be created to represent a particular Business Object (instance of a BOM class) or other variable.createTime() DateTimeUtil.

Creating objects for classes in the sub-package would be done in a similar way to creating objects in the top-level package. the name of the factory contains the package and sub-package hierarchy in its name. for example: order = com_example_scriptingguide_ordersystem_Factory.58 | Chapter 5 Business Data Scripting by Example If the scriptingguide BOM contains a sub-package called ordersystem. there would be a factory created for the classes in that sub-package. separated by "_".createOrder(). Business Data Services Guide .

Creating a New Business Object 59 | Creating a New Business Object You can either create a new Business Object directly. or use a copy of an existing object. Create an Instance of a Class Taking the example of the Person/Customer/Employee BOM: Business Data Services Guide .

we first need a data field to hold the instance. This is done by creating a new Data Field in a process.60 | Chapter 5 Business Data Scripting by Example In order to create an customer instance. Here we have created a field called cust that will be able to hold instances of the Customer class instances: Then a Script Task can be dragged onto the process diagram from the Tasks palette: Business Data Services Guide . and setting the Type to be an External Reference to a type in the BOM.

The ScriptUtil utility method. Factory methods have to be used to create objects. as shown below. the name of the factory that creates Customer instances is based on the name of the BOM package that contains the Customer class as described in the previous section. cust2 = ScriptUtil. The instances of the Customer class are created by the "Customer Factory Method". as shown below: It is very important to understand that when a process starts. Business Data Services Guide . is provided for doing this: cust1 = com_example_scriptingguide_Factory. select JavaScript: The Describe Task Script dialog is displayed. One of the differences between BPM Script and standard JavaScript is the new operator is not supported. cust3 = cust1. cust = com_example_scriptingguide_Factory. Maximise the Describe Task Script dialog. Type the script. the cust process data field will not contain or refer to an instance of the Customer class.copy(cust1). So the first thing to do before attempting to access the attributes of the process data field is create an instance of the Customer object and assign it to the cust process data field.createCustomer().createCustomer(). by clicking Maximize.Creating a New Business Object 61 | View the Script Task properties and from Script Defined As needs. it just has the ability to. Create a Copy of a Business Object Another way of creating a new Business Object is to create a copy of an existing object.

which means that it copies all the objects contained by the Business Object being copied. sets the cust2 process data field to refer to a copy of the Business Object that the cust1 process data field refers to. not for just copying BOM Primitive values.62 | Chapter 5 Business Data Scripting by Example The script in the example above.copy() method performs a "deep" copy. Business Data Services Guide . It is only for copying whole Business Objects. and cust3 to refer to the same Business Object that the cust1 process data field refers to. The ScriptUtil. as well as the Business Object itself.

curly braces are mandatory.Using the Special Value Null 63 | Using the Special Value Null The special value written as null can be used in the following ways: Checking for Null Attributes This section is intended chiefly for those readers not familiar with JavaScript. but it could still be null. since cust = null is valid in some places. as shown below: if (null == cust) { cust = com_example_scriptingguide_Factory. it is being used to test if the cust variable has the value null. then the IF-BLOCK statements between the first "{}" (curly braces) are processed. Between the "()" (parenthesis mark).createCustomer(). and there was a possibility that an earlier script might have set the cust variable to refer to a Customer. There can be multiple statements between the curly braces. Here. they are only required if there is more than one statement to be processed. If the value results in true. In BPM Script. null = cust is never valid. If the value results in false the statements between the second curly braces in the ELSE-BLOCK are processed. then this can be checked in the script before calling the factory method. } else { // cust was assigned in an earlier script } There are several things to note here: • is used for testing and conditionally executing statements. However. The default value of the cust variable when the process starts is a special value written as null. if (CONDITION) {IF-BLOCK} else {ELSE-BLOCK} • The "==" operator is used to test for equality. If our script was running later on in the process. The "//" in the else-block is used to introduce a comment. These are referred to as a block of statements. there should be a condition that results in a true or false result. so the syntax checker would help you in this case. Writing null == cust instead of cust == null can help if you forget to use " ==" and use" =" instead. In JavaScript. The rest of the line following "//" is ignored by the script processing engine. Business Data Services Guide • .

dateOfBirth) { year = cust.dateOfBirth.createCustomer(). even for Optional parameters). although this will only work for attributes that do not have a default value.name = customerName.name if not already set */ if (null != cust. For example: if (null == cust) { cust = com_example_scriptingguide_Factory. so it will not be necessary to initialize the BOM field from the Factory method in any scripts that follow the UserTask that outputs the field. } /* Set the cust.name) { cust. This is also true for any other task that has a mandatory Out or In / Out parameter (the difference between UserTasks and Forms is that it always creates objects. Business Data Services Guide . then all text until a matching "*/" is ignored by the script engine. We can check to see if attributes have been previously assigned by comparing them against null. } The example above shows how to use a multi-line comment. we can then set the name. Similarly.getYear(). • Once we know that the cust field has a value.name if not already set */ if (null == cust. } Otherwise you will get a runtime exception. you should check that an attribute is not null before using any methods on an object.64 | Chapter 5 Business Data Scripting by Example • If a UserTask is processed that has a BOM field as an Out or In / Out parameter in its Interface (the default for all fields is In / Out). then after the UserTask is complete the BOM field will always refer to an object. The comment is opened with a "/*". as shown below: /* * Set the cust.

// Remove car’s roof value (composition) myCar. This is discussed further in Removing an Item from a List or a Containment Relationship on page 85. // Clear myInteger Data Field (Integer basic type) myInteger = null. remove for the removal of a single specific value. // Restore car’s yearBuilt to its default: 1995 (attribute) myCar.Using the Special Value Null 65 | Assigning a Null Value The value of single value Data Fields and Business Objects’ attributes and compositions can be cleared by assigning them the special value. The following diagram and script illustrate this: // Clear car’s model value (attribute) myCar. For Data Fields or Business Object attributes and compositions that have a multiplicity greater than one.model = null. // Clear myCar Data Field (Business Object) myCar = null. null. If a default value is specified for a Business Object attribute. Specifically. Instead. or clear for the removal of all values. this applies to Car’s wheels composition and the myDates data field. In the above example. Business Data Services Guide .roof = null.yearBuilt = null. values can be removed using the appropriate List methods. the assignment of null is not possible. then assigning null will return the attribute to its default value.

66 | Chapter 5 Business Data Scripting by Example When dealing with attributes with a multiplicity greater than one. Business Data Services Guide . with no changes made to the list. operations that add a null to the list will result in nothing being added. resulting in an unchanged attribute.wheels. the following script is equivalent to a no-op. // Adding null to the list of a car’s wheels does nothing myCar.add(null). For example.

type =co and press Ctrl+SPACE. in our example. Double-click cust. we can type c then press Ctrl+Space. Next. A list containing options appears. You are prompted with a list of words. Only the content assist that matches "co" in our example is displayed. Press ENTER. that are appropriate for where you are in the script. methods and so on. Press ENTER to insert the Factory name into the script.Using Content Assist 67 | Using Content Assist TIBCO Business Studio can provide some helpful assistance when entering scripts. you can: • • • • Select cust and press ENTER. as shown below: cust = com_example_scriptingguide_Factory Business Data Services Guide . Going back to our example. associated with cust is displayed. variables. Only items begining with "cu" are displayed. methods and so on. if you cannot remember whether you had called the field cust or customer you can type the first few letters and press Ctrl+SPACE. A list of words. Type u. as shown below: To insert cust in the script. variables. So.

as shown below: Since the Business Object we want is already selected. Press ENTER to complete the line. Business Data Services Guide . press ENTER to cause the text createCustomer() to be added to the script. This allows you to choose the type of Business Object to create.68 | Chapter 5 Business Data Scripting by Example Next." to give a list of the factory methods. cust = com_example_scriptingguide_Factory.createCustomer(). type ".

postcode = postCode.address. Ensure that no variables used to assign attributes are null. For example. write the following script: if (null != cust) { cust.phone cust.street = streetAddress. } Business Data Services Guide .address } = phoneNumber.city = cityAddress.phone = phoneNumber.Working with Single Instance Attributes of Business Objects 69 | Working with Single Instance Attributes of Business Objects To add contact details to a Customer instance. = emailAddress. the following can be done: if (null != cust) { cust. If the address attribute of the Customer class is an attribute of an Address type rather than a Text type.address can be set.address. } cust. cust.address. cust. if (null == cust.district = districtAddress.address = com_example_scriptingguide_Factory. Otherwise.email = emailAddress.country = countryAddress.createAddress(). = postalAddress. cust.address. cust.address. the address attribute needs to be set to refer to an instance of the Address class before the attributes of the customer.address) { cust. cust. the script will cause a runtime exception that can cause the process to fail when the script is run.email cust.

However. the process data field will refer to multiple instances of the Business Object. the process data field cust has only referred to a single instance of the Customer class (a single Customer Business Object). If you want to associate a particular Customer with the custList variable. This is shown below. Let us consider a process data field that holds a List of Customer objects called custList. which can contain multiple Business Objects. The List objects do not need to be created. This is done through a List object.createCustomer(). The properties sheet for custList has Array selected and is of type Customer: Array fields with a multiplicity greater than 1 are implemented using the List object. cust = com_example_scriptingguide_Factory. cust. Business Data Services Guide .name = "Fred Blogs".70 | Chapter 5 Business Data Scripting by Example Multiple Instances of a BOM Class In the examples we have looked at so far. you can assign the cust field with a single instance field. it is possible for it to refer to multiple instances. cust.custNumber = "C123456". then instead of referring to a single Business Object. In a Process Data Field If a process data field is flagged as being an Array Field when the process data field is created (or its properties are changed later). They are created by default as empty Lists.

Business Data Services Guide .Multiple Instances of a BOM Class 71 | Another way is to add the new customer to the custList. We can add multiple customers to a list as well. custList. cust2. this would go wrong on two accounts.name = "John Smith". after you used the script above.add(cust).custNumber = "C123458".add(cust2). cust2.createCustomer(). cust2. This can be pictured as follows: WARNING: If. cust2. custList.name = "Clint Hill". // Now add a second customer to the list (John Smith): cust2 = com_example_scriptingguide_Factory.add(cust2).custNumber = "C123457". you then used the following script to add a third customer to the list. as shown below: // Using cust variable created above (Fred Blogs / C123456) is // added to the List custList: custList.

custList. c2.72 | Chapter 5 Business Data Scripting by Example First. it will attempt to add a second reference to the same Customer instance.createCustomer(). a new Customer instance has not been created for Clint Hill. a Customer instance must be created using the factory method for each Customer to be added to the list. variables can be used in place of the process variable cust. so the first two lines above modify the John Smith Customer instance to refer to Clint Hill.add(c2).name = "John Smith". c1. The example below shows two script local variables c1 and c2 being used to correctly add two Customers to a custList: // Create first customer instance var c1 = com_example_scriptingguide_Factory. Business Data Services Guide . c2. this add will fail because the List type used does not allow the same object to be included more than once.name = "Fred Blogs".add(c1). // Create second customer instance var c2 = com_example_scriptingguide_Factory.custNumber = "C123456". So the list ends up containing the Fred Blogs and Clint Hill Customer instances but not John Smith: Instead. c1. custList. However.custNumber = "C567890".createCustomer(). If references to the individual customer cust are not required outside of the script then local script. Then when the add() method is called for the third time.

Multiple Instances of a BOM Class 73 | It is not necessary to use different variable names for the two Customer instances.isRetail = true. custList.name = "John Smith".createCustomer(). custList.dateAdded = DateTimeUtil.add(cust).custNumber = "C123456".add(c).name = "John Smith". c. c1. // Create second customer instance by copying the first var c2 = ScriptUtil. c2.custNumber = "C567890".name = "John Smith".copy(cust). // Create second customer instance by copying the first cust = ScriptUtil.copy(c1).isRetail = true. variable c could have been used throughout the script in place of c1 and c2. custList. custList.createCustomer().custNumber = "C123456".createCustomer(). cust.add(cust). c. We can use the same var to store the new customer once the first customer has been added to the list.createDate(). Business Data Services Guide . c2.name = "Fred Blogs". c.add(c1).createCustomer().add(c2). cust. c1. cust. Another way of creating the second and subsequent instances would be to make copies of the first. custList. This can be useful if there are a lot of attributes with the same value. c1. for example: // Create first customer instance var c1 = com_example_scriptingguide_Factory. c1. c.name = "Fred Blogs".custNumber = "C567890". but then the word var would have to be removed from the line that contains the second call to the createCustomer(): var c = com_example_scriptingguide_Factory. c = com_example_scriptingguide_Factory.custNumber = "C567890".custNumber = "C123456".add(c). We do not need to keep a reference to it any longer: // Create first customer instance var cust = com_example_scriptingguide_Factory.dateAdded = DateTimeUtil. cust. cust.name = "Fred Blogs".createDate(). custList. cust.

if the multiplicity is 1 (for example. orderline. other values can also be used.. then a straightforward assignment can be used. we can also specify that an attribute of a BOM Class can have and must have multiple instances. for example.orderlines..6 would mean between 3 and 6 instances must be added to the field.6") then a List is used to manage the field. this is configured by setting the multiplicity of the attribute. as shown here: The above screenshot shows some example values that can be used to specify the multiplicity. var orderline = com_example_scriptingguide_Factory. a List is used to manage the data at runtime. however. When the multiplicity of an attribute is greater than one.partNumber = 10023. "1.add(orderline).*" or "3. order.createOrderLine(). order.add(orderline). Business Data Services Guide . for example. 3. the following script can be written. orderline.partNumber = 10056. Otherwise.1"). "*".quantity = 1. an Order may contain multiple OrderLine objects. and values must be added to the field using List methods. multiplicity is "1" or "0. orderline = com_example_scriptingguide_Factory.createOrderLine().quantity = 3. orderline. orderline.orderlines.74 | Chapter 5 Business Data Scripting by Example In a BOM Class Attribute Just as we defined Process Fields that contained Multiple Instances of Customer Business Objects in the previous section. To manage the multiple orderlines associated with an Order.. If the multiplicity is greater than one (e.. in the same way Process Fields are managed when the Array checkbox is set in the Field Properties.g. In BOM Editor.

The List object provides methods for finding out how many items there are in the list. orderline. and enumerating the list. Business Data Services Guide .copy(orderline). order.orderlines. Removing an Item from a List or a Containment Relationship on page 85. orderline.Multiple Instances of a BOM Class 75 | or using the ScriptUtil. see Using the List set() Method on page 84.copy() method: var orderline = com_example_scriptingguide_Factory.add(orderline). orderline.partNumber = 10056. orderline = ScriptUtil. Scripting Containment Relationships on page 82. Some further examples of working with multi-instance fields and attributes are provided in the following sections: • • • • Looping Through Lists and Copying Elements in Lists on page 80.quantity = 3.quantity = 1. accessing particular entries in the list.partNumber = 10023. Using the List set() Method on page 84. To learn more about what you can do with the List object.add(orderline).orderlines. order. orderline.createOrderLine().

var carName = "Herbie". Business Data Services Guide . When writing BPM scripts.name = "Fred Blogs".custNumber = "C123457".add(c1).name = "John Smith". custList. c1 = com_example_scriptingguide_Factory. c2. Adding them to the list of Data Fields would just end up complicating the process. This saves having to add all variables as Process Data Fields. it would not be a good idea to write: var c1. var carName. operation may not be supported and content assist will not be available The content assist will not work.add(c2). which is especially useful if the variables are only used within a single script. c1. it is always best to initialize variables when they are declared so that TIBCO Business Studio’s Script Validation and Content Assist code knows what type the variables are. to declare (that is. So. c2. custList.76 | Chapter 5 Business Data Scripting by Example Working with Temporary Variables and Types When writing scripts. you will get the following warnings: Unable to determine type. a temporary variable is declared using the var keyword. In JavaScript. If you do not initialize a variable. var c2.createCustomer(). to tell the script engine about) two temporary variables called x and carName you can write: var x. the need for temporary variables often arises. For example. using the example from the previous section.custNumber = "C123456". c1.createCustomer(). The variables can also be initialized (given initial values) when they are declared like this: var x = 5. c2 = com_example_scriptingguide_Factory.

name = "Fred Blogs". c1. var c2 = com_example_scriptingguide_Factory. custList. c2.add(c2). the variables should be initialized when they are declared: var c1 = com_example_scriptingguide_Factory. Business Data Services Guide .custNumber = "C123456". c1.custNumber = "C123457".Working with Temporary Variables and Types 77 | Instead. custList.name = "John Smith". c2.createCustomer().add(c1).createCustomer().

ix = ix . using abbreviations allowed in = ix + 1. JavaScript. ix++. can be written result abbreviations allowed in JavaScript.78 | Chapter 5 Business Data Scripting by Example Loops Within Scripts This section is intended chiefly for those readers not familiar with JavaScript. Business Data Services Guide . and one that cannot be used. The ones that are supported are: while (CONDITION) { BLOCK } do { BLOCK } while (CONDITION). or --ix. INCREMENT) { BLOCK } One that is not supported is: for (FIELD in ARRAYFIELD) { BLOCK } Here is a simple while loop that loops until the ix variable becomes less than 0: var result = "". while (ix >= 0) { result = result + " " + ix. } Things to note: • • • • result = result + " + ix. or ++ix. CONDITION. ix = ix . The curly braces are required for loops in TIBCO Business Studio JavaScripts just as they are for if/else statements. for (INITIALISER. var ix = 10. can be used similarly instead of ix . += " " + ix.1.1. There are three different JavaScript loop syntaxes that can be used in BPM Script. using can be written ix--.

for (var ix = 10. { result += " " + ix. var ix = 10. It results in a more compact script. ix--. ix >= 0. Here is the equivalent for loop to the above while loop: var result = "". but has two extra expressions in it. do { result += " " + ix. but the condition is evaluated at the end of the loop. } while (ix >= 0). } Business Data Services Guide . One is executed before the loop starts and the other is executed at the end of each loop.Loops Within Scripts 79 | The do-while loop is very similar. The for loop is similar to the while loop. ix--). so the loop is always executed at least once: var result = "".

Two methods on the ListIterator are used to enumerate the items in the List: the hasNext() method returns true if there are more items in the list. ) { // Get the first/next item in the list var customer = iterator. // add customer’s credit limit to total credit limit totalCreditLimit += customer. they are all initialized so that TIBCO Business Studio knows what type they are.listIterator(). iterator and customer are declared. } Note that when the three temporary variables: totalCreditLimit.next(). for (var iterator=custlist.creditLimit. which contains multiple Orderline Business Objects in an attribute called orderliness. This helps with Script Validation and Content Assist. then the orderlines List in the new Order object cannot just be assigned: Business Data Services Guide . a ListIterator is used. and you want to copy these to another Order Business Object called order. First you need to obtain the ListIterator from the List using the listIterator() method.80 | Chapter 5 Business Data Scripting by Example Looping Through Lists and Copying Elements in Lists In order to iterate through a List. If one of the inputs to a script is a field called oldOrder.creditLimit. and the next() method returns the next item in the list (or the first item in the list the first time it is called): // Iterate through the list of customers to calculate the total // credit limit: var totalCreditLimit = 0. // above statement is equivalent to: //totalCreditLimit = totalCreditLimit + // customer.hasNext(). iterator.

orderlines)).listIterator().copyAll(oldOrder.Looping Through Lists and Copying Elements in Lists 81 | Instead. { var orderline = iterator.orderlines.hasNext(). } However. order. } It can be simplified even more by using the ScriptUtil.copy(orderline)).next().hasNext(). Attempting to add a Business Object to a second Business Object in a containment relationship could have unexpected consequences.productCode = orderline.orderlines List to the List.orderlines This method will copy all elements from the oldOrder.orderlines. newOrderline. this should not be done.createOrderline(). } This can be simplified by using the ScriptUtil. iterator. order. and therefore should not be done (it will remove the object from the oldOrder Business Object). the content of the List needs to be copied over.amount = orderline. Instead. newOrderline. order. order.add(ScriptUtil.listIterator(). You might think of doing it like this: for (var iterator=oldOrder.copyAll() method.amount.next().description = orderline. iterator.next().orderlines.orderlines. iterator. Business Data Services Guide . ) { var orderline = iterator.productCode. newOrderline.addAll(ScriptUtil.orderlines. as Business Objects can only be contained in one Business Object.orderlines.description. var newOrderline = com_example_scriptingguide_order1_Factory. as shown below: for (var iterator=oldOrder.orderlines.add(newOrderline). as shown below: order.add(orderline). the instances in the List need to be copied over.copy() method to: for (var iterator= oldOrder.listIterator(). ) { var orderline = iterator.hasNext().

For example. For the contained relationship. like this: Business Data Services Guide . if there were classes for Car and Widget. a Composition link can be drawn between the two classes.82 | Chapter 5 Business Data Scripting by Example Scripting Containment Relationships The BOM editor allows you to say that one class is contained within another. not both at once. the child object is destroyed also. There are two ways to model this in the BOM editor. it can only belong to a Car or a Bike instance. However. The diagram below shows that Widget objects can be contained by a Car or a Bike. as when its parent object is destroyed. for an individual Widget object instance. the Widget class can be said to be contained by the Car class. the contained objects are affected by the container’s lifecycle events. First. So when the Container (Car in our example) is destroyed. all the contained (Widget in our example) objects will be destroyed too.

widget = com_example_scriptingguide_containment_Factory. widget.widgets.add(widget).createCar(). For example.add(widget).createWidget (). we can write: var car = com_example_scriptingguide_containment_Factory. it is implicitly removed from container A. so an object cannot be added to the same container more than once.widgets. There is an attribute of the Car object called widgets. and it is then added to container B.createWidget(). car. var widget = com_example_scriptingguide_containment_Factory. Another aspect of the way that this relationship is enforced is that if an object is contained within container A.description = "M8 Nut". car. car.description = "M8 Bolt".Scripting Containment Relationships 83 | Alternatively. that can contain Widget objects. Business Data Services Guide . widget. the Car and Bike class can be given an attribute called widgets of type Widget. to create a Car and add two Widgets. We have already mentioned that the contained objects can only be contained by one container. which will be a List type.model = "Saloon". This would be processed in a similar way to the List processing examples already covered. as part of the process of inserting the object into container B. as shown below: Both of these two Car/Widget relationships appear the same when scripting.

widgets. Instead. ) { bike.hasNext(). it will fail as described below: for (var iter = car.widgets. You can also use the copyAll() method discussed in the previous section: bike.copy(iter. iter. it should not be changed unless by means of the ListIterator methods. Business Data Services Guide . iter. } The above script takes copies of the objects. Instead. } As mentioned above. The above will fail because the list is empty. and leaves the original copies contained in the Car object.copyAll(car.widgets)). you cannot add two elements like this: bike.listIterator(). and you attempt to copy them into another Car or Bike object using the following script. widgetB).widgets. // This is wrong! The reason this is wrong is that the set() method is for updating existing entries. if you have an empty list. for example. When a list is being iterated over.84 | Chapter 5 Business Data Scripting by Example For example.widgets. widgetA). the following should be done: for (var iter = car.widgets.set(1. so set() may not even be needed: var widget = bike.listIterator().get(0). widget. if you have a car object that contains a number of Widgets.description = “Widget A”.addAll(ScriptUtil. This interferes with the iterator which is attempting to iterate over a changing list. Using the List set() Method It is important to note that the List set() method cannot be used for adding new items to a list. adding the Car’s Widgets to the Bike removes them from the Car.next()). ) { bike.widgets.add(iter.// This is wrong! bike. Existing entries can be directly updated. the add() method must be used for adding new entries into a list.next())).widgets.hasNext().add(ScriptUtil.widgets.set(0.

) { var customer = iterator. iterator. If you don’t know which item you want to remove. must be the same Business Object instance that is in the list.listIterator(). the remove() method should be used. To remove an item from a list means iterating through the list to find the item and then deleting it. This is done using the list iterator as we have done before: // Iterate through the list of customers removing customers with large credit // limit for (var iterator=custlist.creditLimit >= 1000000) { iterator. The Business Object. } } Business Data Services Guide .next(). Be careful using the first example above. or: order.Scripting Containment Relationships 85 | Removing an Item from a List or a Containment Relationship In order to remove an item from a containment relationship or a list.remove().000 if (customer.000. you should use the Iterator’s remove method. This method checks to see if it is the same object that was adde.remove(0).orderlines. It does not compare the contents of the objects. or the index of the object to be removed: //Remove an object from a collection order.remove(orderline1). // check if credit limit above 1. and not a copy of it.hasNext().orderlines. or other value passed. It can be used with the object to be removed.

for example: bike. custList.clear(). // decrement index so next iteration check the new nth item } } If the list index is managed in the script. you have to be careful not to skip past elements after an element that is remove by only incrementing the index if the item is not removed! So using the iterator is easier.clear(). // check if credit limit above 1.000. ix++) { var customer = custlist.size().000 if (customer. Business Data Services Guide . as in the second example. ix--.get(ix).remove(ix). There is also a clear() method on Lists that can be used to remove all entries in the list.widgets.creditLimit >= 1000000) { custlist. ix < custlist.86 | Chapter 5 Business Data Scripting by Example Alternatively this can be done just using the methods on the List object: // Iterate through the list of customers removing customers with large credit // limit for (var ix=0.

product = elec. If we had a Process Data Field called orderline of type Orderline. or Electrical: var book = com_example_spec3_Factory.createElectrical().product = book.product = prod. orderline. can be assigned Business Objects of type Product. // Set the product attribute to a // Product Business Object Business Data Services Guide .Scripting on Business Objects That Use Inheritance 87 | Scripting on Business Objects That Use Inheritance Using BOM Editor. // Set the product attribute to a Book // Business Object var elec = com_example_spec3_Factory.createBook(). there is a general Product type. An example of this is shown in the screenshot below: In this example. you can define BOM classes that inherit attributes from other classes. orderline. Book. then the containment of type Product. // Set the product attribute to an // Electrical Business Object var prod = com_example_spec3_Factory. Another way of expressing this is to say that you can create BOM classes that specialize other classes. orderline.createProduct(). and then there are two different types of Products: • • Books. which additionally have a serialNumber attribute. which additionally have an isbn attribute Electrical.

the Script Editor just gives you the content assist for the Product object. if we have Process Data Field called productCatalog of type ProductCatalog. You will get an error if you attempt to access the isbn attribute of a Product Business Object. some of these which can Book Business Objects. productCatalog.createBook(). it does allow you to add new instances of Book. and some may just be Product Business Objects. if you iterate through the products List. or the base type Product. productCatalog. it will just show the Product details. you can add all three types to the products list.createElectrical(). productCatalog.createProduct(). You will not be able to access the attributes of the Book or Electrical classes. var prod = com_example_spec3_Factory. the products containment can contain many Product Business Objects.88 | Chapter 5 Business Data Scripting by Example Similarly.add(elec).products.products. Business Data Services Guide . as shown here: var book = com_example_spec3_Factory. however. as shown below: The above code sample shows an attempt to create a List of Text that contains the ISBN number of the Product instances that are Book subtype Book instances. Electrical.products. some Electrical Business Objects.add(book). in scripts.add(prod). var elec = com_example_spec3_Factory. If a Process Data Field productCatalog of type ProductCatalog type appears on a Form in a UserTask. Similarly. For example.

However. Business Data Services Guide . Then we assign the Product Business Object to the book variable. In our example. ) { var product = iter. Book "is-a" Product. we know from the test that we conducted previously. However. from a variable or attribute of a Product type.createBook(). which we initialize to an object of type Book. then the above code can fail at runtime when attempting to access the isbn attribute if the product (and hence the book) was referring to a Product or an Electrical Business Object as these do not have the isbn attribute.createISBNList().type) { var book = com_example_spec3_Factory. Assigning an attribute or process data field that is a Book type. If the Product field or attribute actually refers to a Product or Electrical Business Object.listIterator().isbns. that in this case it is safe: If we do not have the above check. The assignment will fail when the value is saved at the end of the task. will only work at runtime if the Product actually refers to an instance of the Book class (or a sub-type).next().products. bookList. Howerver. we can create a variable called book. iter. it is not always OK to do things the other way around. for (var iter = productCatalog. It is always OK to assign a sub-type (specialized type) object to a supertype (generalized) attribute or variable because you can say that the sub-type object satisfies the "is-a" relationship. after which TIBCO Business Studio allows access to the attributes of the Book class.isbn). a warning is given that the assignment may not work at runtime: bookList = com_example_spec3_Factory. if (ProductType.add(book.BOOK == product. } } The TIBCO Business Studio Script Editor gives a warning about the assignment of a field that it thinks contains a Product to a field that it treats as holding a Book.Scripting on Business Objects That Use Inheritance 89 | To get around this problem.hasNext(). book = product. then it does not satisfy the "is-a" Book condition.

To stop this from happening. if (ProductType.next(). } } However. Business Data Services Guide .90 | Chapter 5 Business Data Scripting by Example If.listIterator().type) { bookList. ) { var product = iter. } } Otherwise. if (ProductType. for (var iter = order.listIterator(). if the booklist refers to a BookList type Business Object with an attribute or composition relationship called Books. ) { var product = iter. if the bookList is a Book type Process Data field. then instead of writing: bookList = com_example_spec3_Factory. we wanted to create a List of Products that were also Books and.copy(product)).add(product).BOOK == product.hasNext().next().// THIS IS WRONG } } We should write: bookList = com_example_spec3_Factory. you must make a copy of the object.products.next().books.createBookList(). for (var iter = order.add(product).add(ScriptUtil.listIterator(). iter.type) { bookList. we are moving the Book Product out of the containment relationship with the order and products into the relationship with booklist/books. and add that to the booklist/books containment relationship.books.products.hasNext(). iter. Remember that a contained Business Object can only be in one container at a time. then we can write: bookList = com_example_spec3_Factory.type) { bookList.BOOK == product.products. instead of building up a list of ISBN Text values. iter. ) { var product = iter. for (var iter = order.hasNext(). if (ProductType.createBookList().createBookList().BOOK == product.

considering the following String variable: var str = "Hello TIBCO!". // // // // var fourthString = ' "The Old House" '. The following operations can be done on the String.substr(6) Business Data Services Guide . for example: var firstString = "Hello World!". for example.length str. Table 7: String Operations Expression str. // // // quoted using double quote character quoted using single quote character includes single quote so used double quote includes double quote so used single quote string includes both so need \ character to escape use of quote in string String values can be compared with the "==" operator. var nextString = 'Hello Fred!'.Working with Strings or Text Fields 91 | Working with Strings or Text Fields String values can easily be assigned using either single or double quotation marks.substr(0.5) Result 12 Hello TIBCO! Comment Returns length of string Return substring starting at offset 0. they must be of the same type. 5 characters long Return substring starting at 6th position in string str. // // var fifthString = "Fred's \"Old\" House". for example: if (firstString == nextString) { // do something } else { // do something else } There are a number of methods on the String class that can be used to manipulate the value of the String object. However. var thirdString = "Fred's World".

or whole string if one word Returns last word in String.lastInd exOf(" ")+1) For more information about String class methods.9) Result TIB tibco! Hello TIBCO! Comment Returns substring starting at offset 6 and finishing before offset 9 Returns substring starting 6 characters from end of String and changes all letters to lowercase Returns first word in string. str.indexOf(" "))) str.slice(0. str.slice(-6).92 | Chapter 5 Business Data Scripting by Example Table 7: String Operations Expression str. see Text (String) Methods on page 203.slice(str. Business Data Services Guide . so when one of the above functions returns a String value. consider using the User-defined Types described in Working with Primitive Types on page 106. or whole string if one word str.slice(6.toLower Case(). The String objects are immutable. If you want to restrict what Strings can be put into certain Text fields. The original String is not changed. it is a reference to a new String.

If the text field is not exactly true or false.discountApplied cust.discountApplied !( cust. false.initialised customer.isWholesale = = = = true. Similarly.isWholesale) { … Boolean values can also be combined with the following logical operators. from true to true). or expressions. For example: Customer.isOnCreditHold customer. if you want to convert a numeric value (0 or 1) to a Boolean. and values less than or equal to 0 get converted to false. then the Boolean result is true. attempting to assign a text field to a Boolean will generate an exception. Boolean values can be compared with the "==" and "!=" operators. for example: if (cust1.createBoolean() method should be used. Table 8: Operators that can be used with Boolean Values Operator && || ! Description And – both are true Or – either is true Not – reverses result Example cust. otherwise it is false.isWholesale && order. Using the createBoolean() method if the value of the Text field is TRUE (in any case).isWholesale == cust2.createBoolean() method should be used.isWholesale && order.staffDiscount customer. then the ScriptUtil. can be used to convert from a text (true/false) or numeric (1/0) Boolean representation to the Boolean type. ! isRetailCustomer. When attempting to convert a text field value to a Boolean (for example. and a false value to true. other Boolean fields. for example: customer.isWholesale || order.createBoolean(isTradeParameter).Working with Booleans 93 | Working with Booleans Boolean fields can be simply assigned from constants. The exclamation mark "!" is the "not" operator. changing the sense of a true value to false.discountApplied) Business Data Services Guide . the ScriptUtil. Values greater than or equal to 1 get converted to true.isTrade = ScriptUtil. memberOfStaff.

you need to be aware of what the largest value is that you could be dealing with. The larger Fixed Integers are dealt with in the Advanced Scripting section. if you are dealing with larger. so it is probably the sub-type of choice.g.) that are supported: Signed Integers and Fixed Length Integers. select the attribute in the BOM class.483. for example.94 | Chapter 5 Business Data Scripting by Example Working with Basic Integer Numbers There are two types of integers (for example. 457. or 231-1). then the signed integer type can cope with numbers up to 2. for example. e. When working with integer numbers.147.000. Signed Integers For smaller numbers. but the Signed Integer sub-type is easier to use from a scripting point of view. and look at the Advanced Properties sheet: Business Data Services Guide .000 (actually. whole numbers. either form of integers can be used. astronomical numbers. If you are dealing with smaller numbers. In order to select the sub-type.647. 1. 2. numbers up to 2. then the fixed form of integers needs to be used. however.000. a number of people. and so on.

Working with Basic Integer Numbers 95 | In scripting. for (var iterator = team. to work out the average weight of a team member. you can do the following: var totalKgs = 0.weightKgs. The operators for comparing signed integers are: Table 9: Operators for Comparing Signed Integers Operator == Description Equals Example 1 == 2 12 == 12 != Not Equals 1 == 2 12 == 12 < Less than 1<2 12 < 12 21 < 20 Result false true true false true false false Business Data Services Guide . var teamSize = 0.members.weightKgs. } Note that the two lines in the loop that update the running totals can be shortened to: totalKgs += member.next(). } if (teamSize > 0) { team.averageWeight = totalKgs / teamSize. } else { team. When dividing. teamSize++.listIterator(). ) { var member = iterator. The code above checks for this special case. teamSize = teamSize + 1.averageWeight = 0. iterator.hasNext(). do not divide by 0. using the arithmetic abbreviations that can be used in scripting. totalKgs = totalKgs + member.

96 | Chapter 5 Business Data Scripting by Example Table 9: Operators for Comparing Signed Integers Operator <= Description Less than or equals Example 1 <= 2 12 <= 12 21 <= 20 >= Greater than or equals 1 >= 2 12 >= 12 21 >= 20 > Greater than 1>2 12 > 12 21 > 20 Result true true false false true true false false true See Working with Fixed Length Integers (BigInteger) on page 118 for more information. Business Data Services Guide .

) instead of the normal arithmetic operators ("+". iterator. teamSize = teamSize + 1.225E-307 0 Positive values between 2. "/".79769E+308. Here are some examples that demonstrate how decimals can be used in scripts. we can write: var totalKgs = 0. As in the integer example.averageWeight = totalKgs / teamSize.79769E+308 and -2. Business Data Services Guide .weightKgs. which. However. and can perform arithmetic using many different types of rounding as required. var teamSize = 0. totalKgs = totalKgs + member.hasNext(). The sub-type to use is selected in the Advanced Property sheet for the attribute. For Floating Point decimals. ) { var member = iterator. "-". The Floating Point variant stores numbers with 16 significant digits of accuracy. and so on.next(). subtract. teamSize++. see Advanced Scripting Examples on page 117.0.).Working with Basic Decimal Numbers 97 | Working with Basic Decimal Numbers Just as Integers have two variants. assuming that averageWeight is now a Floating Point decimal attribute of the team Data Field. especially if large amounts are involved. } team. for example. just as the Integer attributes in the previous section.weightKgs. have to be manipulated using their methods (add(). money amounts. it should not be used for storing values that have to be exact.members. multiple(). However. there are two variants of Decimal attributes in BOM classes: Floating Point and Fixed Point. and so on. like the BigInteger objects in the previous section.225E-307 and 1. the downside is that the Fixed Point attributes are implemented as BigDecimal objects. divide().listIterator(). for (var iterator = team. Rounding errors may occur. The Fixed Point variant can store numbers to an arbitrarily large size. The Floating Point variant can store: • • • Negative numbers between -1. the two additional lines can be abbreviated as: totalKgs += member. For more information about the Fixed Point decimal attributes. "*".

for example. the values should be rounded before comparison.floor() method can be used instead of the ScriptUtil. Rounding of Floating Point Decimals can be done using the ScriptUtil. Business Data Services Guide .round(value.4) To get around this problem. then the Math. the result of the following expression is false due to rounding errors: (((1/10) * 14) == 1.56789 to 1234.round() method. See also Working with Fixed Decimals (BigDecimal) on page 122. so use: roundedValue = ScriptUtil. for example. This rounds 1234. For more information about how these operators can be used. 3). use the standard "<".floor(value*1000)/1000. This converts 1234. for example. See Math Methods on page 206 for details.98 | Chapter 5 Business Data Scripting by Example To compare Floating Point decimal values.round() method can also be used to round to a power of 10.) As an example of how Floating Point numbers may not be exactly as they seem. -2). ">" operators. the power of 10 is 2. log & trig functions and random() and floor() functions. "<="." ==". If you wanted to round down. The Math class provides other methods. It is possible that two numbers that appear to be the same may not be equal using the "==" operator due to rounding errors in the way that the numbers are represented. (These operators are the same as for the Signed Integers.568 using HALF_UP rounding.56789 to 1200.round(value. see Operators for Comparing Signed Integers on page 95. to convert a number to 3 decimal places you can write: roundedValue = ScriptUtil. to round to the nearest 100.round() method: roundedValue = Math. The ScriptUtil. ">=" and. "!=".

Specifically. for example. Datetime.M.createDate(2010. This type is used to hold a date and time. datetime = DateTimeUtil. or alternatively.createDatetimetz("2010-12-25T15:00:00+05:00"). the seconds need to be specified for all types except the Date type. 25). This provides methods to manipulate the date/time type variables and attributes. with a mandatory timezone offset. with an optional timezone offset. time = DateTimeUtil.createDatetime("2010-12-25T15:00:00"). One thing to be aware of if using String values to create date/time objects is that all the relevant fields need to be specified or an exception will be thrown.// equivelant to “2010-12-25” datetime = DateTimeUtil.createDatetime("2010-12-25T15:00:00+05:00").0. The date/time attributes and fields can be initialized in scripts using methods on the DateTimeUtil factory.// equivelant to “17:30:00” date = DateTimeUtil. With no parameters these methods create an object representing the current date or time. datetimetz = DateTimeUtil. and Datetimetz types are represented using a XMLGregorianCalendar object within the Script Engine. they can be given a string or other parameter types to construct the appropriate object with the required value. date = DateTimeUtil.createDate("2010-12-25"). This type is used to hold a date and time. datetimetz = DateTimeUtil. as shown below. Table 10: DateTimeUtil Factory Methods Factory Method createDate() createTime() createDatetime() createDatetimetz() BOM Type Date Time Datetime Datetimetz Comment This type is used to hold a Date.0). 1st January 2011. Time. This type is used to hold a time.createTime("17:30:00").createDatetimetz("2010-12-25T15:00:00Z"). for example 4:25 P. time = DateTimeUtil.30. datetime = DateTimeUtil. The following are some examples of date/time types. Business Data Services Guide .createTime(17.createDatetime("2010-12-25T15:00:00Z").Working with Dates and Times 99 | Working with Dates and Times Dates and Times The Date. 12.

See the reference section for more choices of parameter values. or 2 hours. minutes. Any fields that are zero can be omitted. This can be used with the add() method to subtract a time period.createDuration("PT23.// 1 day and 2 hours Business Data Services Guide . 2.g. months.456). always begin with a P for Then add nY. for timezones that are ahead of UTC time. timezone offset (GMT or UTC time). such as 1 year. DateTimeUtil.// minus 10 days DateTimeUtil. nM. 0. 0. 0.// 1 day and 2 hours When constructing a period of time from a string.456 seconds DateTimeUtil. 0. -HH:MM for timezones that are behind UTC time. 0. 0. 0).// 1 year 0). 0. 0. 0. 0.100 | Chapter 5 Business Data Scripting by Example When initializing the datetime. or Zero. e.createDuration("P1Y"). A leading minus sign can be used to create a negative duration.createDuration("P1DT2H"). or nD. month.createDuration("PT2H"). e.10.// minus 10 days 0).0.createDuration(true. for separated parameters for year. If there is any time component to the Duration.g. 0. 2. period. The timezone can be designated using one of the following formats: • • • Z for Zulu.456 seconds 0).createDuration(true. 0. and day when create date types. DateTimeUtil. 0. or seconds. or nS for specifying hours. minus 10 days. but when initializing the datetimetz. Berlin timezone is +HH:MM +01:00.createDuration(true. 0. 0. nM. Durations Another important attribute/variable type when dealing with dates and times is the Duration type. 1. the timezone is required. 0. The Duration type can also be created by specifying each of the components as integers with a flag to say whether the duration is positive: duration duration duration duration duration = = = = = DateTimeUtil. the timezone is optional.createDuration("P10D"). USA Pacific Time has a timezone of -08:00. or days. 1.createDuration(false.// 1 year DateTimeUtil. followed by nH. A duration object can be created in a similar way: duration duration duration duration duration = = = = = DateTimeUtil. DateTimeUtil. 0.// 2 hours 23. for example.// 23. 0.// 23.456S").createDuration(true. a T must follow the date parts. where n is a number of years. DateTimeUtil. which is used to hold periods of time. 0.// 2 hours DateTimeUtil.

createDate().36. rather than return a new value.0. This is the same as in normal arithmetic where there are two ways of taking 2 from 10.createDuration(false.createDuration(“PT2H”)).0. To add 2 hours onto a Datetime.createDuration(“PT2H”)).0.createDuration("-P1Y")). like BigDecimal and BigInteger objects.0. since the add() method does not return a value.2 is the same as 10 + -2.add(DateTimeUtil.add(DateTimeUtil. we must use the format of adding a negative amount. The following example calculates 1 year ago.add(DateTimeUtil. Duration objects are Immutable. write: datetime. In order to subtract durations. date. you can add a negative duration. The following example calculates a datetime corresponding to 36 hours ago.Working with Dates and Times 101 | Using Date and Time Types with Durations One important point to be aware of is that the date/time (XMLGregorainCalendar) objects are not immutable.add(DateTimeUtil.0)). var date = DateTimeUtil. Not: datetime = datetime. datetime. The second code results in datetime being set to null. The result of 10 . so the add() and setXXX() methods update the object that the method is on. var datetime = DateTimeUtil. If you want to subtract a time period from a date or time type. Business Data Services Guide .createDatetime().

GREATER) { // End date is greater than start date } Do not use the XMLGregorianCalendar compare() method in the same way you would use the compareTo() method to compare BigInteger and BigDecimal objects due to the possibility of it returning INDETERMINATE.EQUAL) { // End date is greater than or equal to start date } || Using the following will also include the INDETERMINATE result: // Verify end date is greater than or equal to start date if (enddate. use the following: // Verify end date is greater than or equal to start date if (enddate. the result is deemed to be indeterminate. The method still works if the date/times are more than 14 hours apart.compare(startdate) == DatatypeConstants.compare(startdate) != DatatypeConstants. An example of using the compare()method to compare two date fields is shown below: // Verify that end date is greater than start date if (enddate. The compare() method should be used to compare items that either do or do not have a timezone. The equals() method is just a wrapper around the compare() method.compare(startdate) == DatatypeConstants.LESSER) { // End date is greater than or equal to start date – OR INDETERMINATE!! } Business Data Services Guide .compare(startdate) == DatatypeConstants.GREATER enddate.102 | Chapter 5 Business Data Scripting by Example Comparing Dates and Times In order to compare two date/time types. To check for greater than or equals. but if they are less than 14 hours apart. either the compare() or equals() method should be used.

To find out how many days have elapsed since the start of the year. // Subtract the start of year from today to work out how many days have elapsed var duration = ScriptUtil. // Extract the days from the duration type and add 1 dayOfYear = duration.Working with Dates and Times 103 | The XMLGregorianCalendar class does not provide a method for finding the difference between two XMLGregorianCalendar objects.setMonth(1). on page 181. Business Data Services Guide . startOfYear). You can read about the different methods that are available on the date/time attributes in Appendix B.getDays() + 1.createDate(). // get today’s date var today = DateTimeUtil. Business Data Scripting. so one is provided in ScriptUtil.subtract(today. startOfYear.createDate(). write: // Calculate date of first day of the year by getting current date // and setting day and month to 1 var startOfYear = DateTimeUtil. startOfYear.setDay(1).

and values can be added to it. with PLANET. ASTEROID. MOON. An ENUM is created in the BOM editor by selecting the Enumeration type from the Elements section of the Palette. The names of the values can be made meaningful. use an Enumerated Type (ENUM). in that they can only take a fixed limited number of values. Having selected the Enumeration Element.104 | Chapter 5 Business Data Scripting by Example Working with Enumerated Types (ENUMs) If you want to categorise objects as different types. The following is an example of an Enumerated type called SpaceType. and STAR values: Having defined the Enumeration type. it can be named. instead of using a number or a free format string. a class attribute can be set to that type: Business Data Services Guide . Enumerated Types provide a better solution because they are restricted.

type = body. or other attributes of that type. For example.next(). if (SpaceType. such as: aggregation. iterator. var dTotalKgs = 0.averagePlanetWeight = dTotalKgs / dPlanetCount. which can be used to calculate the average weight of the planets in a list of astronomical bodies. Either constants of that type. the following is not valid: body.hasNext().type = SpaceType. A Business Object attribute that is configured to be of a particular Enumeration type can only be assigned with values of that enumeration type.weightKgs. dPlanetCount ++.type.listIterator(). such as: body.PLANET == body.0.PLANET. for (var iterator = solarSystem. An attribute of an enumeration type cannot be assigned from any other type. // This is wrong! Business Data Services Guide .type = "PLANET". ) { var body = iterator.objectList.Working with Enumerated Types (ENUMs) 105 | The following is an example of a loop.type) { dTotalKgs = dTotalKgs + planet. } } solarSystem. var dPlanetCount = 0.

such as numeric ranges for numeric fields and patterns for text fields. and restrict the type so that it only holds strings that start with PN. Having created one of these. you can use a Primitive Type. but the set of values is too big for an enumerated type. In scripts and forms. select the Primitive Type from the Elements section of the Palette. you can name it. The patterns are specified using regular expressions. set up a User-defined Type to hold the Part Number. Set a class attribute to contain a PartNumbertype attribute as shown above.106 | Chapter 5 Business Data Scripting by Example Working with Primitive Types If you want to have field that can contain a restricted set of values.followed by 6 digits (\d is the code for a digit and {6} means six of the previous entity). For example. To do this. you can only assign values to the partNum attribute that matched the pattern PN-\d{6}.and are followed by six digits. you can define restrictions that are imposed on the field. if you need to store a Part Number in a field. For our example. In the Advanced Properties sheet. For our example. If all Part Numbers have a fixed format like this. use: PN-\d{6} Which means PN. Business Data Services Guide . this field will probably have a restricted format. such as PN-123456. call it PartNumber.

the partNum field can be assigned using: order.orderline.partNum = "ROB-123456". Instead.partNum = "PN-123456".orderline. since it does not check that Strings have the correct content. If a script is written with an invalid format value. so. Business Data Services Guide . using the above example. the script editor will not detect this as an error. this will cause a runtime validation exception when the Task that contains the script completes. as shown in the example below: order.Working with Primitive Types 107 | Attributes of Primitive Types can be assigned in the same way as the BOM Native Type on which they are based.

// return value of script Business Data Services Guide . // get current datetime datetime.0). The value of the script is the value of the last line in the script.createDuration("P7D")).createDatetimetz().setTime(0.createDuration("-P1D")). which is 7 days in the future. // move on to next month datetime.108 | Chapter 5 Business Data Scripting by Example Return Values from Scripts The following expressions use these return values from scripts to perform certain functions: • • • Conditional flows – Boolean expressions that control whether a path is followed or not. month datetime. These expressions can be multi-line expressions. // clear hours. Loop Conditions – Boolean expressions that determine whether a loop should continue or not. minutes & seconds datetime. we can use the following: var datetime = DateTimeUtil. // back to end of prev. // change to 7 days time datetime. Task TimerEvent – Datetime expressions that determine when a task should timeout. if we want a script to calculate a timeout to be the end of the month. // adjust in case on 31-Jan datetime.0.add(DateTimeUtil. For example.createDuration("P1M")).setDay(1).add(DateTimeUtil.add(DateTimeUtil.

add a Service Task onto the process diagram by dragging it from the tasks palette: Then. set the Service Type to Web Service. Viewing the WSDL in the WSDL Editor. URL. First. Locate your WSDL using one of the mechanisms provided (file location. and select the webservice you want to invoke from the WSDL: Looking in the Package Explorer. we perform the following tasks. then click Import WSDL. and so on).Scripting with Web Services 109 | Scripting with Web Services To invoke a web service and use scripts to prepare data for the web service. in the General Properties sheet. You can open the WSDL by double-clicking the WSDL entry (or right-clicking on the WSDL entry and selecting OpenWith/WSDL Editor). we can see what types the Web Service takes as parameters: Business Data Services Guide . we can see the WSDL file under the Service Descriptors heading.

from the Input To Service property sheet.110 | Chapter 5 Business Data Scripting by Example We can now create two Data Fields in the process of the appropriate types: Then. map the requestInfo field to the RequestInfoType input of the Web Service by dragging the field name onto the parameter name. as shown in the diagram below: Business Data Services Guide .

Scripting with Web Services 111 | The mapping will then be shown like this: Then. drag two script tasks onto the Process Diagram before and after the Web Service call and name them appropriately: Business Data Services Guide . Then. on the General property sheet. This can be done in scripts. for example. change the name of the task to something appropriate. Call "Request" Web Service. repeat for the output of the Web Service: Then. To do this. we have completed the Web Service task: Now we need to prepare the data to go into the webservice and process the data that comes out of the web service.

It is not necessary to make the flexpaySubscriberId field point to an object.requestName = "Search".112 | Chapter 5 Business Data Scripting by Example The error markers in the figure above indicate that the scripts have not been written yet. for example: // Process response from Web Service Call if (null != flexpaySubscriberId) { ban = flexpaySubscriberId.msisdn. and enter the script. because this will have already been done by the Web Service task. requestInfo. we need to make the RequestInfo variable refer to an actual RequestInfo object by initializing it using the factory method (don’t forget to use the content assist to help. First. it will have to wrap it in a BOM class. The multi-instance attribute must contain the multiple instances rather than an Array field. In the General property sheet of the first script.correlationId = 123456. All that remains to do is process the values.createRequestInfoType().ban. requestInfo. } Passing Arrays to Web Services Web Services cannot be passed (in or out) of an array field. See Using Content Assist on page 67 for more information).password = "Password!". if you want to pass an array of Strings to a webservice. msisdn = flexpaySubscriberId.userName = "Fred Blogs". Therefore. For example. The BOM class must contain a multi-instance attribute. requestInfo. set the Script Defined As property to JavaScript. Something similar can be done in the script after the Web Service task. The followng script is one example: // Prepare Web Serice Call Request requestInfo = com_amsbqa_linda01_xsd_define_types_types_Factory. if a process needs a field that contains multiple instances of a Business Object that it wants to pass in or out of a web service. requestInfo. then you cannot just have a Text parameter flagged as an Array: Business Data Services Guide .

Scripting with Web Services 113 | Instead. the following error message appears: BDS Process 1. (ProcessPackageProcess:StartEvent) Business Data Services Guide . instead please create a business object class to contain the array.* indicates that the attribute can contain zero or more values which is like the Array setting on a Process Field): And then reference this type as a parameter: If you define a webservice with an Array parameter..0 : Activities responsible for generating WSDL operations cannot have array parameters associated. create a BOM class to wrap the multiple Text values like this (Note that multiplicity of 0.

User Tasks or ScriptTasks. for example. could be used to copy the array of Business Objects in a single statement. copy the text array into the parameter structure with a loop like this in the ServiceTask’s Init Script.114 | Chapter 5 Business Data Scripting by Example When calling the webservice. but that cannot be used for Basic fields like the Text array in this example. Only the WebService task does not support Array fields.copyAll() method. Business Data Services Guide . An Array object can be passed to other Task types. as described in Looping Through Lists and Copying Elements in Lists on page 80. as shown below: If an array of Business Objects was being passed using the ScriptUtil.

Parse Functions 115 | Parse Functions This section contains notes on: • • parseInt() parseFloat() parseInt() The parseInt(string integer. parseFloat() The parseFloat() function parses a string and returns a floating point decimal number. and returns the number as a number. not as a string. the radix is 10 (decimal). This feature is deprecated. If the string begins with any other value. If the radix parameter is omitted. radix]) function parses a string and returns an The radix parameter specifies which numeral system is to be used. the radix is 16 (hexadecimal). it parses the string until it reaches the end of the number. If it is. [. If the string begins with 0. This function determines if the first character in the specified string is a number. Business Data Services Guide . for example. JavaScript assumes the following: • • • If the string begins with 0x. the radix is 8 (octal). a radix of 16 (hexadecimal) indicates that the number in the string should be parsed from a hexadecimal number to a decimal number.

116 | Chapter 5 Business Data Scripting by Example Business Data Services Guide .

page 122 Object BOM Native Type. page 129 Object BOM Native Type and ScriptUtil. page 135 Business Data Services Guide .setObject(). Topics • • • • • • • Working with Fixed Length Integers (BigInteger).Advanced Scripting Examples 117 | Chapter 6 Advanced Scripting Examples This chapter gives some examples of scripting using some classes and methods that require special attention. page 118 Working with Fixed Decimals (BigDecimal). page 134 encodeURIComponent() and decodeURIComponent(). page 132 escape() and unescape(). page 134 encodeURI() and decodeURI().

createBigInteger(0).listIterator().createBigInteger(1). operators cannot be used.next(). "*".divide(planetCount). } Business Data Services Guide .add(one).add(planet. In the BOM editor. "-". ">".compareTo(one) >= 0) { planets.averageWeight = totalKgs. and want to work out the weight of the average planet. "<". and so on. } if (planetCount.createBigInteger(0). ) var planet = iterator. totalKgs = totalKgs.hasNext().createBigInteger("0"). = planets.118 | Chapter 6 Advanced Scripting Examples Working with Fixed Length Integers (BigInteger) If we are working with large integer numbers. The "+". planetCount = planetCount. iterator.averageWeight = ScriptUtil. the methods of the BigInteger class have to be used when doing arithmetic and comparisons. } else { planets.planetList. ScriptUtil. "==".weightKgs). "/". the attribute sub-type should be set to Fixed Length: The script should be written as shown below: var var var for { totalKgs = planetCount = one = (var iterator ScriptUtil. ScriptUtil. then we would want to use the Fixed Length integers which are implemented using Java BigIntegers. Instead.

planetCount ++. var two = ScriptUtil. For example. } In order to compare Fixed Integers.createBigIntger(2). ) { var planet = iterator. } else { planets. !=. Business Data Services Guide . assuming that variable one has a value of 1 and variable two has a value of 2: var one = ScriptUtil.divide(ScriptUtil. >=.createBigInteger(planetCount)).compareTo(y) <op> 0 returns the same results as the following when using the Signed Integer sub-type if x and y were signed integer values: x <op> y (Where <op> is one of the 6 comparison operators: {==.averageWeight = ScriptUtil. The equals() method returns true or false depending on whether the values are equal or not. and then convert it into BigInteger for the divide operation at the end of the script: var totalKgs = ScriptUtil.add(planet. totalKgs = totalKgs.listIterator().createBigIntger(1).createBigInteger(0). <=. for (var iterator = planets.weightKgs). <.createBigInteger("0"). } if (planetCount >= 1) { planets.planetList. since the number of planets will not have a very large value.Working with Fixed Length Integers (BigInteger) 119 | Or. >}).averageWeight = totalKgs. the expression x. var planetCount = 0.next(). iterator. you have to use the compareTo() or equals() methods. Given two BigInteger variables x and y. we can have the planet counter as a signed integer.hasNext().

they return a new BigInteger object that has the new value.compareTo(one) == 0 x. However. Business Data Services Guide . if appropriate. they do not change once they are created. Therefore.compareTo(one) <= 0 x.compareTo(two) < 0 one.compareTo(two) != 0 one.compareTo(two) == 0 one.compareTo(y) >= 0 Greater than or equals one.compareTo(y) != 0 Not Equals one.compareTo(one) >= 0 two.compareTo(y) < 0 Less than one.compareTo(one) > 0 two. which you can read about in Fixed Length Integer (BigInteger) Methods on page 191. These are: abs min add mod compareTo multiply divide negate equals pow gcd remainder max subtract One thing to note about BigIntegers is that they are Immutable.compareTo(one) <= 0 two.compareTo(y) > 0 Greater than one.120 | Chapter 6 Advanced Scripting Examples Then: Operator x.compareTo(two) > 0 one.compareTo(y) == 0 Description Equals Example one.compareTo(two) <= 0 one.compareTo(one) < 0 x.compareTo(one) > 0 Result false true true false true false false true true false false true true false false true There are other methods available on the BigInteger objects.compareTo(one) >= 0 x. all the above methods do not change the object that they are working on.compareTo(one) != 0 x.compareTo(two) >= 0 one. for example.compareTo(y) <= 0 Less than or equals one.compareTo(one) < 0 two.

createBigInteger(12345678901234567890) The result is the creation of the number 9223372036854776.html Business Data Services Guide . the value should be passed as a String. rather than 12345678901234567890 as might be expected. It is important to be aware that the JavaScript numeric type is only accurate to about 16 significant figures.Working with Fixed Length Integers (BigInteger) 121 | Another thing to bear in mind when creating BigInteger objects with the ScriptUtil. For example: var bigInt = ScriptUtil.createBigInteger() method is that the number to create can be passed as a String or a Numeric type. Otherwise accuracy can decrease since it is converted to a double and then onto a BigInteger. see the Java documentation.oracle.com/javase/6/docs/api/java/math/BigInteger. located at the following web site: http://download. so when initializing large BigInteger values. For more details on the BigInteger type.

whereas some small errors can occur when using numeric parameters. = ScriptUtil. especially if the values are large. in order to add the two fixed decimals together. For more details on these methods.add(moon. see the reference section at the end of this document.createBigDecimal() factory method. multiply(). and each had a weight attribute of Fixed Decimal type. as is done with Floating Point decimals.weight).122 | Chapter 6 Advanced Scripting Examples Working with Fixed Decimals (BigDecimal) Fixed Point (BigDecimal) objects are immutable like the BigInteger objects. Creating and Initializing Fixed Decimal Values Instead of just initializing variables or attributes in scripts with numbers. it is best to use a Text parameter. Simple Operations Instead of using operators like "+" and "-" to perform basic arithmetic with Fixed Decimals. In most cases. rather than update the object that is being operated on.0"). There are similar methods called subtract().0).weight. which is converted to the exact number. and divide() that can be used to perform the other arithmetic operators. The value passed to the factory method can either be a JavaScript number (or a BOM Floating Point attribute value). if we had two Business Objects called earth and moon. or a quoted string (or a BOM Text attribute value). Business Data Services Guide . For example.createBigDecimal(0. for example: var dTotalKgs var dTotalKgs = ScriptUtil. Fixed Decimal values are Java Objects that need to be created using the ScriptUtil.createBigDecimal("0. we would use the add() method of the Fixed Decimal attribute: dTotalKgs = earth. you must use methods to perform these operations. so those methods that generate new BigDecimal results all return the new value.

divide(ScriptUtil.1 Business Data Services Guide .createBigDecimal(0. iterator. dPlanetCount ++.Working with Fixed Decimals (BigDecimal) 123 | Rounding If we needed more accuracy we would use a BigDecimal. which would be required to store 1/9 = 0. There are two ways that Rounding Mode can be applied to the divide() method: either directly. there is a problem with the code.111111….6 1. So when doing division operations that can result in recurring decimals or other overflows. FLOOR. var dPlanetCount = 0.1 Up 6 3 2 2 Down 5 2 1 1 Ceiling 6 3 2 2 Floor 5 2 1 1 Half _up 6 3 2 1 Half_down 5 2 2 1 Half_even 6 2 2 1 Unnecessary 5. Additional details of the behavior regarding the different modes can be found in the reference section. dTotalKgs = dTotalKgs. CEILING. However. There are eight possible values for RoundingMode: UP. ) { var planet = iterator. This causes problems for BigDecimals.6 1. Table 11: Example Rounding Mode Results According to Single Digit Rounding Input Input Number 5. or UNNECESSARY.5 1.5 1. it can be applied with or without the precision. which is discussed following it): var dTotalKgs = ScriptUtil.listIterator(). for (var iterator = planets.5 2. it does NOT store numbers to an infinite level of precision. This would work quite well now that we have 8 planets.createBigDecimal(dPlanetCount)).weightKgs).hasNext(). HALF_EVEN. If applied directly.averageWeight = dTotalKgs. but in the days before Pluto was downgraded to a Dwarf Planet we had nine planets.add(planet. DOWN. also known as a Fixed Point Decimal.5 2. or by way of a MathContext object that contains a precision and RoundingMode. HALF_DOWN. } planets. and attempting to divide a number by 9 often results in a recurring string of decimals if done exactly.next().0). for the averageWeight attribute as represented in the code below (however. Rounding Mode must be applied to the BigDecimal method that is being used. but you can also see from the example here how different values are rounded according to the different RoundingModes. for example. HALF_UP.planetList. since the BigDecimal class stores numbers up to an arbitrary level of precision.

and the Numeric type used in JavaScript) is used. DECIMAL64. If the DECIMAL64 MathContext is used.lang. RoundingModes. then a precision (number of significant figures) and Rounding Mode (HALF_UP) equivalent to that used by the Floating Point Decimal sub-type (which is the same as the Double type used in languages such as Java and C.5 There are three built-in MathContexts provided: DECIMAL32.6 -2.1234512345 0.124 | Chapter 6 Advanced Scripting Examples Table 11: Example Rounding Mode Results According to Single Digit Rounding Input Input Number 1. no exact representable decimal result.1234512346 0. Table 12: Example Rounding Mode Results According to BigDecimals Digit Rounding Input Rounding Mode Precision Math Context Result java.5 -5.1 -1.0 -1.0 -1.1234512345123451234512345123451234512 3451234512346 Business Data Services Guide . and MathContexts.ArithmeticException: Non-terminating decimal expansion.0 -1. and will generate an exception if the resultant number of digits used to represent the result is more than the defined precision.0 -1. UP HALF_UP UP HALF_UP UP 10 10 50 1 0 0. The UNNECESSARY rounding mode is the default RoundingMode. and DECIMAL128.6 -2.5 Up 1 -1 -2 -2 -3 -6 Down 1 -1 -1 -1 -2 -5 Ceiling 1 -1 -1 -1 -2 -5 Floor 1 -1 -2 -2 -3 -6 Half _up 1 -1 -1 -2 -3 -6 Half_down 1 -1 -1 -2 -2 -5 Half_even 1 -1 -1 -2 -2 -6 Unnecessary 1. The table below shows the results of dividing 12345 by 99999 using BigDecimals with different Precisions.5 -5.1 -1.

30. This is because 1. However.RoundingMode.divide(ScriptUtil.5 up planets.ArithmeticException: Non-terminating decimal expansion. The equals() method does not recognize them as the same. or // 34 significant digits.createMathContext(30. number of digits) of 2. no exact representable decimal result. the compareTo() method sees that there is no difference between them.4 is stored in BigDecimal as the number 14 with a scale of 1 and a precision (for example. The divide() method called above should be changed to: // 30 significant digits.averageWeight = totalKgs.averageWeight = totalKgs.createBigDecimal(planetCount).1234512345123451234512345123451235 java. and returns 0. rounding 0.Working with Fixed Decimals (BigDecimal) 125 | Table 12: Example Rounding Mode Results According to BigDecimals Digit Rounding Input Rounding Mode HALF_UP Precision 50 DECIMAL32 DECIMAL64 DECIMAL128 Math Context Result 0.HALF_UP).1234512 0.divide(ScriptUtil.averageWeight = totalKgs.4 to differ from 1. Business Data Services Guide .lang.mc).HALF_UP ).40 is stored as the number 140 with a scale of 2 and a precision of 3. rounding 0.DECIMAL128).5 up (using MathContext) var mc = ScriptUtil.5 up planets.1234512345123451234512345123451234512 3451234512345 0. meaning they have the same value. as the equals() method considers 1.createBigDecimal (planetCount). rounding 0.40. planets. or // 30 significant digits.createBigDecimal (planetCount).RoundingMode. 1. MathContext.divide(ScriptUtil.1234512345123451 0. When comparing BigDecimal values it is best to use the compareTo() method.

Detailed information on how this can be used is available in the previous section on Integers. instead of using x <relational_operator> y you must use x.compareTo(y) <relational_operator> 0 This will return the value that you expect the first expression to return. For example. if you want to use the expression x <= y you should write x. but in summary.compareTo(y) <= 0 Business Data Services Guide . when comparing two decimal fields x and y.126 | Chapter 6 Advanced Scripting Examples Comparing Fixed Decimals and BigDecimals The BigDecimal compareTo() method can be used in the same way as the BigInteger compareTo() method.

456789 is stored as a BigDecimal value.createBigDecimal ("1"). the value entered in the script will first be converted to a Numeric type. then the planetCount variable will be 0.1 may not be stored exactly in a Numeric type.. rounding 0.listIterator().30.0"). Therefore. you need to be aware of how BigDecimal values are stored. } if (planetCount. it will have an unscaled value of 123456789 and a scale of 6. which may introduce some rounding errors..RoundingMode. iterator.add(one).planetList.createBigDecimal("0. the value should be passed as a String. if great accuracy is required.hasNext(). When rounding BigDecimal variables. and our divide operation will cause an exception. planetCount = planetCount. The value of a BigDecimal is: (unscaled_value) * 10-scale Business Data Services Guide . If the value is not passed in a String.weightKgs).averageWeight = ScriptUtil. for (var iterator=planets.createBigDecimal() method. The following example here is a version of the script that checks that the planetCount is greater than or equal to one using the BigDecimal compareTo() method: var totalKgs = ScriptUtil. For example. otherwise an exception will be generated.next(). so when initializing BigDecimal types. as it results in a recurring sequence of binary digits when expressed in binary: 0.00011001100110011001100110011. For example.add(planet.HALF_UP). var planetCount = ScriptUtil. scripts should be programmed defensively to protect against such things. even for values that you would not expect it to.divide(planetCount. } When creating BigDecimal objects with the ScriptUtil.compareTo(one) >= 0) { // 30 significant digits. They are stored as two integer values: unscaled value and scale.0").createBigDecimal ("0"). It is important to be aware that the JavaScript numeric type is only accurate to about 16 significant figures. } else { planets. care should be taken to ensure that the divisor is not zero.createBigDecimal("0.averageWeight = totalKgs.Working with Fixed Decimals (BigDecimal) 127 | As with all divide operations.5 up planets. If there is a problem with the script so that there are no planets in the list. if the number 123. the value 0. the number to create can be passed as a String or a Numeric type. totalKgs = totalKgs. var one = ScriptUtil. ) { var planet = iterator.

RoundingMode. 123.setScale(3.4567890000 to 123. to 3. it would actually represent 123. or the Java Documentation. available at the following web site: http://download.oracle. for example. This converts. then the scale would become 10 and the unscaled value would be changed to 1234567890000 so that the number still has the same numerical value. otherwise an exception will be generated at runtime. When reducing the number of decimal places.HALF_UP). write: roundDecimal = decimal.457.4567890000. rounding must take place often. For more information on BigDecimal.com/javase/6/docs/api/java/math/BigDecimal. see Fixed Point Decimal (BigDecimal) Methods on page 192. If the setScale() method is called with a scale of 10. However.128 | Chapter 6 Advanced Scripting Examples The setScale() method is used to round values. To convert to 3 decimals using the HALF_UP rounding strategy. You must tell setScale() how you want to round the value. in our example.html Business Data Services Guide .

For example. or a BOM class. BOM Attributes can be defined as Object type (for example.Object BOM Native Type 129 | Object BOM Native Type There are four different varieties of BOM objects: • • • • xsd:any xsd:anyAttribute xsd:anyType xsd:anySimpleType All of these allow for different assignments. However. Using the Object BOM Native Type xsd:any The Object Type is used to handle sections of XML with an unknown format or where content is not known. xsd:any). An Object type BOM class attribute can be assigned either another Object attribute. but the data of which can still be passed on by the system. It must remain in that object. it cannot be read back out into its original type. given the following BOM: If a Web Service process has the following fields and parameters Data Field / Parameter Input Parameter Data Field Data Field Type Class1 Class2 Class3 Name inputField1 bomField2 bomField3 Business Data Services Guide . It is also not possible to assign a BOM object of one variety into a BOM bject of a different variety. once data has been stored in an object.

This type can only be assigned to itself. Business Data Services Guide . You can also write outputField1. which would pass the Business Object bomField3 in an xsd:any type construct in the response XML message for the web service.bomObject1. for example: outputField1. in which case the add() method will be used as usual for assigning values to the field.bomObject1.bomObject1 = bomField3. bomField2 can be used as the input parameter to another Web Service. it behaves in the same manner but instead of taking a BOM Class as its input it takes a primitive type. which would pass the xsd:any value from the input parameter of one service to the input parameter of another service. xsd:anyAttribute The xsd:anyAttribute is a very restrictive form of Object BOM Native Type.130 | Chapter 6 Advanced Scripting Examples Data Field / Parameter Output Parameter Type Class2 Name outputField1 Then a script in the process can be written as bomField2.add(bomField3). Object BOM Native Type attributes can have a multiplicity greater than one.bomObject1 = inputField1. No other BOM type can be assigned either to or from it. xsd:anySimpleType The xsd:anySimpleType is very similar to xsd:any.

textData Restrictions There can only be one Object BOM Native Type attribute in any class hierarchy (this is the only case for xsd:any and xsd:anyAttribute). One important difference is that if you wish to set the value of an xsd:anyType to the same value as either another xsd:anyType or a Business Object (i.anyType1 = ScriptUtil. BPM Forms do not support the Object BOM Native Type. This makes it the most flexible of storage types. // Copy a text field into the anyType Class1.anyType1 = ScriptUtil.copy(Class2.e. then you must use ScriptUtil.anyType1 = Class2. The difference is that it can be assigned either a BOM Class or primitive type. a BOM Class instance).copy() in order to take a copy of the source object before assigning it to the xsd:anyType. due to ambiguities with knowing how to parse incoming XML if there are more than one.anyType2). // Copy an anyType from one Class to another Class1. Business Data Services Guide . You cannot examine the contents of any of the Object BOM Native Types. so do not use a Business Object that includes an Object BOM Native Type attribute as a parameter to the UserTask. // Copy an entire BOM Class Instance Class1.copy(Class2).Object BOM Native Type 131 | xsd:anyType The xsd:anyType is again similar to both the xsd:any and xsd:anySimpleType.

For situations where you wish to specify which element the complex data is stored as.setObject(outputField1. as in the following example: ScriptUtil. If the BOM was created in TIBCO Business Studio.bomObject1. so the above example will always produce the desired result. a utility method can be used.Class3Element"). then BDS will automatically select the best available element in which to store the complex object. However. bomField3. For the above example.example.bomobjectexample. then there is only one element for each type. Select the class in the BOM editor. if the BOM was created by importing an XSD Schema and the simple assignment interface is used.bomObject1 = bomField3. "com.132 | Chapter 6 Advanced Scripting Examples Object BOM Native Type and ScriptUtil.setObject() The default assignment of a Business Object (for example. and look at the advanced properties sheet: Business Data Services Guide . to find the parameters that can be used in this case you need to find the name of the element associated with the class (type). a BOM Class instance) to an Object BOM Native Type attribute (imported xsd:any) looks like this [from the previous example]: outputField1.

bomField3.example.setObject() method. the namespace can be found in the Name field of the BOM properties sheet: Concatenating the two parts results in the following ScriptUtil. The element name is combined with the BOM namespace to make up the third parameter to the ScriptUtil.Object BOM Native Type and ScriptUtil. For this BOM example.setObject() 133 | At the bottom of the property sheet. "com.Class3Element"). In the screenshot above. the XsdTopLevelElement property is listed. there are two elements: Class3Element and Class3ElementB. This ScriptUtil function allows the script writer to define which element the xsd:any should be associated with.setObject() line: ScriptUtil. Business Data Services Guide .bomobjectexample.setObject(outputField1.bomObject1.

134

| Chapter 6

Advanced Scripting Examples

Additional Javascript Global Functions
Described below are some additional Javascript global functions you can use.

escape() and unescape()
The JavaScript escape() and unescape() functions can be used to encode strings that contain characters with special meanings or outside the ASCII character set. The escape() function encodes a string. This function makes a string portable, so it can be transmitted across any network to any computer that supports ASCII characters. The function does not encode A-Z, a-z, and 0-9. Additionally, the function encodes all other characters with the exception of: "*", "@", "-", "_", "+", ".", "/". The escape() function maps:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmno pqrstuvwxyz{|}~

To:
%20%21%22%23%24%25%26%27%28%29*+%2C-./0123456789%3A%3B%3C%3D%3E%3F@ABCDEFGHIJKLM NOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E

encodeURI() and decodeURI()
The encodeURI() function is similar to the escape() function but encodes fewer character. Encoding the string:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmno pqrstuvwxyz{|}~

Will produce:
%20!%22#$%25&'()*+,-./0123456789:;%3c=%3e?@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5b%5c%5d%5 e_%60abcdefghijklmnopqrstuvwxyz%7b%7c%7d~

So only the following characters are encoded: SPACE, "“", "&", "<", ">", "[", "\", "]", "^", "`", "{", "|", "}"

Business Data Services Guide

Additional Javascript Global Functions 135

|

encodeURIComponent() and decodeURIComponent()
These functions are similar to the encodeURI() and decodeURI() methods, but they additionally encode and decode the following characters: ,/?:@&=+$#

Business Data Services Guide

136

| Chapter 6

Advanced Scripting Examples

Business Data Services Guide

Business Data Modeling Best Practice 137

|

Chapter 7

Business Data Modeling Best Practice

This chapter gives some brief guidance on best practice.

Topics
• • • • • • • • Choose Appropriate Data Types, page 138 Use Sub-Packages to Aggregate Related Concepts, page 139 Process Data Field Granularity, page 140 BOM Class, Attribute and Variable Names, page 141 Do Not Split a Namespace Across Projects, page 144 Reference a Common Business Object Model, page 142 Do Not Modify Generated BOMs , page 145 Business Data Scripting Best Practice, page 146

Business Data Services Guide

With Datetime types if a timezone is required. use the Fixed Integer type. • Business Data Services Guide .16 significant digits. If it is insufficient. use Datetimetz. Limitation of accuracy and rounding issues may indicate that it’s not suitable for handling large values. Be aware of the limitations of the default Floating Point Decimal sub-type .138 | Chapter 7 Business Data Modeling Best Practice Choose Appropriate Data Types Take care when selecting attribute types: • • Be aware of the value space of the default Signed Integer sub-type [-231.231-1].

Use Sub-Packages to Aggregate Related Concepts 139

|

Use Sub-Packages to Aggregate Related Concepts
It is a good practice to put all related concepts in a sub-package. For example, in a claim model BOM there can be classes, primitive types, and enumerations relating to customers, policies, and claims. So three sub-packages can be created to collect the different types together in different groups. If the root package name is com.example.claimmodel, then there can be sub-packages called:
• • • com.example.claimmodel.customer com.example.claimmodel.policy com.example.claimmodel.claim

Organizing classes, enumerations, and primitive types in sub-packages makes them easier to find when viewing the BOM, and also when scripting it means that the factory has fewer methods in it, which makes it easier to find the method that you need. As an extension to this, you can actually have sub-packages in different BOM files. When doing this, it is important that each package or sub-package is only in one BOM file. Using the above example, you can have three BOM files for the three sub-packages, or you can have four if some things are defined in the root package. Alternatively, it can just be split into two BOM files with the root package and two sub-packages in one BOM file, and the third sub-package in the second file.

Business Data Services Guide

140

| Chapter 7

Business Data Modeling Best Practice

Process Data Field Granularity
If a number of related parameters are commonly passed to Tasks, it is a good idea to create a BOM class that contains all the parameters. Then, all the values can be passed to the tasks as a single parameter. However, one thing to be aware of is that if you have parallel paths within your process that are both processing a Business Object, then the changes made by the first branch to complete may be overwritten by data from the second branch if it is all stored in a single Business Object. To get around this problem, each branch should only be given the data it needs. Then, the data should be merged back into the single Business Object after the branches have merged together.

Business Data Services Guide

BOM Class, Attribute and Variable Names 141

|

BOM Class, Attribute and Variable Names
It is recommended that BOM class names begin with an uppercase letter and that variable and attribute names begin with a lowercase letter so that they can easily be distinguished. This is the convention used by Java, and what is done by the label to name mapping if Labels contain words with initial capital letters. In order to read variable names that are made up of several words, it is recommended that you use "camelcase", where the initial letter of every word (apart from the initial word in a data field or attribute name) is capitalized. A data field holding a customer account should be written customerAccount. Similarly you can have data fields called headOfficeName. This naming convention is used in the factory methods, so if there is a CustomerAccount class, then there will be a createCustomerAccount() method in the factory. If you enter Labels with initial capitals for each word then this will be achieved. Therefore, a label written as "Customer Account" will be converted to a class name of CustomerAccount, or an attribute name of customerAccount. If the label is written as "Customer account", the class name and attribute name will be Customeraccount and customeraccount, both of which are not so readable.

Business Data Services Guide

142

| Chapter 7

Business Data Modeling Best Practice

Reference a Common Business Object Model
It can be valuable to define commonly-used Business Objects in one Business Object Model in a common project, and then re-use these objects by referencing them from multiple other projects. Just as it is common practice for an Organization Model to be defined in one project and referenced from other projects, the same can be done for BOMs that are to be used by many projects.

For example, company-wide generic Business Objects can be put in a shared BOM project that defines BOM classes in a top-level package. Here is an example of what the top-level BOM package can look like:

Business Data Services Guide

The other projects that reference the BOMs will each include the BDS plug-ins for the shared BOMs as part of their own deployment. The following screenshot shows the AcmeWeb BOM referring to BOM classes defined in the top-level BOM: You can see that the Book and Electrical classes are specializations of the Product class. Any projects that just contain BOMs do not get deployed. and the Order class contains Products that are defined in the top-level BOM. and the other projects can define processes that use objects from both the local and the shared BOMs. Business Data Services Guide .Reference a Common Business Object Model 143 | The AcmeIntranet and AcmeWeb projects can define their own BOM sub-packages that inherit from the top-level BOM package.

claimmodel. For example.customerdetails package.customerdetails.example.example.claimmodel.Customer must both be defined in the package that defines the com.claimmodel.customerdetails.customerdetails package: • • com.example.claimmodel.Address com.144 | Chapter 7 Business Data Modeling Best Practice Do Not Split a Namespace Across Projects Classes from the same package must not be defined in separate BOM files. Business Data Services Guide . the following classes must both be defined in the package that defines the com.example.

then any changes made by editing the BOM could be lost.Do Not Modify Generated BOMs | 145 Do Not Modify Generated BOMs Do not modify the contents of BOMs in the Generated Business Objects folder of a project. Business Data Services Guide . The BOMs created in the Generated Business Objects folder as a result of importing XSDs or WSDLs into the Service Descriptors folder should not be edited because if the file is regenerated. If the intention is to import an XSD and generate a BOM. then the XSD (or WSDL) should be imported into the Business Objects folder.

the former construction will result in a syntax error. Use Constant First when Comparing a Constant with a Variable Using: constant == variable is safer than: variable == constant If "=" is used instead of "==" by mistake. Use Comments in Scripts It is good practice to comment code to make it easier for others who follow you to understand what the scripts are doing. and multiplicity are checked at the end of every script. so ensure that all the Out and In / Out fields for the task have valid values before the script task is completed. limits.146 | Chapter 7 Business Data Modeling Best Practice Business Data Scripting Best Practice This section contains some suggestions for Business Data scripting. You can do this by breaking potentially large chunks of logic into separate scripts. Keep the Scripts Small It is recommended that you keep scripts small. Ensure Business Objects Are Valid Before Scripts Complete Remember that the length. Business Data Services Guide . Check for Nulls It is very important to check that fields and attributes are not null before attempting to get their values.

Troubleshooting 147 | Chapter 8 Troubleshooting This chapter describes how to identify and resolve some problems you may encounter when using Business Data Services. page 150 Troubleshooting BDS Scripting . Topics • • • Viewing BDS-generated BDS Plug-in Hidden Projects. page 151 Business Data Services Guide . page 148 BDS Plug-in Generation Problems.

This can be done by clicking the View Menu in the Project Explorer: Select Customize View….". uncheck . Business Data Services Guide . change the view so that it does not hide folder and file names that begin with ". To view the BDS Plug-ins that have been generated. In the Available Customizations dialog.148 | Chapter 8 Troubleshooting Viewing BDS-generated BDS Plug-in Hidden Projects BDS Plug-ins can be seen in the Project Explorer.*resources.

Viewing BDS-generated BDS Plug-in Hidden Projects 149 | For each BOM. Business Data Services Guide . a pair of projects are created: Looking at these can be useful to understand how things are working.

Then the project that the Scripting Guide BOM comes from can be cleaned and rebuilt to regenerate the projects. if the project is rebuilt. for example: Business Data Services Guide . To verify that they are being generated. then click the Problems tab to check for reasons that the BOM generation may not be working: The BOM editor warns you about problems by showing a red cross in the upper-right corner of the problem element: Pointing to the red cross causes a dialog to display containing information about the error. the BDS plug-in folders can be removed. If the projects are not regenerated. the two Scripting Guide folders can be deleted.150 | Chapter 8 Troubleshooting BDS Plug-in Generation Problems Check to see if the BDS plug-ins are being created by looking for the hidden folders as described in the previous section. Then. the BDS Plug-in folders should be regenerated: In the above screenshot.

Log files are located in: <CONFIG_HOME>/tibcohost/<INSTANCE_NAME>/nodes/BPMNode/logs/BPM. Break Script into Smaller Scripts Add User Tasks between script tasks to see the field values. the default location for CONFIG_HOME is: /opt/amxbpm/tibco/data The default INSTANCE_NAME is Admin-AMX BPM-AMX BPM Server.log On Windows. as described previously. This section provides instruction on how to identify and resolve BDS scripting problems.Troubleshooting BDS Scripting | 151 Troubleshooting BDS Scripting Occasionally. the default location for CONFIG_HOME is: C:\ProgramData\amx-bpm\tibco\data On UNIX. Examine the Server Logs TIBCO BPM components write out logging information as they process work. It can be useful to look at these logs when debugging scripts that are not working. a script does not function as planned. In order to do this. Business Data Services Guide . ensure that the debugging level is turned up to maximum (see the Administrator interface documentation for your BPM runtime for more information about editing logging levels). BDS Classes Do Not Appear or Changes Do Not Appear Check that there are no problems with the BDS Plug-in generation.

tibco.java:1707) at com.invoke(Unknown Source) … at java.impl.brm.n2.AsyncWorkItemSchedulerService Impl`.bpm. hostAddress=`10.[ERROR] {BRM_WORKITEM_ASYNC_SCHEDULE_WORK_ITEM_WITH_MODEL_MESSAGE_FAILED} . ¬} Write Variable Values and Progress Updates from the Script to the BPM Log File A facility for writing messages from scripts to the server called the BPM Log file is provided.checkItemBodyDataTypesFromPayload(D ataModelFactory.java:263) at sun.scheduleWorkItemWithWorkMod el(WorkItemSchedulerBase.brm.java:619) `. creationTime=`2011-03-23T17:53:50.services. For example: 23 Mar 2011 17:53:50. managedObjectId=`78`.java:621) at com. componentId=`BRM`. compositeApplicationName=`amx.brm.brm.services.WorkItemSchedulerBase. lineNumber=`290`.impl. messageCategory=`WORK_ITEM`.java:2185) at com.n2. stackTrace=`com.util. messageId=`BRM_WORKITEM_ASYNC_SCHEDULE_WORK_ITEM_WITH_MODEL_MESSAGE_FAILED`. methodId=`asyncScheduleWorkItemWithModel`.run(Thread. requestReceived=`Wed Mar 23 17:53:50 GMT 2011`.impl.100.brm.tibco.scheduleWorkIte mWithModel(AsyncWorkItemSchedulerServiceImpl.n2.tibco.n2.app`.impl.privScheduleWorkItem(WorkIt emSchedulerBase.services. principalId=`tibco-admin`.WorkItemFault: Param [integer] Value [111222333444] exceeds the defined maximum limit of 9 at com.brm. hostName=`uk-keitht`.Thread.DataModelFactory. correlationId=`6fb66791-595c-499b-ad55-5b56b7404fac`.reflect. Business Data Services Guide . nodeName=`BPMNode`.83.DataModelFactory.n2.checkDataTypeValues(DataModelFactor y.tibco.n2.services.n2.model.tibco.java:2280) at com.AsyncWorkItemSchedulerServiceImpl .model.brm.417 [Default Service Virtualization Thread_72] [ERROR] com.brm. environmentName=`BPMEnvironment`.WorkItemSchedulerBase. message=`Async schedule work item with model message failed`.n2. componentClassName=`com.util.tibco.java:1323) at com.80`.n2.util.brm. serviceName=`AsyncWorkItemSchedulerService`.417+0000`.GeneratedMethodAccessor635.152 | Chapter 8 Troubleshooting Checking the log file can help locate the cause of scripting problems. severity=`ERROR`.model.AsyncWorkItemSchedulerServiceImpl. eventType=`FAULT`.tibco. principalName=`tibco-admin`.checkDataTypeValue(DataModelFactory .tibco.Async schedule work item with model message failed ¬{extendedMessage=`Param [integer] Value [111222333444] exceeds the defined maximum limit of 9`. threadName=`Default Service Virtualization Thread_72`.lang. methodName=`scheduleWorkItemWithModel`. priority=`HIGH`. contextId=`6fb66791-595c-499b-ad55-5b56b7404fac`.impl.services.DataModelFactory.tibco. threadId=`1056`.services.

name + "' added"). New Customer Process. for example. Customer: Fred Blogs added See Examine the Server Logs on page 151 for the location of the log.New Customer Process. this function is only useful if you have access to the BPM Log file which is stored on the server. is provided with TIBCO Business Studio. get a script to execute the commands in the Text field. 11 Feb 2011 09:42:06. and executes it as if it was part of a script. For example. which can be found by searching for the text stdout . Although useful for experimenting with scripts and testing them. the following can be done from a script: Log. TIBCO recommends that you do not use this function in a production environment because it allows the execution of any script text that is provided at runtime.or part of the message. eval (scriptField).529 [PVM:Persistent STWorkProcessor:5] [INFO ] stdout . This generates a message like the following in the BPM Log file. Then. Business Data Services Guide . which allows you to step through a process and to examine process flow and data manipulation. you could enter them into a Text field on a Form. which is available in the TIBCO Business Studio help and the HTML help that is installed on disk in the BPM runtime. see the tutorial How to Debug a Business Process. However.Troubleshooting BDS Scripting | 153 For example. to test some expressions. Use the Process Debugger A debugger. Customer: '"+cust.write("New Customer Process. eval() The eval() function provides the ability to execute a dynamic script useful for debugging purposes. This is given a string. For more information.

154 | Chapter 8 Troubleshooting Catch Exceptions If there is the possibility that a script will generate an exception at runtime. you can catch the exception and take corrective action in the process using a catch event. and the properties of one of them: Business Data Services Guide . For example. the following are some ScriptTasks with IntermediateCatch events attached to them.

page 164 Data Mapping. page 163 BDS Limitations. page 156 Unsupported XSD Constructs. page 180 Business Data Services Guide .| 155 Appendix A Supplemental Information This appendix includes reference material to support your use of Business Data Services. Topics • • • • • • Data Type Mappings. page 170 JavaScript Features not Supported in TIBCO BPM Scripting. page 177 Reserved Words in Scripts.

BigDecimal java.datatype.Double javax.lang.xml.String javax.datatype.lang.xml.XMLGregorianCalendar javax.datatype.XMLGregorianCalendar java.lang.eclipse.eclipse.Integer org.any Object .XMLGregorianCalendar javax.BigInteger java.emf.util.ecore. BOM Native Type to BDS Type Mapping This table shows which Java Type the BOM Native Types are mapped onto.lang.xml.lang.xsd.XMLGregorianCalendar Mutable? N/A No Yes Yes Yes No No No No No No No No No No No Yes Business Data Services Guide .anySimpleType Text Time BDS Java Type N/A java.Math.xml.String java.util.FeatureMap EObject java.xml.Boolean javax.Object java.anyAttribute Object .datatype.FeatureMap org.datatype. Table 13: BOM Native Type to BDS Type Mapping BOM Native Type Attachment Boolean Date Datetime Datetimetz Decimal – Fixed Point Decimal – Floating Point Duration ID Integer – Fixed Length Integer – Signed Object .anytype Object .emf.xsd.156 | Appendix A Supplemental Information Data Type Mappings This section contains tables showing data type mappings.xsd. and whether they are mutable or not.xsd.lang.Duration java.Math.ecore.

but the values of immutable types cannot. XSD Type to BDS Type Mapping The following table shows what BDS types the different XSD types are mapped to Table 14: XSD Type to BDS Type Mapping XSD Type xsd:base64Binary xsd:byte xsd:byte (nillable) xsd:decimal xsd:float xsd:float (nillable) xsd:gDay xsd:gMonth xsd:gMonthDay xsd:gYear xsd:gYearMonth xsd:hexBinary xsd:IDREF xsd:IDREFS xsd:integer xsd:language BOM Native Type Text Integer (signed) Decimal (fixed – BigDecimal) Decimal (floating point – Double) Text Text Text Text Text Text Text Text Integer (fixed – BigInteger) Text BDS Type String Integer BigDecimal Double String String String String String String String String BigInteger String Business Data Services Guide .lang.String Mutable? No The values of Mutable types can be changed. The methods that operate on them return new objects with the new values instead of mutating the value of the original object.Data Type Mappings 157 | Table 13: BOM Native Type to BDS Type Mapping BOM Native Type URI BDS Java Type java.

158

| Appendix A

Supplemental Information

Table 14: XSD Type to BDS Type Mapping XSD Type xsd:long xsd:long (nillable) xsd:Name xsd:NCName xsd:negativeInteger xsd:NMTOKEN xsd:NMTOKENS xsd:nonNegativeInteger xsd:nonPositiveInteger xsd:normalizedString xsd:positiveInteger xsd:QName xsd:short xsd:short (nillable) xsd:unsignedByte xsd:unsignedByte (nillable) xsd:unsignedInt xsd:unsignedInt (nillable) xsd:unsignedLong xsd:unsignedShort xsd:unsignedShort (nillable) xsd:string BOM Native Type Integer (fixed – BigInteger) Text Text Integer (fixed – BigInteger) Text Text Integer (fixed – BigInteger) Integer (fixed – BigInteger) Text Integer (fixed – BigInteger) Text Integer (signed) Integer (signed) BDS Type BigInteger BigInteger String String BigInteger String String BigInteger BigInteger String BigInteger String Integer Integer

Integer (fixed – BigInteger)

BigInteger

Integer (fixed – BigInteger) Integer (signed)

BigInteger Integer

Text

String

Business Data Services Guide

Data Type Mappings 159

|

Table 14: XSD Type to BDS Type Mapping XSD Type xsd:int xsd:int (nillable) xsd:double xsd:double (nillable) xsd:ID xsd:date xsd:datetime xsd:duration xsd:time xsd:anyURI xsd:boolean xsd:boolean (nillable) xsd:ENTITY xsd:ENTITIES xsd:anyType xsd:anySimpleType xsd:token xsd:any xsd:anyAttribute Decimal (floating point – double) Text Date Datetime Duration Time Text Boolean Text Text Object Object Text Object Object Double BOM Native Type Integer (signed) BDS Type Integer

String XMLGregorian Calendar XMLGregorian Calendar Duration XMLGregorian Calendar String Boolean String String EObject Java Object String FeatureMap FeatureMap

Business Data Services Guide

160

| Appendix A

Supplemental Information

JDBC Database Type to BOM Data Type Mapping
The following table shows mappings between: • • JDBC database types TIBCO Business Studio Business Object Model (BOM) types. See TIBCO Business Studio Business Object Modeler User’s Guide for more detail.

Table 15: JDBC Database Type to BOM Data Type Mapping JDBC Database Type BIT TINYINT SMALLINT INTEGER BIGINT FLOAT REAL DOUBLE NUMERIC DECIMAL CHAR VARCHAR LONGVARCHAR DATE TIME TIMESTAMP BINARY VARBINARY LONGVARBINARY BOM Type Boolean Integer (signed) Integer (signed) Integer (signed) Integer (fixed - BigInteger) Decimal (floating point - double) Decimal (floating point - double) Decimal (floating point - double) Decimal (fixed point - BigDecimal) Decimal (fixed point - BigDecimal) Text Text Text Date Time Datetime Attachment1 Attachment1 Attachment1

Business Data Services Guide

Data Type Mappings 161

|

Table 15: JDBC Database Type to BOM Data Type Mapping JDBC Database Type NULL OTHER JAVA_OBJECT DISTINCT STRUCT ARRAY BLOB CLOB REF DATALINK BOOLEAN ROWID NCHAR NVARCHAR LONGNVARCHAR NCLOB SQLXML 1. Not currently supported. BOM Type Text Text Attachment1 Text Text Text Attachment1 Text URL URL Boolean Text Text Text Text Text Text

Business Data Services Guide

162

| Appendix A

Supplemental Information

Process Primitive Data Type Mapping
TIBCO Business Studio supports the following process basic data types. Table 16: Process Primitive Data Type Mapping Process Primitive Type Boolean Integer Java Type Representation Boolean Integer Constrained to 9 digits. TIBCO Business Studio validates that the upper limit is not exceeded. Decimal Text Date Time Datetime Performer Double String XMLGregorianCalendar XMLGregorianCalendar XMLGregorianCalendar String Date, without timezone offset. Time, without timezone offset. Date and time, with optional timezone offset. A 64-bit floating point number. Comments

Business Data Services Guide

Unsupported XSD Constructs 163

|

Unsupported XSD Constructs
The following XSD Constructs are not supported: • • • • • • • XSD list XSD Redefine XSD Key XSD KeyRef XSD Unique XSD Notation XSD ComplexType as restriction of another complex type

Business Data Services Guide

164

| Appendix A

Supplemental Information

BDS Limitations
The following sub-sections contain further notes and restrictions.

BDS and Forms
Object Type The BDS Object type is not supported in Forms, so Business Objects that include Object type attributes cannot be displayed on Forms.

Simple Type Default Values
Currently, simple types with default values are not supported. The default value is ignored. This is an EMF restriction. For example:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns=http://example.com/ElementSimpleDefault targetNamespace="http://example.com/ElementSimpleDefault"> <xsd:element name="elementWithDefault" type="tns:NewType" default="10"/> <xsd:complexType name="NewType"> <xsd:simpleContent> <xsd:extension base="xsd:integer"> <xsd:attribute name="NewAttribute" type="xsd:string"/> <xsd:attribute name="NewAttribute1" type="xsd:string"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:schema>

Fixed Attribute Overwrite
If an element or attribute in a complex object exists, it is possible in EMF to actually overwrite the fixed value with a different value. This is then persisted in the XML instead of the fixed value, thus creating invalid XML against the schema.

Business Data Services Guide

maxOccurs) at the sequence or choice level the XML generated may not be valid. the following is an XSD fragment: <xs:sequence maxOccurs="unbounded"> <xs:element name="fruit" type="xs:string" minOccurs="1" maxOccurs="1"/> <xs:element name="cake" type="xs:int" minOccurs="1" maxOccurs="1"/> </xs:sequence> Group Multiplicity The use of multiplicity on the "ref" side of a group is not supported.g. For example. and will result in a validation error.BDS Limitations 165 | For example: <xsd:complexType name="compType"> <xsd:sequence> <xsd:element name="anElement" type="xsd:string" fixed="A fixed value"/> </xsd:sequence> </xsd:complexType> Multiplicity at the Sequence or Choice Level If you have multiplicity (e. Business Data Services Guide . This is because EMF does not support outputting XML where the pattern/order of elements in the group reoccurs in group order. Nested xsd:any in Sequences EMF is unable to handle nested sequences where there is an xsd:any or xsd:anyattribute in each sequence.

com/nsLocalAny" targetNamespace="http://example. it is not possible to set another class in the BOM to it.166 | Appendix A Supplemental Information For example. This is because the BOM class will already have a namespace associated with it. of which contain an xsd:any: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.org/2001/XMLSchema" xmlns="http://example.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.com/NestedAny" targetNamespace="http://example.w3. there is a sequence within another sequence.w3.org/2001/XMLSchema" xmlns="http://example.com/NestedAny"> <xs:element name="train" type="TrainType"/> <xs:complexType name="TrainType"> <xs:sequence> <xs:element name="line" type="xs:string"/> <xs:element name="company" type="xs:string"/> <xs:any processContents="lax" minOccurs="1" maxOccurs="1"/> <xs:sequence> <xs:any processContents="skip" minOccurs="1" maxOccurs="1"/> </xs:sequence> </xs:sequence> </xs:complexType> </xs:schema> xsd:any "##local" When there is an xsd:any. EMF will not strip the namespace automatically. where the namespace is set to ##local. For example: <?xml version="1.com/nsLocalAny"> <xs:element name="TrainSpotter" type="ResearchType"/> <xs:complexType name="ResearchType"> <xs:sequence> <xs:element name="details" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:element name="train"> <xs:complexType> <xs:sequence> <xs:element name="line" type="xs:string"/> <xs:element name="company" type="xs:string"/> <xs:any namespace="##local" processContents="lax" minOccurs="0" maxOccurs="5"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Business Data Services Guide . in the following schema.

base type --> <xs:complexType name="BaseInfo"> <xs:sequence> <xs:element name="numPosts" type="xs:integer" minOccurs="0" maxOccurs="1"/> </xs:sequence> <xs:attribute name="firstSubscribed" type="xs:date" use="optional"/> <xs:attribute name="mailReader" type="xs:string"/> </xs:complexType> <!-. the following schema is not supported: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.derived type --> <xs:complexType name="RestrictedOne"> <xs:complexContent> <xs:restriction base="BaseInfo"> <xs:sequence> <xs:element name="numPosts" type="xs:integer" minOccurs="1"/> </xs:sequence> <xs:attribute name="firstSubscribed" type="xs:date" use="required"/> <xs:attribute name="mailReader" type="xs:string" fixed="Microsoft Outlook"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="NoBaseRestricted"> <xs:sequence> <xs:element name="numPosts" type="xs:integer" minOccurs="1"/> </xs:sequence> <xs:attribute name="firstSubscribed" type="xs:date" use="required"/> <xs:attribute name="mailReader" type="xs:string" fixed="Microsoft Outlook"/> </xs:complexType> </xs:schema> Attempting to import this schema results in the following error: XML Schema contains an unsupported Complex Type restriction of another Complex Type.com/ComplexRestriction" targetNamespace="http://example. EMF restrictions prevent this.com/ComplexRestriction"> <!-.BDS Limitations 167 | Restrictions between Complex Types A Complex Type cannot be a restriction of another Complex Type.w3.org/2001/XMLSchema" xmlns="http://example. For example. Business Data Services Guide .

com/RecurringElements"> <xs:element name="BoatElement" type="Boat"/> <xs:complexType name="Boat"> <xs:sequence> <xs:element name="power" type="xs:string" minOccurs="3" maxOccurs="3"/> <xs:element name="hulltype" type="xs:string" minOccurs="1" maxOccurs="1"/> <xs:element name="power" type="xs:string" minOccurs="3" maxOccurs="3"/> </xs:sequence> </xs:complexType> </xs:schema> Attempting to import the above schema into TIBCO Business Studio will fail with the following message: XML Schema contains unsupported duplicate element names inside the same complex type. They will be allowed to import and run as if the block does not exist. For example.org/2001/XMLSchema" xmlns="http://example. the following schema would not be supported: <xs:schema xmlns:xs="http://www.168 | Appendix A Supplemental Information Recurring Elements in Sequence Having an ordered sequence with multiple instances of the same element name is not supported in XML schemas due to an EMF restriction.w3. For example. The "block" Function EMF will not enforce a block if used on either Complex Types or Elements. see the following schema fragment: Business Data Services Guide .com/RecurringElements" targetNamespace="http://example.

BDS Limitations 169 | <xsd:complexType name="coreIdentifier" block="#all"> <xsd:sequence> <xsd:element name="surname" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="enhancedIdentifier"> <xsd:complexContent> <xsd:extension base="ns1:coreIdentifier"> <xsd:sequence> <xsd:element name="firstname" type="xsd:string"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="Household"> <xsd:sequence> <xsd:element name="family" type="ns1:coreIdentifier"/> </xsd:sequence> </xsd:complexType> <xsd:element name="myBaseInfo" type="ns1:coreIdentifier"/> <xsd:element name="myFullInfo" type="ns1:enhancedIdentifier"/> <xsd:element name="myHousehold" type="ns1:Household"/> Business Data Services Guide .

Boolean Integer-Fixed bomField.booleanAttribute = (1.decimalFloat).integerFixed.compa reTo( ScriptUtil.createBigDecimal(1)) == 0). Table 17: Converting Values Between Different BOM Attribute Types To Type Boolean From Type Text Example bomField.equals( ScriptUtil. (14/10==1.integerSigned).decimalFixed. Boolean Decimal Signed bomField. Converting Values Between Different BOM Attribute Types This section shows how to convert between fields of different types.booleanAttribute = (bomField.booleanAttribute = bomField. Boolean Integer-Signed bomField.createBoolean( bomField.textAttribute). Business Data Services Guide . e.170 | Appendix A Supplemental Information Data Mapping These tables show data mappings within the BOM. for example.0 == bomField. Testing for equality may not give expected result due to floating point inaccuracies. how to convert between a text field containing the String 123 and an integer field containing the number 123.g.booleanAttribute = ScriptUtil.createBigInteger(1)).booleanAttribute = (1 == bomField.4) evaluates to false due to rounding errors Comments Parameter to createBoolean() should be true or false Boolean Decimal Fixed bomField.

time. P12DT3H for 12 days and 3 hours.text = bomField.text = bomField. Object. Text Object.decimalFixed.text = bomField. Attachment Text Text Text Text Text Text Boolean Integer-Signed Integer-Fixed Decimal Float Decimal Fixed Date. Datetimetz Duration. URI bomField.text = bomField.text = bomField. bomField.datetime.uri. bomField. Example N/A Comments N/A Business Data Services Guide .duration.bool. Time. bomField. bomField. Datetime. bomField. Same value yyyy-mm-dd hh:mm:ss yyyy-mm-ddThh:mm:ss yyyy-mm-ddThh:mm:ssZ Results in true or false value being assigned.Data Mapping 171 | Table 17: Converting Values Between Different BOM Attribute Types To Type Boolean From Type Date. Attachment N/A N/A For example. intSigned. bomField. bomField.text = bomField. Datetimetz bomField.text = bomField.integerFixed.text = bomField. Text Text Duration ID.datetimetz.decimal. URI. bomField. Datetime. bomField.text = bomField. ID.text = bomField.date. bomField.text = bomField.text = bomField.id. Time.

bomField.decFloat). Copes with base. Decimal Fixed bomField.172 | Appendix A Supplemental Information Table 17: Converting Values Between Different BOM Attribute Types To Type Integer Signed From Type Text Example bomField. ID.createBigInteger( bomField. intSigned = parseInt(bomField. Duration.intFixed = ScriptUtil. Boolean. intSigned = bomField.toS tring()).intFixed.toS tring()).intSigned).intFixed.intFixed = ScriptUtil. intSigned = parseInt(bomField.text.createBigInteger( bomField.intFixed = ScriptUtil.intSigned = parseInt(bomField. Integer Fixed Integer-Signed bomField.decFloat. Attachment Integer Fixed Text bomField. Time. Rounds towards 0 Using ScriptUtil Factory Using ScriptUtil Factory N/A N/A Goes by a String Goes by a String Can result in loss of precision Rounds toward 0 Comments parseInt() stops at first non-number character. Decimal Float bomField. Datetime. intSigned = parseInt(bomField. Date. Datetimetz. Object. Integer Fixed Decimal Float bomField.text). Integer Signed Integer Signed Integer Signed Business Data Services Guide .10). Integer Signed Integer-Fixed bomField.text). URI.createBigInteger( bomField.

createBigDecimal( bomField. Duration. ID.createBigDecimal( bomField. 45z  45. First converts value to a String and then to a Floating Point. Datetimetz. N/A NaN if starts with non-digit.decFixed = ScriptUtil.createBigInteger( bomField. Using ScriptUtil Factory Decimal Fixed Integer-Signed bomField. Object. Duration.Data Mapping 173 | Table 17: Converting Values Between Different BOM Attribute Types To Type Integer Fixed From Type Decimal Fixed Example bomField. Time. URI. Datetime. Datetimetz.decFloat =parseFloat(bomField.text). toString()).intFixed = ScriptUtil. Using ScriptUtil Factory Business Data Services Guide .toString()). Datetime. Time.decFixed = ScriptUtil.decFloat =parseFloat(bomField. Possible loss of precision. Date. bomField. Attachment Text N/A N/A Comments Rounds towards 0 Floating Point Floating Point bomField. Integer Fixed Boolean. URI. N/A Integer-Fixed Floating Point Decimal Fixed Floating Point Boolean . First converts value to a String and then to a Floating Point.decFloat = parseFloat( bomField. bomField.intFixed.decFixed . Date.decFixed).text). Object. Possible loss of precision. ID. Attachment Decimal Fixed Text bomField.intSigned). Or ignores after non-digit. for example.

text). Datetime. Datetimetz bomField.decFixed = ScriptUtil. Duration.createDate( bomField. Date. Attachment Text N/A N/A Using ScriptUtil Factory Comments Using ScriptUtil Factory Date.date = DateTimeUtil. Decimal Fixed Integer Fixed bomField.datetime = DateTimeUtil.date = DateTimeUtil. Time.decFloat).text).intDay). Datetime.text).text).datetimetz = DateTimeUtil.intMonth.createBigDecimal( bomField. bomField.174 | Appendix A Supplemental Information Table 17: Converting Values Between Different BOM Attribute Types To Type Decimal Fixed From Type Decimal Float Example bomField.text). Decimal Fixed Boolean . Time.createDatetimetz( bomField.intYear.g. bomField. bomField. Decimal Float e. Object.createBigDecimal( bomField. Date.time = DateTimeUtil.decFixed = ScriptUtil. See DateTimeUtil for more factory methods Business Data Services Guide .createTime( bomField. ID. bomField. bomField.createDatetime( bomField. Time. Datetime.createDate( bomField. bomField. Datetimetz. Datetimetz Integer. URI.

Fixed Integer. URI Attachment N/A Business Data Services Guide . URI. Time.date. Duration Signed Integer.text. Datetime. Decimal Fixed All other types Text bomField. Decimal Float. Datetime.datetime = DateTimeUtil. ID.uri = bomField.text. Fixed Decimal.createDuration( bomField. Duration. Datetime. bomField. Time. Datetimetz From Type Date.time).id = bomField.text). Datetimetz Date.integerOrDecimal).createDuration( bomField.createDatetime( bomField. Fixed Integer.duration = DateTimeUtil. Datetimetz Boolean. Attachment Duration Text bomField.Data Mapping 175 | Table 17: Converting Values Between Different BOM Attribute Types To Type Date. Object. bomField. time. N/A N/A Comments See DateTimeUtil for more factory methods Duration ID. URI Object All other types All Business Objects All Types N/A N/A N/A Can only be assigned an Object attribute or a Business Object N/A Specify duration in milliseconds using any of the 4 numeric sub-types N/A Example bomField. N/A bomField.duration = DateTimeUtil. ID.

Others are slightly different. If it doesn’t. as shown below. No problems mapping data Boolean Date Time Datetime Boolean Date Time Datetime Performer Text The Process Basic Types can be mapped to BOM Attributes of different types if the guidelines in the previous section are followed.176 | Appendix A Supplemental Information Mapping to or from Process Basic Types There are 8 different Process Basic Types that Business Object Attributes can be assigned to or from. Business Data Services Guide . No problems mapping data No problems mapping data No problems mapping data No problems mapping data. an exception will be raised. Some of these types have equivalent BDS Attribute types. Table 18: Mapping to or From Process Basic Types Process Basic Type Text Decimal Integer Equivalent BOM Attribute Type Text Decimal (Floating Point sub-type) Integer (Signed Integer sub-type) Comments No problems mapping data No problems mapping data The range of values supported by the Process Basic Integer is constrained to 9 digits. provided that it contains a timezone. The Basic Datetime type can be assigned to a BOM Datetimetz Attribute. so all values that this can take will fit in a BOM Attribute Integer (which is a 32-bit Integer).

} The only way to catch an exception in a script is to catch the error on ScriptTask or another task. try/catch Statement The try/catch statement is not supported: try { BLOCK. break. break } Instead. } Finally { BLOCK. an if () {} else if () {} … statement should be used.JavaScript Features not Supported in TIBCO BPM Scripting 177 | JavaScript Features not Supported in TIBCO BPM Scripting Certain JavaScript features are not supported. } catch (error) { BLOCK. Switch Statement The switch statement from JavaScript is not supported: switch (value) { case constant: BLOCK. the factory methods must be used to create new instances of classes. Business Data Services Guide . New Operator The new operator from JavaScript is not supported. Instead. … default: BLOCK.

For example. } Business Data Services Guide . "==="operator The === operator (same value and type) is not supported. JavaScript RegExp Object The JavaScript RegExp object is not supported. Consequently. the List type is used.178 | Appendix A Supplemental Information JavaScript Functions JavaScript functions are not supported. as there is no way to create JavaScript arrays in TIBCO BPM. Instead. the Text field replace() method only supports string substitution. the following loop is not supported: for (FIELD in ARRAYFIELD) { BLOCK. Code must be written out in full. not the substitution of a pattern matched by a regular expression. JavaScript Arrays Using [ ] for array indices is not supported.

Using If. and While Expressions 179 | Using If. and While Expressions The curly braces are required in TIBCO Business Studio scripts for if. while. For. For. Business Data Services Guide . and for expressions.

but WHILE is acceptable). Cannot be used. Other reserved words cannot be used in the case shown. regardless of case. while is prohibited. Business Data Services Guide . but can be used by changing the case (for example.180 | Appendix A Supplemental Information Reserved Words in Scripts Array RegExp boolean class do false goto int package static throw upper Boolean String break const double final if interface private strictfp throws var Date abstract byte continue else finally implements long protected super transient void Math assert case debugger enum float import native public switch true volatile Number bdsId1 catch default export for in new return synchronized try while Object bdsVersion1 char delete extends function instanceof null short this typeof with 1.

page 182 BOM Native Type Methods. page 191 Other Supported Methods. Standard JavaScript is supported.| 181 Appendix B Business Data Scripting TIBCO Business Studio used with TIBCO BPM enables you to write scripts for various purposes. page 204 Other JavaScript Functions. This appendix describes the additional functions that are supported to help with BDS scripting. page 206 Business Data Services Guide . Topics • • • • Static Factory Methods.

if set to True. it strips timezone. such as year. createDate() This creates a Date object set to today’s date. For example: 2009-11-30T23:50:00-05:00 becomes 2009-11-30. and seconds. month. Type Name Date Factory Method createDate(int year. hours. day. such as seconds and minutes. For example. should also be within normal ranges. This ignores any timezone offset. Boolean normalize) This is a Boolean that. Date and Time. int day) createDate(Text isoFormatDate) This is a native type used in BPM for storing dates in YYYY-MM-DD format only. normalizes to Zulu time. Other parameters. and String Functions DateTimeUtil These methods are used to create date and time objects of the types used in BPM. createDate(Datetimetz datetime. Business Data Services Guide . Parameters.182 | Appendix B Business Data Scripting Static Factory Methods This section describes the following classes of factory methods: • • • DateTimeUtil ScriptUtil IpeScriptUtil (and ScriptUtil) Conversion. should be in the range 0-59. int month. 2009-11-30T23:50:00-05:00 becomes 2009-12-01. The same example date becomes 2009-11-30. createDate(Datetime datetime) This ignores any timezone offset. If set to False. as shown in the following tables.

int second. Time time) No timezone offset set. BigDecimal fractionalSecond) createDatetime(int year. Business Data Services Guide . if set to True.Static Factory Methods 183 | Type Name Time Factory Method createTime(int hour. int hour. int second. int month. if set to True. normalizes to Zulu time. BigDecimal fractionalSecond) createTime(int hour. createTime(Datetimetz datetimetz. int millisecond) createDatetime(String lexicalRepresentation) This creates a new Datetime by parsing the String as a lexical representation. If it is set to False. normalizes to Zulu time. createDateTime() This creates a Datetime object set to the current date and time. it strips timezone. int month. int minute. Datetime createDatetime(BigInteger) year. createDatetime(Datetimetz datetime. createTime() This creates a Time object set to the current time. as with Date above. createTime(Datetime datetime) This ignores any timezone offset. int day. int hour. int second. The Timezone offset is to be set only if specified in the string. Boolean normalize) This is a Boolean that. it strips timezone as with Date previously mentioned. createDatetime(Date date. int second. Boolean normalize) This is a Boolean that. int day. int minute. int minute. If it is set to False. int millisecond) createTime(Text isoFormatTime) This ignores any timezone offset. int minute.

and defaults to zulu time if not specified. int millisecond. int minutes. Time time. months. int months. int second. int timezone_offset) This is a constructor of value spaces that a java. months. Integer offset_minutes) createDatetimetz(Date date. int seconds) This obtains a new instance of a Duration specifying the Duration as isPositive. BigDecimal seconds) This obtains a new instance of a Duration specifying the Duration as isPositive. int timezone_offset) This is a constructor allowing for complete value spaces allowed by W3C XML Schema 1. int second. createDuration(long durationInMilliSeconds) This obtains a new instance of a Duration specifying the Duration as milliseconds. int days. BigInteger days.0 recommendation for xsd:dateTime and related built-in datatypes.184 | Appendix B Business Data Scripting Type Name Datetimetz Factory Method createDatetimetz(BigInteger) year. Business Data Services Guide . int hours. int month. int minute.util. It takes the timezone offset from string. createDuration(boolean isPositive. days. createDuration(String lexicalRepresentation) This obtains a new instance of a Duration specifying the Duration as its string representation PnYnMnDTnHnMnS. days. int month. Duration createDuration(boolean isPositive. minutes and seconds. int hour. BigInteger minutes. years. createDatetimetz(Datetime datetime. BigInteger months. hours. int day. int hour.GregorianCalendar instance would need to convert to an XMLGregorianCalendar instance. hours. BigInteger hours. int day. BigInteger years. int years. Integer offset_minutes) createDatetimetz(String lexicalRepresentation) This creates a new Datetimetz by parsing the String as a lexical representation. createDateTimetz() This creates a Datetimetz object set to the current date and time. BigDecimal fractionalSecond. years. createDatetimetz(int year. seconds. int minute. minutes.

HALF_UP.0/docs/api/java/math/MathContext.5. DOWN. createBigDecimal (Text) createBigDecimal (BigInteger) MathContext createMathContext(Integer setPrecision) createMathContext(Integer setPrecision. Return Type BigInteger Function createBigInteger(Integer) createBigInteger(Text) createBigInteger(BigDecimal) Comments BigDecimal createBigDecimal(Integer) createBigDecimal(Decimal) This uses an implicit MathContext. Business Data Services Guide .Static Factory Methods 185 | ScriptUtil The following methods are used to create objects of the following types used in TIBCO BPM. Some of the functions provided by the ScriptUtil factory are also supported in an IpeScriptUtil factory. UP. up. and String Functions on page 186. RoundingMode setRoundingMode) .html. the size of the mantissa). For more information about MathContext. See IpeScriptUtil (and ScriptUtil) Conversion. see http://java. It is the scale parameter in BigDecimal methods that specifies the number of decimal places that should be maintained in the objects.sun. UNNECESSARY Boolean createBoolean(Text booleanText) The MathContext object specifies the number of digits used to store the number (that is. Date and Time. See Other Supported Methods on page 204 for more details on this format. for more information. down. RoundingMode is an enumeration with the following values: CEILING. and nearest to use). HALF_EVEN.DECIMAL64. MathContext is not used when creating BigDecimal objects unless otherwise stated. FLOOR. and also how to round numbers (of various forms. HALF_DOWN.com/j2se/1.

expressed in arithmetic form "date + num". Returns the fractional part of the seconds of the duration.getMilliseconds(srcField. Functions relating to the internal operations of iProcess or its environment are not supported. Comments IpeScriptUtil (and ScriptUtil) Conversion. "time . Operations of this kind in BPM should be performed by the supported add() or subtract() methods on the date and time objects.integerSigned = ScriptUtil.du ration). Return Type BigDecimal Integer Function Prototype Duration getFractionalSeconds(Duration dur) getMilliseconds(Duration dur) dstField. and String Functions The following functions are supported both in the ScriptUtil factory and. 20/08/2009. in an IpeScriptUtil factory designed for assistance in migrating iProcess scripts to BPM.186 | Appendix B Business Data Scripting The following additional ScriptUtil functions are provided to enhance the basic interfaces provided for the XMLGregorianCalendar and Duration objects.DATESTR(DateTimeUtil.<FunctionName> IpeScriptUtil. Decimal NUM(Text) Field = ScriptUtil. and so on. iProcess expressions support the addition and subtraction of dates and times.cr eateDate()). Date and Time.time". Business Data Services Guide .NUM("123"). for compatibility with the TIBCO iProcess™ Suite. Returns the fractional second part of the duration measured in milliseconds. Syntax and Example Conversion Functions DATESTR(Date) Field = ScriptUtil. Converts a date field into a locale-specific string. for example. Comments Converts String to Decimal. You can access these functions using either of the following: • • Return Type Text ScriptUtil.<FunctionName>.

4 Delete all trailing spaces. Text STRCONVERT(Text TEXT. Converts a time field into a locale-specific string. Text TIMESTR(TIME) Business Data Services Guide .30" Converts from Decimal to a string with a specified number of decimal places. such as NEWLINE. since these cannot be input into a field. Depending on which bits are set in the opcode parameter.255. Returns a lowercase copy of the string passed in. Text STRTOLOWER(TEXT) ScriptUtil. into a string. Integer OPCODE) ScriptUtil. Text STRTOUPPER(TEXT) ScriptUtil. 32 Convert to uppercase. Comments Used for adding special characters.Static Factory Methods 187 | Return Type Text Syntax and Example SPECIALCHARS(Text) ScriptUtil. Supports \n.the result is returned: 1 Delete all spaces. 2 Delete all leading spaces. \t and \\. 21:23. 16 Convert to lowercase.STR(2.STRTOUPPER("test").2).3. // Generate "2. Text STR(Decimal DECIMAL.STRTOLOWER("TEST").32). Returns an uppercase copy of the string passed in.SPECIALCHARS("Your test results are\r\n English=80 \r\n Maths=90"). where nnn is a 3 digit decimal number in the range 000 . 8 Reduce sequences of multiple spaces to single spaces. Integer DECIMALS) ScriptUtil. iProcess also supports \nnn. the following conversions are applied to the text parameter .STRCONVERT("test". \r. for example.

Adds an offset to a time. The new time is from the original time. Integer dMo. createDate().CALCTIMECARRYOVER( DateTimeUtil. Integer dHr.cr eateDate("2001-10-08")). Integer dMi) carryDays = ScriptUtil. Integer MINSNUM (Time time) DateTimeUtil. Integer dWk.HOURNUM(DateTimeUtil.createTime("06:24:00")). for the specified date. createTime("12:00:00"). an offset expressed as a number of days is not restricted to the number of days in a week or a month.MINSNUM(DateTime Util.CALCDATE(DateTimeUtil.DAYNUM(DateTimeUtil.DATE(31. 0. Returns the minutes from the specified time. the function would return 2 (or -2 for -48hours).CALCTIME(DateTimeUtil. Integer dMi) newTime = ScriptUtil. 0). Integer dDy. Integer mon.createTime("12:00:00"). Returns the hour of the specified time. so for a 48 hour offset. Date and Time Functions Time Time CALCTIME(Time time. Date DATE(Integer day. createTime("06:24:00")). 0.12. Returns the day of the month of the specified date.40). for example. Business Data Services Guide .2. Monday. Integer CALCTIMECARRYOVER(Time time. The function returns an integer whose value is the number of days apart.DAYSTR(DateTimeUtil. Comments Adds an offset to a date.40).188 | Appendix B Business Data Scripting Return Type Date Syntax and Example CALCDATE(Date date. Returns the day of the week as a string.2009) Integer DAYNUM (Date date) ScriptUtil. Integer year) ScriptUtil. Adds an offset to a time. 1. The time plus offset is returned by the function. for example. Constructs a Date. Note that the offset is not restricted by the units used. Integer dYr) ScriptUtil.crea teDate("2001-10-08")). Integer dHr. Integer HOURNUM (Time time) ScriptUtil. Text DAYSTR (Date date) ScriptUtil.2 .

Comments Returns the month number (1-12) from the specified date. Count the number of characters in a string.SUBSTR("abcdefgh". Reverse search for substring in string. Constructs a time. "junkabcdefs").createDate("2001-10-08")). String Functions Returns the year from the specified date. Integer Integer WEEKNUM (Date date) ScriptUtil. "junkabcdefs"). Time TIME (Integer hours. Returns the month name from the specified date.integerSigned = ScriptUtil. for example. The indices are 1-based.RSEARCH("abc".c reateDate("2001-10-08")).0). BigDecimal getFractionalSecond(Duration dur) dstField.MONTHSTR(DateTimeUtil .duration).YEARNUM(DateTimeUtil. Returns "def".getFractionalSecond(srcFiel d.STRLEN("abcdef"). Returns "5". Returns the fractional part of the seconds of the duration (0 <= value < 1. Text SUBSTR ScriptUtil. Business Data Services Guide . createDate("2001-10-08")).TIME(6. 3. 3). Integer SEARCH ScriptUtil. Integer minutes) ScriptUtil. returning the string length. Integer STRLEN (Text) ScriptUtil. Integer YEARNUM (Date date) ScriptUtil.24).MONTHNUM(DateTimeUt il.SEARCH("abc". The indices are 1-based.createDate("2001-10-08")). January.Static Factory Methods 189 | Return Type Integer Syntax and Example MONTHNUM (Date date) ScriptUtil. Search for substring in string. Integer RSEARCH ScriptUtil. The indices are 1-based. Returns "5". Text MONTHSTR (Date date) ScriptUtil.WEEKNUM(DateTimeUtil. Returns the week number from the specified date.

Copies all the objects in the source List returning a new List that can be passed to the add All() method of another List.integerSigned = ScriptUtil.addAll(ScriptUtil.du ration). List<BDSObject> copyAll(SrcBDSObjectList) destList. since each BDS object can only be referenced from one collection.copyAll (sourceList)). It is not for use with Process Array fields. Note that this is for BDS objects only.getMilliseconds(srcField.190 | Appendix B Business Data Scripting Return Type Int Syntax and Example getMilliseconds(Duration dur) dstField. Comments Returns the duration measured in milliseconds BDSObject copy(BDSObject) Copies a BDS object as a BDS Object so it can be included in a second collection. Business Data Services Guide .

Compares this BigInteger with the specified Object. Returns a BigInteger whose value is (this divided by val). Date and Time. and String Functions Duration Methods Text (String) Methods Fixed Length Integer (BigInteger) Methods The following methods using the BigInteger numeric format are supported in TIBCO BPM. Returns the minimum of this BigInteger and val. Compares this BigInteger with the specified Object for equality. including the following: • • • • • Fixed Length Integer (BigInteger) Methods Fixed Point Decimal (BigDecimal) Methods IpeScriptUtil (and ScriptUtil) Conversion. Business Data Services Guide . Type BigInteger BigInteger int int BigInteger boolean BigInteger BigInteger BigInteger Method abs() add(BigInteger val) compareTo(BigInteger val) compareTo(Object o) divide(BigInteger val) equals(Object x) gcd(BigInteger val) max(BigInteger val) min(BigInteger val) Notes Returns a BigInteger whose value is the absolute value of this BigInteger. Returns a BigInteger whose value is (this plus val). Returns the maximum of this BigInteger and val. Returns a BigInteger whose value is the greatest common divisor of abs(this) and abs(val). Compares this BigInteger with the specified BigInteger.BOM Native Type Methods 191 | BOM Native Type Methods This section describes supported methods using different BOM native types.

and the IEEE 754R default (which is equivalent to "double" arithmetic). or passed directly to the relevant methods of BigDecimal. it is necessary to specify what precision to use in certain circumstances. Returns a BigInteger whose value is (minus this). BigDecimal format can cope with arbitrarily large numbers. tax calculations). Returns a BigInteger whose value is (this minus val). However. a rounding mode of HALF_EVEN. Returns a BigInteger whose value is (this times val).192 | Appendix B Type BigInteger BigInteger BigInteger BigInteger BigInteger BigInteger Business Data Scripting Method mod(BIgInteger m) multiply(BigInteger val) negate() pow(int exponent) remainder(BigInteger val) subtract(BigInteger val) Notes Returns a BigInteger whose value is (this mod m). a rounding mode of HALF_EVEN. seven digits. calculating one-third would produce an exception if precision is not specified. 34 digits. and the IEEE 754R default. The type of rounding to be used by a BigDecimal operation can be specified when creating a MathContext. a rounding mode of HALF_EVEN. For example. static MathContext DECIMAL64: A MathContext object with a precision setting matching the IEEE 754R Decimal64 format. BigDecimal supports three standard levels of precision: • static MathContext DECIMAL32: A MathContext object with a precision setting matching the IEEE 754R Decimal32 format. the rounding rules can be specified when a particular method of rounding is required for a particular type of calculation (for example. Returns a BigInteger whose value is (this % val). Returns a BigInteger whose value is (thisexponent). when using the BigDecimal type. 16 digits. static MathContext DECIMAL128: A MathContext object with a precision setting matching the IEEE 754R Decimal128 format. Possible values are: • CEILING Business Data Services Guide . Fixed Point Decimal (BigDecimal) Methods Some numeric objects in BPM are expressed in BigDecimal format. • • In addition. and the IEEE 754R default (which is equivalent to "float" arithmetic).

divisor). divisor).scale()). BigDecimal divide(BigDecimal divisor.scale()).divisor. an ArithmeticException is thrown. augend).BOM Native Type Methods 193 | • • • • • • • FLOOR UP DOWN HALF_UP HALF_DOWN HALF_EVEN UNNECESSARY The following table lists the methods available for BigDecimal objects. MathContext mc) compareTo(BigDecimal val) divide(BigDecimal divisor) Returns a BigDecimal whose value is (this + with rounding according to the context settings.scale(). Returns a BigDecimal whose value is (this + and whose scale is max(this. Returns a BigDecimal whose value is (this / and whose preferred scale is (this.scale() . RoundingMode roundingMode) divide(BigDecimal divisor. augend. int BigDecimal Compares this BigDecimal with the specified BigDecimal. If the exact quotient cannot be represented (because it has a non-terminating decimal expansion). Business Data Services Guide . and whose scale is this. BigDecimal add(BigDecimal augend) BigDecimal add(BigDecimal augend. / BigDecimal divisor). augend).scale(). MathContext mc) Returns a BigDecimal whose value is (this and whose scale is as specified. int scale. Returns a BigDecimal whose value is (this / with rounding according to the context settings. Type BigDecimal Method abs() Notes Returns a BigDecimal whose value is the absolute value of this BigDecimal.

BigDecimal Returns a BigDecimal whose value is the integer part of the quotient (this / divisor) rounded down. and whose scale is × BigDecimal BigDecimal BigDecimal BigDecimal (this. Returns a BigDecimal whose value is (this multiplicand). RoundingMode roundingMode) divideToIntegralValue(BigD ecimal divisor) divideToIntegralValue(BigD ecimal divisor. BigDecimal Returns a BigDecimal whose value is (this × with rounding according to the context settings. multiplicand). to unlimited precision. Returns a BigDecimal whose value is (this divisor). MathContext mc) round(MathContext mc) divisor).scale()). BigDecimal Business Data Services Guide .scale(). BigDecimal BigDecimal Returns a BigDecimal whose value is (-this).194 | Appendix B Type Business Data Scripting Method divide(BigDecimal divisor. Returns a BigDecimal whose value is (thisn). Returns a BigDecimal rounded according to the MathContext settings. BigDecimal Returns a BigDecimal whose value is (this / and whose scale is this. Returns the precision of this BigDecimal. Returns the maximum of this BigDecimal and val. Returns a BigDecimal whose value is (this % with rounding according to the context settings. and whose scale is this. Returns a BigDecimal whose value is the integer part of (this / divisor). The power is computed exactly. MathContext mc) precision() remainder(BigDecimal divisor) remainder(BigDecimal divisor. Returns a BigDecimal whose value is (thisn). % BigDecimal int BigDecimal BigDecimal pow(int n. Returns the minimum of this BigDecimal and val. MathContext mc) negate() pow(int n) Notes divisor).scale() + multiplicand.scale(). MathContext mc) max(BigDecimal val) min(BigDecimal val) multiply(BigDecimal multiplicand) multiply(BigDecimal multiplicand.

with rounding according to the context settings. subtrahend. Returns a string representation of this BigDecimal. using engineering notation if an exponent is needed. subtrahend). MathContext mc) toEngineeringString() BigDecimal Returns a BigDecimal whose value is (this subtrahend). but with any trailing zeros removed from the representation. Returns a BigDecimal whose value is (this and whose scale is max(this. Returns the size of an ulp (a unit in the last place) of this BigDecimal. Returns a BigDecimal whose scale is the specified value. Returns the string representation of this BigDecimal. Returns a BigDecimal whose numerical value is equal to (this * 10n). RoundingMode roundingMode) int BigDecimal signum() stripTrailingZeros() BigDecimal subtract(BigDecimal subtrahend) subtract(BigDecimal subtrahend. Returns a BigDecimal whose scale is the specified value.scale(). Returns a BigDecimal that is numerically equal to this one. using scientific notation if an exponent is needed. Returns the signum function of this BigDecimal. BigDecimal setScale(int newScale. String String String toPlainString() toString() BigDecimal ulp() Business Data Services Guide .BOM Native Type Methods 195 | Type int BigDecimal BigDecimal Method scale() scaleByPowerOfTen(int n) setScale(int newScale) Notes Returns the scale of this BigDecimal. Returns a string representation of this BigDecimal without an exponent field.scale()). and whose unscaled value is determined by multiplying or dividing this BigDecimal's unscaled value by the appropriate power of ten to maintain its overall value. and whose value is numerically equal to this BigDecimal's.

196 | Appendix B Type BigInteger Business Data Scripting Method unscaledValue() Notes Returns a BigInteger whose value is the unscaled value of this BigDecimal. Business Data Services Guide .

BOM Native Type Methods 197 | Date. getHour() Return hours or DatatypeConstants. Time. Y Y Y Y Y Y Y Y Y int compare(XMLGregorian Calendar xmlGregorianCalendar) Compare two instances of XMLGregorianCalendar Y Y Y Y n/a n/a n/a n/a n/a boolean equals(Object obj) Indicates whether parameter obj is equal to this one. Y n/a Y Y Y n/a Y Y n/a BigDecima l int getFractionalSecond() Return fractional seconds. Datetime and Datetimetz (XMLGregorianCalendar) Methods Date Time Date Time Date Timetz gDay gMonth gMonthDay gYear gYear Month Type Method void add(Duration duration) Add duration to this instance.FIELD _UNDEFINED. Y Y Y Y Y Y Y Y Y void clear() Unset all fields to undefined.FIE LD_UNDEFINED. Y Y Y Y Y Y Y Y Y int getDay() Return day in month or DatatypeConstants. n/a Y Y Y n/a n/a n/a n/a n/a n/a Y Y Y n/a n/a n/a n/a n/a Business Data Services Guide .

FIE LD_UNDEFINED if this optional field is not defined.FIE LD_UNDEFINED. n/a Y Y Y n/a n/a n/a n/a n/a int getTimezone() Return timezone offset in minutes or DatatypeConstants.198 | Appendix B Business Data Scripting Date Time Date Time Date Timetz gDay gMonth gMonthDay gYear gYear Month Type Method int getMillisecond() Return millisecond precision of getFractionalSecond() n/a Y Y Y n/a n/a n/a n/a n/a int getMinute() Return minutes or DatatypeConstants. n/a n/a Y Y n/a n/a n/a n/a n/a Business Data Services Guide .FIE LD_UNDEFINED. Y n/a Y Y n/a Y Y n/a Y int getSecond() Return seconds or DatatypeConstants.FIE LD_UNDEFINED. n/a Y Y Y n/a n/a n/a n/a n/a int getMonth() Return number of month or DatatypeConstants.

FIELD _UNDEFINED. n/a Y Y Y n/a n/a n/a n/a n/a void setMonth(int month) Set month.0 dateTime datatype field for year or DatatypeConstants. n/a Y Y Y n/a n/a n/a n/a n/a void setMillisecond(int millisecond) Set milliseconds. Y n/a Y Y n/a Y Y n/a Y void setSecond(int second) Set seconds. n/a Y Y Y n/a n/a n/a n/a n/a void setHour(int hour) Set hours.BOM Native Type Methods 199 | Date Time Date Time Date Timetz gDay gMonth gMonthDay gYear gYear Month Type Method int getYear() Return low order component for XML Schema 1. n/a Y Y Y n/a n/a n/a n/a n/a Business Data Services Guide . Y n/a Y Y n/a n/a n/a Y Y void setDay(int day) Set days in month. n/a Y Y Y n/a n/a n/a n/a n/a void setMinute(int minute) Set minutes. Y n/a Y Y Y n/a Y n/a n/a void setFractionalSecond(Big Decimal fractional) Set fractional seconds.

int second. second. n/a Y Y Y n/a n/a n/a n/a n/a void setTime(int hour.200 | Appendix B Business Data Scripting Date Time Date Time Date Timetz gDay gMonth gMonthDay gYear gYear Month Type Method void setTime(int hour. including the optional infinite precision fractional seconds. and millisecond fields as: setTime(int hour. int second) setMillisecond(int millisecond) Business Data Services Guide . n/a Y Y Y n/a n/a n/a n/a n/a This method should not be used in scripts where the time field has been set before the script. int millisecond) Set time as one unit. int minute. including optional milliseconds. int minute. n/a Y Y Y n/a n/a n/a n/a n/a void setTime(int hour. int minute. BigDecimal fractional) Set time as one unit. int second. In this case it is best to use two separate calls to set the hour. int minute. minute. int second) Set time as one unit.

String toXMLFormat() Return the lexical representation of this instance. n/a n/a Y Y n/a n/a n/a n/a n/a void setYear(BigInteger year) Set low and high order component of XSD dateTime year field.BOM Native Type Methods 201 | Date Time Date Time Date Timetz gDay gMonth gMonthDay gYear gYear Month Type Method void setTimezone(int offset) Set the number of minutes in the timezone offset. Y n/a Y Y n/a n/a n/a Y Y This method should not be used in scripts where the date field has been set before the script. In this case it is best to use setYear(BigInteger year) instead. Y n/a Y Y n/a n/a n/a Y Y void setYear(int year) Set year of XSD dateTime year field. Y Y Y Y Y Y Y Y Y Business Data Services Guide .

boolean isShorterThan(Duration duration) Checks if this duration object is strictly shorter than another Duration object. int getHours() Obtains the value of the HOURS field as an integer value. this+rhs. boolean isLongerThan(Duration duration) Checks if this duration object is strictly longer than another Duration object. int getSeconds() Obtains the value of the SECONDS field as an integer value. int getMinutes() Obtains the value of the MINUTES field as an integer value. int getYears() Get the years value of this Duration as an int or 0 if not present. or 0 if not present. int getDays() Obtains the value of the DAYS field as an integer value. Business Data Services Guide . or 0 if not present. int getMonths() Obtains the value of the MONTHS field as an integer value. or 0 if not present. or 0 if not present. or 0 if not present. boolean equals(Object duration) Checks if this duration object has the same duration as another Duration object. Duration multiply(BigDecimal factor) Computes a new duration whose value is factor times longer than the value of this duration.202 | Appendix B Business Data Scripting Duration Methods Type Duration Method add(Duration rhs) Computes a new duration whose value is int compare(Duration duration) Partial order relation comparison with this Duration instance.

fromIndex]) lastIndexOf(str[. Methods charAt(index) indexOf(str[. Extracts the characters from a string. between two specified indices. Extracts the characters from a string. Returns the position of the first found occurrence of a specified value in a string. Converts a string to lowercase letters. Extracts a part of a string and returns a new string. Searches for a match between a substring (or regular expression) and a string. Method Description Properties length Returns the length of a string.BOM Native Type Methods 203 | Type Duration Method multiply(int factor) Computes a new duration whose value is factor times longer than the value of this duration. and replaces the matched substring with a new substring. slice() substr() substring() toLowerCase() toUpperCase() Business Data Services Guide . Text (String) Methods The following methods are supported for use with String objects. Converts a string to uppercase letters. and through the specified number of characters. beginning at a specified start position. Duration subtract(Duration rhs) Computes a new duration whose value is this-rhs.fromIndex]) replace() Returns the character at the specified zero-based index. Returns the position of the last found occurrence of a specified value in a string.

Removes the element at the specified position in this list. Methods not described are not supported. Returns true if this list contains no elements. Replaces the element at the specified position in this list with the specified element. Inserts the specified element at the specified position in this list. Type boolean void void boolean E boolean ListIterator<E> E boolean E int Method add(E o) add(int index. Returns the number of elements in this list. Removes the first occurrence in this list of the specified element. E element) clear() contains(Object o) get(int index) isEmpty() listIterator() remove(int index) remove(Object o) set(int index.204 | Appendix B Business Data Scripting Other Supported Methods The methods described in the following sections are supported for the types of object listed. Returns the element at the specified position in this list. page 205 List Methods The following List methods are supported for use in manipulating a range of values. Returns true if this list contains the specified element. Removes all of the elements from this list. E element) size() Notes Appends the specified element to the end of this list. Returns a list iterator of the elements in this list (in proper sequence). This section includes: • • List Methods. page 204 ListIterator Methods. Business Data Services Guide .

Replaces the last element returned by next or previous with the specified element. boolean ListIterator Methods The following ListIterator methods are supported. Returns true if this list iterator has more elements when traversing the list in the reverse direction. exclusive. inclusive. Returns the next element in the list. int toIndex) addAll(Collection c) Notes Returns a view of the portion of this list between the specified fromIndex. Returns true if this list iterator has more elements when traversing the list in the forward direction. Returns the previous element in the list. Removes from the list the last element that was returned by next or previous. Type void boolean boolean E int E int void void Method add(E o) hasNext() hasPrevious() next() nextIndex() previous() previousIndex() remove() set(E o) Notes Inserts the specified element into the list. and toIndex. Returns the index of the element that would be returned by a subsequent call to next. Returns the index of the element that would be returned by a subsequent call to previous. Business Data Services Guide .Other Supported Methods 205 | Type List Method subList(int fromIndex. Appends all of the elements in the specified collection to the end of this list. in the order that they are returned by the specified collection's iterator (optional operation).

Returns x. Methods abs(x) acos(x) asin(x) atan(x) ceil(x) cos(x) exp(x) floor(x) log(x) max(x.718).693). Returns Pi (approximately 3. rounded up to the nearest integer. Returns the value of Ex... Returns the natural logarithm (base E) of x..302).y) Business Data Services Guide Returns the absolute value of x. . .y. Method Description Properties E LN2 LN10 PI Returns Euler’s number (approximately 2. z. z. n) pow(x. Returns the arctangent of x. . . Returns the cosine of x (where x is in radians).14159). in radians. Returns x. Returns the arccosine of x.. in radians. as a numeric value between -Pi/2 and +Pi/2 radians. rounded down to the nearest integer. Returns the number with the lowest value. using 2 arguments. Returns the natural logarithm of 2 (approximately 0. Returns the natural logarithm of 10 (approximately 2. using 2 arguments. n) min(x. Returns the number with the highest value.206 | Appendix B Business Data Scripting Other JavaScript Functions Some other JavaScript methods are supported for Math objects. . Returns the arcsine of x.y. Math Methods The following methods are supported for use with Math objects. Returns the value of x to the power of y.

Returns the tangent of the angle x. Rounds x to the nearest integer.Other JavaScript Functions 207 | Method random() round(x) sin (x) sqrt(x) tan(x) Description Returns a random number between 0 and 1. Returns the sine of x (where x is in radians). Returns the square root of x. Business Data Services Guide .

208 | Appendix B Business Data Scripting Business Data Services Guide .

| 209 Appendix C Process Scripting TIBCO Business Studio used with TIBCO BPM enables you to write scripts for various purposes. This appendix describes the additional functions that are provided to help with process scripting. page 210 Business Data Services Guide . Topics • Process Instance Attributes and Methods.

Description Returns priority of the Process Instance Returns Process Template name Returns description of Process Returns date/time the Process Instance was started Returns priority of the Process Instance Returns originator of Process Instance.getName(). priority. e. pvm:0a128cu Business Data Services Guide .210 | Appendix C Process Scripting Process Instance Attributes and Methods This section summarizes the attributes and methods that are available for accessing information about process instances using the Process class. getPriority(). ou=system Returns Process Instance ID. description = Process. for example. getId(). priority = Process. getStartTime(). uid=admin. getDescription(). Attribute/Method priority : Integer getName() : String getDescription() : String getStartTime() : Datetimetz getPriority() : Integer getOriginator() : String getId() : String Example priority = Process.g. getOriginator(). id = Process. name = Process. originator = Process. start = Process.

addActivityLoop AdditionalInstances ("UserTask".1) typ = Process. started = Process.getActivityCom pletionTime('UserTask2' ). state = Process. userTask Returns task state.getActivityStart Time('UserTask2'). this will be the loop index for the nearest multi-instance embedded sub-process ancestor (defaulting to 0 if no multi-instance ancestor found). In nested multi-instance situations. done. for example.state Returns time task was started Returns time task was completed Business Data Services Guide . getActivityLoopIndex() Description • • • Retrieves most local loop index. for example. Adds additional instances to a multi-instance loop task while that task is in progress Returns task type. • • addActivityLoopAdd itionalInstances: (String . Index starts from 0 (zero) for first loop/multi-instance instance. the user can transfer an embedded sub-process loop index into a embedded sub-process local data field.Process Instance Attributes and Methods 211 | Attribute/Method getActivityLoopInde x() : Integer Example index = Process. Integer) getActivityType(Strin g) : String getActivityState(Strin g) : String getActivityStartTime( String) : Datetimetz getActivityCompleti onTime(String) : Datetimetz add = Process.getActivityState( 'UserTask2'). completed = Process.getActivityType( 'UserTask2'). For a loop/multi-instance task or embedded sub-process this will be the loop index for this task/embedded sub-process. For a non-multi-instance task.

getActivityDead line('UserTask2'). 200.getActivityAttri bute('UserTask2'. Only Participant is supported as an attribute name.getActivityAttri bute('UserTask2'. Once a process instance has been created. String) : String Example deadtime = Process.'Pa rticipant'). 430 Only WorkItemId and Completer are supported as attribute names. priority = Process.'WorkIt emId'). 300 and 400.getOriginatorNa me() Returns the process instance originator login name.setPriority(). it can change its own priority. Valid entries are 100. getOriginatorName() : String name = Process. The default value is 200.getActivityArray Attribute('UserTask2'. String) : List<String> setPriority() : Integer attrs = Process. completer = Process. getActivityArrayAttr ibute(String. workItemId = Process.212 | Appendix C Process Scripting Attribute/Method getActivityDeadline( String) : Datetimetz getActivityAttribute( String. for example. Business Data Services Guide . Description Returns task deadline time Returns value of attribute. Returns array of attribute values.'Compl eter').

Topics • • • WorkManagerFactory. page 215 OrgModel.| 213 Appendix D Work Item Scripting TIBCO Business Studio used with TIBCO BPM enables you to write scripts for various purposes. page 214 WorkItem. This appendix describes the additional functions that are provided to help with work item scripting. page 219 Business Data Services Guide .

See below for methods.214 | Appendix D Work Item Scripting WorkManagerFactory This table lists the WorkManagerFactory attributes and methods provided. See below for properties & methods Comments Business Data Services Guide . Attribute / Method WorkManagerFactory getOrgModel() : OrgModel getOrgModelByVersion() : OrgModel getWorkItem() : WorkItem Returns an OrgModel object. Returns WorkItem object. OrgModel must have a parameter to specify which version.

Returns the version number of the work item. Returns a resource that has this work item. The description of the work item. Attribute / Method WorkItem cancel : Boolean description : Text priority : Integer getId() : Integer getVersion() : Integer getWorkItemResource() : EntityDetail Cancels an API that exists in BRM. The specified priority of the work item. Returns the work item’s unique ID. this will contain all the entities to which the item was originally offered. Returns a work item resource object for the work item. If the item was originally offered to more than one organizational entity and is now allocated.WorkItem 215 | WorkItem This table lists the WorkItem attributes and methods provided. It contains all the organizational entities whose work list currently contains this work item. Comments getWorkItemOffers() : List<EntityDetail> Business Data Services Guide .

on a user task schedule script). See description above.648 to 2. workItemAttributes.147. The attribute1 work item attribute can be assigned integer values in the range -2. They are available where the WorkManagerFactory object can be accessed (for example. attribute2 can be used to hold a customer name.483.attribute2: Text workItemAttributes.216 | Appendix D Work Item Scripting Attribute / Method getContext() : ItemContext Comments Returns the work item's context information and provides read only methods to access the following information: • • • • • • activity ID activity name application name application instance application ID application instance description getSchedule() : ItemSchedule Returns the work item's schedule information and provides read only methods to access the start date and target date.attribute1: Integer workItemAttributes. For example.647.attribute4: Text Limited to 64 characters in length.483. and attribute1 a customer reference number to aid work list sort and filter choices.attribute3: Text workItemAttributes. Business Data Services Guide . These work item attributes (attribute1 and the others listed below) can be used to contain data associated with a work item and to sort and filter your work list.147.

workItemAttributes. This can be assigned Decimal or BigDecimal values.attribute7: DateTime workItemAttributes.attribute6: DateTime workItemAttributes.attribute10: Text workItemAttributes. Limited to a maximum of 20 characters .anything larger will be truncated.attribute13: Text workItemAttributes.attribute11: Text workItemAttributes.attribute9: Text workItemAttributes.WorkItem 217 | Attribute / Method workItemAttributes. See description above.attribute12: Text workItemAttributes.attribute8: Text workItemAttributes. See description above. See description above.attribute14: Text ItemContext getActivityId() : Text getActivityName() : Text getAppName() : Text getAppInstance() : Text getAppId() : Text getAppInstanceDescription() : Text ItemSchedule getStartDate() : Datetime getTargetDate : Datetime Business Data Services Guide .attribute5: BigDecimal Comments See description above.

Business Data Services Guide .218 | Appendix D Work Item Scripting When using getWorkItem() or getSchedule(). when there is a 0 length value. "". An empty object. note that the following will be shown: • • A null object when there is a null value.

the return value will be an empty list. the return value will be an empty list. Returns the list of EntityDetails that describe the Human Resources identified by the given name. If no such Organizational Unit exists. Returns the single EntityDetail that describes the Human Resource identified by its GUID. Comments ouByName(name:Text) : List<EntityDetail> groupByGuid(guid:Text) : EntityDetail groupByName(name:Text) : List<EntityDetail> resourceByGuid(guid:Text) : EntityDetail resourceByName(name:Text) : List<EntityDetail> Business Data Services Guide . Attribute / Method OrgModel ouByGuid (guid:Text) : EntityDetail Returns the single EntityDetail that describes the Organizational Unit identified by its GUID. the return value will be null. the return value will be an empty list. If no such Human Resource exists. If no such Group exists. Returns the list of EntityDetails that describe the Organizational Units identified by the given name.OrgModel 219 | OrgModel This table lists the OrgModel attributes and methods provided. Returns the single EntityDetail that describes the Group identified by its GUID. If no such named Groups exist. Returns the list of EntityDetails that describe the Groups identified by the given name. If no such named Human Resources exist. If no such named Organizational Units exist. the return value will be null. the return value will be null.

the return value will be null. If no such Human Resource exists. If no such named Organizations exist. the return value will be an empty list.220 | Appendix D Work Item Scripting Attribute / Method resourceByLdapDN(ldapDN:Text): List<EntityDetail> Comments Returns the single EntityDetail that describes the Human Resource identified by its Primary LDAP DN. Returns the single EntityDetail that describes the Organization identified by its GUID. Returns the single EntityDetail that describes the Position identified by its GUID. Returns the list of EntityDetails that describe the Organizations identified by the given name. Returns the list of EntityDetails that describe the Positions identified by the given name. positionByGuid(guid:Text) : EntityDetail positionByName(name:Text) : List<EntityDetail> orgByGuid(guid:Text) : EntityDetail orgByName(name:Text) : List<EntityDetail> EntityDetail getEntityType() : Text Returns the type identifier for this organizational model entity. the return value will be an empty list. Example values are: • • • • • ORGANIZATION ORGANIZATIONAL_UNIT GROUP POSITION RESOURCE Business Data Services Guide . If no such Position exists. the return value will be null. If no such named Positions exist. the return value will be null. If no such Organization exists.

this will return the EntityDetails that describe the Positions to which the Resource is associated. The name of the organizational model entity.OrgModel 221 | Attribute / Method getGroups() : List<EntityDetail> Comments For Human Resource entities. For example. this will return the EntityDetails that describe the Groups to which the Resource is associated. for a Position. For entities of Entity Type RESOURCE. only HUMAN Resources are supported. For Human Resource entities this is the Distinguishing Name (DN) of the LDAP entry from which the Resource is derived. Business Data Services Guide . For Human Resource entities. For Human Resource entities. this will return the Resource entities associated with that entity. this identifies the type of Resource: • • • "DURABLE" "CONSUMABLE" "HUMAN" getPositions() : List<EntityDetail> getName() : Text getGuid() : Text getAlias() : Text getDn() : Text getResourceType() : Text Currently. it will be all the Resources that hold that Position. this is the Alias of the LDAP Source from which the Resource is derived. getResources() : List<EntityDetail> For non-Resource entity types (such as Positions and Groups). The GUID that uniquely identifies the organizational model entity.

222 | Appendix D Work Item Scripting Attribute / Method getAttributeValue(attrName:Text) :List<Text> Comments For Resource entity types. this will return the value of the named Resource Attribute held by that Resource entity. this will return the data type of the named Resource Attribute. Possible values are: • • • • • • • • • string decimal integer boolean datetime date time enum enumset getAttributeType(attrName:Text) : Text Business Data Services Guide . For Resource entity types.

BOM See Business Object Model (BOM). if there is more than one BOM that contains an OrderId class. Primitive Types. for instance. and the Performer field is a special type of Text field that contains an RQL query string. Department-Teacher. may contain date and orderNumber attributes. This can be useful. those that are defined within a BOM. but one object is related to the other object with a “has-a” type of relationship. or ID type (or an Attachment type). Objects in an aggregation relation have their own lifecycle. BOM Editor refers to the BOM Native Types as Primitive Types. The type of attribute can be one of the following: • • • Primitive Type (see below) Enumerated Type (see below) Class Type (see below) B Basic Type Process Template field values can be of a Basic Type or an External Reference Type that refers to a BOM Class. Business Data Services Guide . BDS See Business Data Services. Duration. BOM Object. for example. which are not pre-defined. The Basic Types are: • • • • • • • Text Decimal Integer Boolean Date Time Date Time • Performer Note: There is no Datetimetz. have the package name of the BOM against them when selecting the Type to use. This is the most general of the UML relationships. an Order or a Customer. Association Association is a relationship where all the objects have their own lifecycle and there is no parent.| 223 Glossary A Aggregation Aggregation is a specialized form of association. The Basic Types are also known as Process Types. amongst others. URI. BOM Class An entity in the BOM that represents a particular part of the application data. A BOM Class is a template for a Business Object. Attribute A property of a Class. for example. When choosing a type for an attribute. for example. an Order class. for example. For example: is the Teacher-Student relationship.

For example. This is not the case for Aggregation. name. for example. or used as types of attributes of classes: • • • • • Boolean. Time. Business Object An instance of a BOM Class. TUESDAY. These types of relationships are characterized by the "is-a" phrase. Oak "is-a" Tree. Order. and Tree is a generalization of the more specific Oak class. Business Data Services Guide . MONDAY. Object. the classrooms will be destroyed too. Datetime. For example.224 | Glossary BOM Native Types There are 13 predefined primitive types (or 15. Duration URI. E Enum or Enumerated Type A type that can have a restricted set of values. In this relationship if the parent object is deleted. and date. SATURDAY G Generalization The Generalization relationship indicates that one of the two related classes (the subtype) is considered to be a specialized form of the other (the super type). Datetimetz. for example. Each of these entities will have a number of attributes. C Composition Composition is a specialized form of the Aggregation relationship. Business Data Services A Component of AMX BPM that handles all the application data needs of the AMX BPM system. FRIDAY. and Orderline. Do not confuse this term with Object BOM Native Type. Business Object Model (BOM) The Model representing the structure of the application data created using the BOM editor. DayOfWeek can have the following values: SUNDAY. and supertype is considered as a Generalization of the subtype. there is a Business Object that represents and holds information about a particular customer. if you count the numeric sub-types) that can be used to build other Primitive Types. address. An example of this type of relationship is School-Classroom. If the School is destroyed. Community Site A type of portal site created and used by business users in support of team communications. Attachment * * N. THURSDAY. For example. WEDNESDAY. It can also be imported from an XSD or WSDL file. ID. An Oak is a Specialization of the more general Tree class.B. for a Customer class. Attachment type is not currently supported Business Data Structured data that contains information about real-world entities that an organization deals with. These objects will also be related to each other in different relationships and with different multiplicities. String Integer (Signed integer and Fixed integer sub-types) Decimal (Floating Point and Fixed Point sub-types) Date. Customer. all the child objects will be deleted too.

Process Template The definition of what a process should do. The object will either be a Business Object or a Basic Type. They must be of BOM Types or Basic Types. Process Instance An instance of a flow through a Process Template with data values that reflect the information being processed by this particular instance of the process.Glossary 225 | P Primitive Type In a BOM. UserTask A UserTask is a step in a process that is handled by a user and requires the user to complete a form. W WSDL WSDL stands for Web Service Definition Language. it is possible to define a type based on one of the BOM Native Types or another Primitive Type. and aggregation. When these Primitive Types are defined. it is possible to add some limitations using a regular expression or a range. Process Local Data Data that lives within a Process Instance. U UML Unified Modelling Language – an international standard modelling language supported by many tools. Data Fields of Primitive Types cannot be used in processes. Identifies different types of relationships that can exist between the objects being modelled. R RQL Resource Query Language – a language for selecting which resources can have access to a UserTask in a process. A file with a . A WSDL file can be imported by TIBCO Business Studio to make it easy to call web services. S Specialization.wsdl extension contains the definition of a Web Service. generalization/specialization. A user may Close a form so that they can complete it later. the user submits the values causing the changes to the field values to be saved. For example: resource(name="Clint Hill") Business Data Services Guide . for example: composition. Process Types See Basic Type. association. See Generalization. defining the format of the request and responses. On completing the form.

Business Data Services Guide .226 | Glossary X XSD XSD stands for XML Schema Definition. This other XML is used to pass data between processes. A file with a .xsd extension contains XML that defines the format that some other XML should take.