P. 1
tib_amx_bpm_bds_developer

tib_amx_bpm_bds_developer

|Views: 189|Likes:
Published by Karthik Bk

More info:

Published by: Karthik Bk on Dec 16, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

12/16/2011

pdf

text

original

Sections

  • Changes from the Previous Release of this Guide
  • Related Documentation
  • Business Data Services Documentation
  • Typographical Conventions
  • Connecting with TIBCO Resources
  • How to Access All TIBCO Documentation
  • How to Contact TIBCO Support
  • Chapter1 Introduction to BDS
  • Overview
  • Business Data Services (BDS)
  • Chapter2 Concepts
  • Object Orientation (OO)
  • BOM Class
  • Business Objects
  • Business Object Scope
  • Business Object Creation by Factory
  • Retrieving and Setting Business Object Attributes
  • Invoking Operations on Business Object Attributes
  • BOM Relationships and Process Local Data
  • Composition
  • Specialization and Generalization
  • Assignment by Value and by Reference
  • BOM Native Type or Primitive Type Object to Business Object Attribute
  • Assigning a Business Object
  • Assigning a Basic Type Object to a Process Data Field
  • The Significance of the Script Boundary
  • Chapter3 Business Data Definition
  • UML Relationships Supported by Process Local Data
  • BOM Native Types
  • Value Spaces for BOM Native Types
  • Table 3: Value Spaces for BOM Native Types
  • 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
  • Chapter4 BDS Generation and Business Data Usage in TIBCO BPM
  • BDS Plug-in Generation
  • BDS Design-time Validations
  • Validations in BOM Editor
  • Process Validations
  • BDS Runtime Validations
  • BOM Versions
  • Process Migration
  • Compatible Changes
  • Using BDS in Tasks
  • General
  • User Task
  • Script Task
  • Web Services
  • Business Data Scripting
  • Supplying xsi:type Information in XML Sent to TIBCO BPM
  • Chapter5 Business Data Scripting by Example
  • Factories
  • Creating a New Business Object
  • Create an Instance of a Class
  • Create a Copy of a Business Object
  • Using the Special Value Null
  • Checking for Null Attributes
  • Assigning a Null Value
  • Using Content Assist
  • Working with Single Instance Attributes of Business Objects
  • Multiple Instances of a BOM Class
  • In a Process Data Field
  • In a BOM Class Attribute
  • Working with Temporary Variables and Types
  • Loops Within Scripts
  • Looping Through Lists and Copying Elements in Lists
  • Scripting Containment Relationships
  • Using the List set() Method
  • Removing an Item from a List or a Containment Relationship
  • Scripting on Business Objects That Use Inheritance
  • Working with Strings or Text Fields
  • Working with Booleans
  • Working with Basic Integer Numbers
  • Table 9: Operators for Comparing Signed Integers
  • Working with Basic Decimal Numbers
  • Working with Dates and Times
  • Dates and Times
  • Durations
  • Using Date and Time Types with Durations
  • Comparing Dates and Times
  • Working with Enumerated Types (ENUMs)
  • Working with Primitive Types
  • Return Values from Scripts
  • Scripting with Web Services
  • Passing Arrays to Web Services
  • Parse Functions
  • parseInt()
  • parseFloat()
  • Chapter6 Advanced Scripting Examples
  • Working with Fixed Length Integers (BigInteger)
  • Working with Fixed Decimals (BigDecimal)
  • Creating and Initializing Fixed Decimal Values
  • Simple Operations
  • Rounding
  • Comparing Fixed Decimals and BigDecimals
  • Object BOM Native Type
  • Using the Object BOM Native Type
  • Restrictions
  • Object BOM Native Type and ScriptUtil.setObject()
  • Additional Javascript Global Functions
  • escape() and unescape()
  • encodeURI() and decodeURI()
  • encodeURIComponent() and decodeURIComponent()
  • Chapter7 Business Data Modeling Best Practice
  • Choose Appropriate Data Types
  • Use Sub-Packages to Aggregate Related Concepts
  • Process Data Field Granularity
  • BOM Class, Attribute and Variable Names
  • Reference a Common Business Object Model
  • Do Not Split a Namespace Across Projects
  • Do Not Modify Generated BOMs
  • Business Data Scripting Best Practice
  • Keep the Scripts Small
  • Ensure Business Objects Are Valid Before Scripts Complete
  • Check for Nulls
  • Use Comments in Scripts
  • Use Constant First when Comparing a Constant with a Variable
  • Chapter8 Troubleshooting
  • Viewing BDS-generated BDS Plug-in Hidden Projects
  • BDS Plug-in Generation Problems
  • Troubleshooting BDS Scripting
  • BDS Classes Do Not Appear or Changes Do Not Appear
  • Break Script into Smaller Scripts
  • Examine the Server Logs
  • Write Variable Values and Progress Updates from the Script to the BPM Log File
  • eval()
  • Use the Process Debugger
  • Catch Exceptions
  • AppendixASupplemental Information
  • Data Type Mappings
  • BOM Native Type to BDS Type Mapping
  • XSD Type to BDS Type Mapping
  • JDBC Database Type to BOM Data Type Mapping
  • Table 15: JDBC Database Type to BOM Data Type Mapping
  • Process Primitive Data Type Mapping
  • Unsupported XSD Constructs
  • BDS Limitations
  • BDS and Forms
  • Simple Type Default Values
  • Fixed Attribute Overwrite
  • Multiplicity at the Sequence or Choice Level
  • Group Multiplicity
  • Nested xsd:any in Sequences
  • xsd:any "##local"
  • Restrictions between Complex Types
  • Recurring Elements in Sequence
  • The "block" Function
  • Data Mapping
  • Converting Values Between Different BOM Attribute Types
  • Table 17: Converting Values Between Different BOM Attribute Types
  • Mapping to or from Process Basic Types
  • JavaScript Features not Supported in TIBCO BPM Scripting
  • New Operator
  • Switch Statement
  • try/catch Statement
  • JavaScript Functions
  • JavaScript RegExp Object
  • "==="operator
  • JavaScript Arrays
  • Using If, For, and While Expressions
  • Reserved Words in Scripts
  • AppendixBBusiness Data Scripting
  • Static Factory Methods
  • •DateTimeUtil
  • DateTimeUtil
  • ScriptUtil
  • IpeScriptUtil (and ScriptUtil) Conversion, Date and Time, and String Functions
  • BOM Native Type Methods
  • •Fixed Length Integer (BigInteger) Methods
  • Fixed Length Integer (BigInteger) Methods
  • Fixed Point Decimal (BigDecimal) Methods
  • Date, Time, Datetime and Datetimetz (XMLGregorianCalendar) Methods
  • Duration Methods
  • Text (String) Methods
  • Other Supported Methods
  • List Methods
  • ListIterator Methods
  • Other JavaScript Functions
  • Math Methods
  • AppendixCProcess Scripting
  • Process Instance Attributes and Methods
  • AppendixDWork Item Scripting
  • WorkManagerFactory
  • WorkItem
  • OrgModel
  • Glossary
  • Basic Type
  • Business Data Services
  • Business Object Model (BOM)
  • Generalization

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

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

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

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

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

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

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

