+ All Categories
Home > Documents > Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for...

Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for...

Date post: 14-Mar-2018
Category:
Upload: dokhue
View: 221 times
Download: 3 times
Share this document with a friend
34
Baan OpenWorld 2.2 Programmer’s Guide for Baan 3GL Client Adapter
Transcript
Page 1: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Baan OpenWorld 2.2

Programmer's Guide for Baan 3GLClient Adapter

Page 2: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

A publication of:

Baan Development B.V.P.O.Box 1433770 AC BarneveldThe Netherlands

Printed in the Netherlands

© Baan Development B.V. 2001.All rights reserved.

The information in this documentis subject to change withoutnotice. No part of this documentmay be reproduced, stored ortransmitted in any form or by anymeans, electronic or mechanical,for any purpose, without theexpress written permission ofBaan Development B.V.

Baan Development B.V.assumes no liability for anydamages incurred, directly orindirectly, from any errors,omissions or discrepanciesbetween the software and theinformation contained in thisdocument.

Document Information

Code: U7538B USGroup: User DocumentationEdition: BDate: July, 2001

Page 3: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

i

Programmer's Guide for Baan 3GL Client Adapter

1 Overview 1-1Object-oriented vs procedural 1-1Generated BOIs 1-2Generated BusinessManager 1-2Generated Business Element 1-3To use the API 1-4Memory management/ownership 1-5If you use the function model 1-5If you use the data model 1-5Data-type mapping 1-5XML data type 1-6Binary data type 1-6Typesafe Business Objects 1-7The error interface 1-7

2 API reference 2-1Business Element 2-1Business Element manager 2-2The Iterator 2-5Synchronization 2-6The UserInfo 2-7Error functions 2-8Generic Error Functions 2-8Type-Specific Error Functions 2-10

Appendix A Function model example 1

Appendix B Data model examples 1

Appendix C Special features examples 1

Appendix D Error API example 1

Table of contents

Page 4: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Table of contents

Programmer's Guide for Baan 3GL Client Adapterii

Page 5: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Programmer's Guide for Baan 3GL Client Adapteriii

This document describes the BaanC OpenWorld Adapter Client API. This API ispart of the OpenWorld Adapter For BaanERP and can be used to write Clientcode For OpenWorld in BaanC. For more high-level descriptions of thefunctionality of an OpenWorld Client in combination with BOIs the BOI UsersGuide can be referred.

References� Baan OpenWorld 2.2 User�s Guide for BOIs (U7452 US)� Baan OpenWorld 2.2 Configuration Guide for Adapter for BaanERP

(U7305 US)� Baan OpenWorld 2.2 Adapter Installation and Configuration Guide

(U7304 US)� Baan OpenWorld 2.2 Deployment Guide (U7455 US)� Baan OpenWorld 2.2 BOI Developers Guide (U7453 US)� Baan OpenWorld Adapter (Java) Documentation:

− Adapter Configuration Help.− BusComponent Editor Help.− JavaDoc.

In this document, the Baan 3GL programming language is referred to as BaanC.

About this document

NOTE

Page 6: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

About this document

Programmer's Guide for Baan 3GL Client Adapteriv

Page 7: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Programmer's Guide for Baan 3GL Client Adapter1-1

This document describes how to use the OpenWorld Client Adapter API in BaanC.You use an OpenWorld Adapter with BOIs. The BaanC client Adapter uses BOIsthat are generated in BaanC.

With the BOIs and this API, you can make your BaanERP program a client of anOpenWorld server.

This document is an extension to the User�s Guide for BOIs, which describes thefunctionality you can use with BOIs. This document assumes you have knowledgeof the concepts and functionality described in the User�s Guide for BOIs. Thisdocument describes how you can use the functionality described in the Users Guidefor BOIs.

Object-oriented vs proceduralThe most visible language-specific feature of Baan 3GL is procedural instead ofobject-oriented. However, this does not mean that the interface differs completely.Baan3GL is designed in an object-oriented fashion.