TIBCO Business Studio™ BPM Implementation Read this manual to learn how to implement business processes (including using scripts). Read the release notes for the various products for lists of new and changed features. 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.Related Documentation xi | Related Documentation This section lists documentation resources you may find useful. Business Data Services Guide . These documents also contain lists of known issues and closed issues for the release.

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

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

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

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

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

For example. consider a claims handling system.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.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 . a user task. script task. Use TIBCO Business Studio Business Object Modeler to define a BOM. database task. For more information about EMF.org/modeling/emf/ You can interact with Business Data (any BOM-based data) from any activity in a Process (for example. see: http://www. BDS converts the design-time BOM definitions into BDS Plug-ins that act as the runtime model for Business Data. and so on). The BDS Plug-ins are based on the Eclipse Modelling Framework (EMF).

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

Topics • • • • • Object Orientation (OO). page 8 BOM Relationships and Process Local Data.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 7 Business Objects. page 6 BOM Class. page 14 Business Data Services Guide .

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

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

These instances are referred to as Business Objects. The diagram below shows a simple Customer class and three Business Objects. a Customer may have attributes that include a name and number. John Smith and Fred Blogs. instances of these BOM classes are created to represent particular instances of the generic BOM class. generally all Customers have the same set of attributes. For example. Business Data Services Guide . 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. It is possible in a service task to write information out to. For example. a database. This is called Process Local Scope.8 | Chapter 2 Concepts Business Objects At runtime. Each of these BOM classes and Business Objects have attributes. Although Customer attributes differ from Order attributes. or read from. the Customer BOM class can have two Business Objects to represent two actual customers. The structure of the database table may match one of the normal BOM classes. and an Order may have attributes that include Customer and DateCreated. 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.

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

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

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 Fish is-an Animal. Fish. For example. and telephone). 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. (Also. this means that a Mammal is a specialization of an Animal. In the Business Object Modeler. and so on. providing a Goldfish does not satisfy the "is-a" Mammal requirement. name. and they specify that they want a Mammal. A Dog is-a Mammal. A Cat is-a Mammal. and a Cat is a specialization of a Mammal. However. you can create a Person class that holds the common attributes of Customer and Employee (for example. For example. you may discover that some classes have some things in common. Business Data Services Guide . both classes representing a person. and Dog. (Also. there might be a Customer and an Employee class. as a hamster "is-a" Mammal. Goldfish. When modeling this. or they can even be given a Hamster. a supplier can give them a Cat or a Dog because they both satisfy the "is-a" Mammal requirement. A Mammal is-an Animal. these relationships would be represented like this: In OO terms. a Goldfish is-an Animal). While building up the model of what objects a business deals with. email. consider the following terms: Animal. a Cat is-an Animal and a Dog is-an Animal). If someone wants a pet. Mammal. Cat.

department. the Employee class can specialize the Person class. 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). 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. manager and so on). 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).12 | Chapter 2 Concepts The Customer class can then specialize the Person class. Business Data Services Guide . by adding any attributes that only the Employee had (for example. if you had a Customer business object. Having done this. We can say that the Person class is a generalization of the Customer and Employee classes. Alternatively. Generalization is the reverse of specialization (looking at the same relationship from the opposite direction). adding the extra attributes that only a customer has (for example. Using the previous diagram as an example. Similarly. customerNumber). we can say that the Customer and Employee classes are specializations of the Person class. as its BOM class is a subtype of the Person class.

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). 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. In other words. If the Person attribute is referring to a Business Object of the generic Person. Business Data Services Guide . For example. or the Employee BOM classes then it will not work. it will only work if the Person attribute is actually referring to an instance of the Customer BOM class. it passes the "is-a" test.

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

make = "Ford" // will not affect car.age + 1. person2.// Will not increment person1.age person1.make.dob = person1.age = person2. person1. person2.age = person2. // Value now 1970-01-04.dob // is still 1968-01-04 Business Data Services Guide .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. person2.createDate("1968-01-04").age.make person1. bus.make = bus.dob.dob.dob = DateTimeUtil.setYear(1970).

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

address). account and customer end up with independent copies of the address: var address = com_example_refval_Factory. greetingDataField = "Goodbye". account. leaving Customer with no Address: var address = com_example_refval_Factory.createAddress().address = ScriptUtil.address = customer.Assignment by Value and by Reference 17 | In the next example. // Will not affect local variable // greeting Business Data Services Guide . customer.copy(customer. greetingDataField = greeting.address. the final line of the script removes the Address from Customer.address = address. // Removes address from // customer If this script is modified to use ScriptUtil.createAddress(). customer. // 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". although all assignments are by reference (there is only ever one Address). account.address = address.copy(…).

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

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. and the types of data it supports. page 21 Creating a Business Object Model (BOM). page 29 Business Data Services Guide . page 20 BOM Native Types. page 25 BOM Design-time Model.

Business Data Services Guide . Although in TIBCO Business Studio BOM Editor also supports Association and Aggregation relationships. so an understanding of UML can be useful. these relationships cannot be used in processes. BDS and Process Local Data support Generalization and Specialization relationships and Uni-directional Composition relationships.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).

xsd:anyType. there are 18 different types. if you include the sub-types as types. xsd:anySimpleType and xsd:anyAttribute).. Therefore. The Attachment type is not currently supported by the BPM runtime. Using Business Object Modeler. for example. a range or a regular expression that it must match. 4 sub-types of Object (xsd:any. in total.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). these BOM Native Types can be used to generate Primitive Types that have some application-specific restrictions. Business Data Services Guide .