To achieve this object-oriented design, Baan simulates objects with an XML tree.This tree represents the state of the object. To invoke methods on this object, Baanpasses the state as the first parameter in a function call. All functions for a particularobject are usually grouped in one DLL.

This solution does not allow Baan to use all features of object orientation. Baan doesnot have any inheritance, nor does Baan support polymorphism. However, Baandoes get encapsulation.

Most of the methods that are available through inheritance in Java are eithergenerated on the BOIs or are written on a more generic object that simulates a formof inheritance. An example of the latter is the Manager.add() method, which theuser can call with the generated manager.

Example Java:

SpecificManager.add( SpecificBusinessobject )

Example BaanC:

Manager.add( SpecificManager, SpecificBusinessobject )

1 Overview

Page 8: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Overview

Programmer's Guide for Baan 3GL Client Adapter1-2

Generated BOIsIn addition to the API of the Adapter, the BOI API consists of the functions on thegenerated BOIs itself. These BOIs are generated from a BOI Definition described inQCD/DCD files. The generated code consists of managers and elements. Thefunctions available on these generated BOIs depend on the content of the QCD/DCDfiles.

Generated BusinessManagerFor example

package : package1

name : manager1

functions : long function1(f1_par1, f1_par2)

Business Element function2( f2_par1, f2_par2)

f1_par1 : double

f1_par2 : string

f2_par1 : Business Element

f2_par2 : Business Element

Always generated*

long package1.manager1.create( )

Depending on QCD

long package1.manager1.function1(long manager1,double

f1_par1,string f1_par2)

long package1.manager1.function2(long manager1, long f2_par1,

long f2_par2)

* The name of the manager depends on the content of the QCD.

Page 9: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Overview

Programmer's Guide for Baan 3GL Client Adapter1-3

Generated Business ElementElements can contain various types of data, for example:

� Basic type.� Structure of basic types.� Structure of Business Elements.� Array of basic types.� Array of Business Elements.

Each of the attributes of these types causes set and get functions to be generated.

For example:

package : package1

name : Order

Layout example1 : Order = array of doubleval (doubleval = basic type double)

Layout example2 : Order = structure {long field1, double field2, string field3}

Layout example3: OrderContainer = structure{Order order1}

Always generated*

long package1.order.create( )

This function creates an Business Element of type Order.

long package1.order.destroy( )

This function destroys a Business Element of type Order.

string package1.order.type( )

This function returns the internal type(name) of a generated Business Element.

string package1.order.id( )

This function returns the name of a generated object wrapper.

Page 10: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Overview

Programmer's Guide for Baan 3GL Client Adapter1-4

Depending on QCD (example1):

double package1.order.getdoublevalat(long order, long index)

void package1.order.adddoubleval (long order, double d)

void package1.order.setdoublevalat(long order, double d, long

index)

void package1.order.insertdoublevalAt(long order, double d,

long index)

void package1.order.removealldoubleval(long order)

void package1.order.removedoublevalAt(long order long index)

void package1.order.removedoubleval (long order, double d)

long package1.order.sizedoubleval (long order)

Depending on QCD (example2):

void package1.order.setfield1(long order, long value)

long package1.order.getfield1(long order)

void package1.order.setfield2(long order, double value)

double package1.order.getfield2(long order)

void package1.order.setfield3(long order, string value)

string package1.order.getfield3(long order)

Depending on QCD (example3):

void package1.OrderContainer.setorder1(long Container, long

Order)

long package1.OrderContainer.getorder1(long Container)

* The name of the Business Element always depends on the QCD/DCD

To use the APIAs explained previously, the BOI API contains the following parts.

� The Adapter API.� Generated BOIs.

To use these codes in your application, you must import/link this code.

To include the Adapter API:

#include <bic_tmboa>

To include a specific BOI, which is already compiled in a DLL:

#pragma used DLL <package><module><name>

#pragma used DLL tststtestboiEXAMPLE

Page 11: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Overview

Programmer's Guide for Baan 3GL Client Adapter1-5

To compile the BOI in your application, which is available as a function:

#include i<package><module><name>

#include itststtestboi

Memory management/ownershipAll data retrieved through BOIs is in the shape of Business Elements (XML trees).The BOIs consist of generated Business Elements code, which can act as typesafe-wrappers for these XML trees. Through these wrappers, you can retrieve the basetypes from, or set the base types into, the XML tree (setters and getters).

If you use the function modelIf you retrieve the return and out parameters of a BOI with the function model, youmust make sure that this Business Element, represented by an XML tree, is removedfrom memory. On a Business Element, you can use the Destroy function to removethis Business ELement.

If you use the data modelAll the data that the BOI retrieves is stored inside the manager, with which youretrieve this data. You must make sure that after you finish using a manager, youdestroy the data in the manager. You can also delete the individual BusinessElements while you retrieve the elements from the Iterator.

Data-type mappingBaanC supports a limited set of base data types:

� Long.� Double.� String.

OpenWorld supports a larger set of data types, so the BOI creates a mappingbetween the data types.

BaanC base types can contain such things as XML trees, Binaries, Date andDateTime. You must refer to the documentation provided with your BOI to definewhat the BaanC basic type actually contains.

EXAMPLE

Page 12: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Overview

Programmer's Guide for Baan 3GL Client Adapter1-6

XML data typeThe basis for the XML data type is the XML library of the BaanC language. Formore information, refer to the BaanERP programmer�s guide under the topic �XMLobject overview.�

The BaanC data type that stores the XML tree is long. However, through the BOI,you can set and get these XML trees in a Business Object, or pass these XML treesas arguments of a function.

Binary data typeThe OpenWorld Binary data type maps to a based string in BaanC. Note that thisByteArray is stored into a string, but contains no string. Therefore, you must not usethe �normal� string functions, such as len() and so on. When you receive this type ofByteArray through a BOI, the client application is owner of the allocated data. Toprevent memory leaks, use the free.mem function.

You can use this Binary data type to set and get from a Business Object, or as aparameter on a BOI function.

To allocate or create a new ByteArray of 256 bytes:

string myByteArray(1) based

alloc.mem(myByteArray, 256)

To free the ByteArray:

free.mem(myByteArray)

Part of the OpenWorld code is several functions that enable you to handle this datatype more easily. These functions are available when you use �#pragma used DLLotmboaswl� on top of your program.

long ByteArray.getLength(string ByteArray)

void byteArray.setByteAt(string ByteArray, long position, long value)

long ByteArray.getByteAt(string ByteArray , long position)

Page 13: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Overview

Programmer's Guide for Baan 3GL Client Adapter1-7

Typesafe Business ObjectsTypesafe objects in BaanC are actually XML trees that include some generatedcode. If you use generated Business Objects, you must make sure as a clientprogrammer that you pass the correct XML tree to this Typesafe Business Objectcode.

For example, if you retrieve a specific Business Element from an Iterator, you mustuse the correct Business Element for this specific XML tree.

The error interfaceBaan 3GL does not support exceptions as Java does. Therefore, error handlingdiffers from what is described in Chapter 6, �To handle errors,� of the User�s Guidefor BOIs. Instead of catching exceptions, the Adapter API for BaanC providesfunctions to check whether an error occurred, and what the error is.

To find the error semantics equal to Java, the application must check for errors aftereach call to the BOI interface. However, if a number of relatively independent callsare performed, you can check the errors after a number of calls.

The following three types of errors can occur:� BusErrors.� ApplicationErrors.� SynchronisationErrors.

They contain information equivalent to the various types of exceptions in the JavaAPI.