225E-307 0 Positive values between 2.99. For example: 1.79769E+308. 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.23 Business Data Services Guide .999] Month in range [1 – 12] Day in range [1 .225E-307 and 1.1234567890 Decimal – Floating Point • • • Negative numbers between -1.999 – 999. For example: 1234567890. Table 3: Value Spaces for BOM Native Types BOM Native Type Attachment Boolean Date Value Space N/A true.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 .+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 and -2. false Year in range [-999.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.999.

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

tibco.w3.com Business Data Services Guide . See World Wide Web Consortium.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.org/TR/2001/REC-xlink-20010627/ For example: http://www.

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

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

if you attempt to change one of the generated BOMs. In order to call a web service. 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. 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 warning is generated: TIBCO recommends that you do not change a generated file. 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. as you risk losing changes if the file is regenerated. a service task must be added to a BPM process and the Task Type must be set to Web Service. Business Data Services Guide . you can view the services defined by the WSDL file. 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. However. a BOM is generated that contains all the structured data definitions used by the web service.

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. 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). 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. 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. If the WSDL does not exist yet. 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.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. it can be created here For a more detailed overview of defining Web Services. see Scripting with Web Services on page 109. Business Data Services Guide . As previously explained.

based on the Integer(Signed) type with the values restricted to numbers between 0 and 23. 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 . it is possible to define your own Primitive Types. which are specializations of BOM Native Types. for example. Usually.BOM Design-time Model 29 | BOM Design-time Model Primitive Types In a BOM. 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. where "N" represents a digit. a type called Hour can be defined. text fields can be constrained to match certain patterns. if you want an OrderId type to be formatted as ORD-NNNNNN. For example.

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

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

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

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

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

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

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. 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. For example: Business Data Services Guide . In the following example. in which case the name must then be manually changed. Because the Name is used in scripts. as in the example above.36 | Chapter 3 Business Data Definition Spaces and punctuation characters are not allowed in names. 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. including the following: Character . any illegal name characters are ignored. As the label is converted to the class name.

a single letter word as the first word. and if possible. Each BOM must have a unique name across all other projects in the TIBCO Business Studio workspace. the software automatically uses lowercase letters for the first two characters if they are of different cases. Business Data Services Guide . ("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.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. The names will follow the camelcase convention. it is recommend that you use uppercase letters for the initial letter of each word in the label. and numbers. do not use. underscores. as shown in the following examples: When creating attributes for BOM classes. To meet this requirement. and must avoid reserved words in a similar manner as BOM class names. each beginning with a letter or underscore and containing only letters.

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

there are further restrictions on names that can cause other clashes. if another attribute is added with the name "thmonth". 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. For example. Therefore.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. as shown below: Business Data Services Guide . as shown below: This is a generic BOM problem and has to be fixed manually. Because of the internal workings of BDS. attribute and class names must be unique and ignore case and underscores.

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

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

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

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

Instead.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. Document literal type bindings must have formal parameters of type external reference. please create a Class to contain the array. Activities responsible for generating WSDL operations cannot have array parameters associated. Business Data Services Guide .

the BDS ensures that all BDS data is in a valid state. For example.. if a field has a multiplicity of 3. 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. ranges of numeric fields. an exception is raised. then an exception is generated if the field has more than 6 values or less than 3 values as specified by the multiplicity rule.BDS Runtime Validations 45 | BDS Runtime Validations When a task completes. Business Data Services Guide . lengths of Text and Fixed Length Numeric fields. Similarly.6. If there are any problems.

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. therefore. they are independent of each other. As each deployed project has its own copy of the BOM artifacts. Business Data Services Guide . or redeployed. However. there are restrictions if you want to migrate Process Instances between different versions of a Process Template. See the next section for details. any change can be made to the BOM between deployments without affecting existing projects that make use of the BOM. Each time a TIBCO Business Studio project is deployed. it will be deployed with a copy of the BDS plug-ins from each BOM that the project references.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.

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

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.... as long as they are less restrictive than the old restrictions..* 1.. 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.1 1 * 0. 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) . If an attribute’s type remains the same. Table 5: Examples of Compatible Change Rules From 1..* 1 4..* Valid? Yes . its restrictions may be altered.. Examples are given in the following table.8 0.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. as long as it makes it less restrictive (for example.1 * 1.5 1 0.

Business Data Services Guide . 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. Permitted Change Can be removed Change to a Primitive Type When the type has a BOM Native Type as its superclass. page 48.

After a User Task has been completed. which controls whether the field has to have a value. By default. 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. which means there are no restrictions and the Task has access to all the fields in the process.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. 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. no fields are listed. and a new field is added to the process. Business Data Services Guide . See Creating a New Business Object on page 59 and the following sections for more details on using BOM fields in Script Tasks. and using Scripts in general. and therefore need to be initialized using the factory method before any of the attributes can be referenced. If the Interface tab is used. User Task BOM fields can be displayed and updated in User Task steps. There is also a Mandatory flag that can be specified. the new field will not be available in the Task until it is added to the Interface.

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

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 xsi:type is present. wherever possible.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. This is described in the specification: http://www. You can learn more about JavaScript from many sources. It does not include a full description of the syntax of the JavaScript language. this data is fully compliant with the use of xsi:type as described in the specifications. it must contain an xsi:type as illustrated below: <tns1:PersonElement xmlns:tns1="http://example.w3. A useful introduction to JavaScript can be found at the W3Schools web site http://www. you must provide an xsi:type when using extended types. are encouraged to first learn the basics of JavaScript before progressing onto TIBCO BPM Scripting.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. Supplying xsi:type Information in XML Sent to TIBCO BPM When using external clients to pass XML representing BOM information to TIBCO BPM. or who are struggling with the syntax. For clarity. Business Data Services Guide . This means that. Those not familiar.com/.org/math/types/" xsi:type="tns1:Customer"> <name>Fred</name> <email>fred@myemail.w3schools. The following section gives an example of how to use Business Data Scripting in practice in TIBCO BPM.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.

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

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

there are some places where the processes require custom processing of the data beyond the direct mapping of attributes. However. cancel. both within and between processes. This chapter illustrates how to write BDS server-side scripts. 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. submit and close) Timer Scripts . for example: • • • • • Script tasks within processes Action Scripts that are run on particular events related to tasks (for example. can sometimes be mapped as whole objects from one process to another. Business Data Services Guide . 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. all of which are described later in this guide. In these cases. open. but has some unique restrictions and extensions.56 | Chapter 5 Business Data Scripting by Example Overview The data objects that are passed around the system. or attributes of one object can be mapped onto attributes of another object in graphical ways using the mappers.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. complete. the scripting capabilities can be used. through a number of examples. timeout. initiate.

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

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

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

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. we first need a data field to hold the instance.

as shown below: It is very important to understand that when a process starts. select JavaScript: The Describe Task Script dialog is displayed. The instances of the Customer class are created by the "Customer Factory Method". 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. One of the differences between BPM Script and standard JavaScript is the new operator is not supported. Type the script. it just has the ability to. is provided for doing this: cust1 = com_example_scriptingguide_Factory.createCustomer(). Maximise the Describe Task Script dialog. the cust process data field will not contain or refer to an instance of the Customer class. Business Data Services Guide . cust3 = cust1. by clicking Maximize. cust2 = ScriptUtil.Creating a New Business Object 61 | View the Script Task properties and from Script Defined As needs. The ScriptUtil utility method. Create a Copy of a Business Object Another way of creating a new Business Object is to create a copy of an existing object. cust = com_example_scriptingguide_Factory. 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.createCustomer().copy(cust1).

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

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

name = customerName. although this will only work for attributes that do not have a default value. For example: if (null == cust) { cust = com_example_scriptingguide_Factory.createCustomer(). you should check that an attribute is not null before using any methods on an object. • Once we know that the cust field has a value. even for Optional parameters). then after the UserTask is complete the BOM field will always refer to an object.dateOfBirth. as shown below: /* * Set the cust.name if not already set */ if (null != cust. then all text until a matching "*/" is ignored by the script engine.name) { cust.getYear(). The comment is opened with a "/*". Similarly. 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.name if not already set */ if (null == cust. } /* Set the cust. we can then set the name. } Otherwise you will get a runtime exception.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). Business Data Services Guide . } The example above shows how to use a multi-line comment. 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.dateOfBirth) { year = cust. We can check to see if attributes have been previously assigned by comparing them against null.

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

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

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

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

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

cust. 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. If you want to associate a particular Customer with the custList variable. then instead of referring to a single Business Object. the process data field cust has only referred to a single instance of the Customer class (a single Customer Business Object). They are created by default as empty Lists. it is possible for it to refer to multiple instances. The List objects do not need to be created.custNumber = "C123456".name = "Fred Blogs". cust. you can assign the cust field with a single instance field. which can contain multiple Business Objects. Let us consider a process data field that holds a List of Customer objects called custList. the process data field will refer to multiple instances of the Business Object. However.70 | Chapter 5 Business Data Scripting by Example Multiple Instances of a BOM Class In the examples we have looked at so far. 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). cust = com_example_scriptingguide_Factory. This is done through a List object. Business Data Services Guide . This is shown below.createCustomer().

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

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

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

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

order.Multiple Instances of a BOM Class 75 | or using the ScriptUtil. accessing particular entries in the list. Using the List set() Method on page 84.partNumber = 10056. Business Data Services Guide . orderline.orderlines. see Using the List set() Method on page 84.copy(orderline). orderline.copy() method: var orderline = com_example_scriptingguide_Factory. orderline.add(orderline). The List object provides methods for finding out how many items there are in the list.orderlines. and enumerating the list. Removing an Item from a List or a Containment Relationship on page 85.partNumber = 10023. 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. Scripting Containment Relationships on page 82. orderline. To learn more about what you can do with the List object. orderline = ScriptUtil.add(orderline).createOrderLine(). order.quantity = 1.quantity = 3.

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

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

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

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

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

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

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

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

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

The Business Object. Be careful using the first example above. ) { var customer = iterator. To remove an item from a list means iterating through the list to find the item and then deleting it. or other value passed.hasNext().creditLimit >= 1000000) { iterator. 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. the remove() method should be used. It can be used with the object to be removed. or the index of the object to be removed: //Remove an object from a collection order. you should use the Iterator’s remove method. iterator.listIterator(). and not a copy of it.000. It does not compare the contents of the objects.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.next().remove(orderline1).remove().orderlines.000 if (customer. } } Business Data Services Guide .remove(0). or: order.orderlines. This method checks to see if it is the same object that was adde. must be the same Business Object instance that is in the list. // check if credit limit above 1. If you don’t know which item you want to remove.

clear().remove(ix).clear(). as in the second example. for example: bike. Business Data Services Guide .size(). 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.000 if (customer. 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. ix++) { var customer = custlist.000. There is also a clear() method on Lists that can be used to remove all entries in the list.get(ix). ix--.widgets. // decrement index so next iteration check the new nth item } } If the list index is managed in the script.creditLimit >= 1000000) { custlist. // check if credit limit above 1. custList.

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

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

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

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

// // var fifthString = "Fred's \"Old\" House". they must be of the same type. However. var nextString = 'Hello Fred!'. The following operations can be done on the String.length str. var thirdString = "Fred's World". for example. // // // 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.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. // // // // var fourthString = ' "The Old House" '. Table 7: String Operations Expression str.substr(6) Business Data Services Guide .substr(0. considering the following String variable: var str = "Hello TIBCO!". for example: var firstString = "Hello World!". 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.5) Result 12 Hello TIBCO! Comment Returns length of string Return substring starting at offset 0. 5 characters long Return substring starting at 6th position in string str.

consider using the User-defined Types described in Working with Primitive Types on page 106.indexOf(" "))) str.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.slice(-6). so when one of the above functions returns a String value.slice(6. Business Data Services Guide .slice(str.92 | Chapter 5 Business Data Scripting by Example Table 7: String Operations Expression str. The String objects are immutable.slice(0.lastInd exOf(" ")+1) For more information about String class methods. it is a reference to a new String. str. If you want to restrict what Strings can be put into certain Text fields. str.toLower Case(). or whole string if one word Returns last word in String. or whole string if one word str. The original String is not changed. see Text (String) Methods on page 203.

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

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

Working with Basic Integer Numbers 95 | In scripting. 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 . do not divide by 0.members.averageWeight = 0. you can do the following: var totalKgs = 0. } Note that the two lines in the loop that update the running totals can be shortened to: totalKgs += member. } else { team. teamSize++.next(). using the arithmetic abbreviations that can be used in scripting.weightKgs. for (var iterator = team.hasNext(). var teamSize = 0. iterator.weightKgs. When dividing. The code above checks for this special case. } if (teamSize > 0) { team.listIterator(). teamSize = teamSize + 1. ) { var member = iterator.averageWeight = totalKgs / teamSize. totalKgs = totalKgs + member. to work out the average weight of a team member.

Business Data Services Guide .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.

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

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

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

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

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

The compare() method should be used to compare items that either do or do not have a timezone.compare(startdate) == DatatypeConstants.compare(startdate) == DatatypeConstants. The equals() method is just a wrapper around the compare() method.GREATER enddate.LESSER) { // End date is greater than or equal to start date – OR INDETERMINATE!! } Business Data Services Guide . the result is deemed to be 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.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. To check for greater than or equals.compare(startdate) != DatatypeConstants. The method still works if the date/times are more than 14 hours apart.102 | Chapter 5 Business Data Scripting by Example Comparing Dates and Times In order to compare two date/time types. but if they are less than 14 hours apart. either the compare() or equals() method should be used. use the following: // Verify end date is greater than or equal to start date if (enddate.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.

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

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

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

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

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. Instead.orderline. as shown in the example below: order. since it does not check that Strings have the correct content. this will cause a runtime validation exception when the Task that contains the script completes. using the above example.partNum = "PN-123456". so. Business Data Services Guide . the partNum field can be assigned using: order. the script editor will not detect this as an error. If a script is written with an invalid format value.orderline.partNum = "ROB-123456".

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. For example. which is 7 days in the future.setDay(1). Loop Conditions – Boolean expressions that determine whether a loop should continue or not. // get current datetime datetime.setTime(0. // adjust in case on 31-Jan datetime.0.add(DateTimeUtil. The value of the script is the value of the last line in the script. These expressions can be multi-line expressions.createDuration("-P1D")). month datetime. if we want a script to calculate a timeout to be the end of the month. Task TimerEvent – Datetime expressions that determine when a task should timeout. // return value of script Business Data Services Guide .add(DateTimeUtil.0). // change to 7 days time datetime.add(DateTimeUtil. we can use the following: var datetime = DateTimeUtil. // back to end of prev. // clear hours.createDuration("P7D")). // move on to next month datetime.createDatetimetz().createDuration("P1M")). minutes & seconds datetime.

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

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 .110 | Chapter 5 Business Data Scripting by Example We can now create two Data Fields in the process of the appropriate types: Then. from the Input To Service property sheet.

for example. This can be done in scripts. change the name of the task to something appropriate. To do this. Then. on the General property sheet. repeat for the output of the Web Service: Then. 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.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 . Call "Request" Web Service.

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

* 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. instead please create a business object class to contain the array. (ProcessPackageProcess:StartEvent) Business Data Services Guide .Scripting with Web Services 113 | Instead. the following error message appears: BDS Process 1.

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

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

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

Topics • • • • • • • Working with Fixed Length Integers (BigInteger).setObject(). page 134 encodeURIComponent() and decodeURIComponent().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 122 Object BOM Native Type. page 132 escape() and unescape(). page 135 Business Data Services Guide . page 118 Working with Fixed Decimals (BigDecimal). page 134 encodeURI() and decodeURI(). page 129 Object BOM Native Type and ScriptUtil.

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

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

compareTo(one) < 0 two.120 | Chapter 6 Advanced Scripting Examples Then: Operator 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 two.compareTo(one) == 0 x. Therefore. However.compareTo(two) > 0 one. for example. they do not change once they are created.compareTo(two) < 0 one.compareTo(y) > 0 Greater than one.compareTo(two) == 0 one. which you can read about in Fixed Length Integer (BigInteger) Methods on page 191.compareTo(y) != 0 Not Equals one.compareTo(one) >= 0 x.compareTo(one) > 0 two. they return a new BigInteger object that has the new value. if appropriate.compareTo(y) < 0 Less than one. Business Data Services Guide .compareTo(one) <= 0 x.compareTo(one) >= 0 two.compareTo(y) == 0 Description Equals Example one. 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 x.compareTo(two) != 0 one.compareTo(two) >= 0 one.compareTo(one) != 0 x.compareTo(y) >= 0 Greater than or equals one.compareTo(y) <= 0 Less than or equals one.compareTo(two) <= 0 one. all the above methods do not change the object that they are working on.

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

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

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

1 -1. 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. RoundingModes. and MathContexts.lang.0 -1.6 -2.1 -1.0 -1.5 -5. UP HALF_UP UP HALF_UP UP 10 10 50 1 0 0.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.124 | Chapter 6 Advanced Scripting Examples Table 11: Example Rounding Mode Results According to Single Digit Rounding Input Input Number 1.6 -2. Table 12: Example Rounding Mode Results According to BigDecimals Digit Rounding Input Rounding Mode Precision Math Context Result java. and the Numeric type used in JavaScript) is used. The UNNECESSARY rounding mode is the default RoundingMode.0 -1.5 -5.1234512346 0. no exact representable decimal result. If the DECIMAL64 MathContext is used.ArithmeticException: Non-terminating decimal expansion.0 -1. DECIMAL64. The table below shows the results of dividing 12345 by 99999 using BigDecimals with different Precisions.1234512345123451234512345123451234512 3451234512346 Business Data Services Guide .5 There are three built-in MathContexts provided: DECIMAL32. and DECIMAL128.1234512345 0. and will generate an exception if the resultant number of digits used to represent the result is more than the defined precision.

ArithmeticException: Non-terminating decimal expansion.1234512345123451234512345123451235 java.4 is stored in BigDecimal as the number 14 with a scale of 1 and a precision (for example. the compareTo() method sees that there is no difference between them. MathContext. The equals() method does not recognize them as the same.divide(ScriptUtil. 1. The divide() method called above should be changed to: // 30 significant digits.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. rounding 0.HALF_UP).createBigDecimal (planetCount). However.40. meaning they have the same value.lang.30.1234512 0. rounding 0.1234512345123451 0.40 is stored as the number 140 with a scale of 2 and a precision of 3.5 up (using MathContext) var mc = ScriptUtil.1234512345123451234512345123451234512 3451234512345 0. Business Data Services Guide .HALF_UP ). no exact representable decimal result.divide(ScriptUtil.averageWeight = totalKgs. and returns 0.averageWeight = totalKgs.DECIMAL128). When comparing BigDecimal values it is best to use the compareTo() method.5 up planets.mc).createBigDecimal (planetCount).5 up planets. planets.divide(ScriptUtil. or // 30 significant digits.RoundingMode. number of digits) of 2.createBigDecimal(planetCount). rounding 0.averageWeight = totalKgs. as the equals() method considers 1. This is because 1. or // 34 significant digits.RoundingMode.createMathContext(30.4 to differ from 1.

For example. instead of using x <relational_operator> y you must use x. when comparing two decimal fields x and y.compareTo(y) <= 0 Business Data Services Guide .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. but in summary. if you want to use the expression x <= y you should write x.compareTo(y) <relational_operator> 0 This will return the value that you expect the first expression to return. Detailed information on how this can be used is available in the previous section on Integers.

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

457. If the setScale() method is called with a scale of 10. This converts.com/javase/6/docs/api/java/math/BigDecimal. For more information on BigDecimal. rounding must take place often.4567890000 to 123.HALF_UP).oracle. it would actually represent 123. To convert to 3 decimals using the HALF_UP rounding strategy. You must tell setScale() how you want to round the value. to 3.setScale(3.4567890000. RoundingMode. When reducing the number of decimal places. see Fixed Point Decimal (BigDecimal) Methods on page 192. for example. 123. 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.128 | Chapter 6 Advanced Scripting Examples The setScale() method is used to round values. available at the following web site: http://download. However. in our example. write: roundDecimal = decimal.html Business Data Services Guide . or the Java Documentation.

but the data of which can still be passed on by the system.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. 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. For example. it cannot be read back out into its original type. An Object type BOM class attribute can be assigned either another Object attribute. or a BOM class. once data has been stored in an object. It is also not possible to assign a BOM object of one variety into a BOM bject of a different variety. BOM Attributes can be defined as Object type (for example. It must remain in that object. 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 . xsd:any). However.

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

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

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

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

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

231-1].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. • Business Data Services Guide . If it is insufficient. use Datetimetz. Be aware of the limitations of the default Floating Point Decimal sub-type . With Datetime types if a timezone is required.16 significant digits. use the Fixed Integer type. Limitation of accuracy and rounding issues may indicate that it’s not suitable for handling large values.

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. Any projects that just contain BOMs do not get deployed.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. Business Data Services Guide . 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. 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.

For example.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.customerdetails.claimmodel.Address com. the following classes must both be defined in the package that defines the com.claimmodel.claimmodel.customerdetails package: • • com.example.customerdetails. Business Data Services Guide .example.Customer must both be defined in the package that defines the com.customerdetails package.example.claimmodel.example.

then the XSD (or WSDL) should be imported into the Business Objects folder. then any changes made by editing the BOM could be lost. Business Data Services Guide . If the intention is to import an XSD and generate a BOM. 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.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.

the former construction will result in a syntax error. Ensure Business Objects Are Valid Before Scripts Complete Remember that the length. Keep the Scripts Small It is recommended that you keep scripts small. so ensure that all the Out and In / Out fields for the task have valid values before the script task is completed. Business Data Services Guide . limits. and multiplicity are checked at the end of every script. 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.146 | Chapter 7 Business Data Modeling Best Practice Business Data Scripting Best Practice This section contains some suggestions for Business Data scripting. 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. You can do this by breaking potentially large chunks of logic into separate scripts. Check for Nulls It is very important to check that fields and attributes are not null before attempting to get their values.

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

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

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

the two Scripting Guide folders can be deleted. Then the project that the Scripting Guide BOM comes from can be cleaned and rebuilt to regenerate the projects. If the projects are not regenerated. the BDS plug-in folders can be removed. the BDS Plug-in folders should be regenerated: In the above screenshot. To verify that they are being generated.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. for example: Business Data Services Guide . 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. if the project is rebuilt.

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

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

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

the following are some ScriptTasks with IntermediateCatch events attached to them.154 | Chapter 8 Troubleshooting Catch Exceptions If there is the possibility that a script will generate an exception at runtime. For example. 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 .

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

datatype.eclipse.lang. BOM Native Type to BDS Type Mapping This table shows which Java Type the BOM Native Types are mapped onto.Math.Duration java.xml.util.anySimpleType Text Time BDS Java Type N/A java.String javax.Math.datatype.BigDecimal java.FeatureMap org.datatype. and whether they are mutable or not.xsd.lang.xsd.lang.156 | Appendix A Supplemental Information Data Type Mappings This section contains tables showing data type mappings.XMLGregorianCalendar javax.xml.anyAttribute Object .emf.Integer org.xml.ecore.ecore.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 .lang.FeatureMap EObject java.XMLGregorianCalendar java.any Object .XMLGregorianCalendar Mutable? N/A No Yes Yes Yes No No No No No No No No No No No Yes Business Data Services Guide .xml.datatype.lang.Double javax.String java.lang.BigInteger java.eclipse.anytype Object .XMLGregorianCalendar javax.xsd.Object java.xml.util.xsd.emf.Boolean javax.

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 .Data Type Mappings 157 | Table 13: BOM Native Type to BDS Type Mapping BOM Native Type URI BDS Java Type java.String Mutable? No The values of Mutable types can be changed.lang. but the values of immutable types cannot. The methods that operate on them return new objects with the new values instead of mutating the value of the original object.

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

and will result in a validation error. This is because EMF does not support outputting XML where the pattern/order of elements in the group reoccurs in group order. 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. For example.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 . maxOccurs) at the sequence or choice level the XML generated may not be valid.g. Nested xsd:any in Sequences EMF is unable to handle nested sequences where there is an xsd:any or xsd:anyattribute in each sequence.

there is a sequence within another sequence. of which contain an xsd:any: <?xml version="1.com/nsLocalAny" targetNamespace="http://example. where the namespace is set to ##local.166 | Appendix A Supplemental Information For example.org/2001/XMLSchema" xmlns="http://example.com/NestedAny" targetNamespace="http://example.w3.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. in the following schema.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www. EMF will not strip the namespace automatically. This is because the BOM class will already have a namespace associated with it. 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 .0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www. it is not possible to set another class in the BOM to it.org/2001/XMLSchema" xmlns="http://example.w3.

Business Data Services Guide .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.org/2001/XMLSchema" xmlns="http://example.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www. the following schema is not supported: <?xml version="1. EMF restrictions prevent this.com/ComplexRestriction"> <!-.BDS Limitations 167 | Restrictions between Complex Types A Complex Type cannot be a restriction of another Complex Type.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> <!-. For example.w3.

They will be allowed to import and run as if the block does not exist.org/2001/XMLSchema" xmlns="http://example. For example. the following schema would not be supported: <xs:schema xmlns:xs="http://www. see the following schema fragment: Business Data Services Guide .w3. The "block" Function EMF will not enforce a block if used on either Complex Types or Elements.com/RecurringElements" targetNamespace="http://example.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. For example.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.

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 .

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

text = bomField.text = bomField.text = bomField.datetime.text = bomField.text = bomField. bomField.decimal.text = bomField.uri. URI. Text Object. Time.id. Attachment N/A N/A For example.text = bomField.duration. Example N/A Comments N/A Business Data Services Guide . intSigned. bomField. 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.bool. bomField.datetimetz.text = bomField.text = bomField. Time. Datetime. Attachment Text Text Text Text Text Text Boolean Integer-Signed Integer-Fixed Decimal Float Decimal Fixed Date. Datetimetz bomField.decimalFixed. ID. bomField. bomField. P12DT3H for 12 days and 3 hours.text = bomField. bomField. Text Text Duration ID.text = bomField.time. Object. bomField. Datetime.date.Data Mapping 171 | Table 17: Converting Values Between Different BOM Attribute Types To Type Boolean From Type Date. bomField. bomField. URI bomField.text = bomField.integerFixed. Datetimetz Duration.

createBigInteger( bomField.text.toS tring()). intSigned = parseInt(bomField.intFixed.intFixed = ScriptUtil.10). Copes with base. Datetime. Integer Signed Integer-Fixed bomField. 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.intFixed = ScriptUtil.text).createBigInteger( bomField. Datetimetz. intSigned = parseInt(bomField. ID.toS tring()). Time.172 | Appendix A Supplemental Information Table 17: Converting Values Between Different BOM Attribute Types To Type Integer Signed From Type Text Example bomField. Attachment Integer Fixed Text bomField. Integer Fixed Integer-Signed bomField. Integer Fixed Decimal Float bomField. Decimal Float bomField. Duration. Decimal Fixed bomField.createBigInteger( bomField.decFloat. Date.intFixed. Boolean.intSigned).decFloat). intSigned = parseInt(bomField. URI.text). intSigned = bomField.intFixed = ScriptUtil.intSigned = parseInt(bomField. Object. bomField. Integer Signed Integer Signed Integer Signed Business Data Services Guide .

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

time = DateTimeUtil.text).createDate( bomField.createTime( bomField.date = DateTimeUtil. Decimal Float e.datetimetz = DateTimeUtil.date = DateTimeUtil. Datetimetz. Datetime.createBigDecimal( bomField.datetime = DateTimeUtil. Date. ID. bomField. bomField.text).intYear. bomField. Datetimetz Integer. Datetimetz 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.intMonth. Attachment Text N/A N/A Using ScriptUtil Factory Comments Using ScriptUtil Factory Date. URI. Time.createBigDecimal( bomField. See DateTimeUtil for more factory methods Business Data Services Guide . bomField.createDatetime( bomField. bomField.createDatetimetz( bomField. Time. Time. Duration.decFixed = ScriptUtil.decFixed = ScriptUtil.text). bomField.decFloat). Decimal Fixed Integer Fixed bomField.text). Decimal Fixed Boolean . Date.g. Datetime.createDate( bomField. Datetime. Object.text).intDay).

bomField.date.duration = DateTimeUtil. Datetimetz Date.createDuration( bomField.integerOrDecimal).id = bomField. Fixed Integer.createDuration( bomField. Duration Signed Integer. Duration. Datetimetz Boolean.datetime = DateTimeUtil. Fixed Integer. Attachment Duration Text bomField.createDatetime( bomField. Decimal Float. Time.uri = bomField. Datetimetz From Type Date. time.text. ID. N/A N/A Comments See DateTimeUtil for more factory methods Duration ID.text). Time.time). N/A bomField. Object. URI. Fixed Decimal. Datetime. ID. Decimal Fixed All other types Text bomField. 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.text.duration = DateTimeUtil. Datetime. Datetime. URI Attachment N/A Business Data Services Guide .Data Mapping 175 | Table 17: Converting Values Between Different BOM Attribute Types To Type Date. bomField.

No problems mapping data No problems mapping data No problems mapping data No problems mapping data. as shown below. Others are slightly different. Some of these types have equivalent BDS Attribute types. an exception will be raised. 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. Business Data Services Guide . The Basic Datetime type can be assigned to a BOM Datetimetz Attribute. If it doesn’t. 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.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. so all values that this can take will fit in a BOM Attribute Integer (which is a 32-bit Integer). provided that it contains a timezone.

… default: BLOCK. } 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. Business Data Services Guide . the factory methods must be used to create new instances of classes. } Finally { BLOCK. Instead. New Operator The new operator from JavaScript is not supported.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. break. an if () {} else if () {} … statement should be used. break } Instead. Switch Statement The switch statement from JavaScript is not supported: switch (value) { case constant: BLOCK.

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

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

Cannot be used.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. Business Data Services Guide . but can be used by changing the case (for example. regardless of case. while is prohibited. but WHILE is acceptable). Other reserved words cannot be used in the case shown.

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

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

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

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

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

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

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

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

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

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

Returns a BigInteger whose value is (this plus val). 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. Compares this BigInteger with the specified Object. Returns the maximum of this BigInteger and val. Returns a BigInteger whose value is (this divided by val). Compares this BigInteger with the specified Object for equality. Business Data Services Guide . 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 a BigInteger whose value is the greatest common divisor of abs(this) and abs(val).BOM Native Type Methods 191 | BOM Native Type Methods This section describes supported methods using different BOM native types. Date and Time. Returns the minimum of this BigInteger and val. including the following: • • • • • Fixed Length Integer (BigInteger) Methods Fixed Point Decimal (BigDecimal) Methods IpeScriptUtil (and ScriptUtil) Conversion. Compares this BigInteger with the specified BigInteger.

BigDecimal supports three standard levels of precision: • static MathContext DECIMAL32: A MathContext object with a precision setting matching the IEEE 754R Decimal32 format. • • In addition. static MathContext DECIMAL128: A MathContext object with a precision setting matching the IEEE 754R Decimal128 format. Returns a BigInteger whose value is (this times val). when using the BigDecimal type. tax calculations). 34 digits. Returns a BigInteger whose value is (this minus val). Returns a BigInteger whose value is (minus this). 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). Possible values are: • CEILING Business Data Services Guide . and the IEEE 754R default (which is equivalent to "float" arithmetic). and the IEEE 754R default. it is necessary to specify what precision to use in certain circumstances. Returns a BigInteger whose value is (thisexponent).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). calculating one-third would produce an exception if precision is not specified. BigDecimal format can cope with arbitrarily large numbers. and the IEEE 754R default (which is equivalent to "double" arithmetic). static MathContext DECIMAL64: A MathContext object with a precision setting matching the IEEE 754R Decimal64 format. Fixed Point Decimal (BigDecimal) Methods Some numeric objects in BPM are expressed in BigDecimal format. a rounding mode of HALF_EVEN. 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. 16 digits. a rounding mode of HALF_EVEN. However. or passed directly to the relevant methods of BigDecimal. seven digits.

divisor. BigDecimal divide(BigDecimal divisor. RoundingMode roundingMode) divide(BigDecimal divisor.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. Type BigDecimal Method abs() Notes Returns a BigDecimal whose value is the absolute value of this BigDecimal. BigDecimal add(BigDecimal augend) BigDecimal add(BigDecimal augend. Business Data Services Guide .scale()). / BigDecimal divisor).scale(). MathContext mc) Returns a BigDecimal whose value is (this and whose scale is as specified. augend. divisor). Returns a BigDecimal whose value is (this / with rounding according to the context settings. divisor).scale(). Returns a BigDecimal whose value is (this / and whose preferred scale is (this. augend). Returns a BigDecimal whose value is (this + and whose scale is max(this. augend). int BigDecimal Compares this BigDecimal with the specified BigDecimal. int scale.scale()).scale() . an ArithmeticException is thrown. If the exact quotient cannot be represented (because it has a non-terminating decimal expansion). MathContext mc) compareTo(BigDecimal val) divide(BigDecimal divisor) Returns a BigDecimal whose value is (this + with rounding according to the context settings. and whose scale is this.

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

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

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

Y Y Y Y Y Y Y Y Y int getDay() Return day in month or DatatypeConstants. 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.BOM Native Type Methods 197 | Date. 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 . Y Y Y Y Y Y Y Y Y void clear() Unset all fields to undefined. 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.FIE LD_UNDEFINED.FIELD _UNDEFINED. getHour() Return hours or DatatypeConstants. Time.

FIE LD_UNDEFINED. 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.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 Y Y Y n/a n/a n/a n/a n/a int getMonth() Return number of month or DatatypeConstants.FIE LD_UNDEFINED if this optional field is not defined. n/a Y Y Y n/a n/a n/a n/a n/a int getTimezone() Return timezone offset in minutes or DatatypeConstants.

n/a Y Y Y n/a n/a n/a n/a n/a void setMonth(int month) Set month. n/a Y Y Y n/a n/a n/a n/a n/a Business Data Services Guide .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. 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.FIELD _UNDEFINED. 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 setMillisecond(int millisecond) Set milliseconds. 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.0 dateTime datatype field for year or DatatypeConstants.

int millisecond) Set time as one unit. n/a Y Y Y n/a n/a n/a n/a n/a void setTime(int hour. 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.200 | Appendix B Business Data Scripting Date Time Date Time Date Timetz gDay gMonth gMonthDay gYear gYear Month Type Method void setTime(int hour. n/a Y Y Y n/a n/a n/a n/a n/a void setTime(int hour. int minute. int minute. int second. including optional milliseconds. int minute. BigDecimal fractional) Set time as one unit. including the optional infinite precision fractional seconds. int minute. In this case it is best to use two separate calls to set the hour. second. and millisecond fields as: setTime(int hour. minute. int second) setMillisecond(int millisecond) Business Data Services Guide . int second) Set time as one unit. int second.

Y n/a Y Y n/a n/a n/a Y Y void setYear(int year) Set year 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. 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. String toXMLFormat() Return the lexical representation of this instance. 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 Y Y Y Y Y Y Y Y Business Data Services Guide .

int getMinutes() Obtains the value of the MINUTES field as an integer value. or 0 if not present. boolean isShorterThan(Duration duration) Checks if this duration object is strictly shorter than another Duration object. or 0 if not present. or 0 if not present. boolean isLongerThan(Duration duration) Checks if this duration object is strictly longer than another Duration object. int getYears() Get the years value of this Duration as an int or 0 if not present. Business Data Services Guide . or 0 if not present. int getHours() Obtains the value of the HOURS field as an integer value. Duration multiply(BigDecimal factor) Computes a new duration whose value is factor times longer than the value of this duration. int getMonths() Obtains the value of the MONTHS field as an integer value. int getDays() Obtains the value of the DAYS field as an integer value. boolean equals(Object duration) Checks if this duration object has the same duration as another Duration object. or 0 if not present. this+rhs.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. int getSeconds() Obtains the value of the SECONDS field as an integer value.

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

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

inclusive. exclusive. boolean ListIterator Methods The following ListIterator methods are supported.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. Replaces the last element returned by next or previous with the specified element. Returns true if this list iterator has more elements when traversing the list in the forward direction. Returns the index of the element that would be returned by a subsequent call to previous. 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. Business Data Services Guide . int toIndex) addAll(Collection c) Notes Returns a view of the portion of this list between the specified fromIndex. Returns the next element in the list. and toIndex. in the order that they are returned by the specified collection's iterator (optional operation). Returns the previous element in the list. Returns true if this list iterator has more elements when traversing the list in the reverse direction. Returns the index of the element that would be returned by a subsequent call to next.

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

Rounds x to the nearest integer. Returns the tangent of the angle x.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). Business Data Services Guide . Returns the square root of x.

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

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

getId(). ou=system Returns Process Instance ID. for example. priority. id = Process. start = Process.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. pvm:0a128cu Business Data Services Guide . priority = Process. getStartTime(). e. getOriginator(). getPriority(). name = Process. uid=admin. getDescription().getName(). description = Process.g. Attribute/Method priority : Integer getName() : String getDescription() : String getStartTime() : Datetimetz getPriority() : Integer getOriginator() : String getId() : String Example priority = Process. originator = Process. 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.

getActivityState( 'UserTask2'). • • addActivityLoopAdd itionalInstances: (String .getActivityType( 'UserTask2').getActivityCom pletionTime('UserTask2' ).1) typ = Process.getActivityStart Time('UserTask2'). getActivityLoopIndex() Description • • • Retrieves most local loop index. Index starts from 0 (zero) for first loop/multi-instance instance. for example.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. the user can transfer an embedded sub-process loop index into a embedded sub-process local data field. completed = Process. this will be the loop index for the nearest multi-instance embedded sub-process ancestor (defaulting to 0 if no multi-instance ancestor found). Adds additional instances to a multi-instance loop task while that task is in progress Returns task type. started = Process. For a non-multi-instance task.addActivityLoop AdditionalInstances ("UserTask". state = Process. For a loop/multi-instance task or embedded sub-process this will be the loop index for this task/embedded sub-process. done. for example. userTask Returns task state. In nested multi-instance situations.state Returns time task was started Returns time task was completed Business Data Services Guide .

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

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

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

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

648 to 2. and attribute1 a customer reference number to aid work list sort and filter choices. on a user task schedule script).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.attribute2: Text workItemAttributes. For example.147.attribute3: Text workItemAttributes. The attribute1 work item attribute can be assigned integer values in the range -2. attribute2 can be used to hold a customer name. See description above. They are available where the WorkManagerFactory object can be accessed (for example.attribute1: Integer workItemAttributes. 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.483.647.483.attribute4: Text Limited to 64 characters in length. Business Data Services Guide . workItemAttributes.147.

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

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

the return value will be null. Returns the list of EntityDetails that describe the Organizational Units identified by the given name. the return value will be an empty list. Returns the single EntityDetail that describes the Group 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 . If no such Organizational Unit exists. If no such Group exists. Returns the list of EntityDetails that describe the Groups identified by the given name. If no such named Groups exist. the return value will be null. Returns the list of EntityDetails that describe the Human Resources identified by the given name. If no such Human Resource exists. If no such named Human Resources exist.OrgModel 219 | OrgModel This table lists the OrgModel attributes and methods provided. Attribute / Method OrgModel ouByGuid (guid:Text) : EntityDetail Returns the single EntityDetail that describes the Organizational Unit identified by its GUID. If no such named Organizational Units exist. the return value will be an empty list. Returns the single EntityDetail that describes the Human Resource identified by its GUID. the return value will be an empty list. the return value will be null.

If no such Position exists. If no such Organization exists. If no such Human Resource exists. Returns the list of EntityDetails that describe the Positions identified by the given name. the return value will be null. 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. Returns the list of EntityDetails that describe the Organizations identified by the given name. the return value will be null. the return value will be an empty list. If no such named Organizations exist. Example values are: • • • • • ORGANIZATION ORGANIZATIONAL_UNIT GROUP POSITION RESOURCE Business Data Services Guide . Returns the single EntityDetail that describes the Position identified by its GUID. Returns the single EntityDetail that describes the Organization identified by its GUID. If no such named Positions exist.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. the return value will be null. the return value will be an empty list.

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

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. For Resource entity types. Possible values are: • • • • • • • • • string decimal integer boolean datetime date time enum enumset getAttributeType(attrName:Text) : Text Business Data Services Guide .222 | Appendix D Work Item Scripting Attribute / Method getAttributeValue(attrName:Text) :List<Text> Comments For Resource entity types.

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

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

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

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

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->