These various types of errors have different content. Various functions exist on theerror API to retrieve this data.

BoiError contains a string that indicates the problem.

ApplicationError contains a list of error parts that each contain a string.

SynchronisationError contains a structure with three fields: FieldName,MessageCode, and MessageDescription.

Page 14: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Overview

Programmer's Guide for Baan 3GL Client Adapter1-8

Page 15: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Programmer's Guide for Baan 3GL Client Adapter2-1

Business Elementlong businesselement.destroy( long businesselem )

Destroys a Business Element., which frees up the memory that the BusinessElement consumes. You can use this function while you go through largeBusiness Elements to reduce the memory consumption of your 3GL program.

businesselem The Typesafe Business Element.

retval 0 if succeeded, < 0 if a memory/XML error occurs.

long businesselement.getmanager( long businesselem )

Returns the manager object to which the Business Element object is linked.

businesselem The Typesafe Business Element.

retval The Typesafe manager to which this Business Element islinked.

2 API reference

Page 16: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-2

Business Element managerlong manager.close( long manager )

This function closes and unregisters this manager with the connectionlayerHowever, this function does not free up the resources the managerconsumes.

manager The Typesafe manager to close.

retval 0.

Can Generate Error.

long manager.initialize(long manager,const string

buscomponentid())

Initializes a manager for a specific BusComponent.

manager The Typesafe manager to initialize.

buscomponentid The identifier of the BusComponent with which to initializethis manager.

retval The reference to the Typesafe manager.

Can Generate Error.

long manager.getTimeout( long manager )

Returns the timeout, which is currently configured for this manager.

manager The Typesafe manager.

retval The time in milliseconds.

manager.setTimeout( long manager, long timeout )

Sets the timeout, which this manager uses during communication. This timeout isthe amount of time that this manager waits for a reply from the OpenWorld backend.

manager The Typesafe manager.

timeout The timeout in milliseconds.

Page 17: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-3

string manager.getCurrentBackend( long manager )

This function returns the identifier of the BusComponent with which themanager is currently initialized.

manager The Typesafe manager.

retval The string that represents the identifier of the BusComponent.

manager.add( long manager, long buselement )

This function adds a Business Element to the control of this manager. With thisfeature, new elements can be sent to the backend.

manager The Typesafe manager.

buselement The Typesafe Business Element to add to this manager.

long manager.synchronize( long manager )

Synchronizes local changed Business Element objects to the backend. Thismethod is part of the Data Oriented Programming model, which you can use toadd, change, or remove data from the back end (DB).

manager The Typesafe manager.

retval 0.

Can Generate Error.

manager.release( long manager, long buselement )

Release one particular Business Element object from this manager. The managerno longer keeps track of the changes of this Business Element, and also does notsend the Business Element to the back end or synchronize.

manager The Typesafe manager.

buselement The Typesafe Business Element to release from this manager.

manager.releaseAll( long manager )

Release all the Business Element objects from this manager. The manager nolonger keeps track of the changes of these Business Elements, and does not sendthe Business Elements to the back end or synchronize.

manager The Typesafe manager.

Page 18: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-4

manager.remove( long manager, long buselement )

Earmarks a local business object for removal. With the next synchronize on thismanager, the request for removing the business object from the backend is sent tothe server.

manager The Typesafe manager.

buselement The Typesafe Business Element to remove from the back end.

long manager.destroy( ref long manager )

This function removes a manager and all the manager�s content and frees up allthe memory of received Business Elements. Afterwards, the complete manager isgone and can no longer be used. If any references are left to Business Elements,the references are no longer valid, and the XML trees that represent theseBusiness Elements are deleted.

manager The Typesafe manager.

retval 0 if succeeded, < 0 if a memory/XML error occurs.

manager.destroyData( long manager )

This function releases all the Business Elements that are controlled by thismanager and frees up the memory these Business Elements consume.Afterwards, you can continue to use this manager.

manager The Typesafe manager.

manager.setUnconditional( long manager )

Sets the unconditional feature for this manager. With this feature turned on, theoptimistic locking mechanism is disabled. The consistency rules of the backendare, however, still in place.

manager The Typesafe manager.

manager.setUserinfo( long manager, long userinfo )

Sets a UserInfo object to this manager. This manager works with a securitycontext from now on.

manager The Typesafe manager.

userinfo The UserInfo object to set in this manager.

Page 19: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-5

The Iteratorlong iterator.destroy( ref long this )

This function destroys the Iterator object, but. does not destroy the BusinessElements that this Iterator retrieves. To destroy all the Business Elements, use themanager.destroy and manager.destroydata functions. Afterwards, this Iterater canno longer be used, and the reference to this Iterator is 0.

iterator The Iterator Object.

retval 0 if succeeded, < 0 if a memory/XML error occurs.

long iterator.hasMoreElements( long this )

Determines whether more Business Elements exist to retrieve from this Iterator.

iterator The Iterator Object.

retval True, if more Business Elements exist, False, if no moreBusiness Elements do not exist.

long iterator.nextElement( long iterator )

Retrieves the next Business Element. If no more business elements are present inthe local buffer, then a call to the backend is made to retrieve the next set of data.The received element can be a basic type or a Business Element that has a uniqueType Safe wrapper.

iterator The Iterator Object.

retval The Typesafe Business Element retrieved from the Iterator.

Can Generate Error.

iterator.hintNextBufferSize( long iterator, long bufsize )

Sets the fetch size for this iterator. The Iterator retrieves all data in sets, and thesize of these sets is configurable. You can configurable the size of sets with theadapter configuration tools, however, you can also configure the size of the set atrun time with this method. Note that retrieving the data in sets is performed forperformance reasons. The optimal fetch size depends on the size of one record(and number of sub records), the transport speed, and the time the OpenWorldback end needs to produce the data.

iterator The Iterator Object.

bufsize The size of the buffer to use with the next fetch.

Page 20: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-6

Synchronizationlong synchronization.create( )

Creates a synchronization object, which is a context that you can use to performupdates on multiple managers.

retval The synchronization object.

long synchronization.addmanager(long synchronization,long

manager)

Adds a type-safe manager to this synchronization context.

synchronization The synchronisation object.

manager The type-safe manager to add to the synchronization context.

retval The type-safe manager added.

long synchronization.execute( long synchronization )

Synchronizes the changed Business Elements in all the Typesafe managers inthis synchronization to the back end.

synchronization The synchronization object.

retval 0.

Can Generate Error.

Page 21: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-7

The UserInfolong userinfo.create( )

Creates an empty UserInfo object that you can use to store usercontextinformation.

retval An empty UserInfo object.

string userinfo.getPlainUsername( long UserInfo )

Returns the username that is stored in this UserInfo object.

retval String that contains the user name.

userinfo.setPassword( long UserInfo, const string

password())

Sets the password string in this UserInfo object.

userinfo The UserInfo object.

password The password to set in this UserInfo object.

userinfo.setUsername( long UserInfo, const string

username())

Sets the username string in this UserInfo object.

userinfo The UserInfo object.

username The user name to set in this UserInfo object.

Page 22: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-8

Error functionsGeneric Error Functionslong error.hasErrors( )

Checks whether errors are generated and stored by the OpenWorld Client API.The errors are logged while you work with the API.

retval True if errors occurred, False if no errors occurred.

long error.getFirst( )

Returns the first error generated by the 3GL BOI API.

retval Error of type BusError, SynchronisationError, orApplicationError.

long error.getLast( )

Returns the last error generated by the 3GL BOI API.

retval Error, of type BusError, SynchronisationError, orApplicationError.

long error.getNext( long error )

Returns the next error generated by the 3GL BOI API, according to the givenerror.

error Error generated by the 3GL BOI API.

retval Error, of type BusError, SynchronisationError, orApplicationError.

long error.getPrevious( long error )

Returns the previous error generated by the 3GL BOI API, according to the givenerror.

error Error generated by the 3GL BOI API.

retval Error, of type BusError, SynchronisationError, orApplicationError.

Page 23: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-9

string error.getNiceString( long error )

Returns a formatted string that contains the information in the error. The stringdepends on the type of the error and the data in the error.

error Error generated by the 3GL BOI API.

retval Formatted string that contains the information in the error.

bus error:Security error,missing UserInfo. (Backend Security Mode = ThisUser)

synchronization error:FieldName = ��MessageCode = �ttstps114�MessageDescr. = �Record already exists�

application error:MethodName �nofunc� unknown in DLL �otmboab3server�

string error.getErrorType( long error )

Returns the type of an error generated by the 3GL BOI API.

error Error generated by the 3GL BOI API.

retval String that indicates the type of error: BusError (�bus�),SynchronisationError (�synchronization�), or ApplicationError(�application�).

error.clear( )

Clears all the errors logged by the OpenWorld 3GL Client Adapter API.

error.clearlast( )

Clears the last error logged by the OpenWorld 3GL Client Adapter API.

EXAMPLES

Page 24: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-10

Type-Specific Error Functionsstring error.getBusErrorString(long buserror)

Returns the string that contains the information in this BusError.

buserror Error generated by the 3GL BOI API, of type BusError.

retval String that contains the information in this BusError.

long error.getApplicationErrorFirstPart(long appllicerror)

This function returns the first detailed error inside this application error.

appllicerror Error generated by the 3GL BOI API, of typeApplicationError.

retval The first part of inside this application error

long error.getApplicationErrorNextPart(long app_error_part)

This function returns the next detailed error inside this application error.

app_error_part Detailed error inside an application error.

retval The next part of the application error.

string error.getApplicationErrorPartString(long

app_error_part)

This function returns the error information from this part of an application error.

app_error_part Detailed error inside an application error.

retval The string that contains the error information of this part of theapplication error.

string error.getSynchronisationFieldName(long syncherror)

This function returns a part of the information of a synchronization error, theFieldName that caused the error.

syncherror Error generated by the 3GL BOI API, of typeSynchronisationError.

retval The string that contains the FieldName information.

Page 25: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-11

string error.getSynchronisationMessageCode(long syncherror)

This function returns a part of the information of a synchronization error, theMessageCode of this error.

syncherror Error generated by the 3GL BOI API, of typeSynchronisationError.

retval The string that contains the MessageCode information.

string error.getSynchronisationMessageDescription(long

syncherror)

This function returns a part of the information of a synchronization error, theMessageDescription of this error.

syncherror Error generated by the 3GL BOI API, of typeSynchronisationError.

retval The string that contains the MessageDescription information.

Page 26: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

API reference

Programmer's Guide for Baan 3GL Client Adapter2-12

Page 27: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Programmer's Guide for Baan 3GL Client AdapterFunction model example - Page 1

long mymanager, ret

mymanager = 0

| Creating Typesafe managermymanager = boa.basictypemanager.create( )

| Initializing Typesafe managerret = manager.initialize( mymanager, "cn=orbix,o=baan.com" )

| Setting timeout to 5 sec.manager.settimeout( mymanager, 2000 )

| Check errors

long copystringret, nofuncretstring str1(25), str2(25)str1 = "The String to Copy"str2 = ""

| Doing call on BOI with one argumentcopystringret = boa.basictypeManager.copystring( mymanager,str1)str2 = boa.copystringreturn.getstring2( copystringret )

| Check errors

| Doing call on BOI without argumentsnofuncret = boa.basictypeManager.nofunc( mymanager )

| Destroy the business element receivedret = businesselement.destroy( copystringret )ret = businesselement.destroy( nofuncret )

| Close the managerret = manager.close( mymanager )| Destroy the managerret = manager.destroy( mymanager )

Appendix A Function model example

Page 28: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Function model example

Programmer's Guide for Baan 3GL Client AdapterPage 2 - Function model example

Page 29: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Programmer's Guide for Baan 3GL Client AdapterData model examples - Page 1

To retrieve data:

long streetmanager, street, resident, iterator,long ret, noresidents, counter

streetmanager = 0| Creating Typesafe managerstreetmanager = boa.streetsmanager.create( )s = manager.getcurrentbackend( streetmanager )ret = manager.initialize( streetmanager,"cn=orbix,o=baan.com" )iterator = boa.streetsmanager.list_aggregated(streetmanager, 0, 2 )

string ComponentId(30)ComponentId = manager.getcurrentbackend( streetmanager )

| Check errors

while iterator.hasmoreelements( iterator )street = iterator.nextelement( iterator )noresidents = boa.streets.sizeresidents( street )for counter=1 to noresidents

resident = boa.streets.getresidentsat( street,counter )

boa.residents.getlastname( resident ))endforret = businesselement.destroy( street)

endwhile| Destroy the iteratorret = iterator.destroy( iterator )| Close the managerret = manager.close( mymanager )| Destroy the managerret = manager.destroy( mymanager )

Appendix B Data model examples

Page 30: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Data model examples

Programmer's Guide for Baan 3GL Client AdapterPage 2 - Data model examples

To update data:

| Assuming manager is correctly initialized

datatype = boa.datatypes.create()

boa.datatypes.setlong1( datatype, 1 )boa.datatypes.setlong2( datatype, 20 )boa.datatypes.setdouble1( datatype, 10.10 )boa.datatypes.setdouble2( datatype, 20.20 )boa.datatypes.setstring1( datatype, "11110" )boa.datatypes.setstring2( datatype, "22220" )

| Adding local BusinessElement to manager.manager.add( datatypemanager, datatype )

| Synchronize changes to backend.ret = manager.synchronize( datatypemanager )

| Check errors

| Destroy Manager and data

Page 31: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Programmer's Guide for Baan 3GL Client AdapterSpecial features examples - Page 1

To get the name of the current busComponent:

string ComponentId(30)ComponentId = manager.getcurrentbackend( myManager )

To change the timeout:

| Getting the cureent timeoutlong timeouttimeout = manager.gettimeout( mymanager )| Setting timeout to 5 sec.manager.settimeout( mymanager, 5000 )

To use UserInfo:

| create a new userinfo Objuserinfo = userinfo.create()userinfo.setusername( userinfo, "myName" )userinfo.setpassword( userinfo, "myPassword" )

| setting the userinfo to the manager, to enable securitymanager.setuserinfo( myManager, userinfo )

Appendix C Special features examples

Page 32: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Special features examples

Programmer's Guide for Baan 3GL Client AdapterPage 2 - Special features examples

Page 33: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Programmer's Guide for Baan 3GL Client AdapterError API example - Page 1

Function that puts all the errors in message boxes:

function void checkandprinterrors(){

long error.objif error.haserrors() then

error.obj = error.getfirst()while error.obj

message(error.getnicestring(error.obj))error.obj = error.getnext(error.obj)

endwhileerror.clear()

endif}

To retrieve the error type:

long error.objstring errorType(16)

if error.haserrors() thenerror.obj = error.getfirst()while error.obj

errorType = error.geterrortype( error.obj )error.obj = error.getnext(error.obj)

endwhileendif

Appendix D Error API example

Page 34: Programmer's Guide for Baan 3GL Client Adapterbaansupport.com/docs/baan/Programmers Guide for 3GL... · In this document, the Baan 3GL programming language is referred to as BaanC.

Error API example

Programmer's Guide for Baan 3GL Client AdapterPage 2 - Error API example


Recommended