+ All Categories
Home > Documents > Advanced User Documentation -...

Advanced User Documentation -...

Date post: 05-Aug-2020
Category:
Upload: others
View: 41 times
Download: 0 times
Share this document with a friend
372
Advanced User Documentation Sybase ® PowerDesigner ® 12.5 Windows
Transcript
Page 1: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Advanced User Documentation

Sybase® PowerDesigner®

12.5Windows

Page 2: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Part number: DC38628-01-1250-01Last modified: April 2007

Copyright © 1991-2007 Sybase, Inc. and its subsidiaries. All rights reserved.

Information in this manual may change without notice and does not represent a commitment on the part of Sybase, Inc. and its subsidiaries.

Sybase, Inc. provides the software described in this manual under a Sybase License Agreement. The software may be used only in accordance withthe terms of the agreement.

No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, orotherwise, without the prior written permission of Sybase, Inc. and its subsidiaries.

Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for theDOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.

Sybase, SYBASE (logo), ADA Workbench, Adaptable Windowing Environment, Adaptive Component Architecture, Adaptive Server, AdaptiveServer Anywhere, Adaptive Server Enterprise, Adaptive Server Enterprise Monitor, Adaptive Server Enterprise Replication, Adaptive ServerEverywhere, Advantage Database Server, Afaria, Answers Anywhere, AppModeler, APT Workbench, APT-Build, APT-Edit, APT-Execute,APT-Translator, APT-Library, ASEP, Avaki, Avaki (Arrow Design), Avaki Data Grid, AvantGo, Backup Server, BayCam, Bit-Wise, BizTracker,Certified PowerBuilder Developer, Certified SYBASE Professional, Certified SYBASE Professional Logo, ClearConnect, Client-Library, ClientServices, CodeBank, Column Design, ComponentPack, Connection Manager, Convoy/DM, Copernicus, CSP, Data Pipeline, Data Workbench,DataArchitect, Database Analyzer, DataExpress, DataServer, DataWindow, DataWindow .NET, DB-Library, dbQueue, Dejima, Dejima Direct,Developers Workbench, DirectConnect Anywhere, DirectConnect, Distribution Director, Dynamic Mobility Model, e-ADK, E-Anywhere, e-BizIntegrator, E-Whatever, EC Gateway, ECMAP, ECRTP, eFulfillment Accelerator, EII Plus, Electronic Case Management, Embedded SQL, EMS,Enterprise Application Studio, Enterprise Client/Server, Enterprise Connect, Enterprise Data Studio, Enterprise Manager, Enterprise Portal (logo),Enterprise SQL Server Manager, Enterprise Work Architecture, Enterprise Work Designer, Enterprise Work Modeler, eProcurement Accelerator,eremote, Everything Works Better When Everything Works Together, EWA, ExtendedAssist, Extended Systems, ExtendedView, Financial Fusion,Financial Fusion (and design), Financial Fusion Server, Formula One, Fusion Powered e-Finance, Fusion Powered Financial Destinations, FusionPowered STP, Gateway Manager, GeoPoint, GlobalFIX, iAnywhere, iAnywhere Solutions, ImpactNow, Industry Warehouse Studio, InfoMaker,Information Anywhere, Information Everywhere, InformationConnect, InphoMatch, InstaHelp, Intelligent Self-Care, InternetBuilder, iremote,iScript, Jaguar CTS, jConnect for JDBC, KnowledgeBase, Logical Memory Manager, lrLite, M2M Anywhere, Mach Desktop, Mail AnywhereStudio, Mainframe Connect, Maintenance Express, Manage Anywhere Studio, MAP, M-Business Anywhere, M-Business Channel, M-BusinessNetwork, M-Business Suite, MDI Access Server, MDI Database Gateway, media.splash, Message Anywhere Server, MetaWorks, MethodSet,mFolio, Mirror Activator, ML Query, MobiCATS, Mobil 365, Mobileway, MySupport, Net-Gateway, Net-Library, New Era of Networks, NextGeneration Learning, Next Generation Learning Studio, O DEVICE, OASiS, OASiS logo, ObjectConnect, ObjectCycle, OmniConnect, OmniQ,OmniSQL Access Module, OmniSQL Toolkit, OneBridge, Open Biz, Open Business Interchange, Open Client, Open ClientConnect, OpenClient/Server, Open Client/Server Interfaces, Open Gateway, Open Server, Open ServerConnect, Open Solutions, Optima++, Partnerships thatWork, PB-Gen, PC APT Execute, PC DB-Net, PC Net Library, Pharma Anywhere, PhysicalArchitect, Pocket PowerBuilder, PocketBuilder,Power++, Power Through Knowledge, power.stop, PowerAMC, PowerBuilder, PowerBuilder Foundation Class Library, PowerDesigner,PowerDimensions, PowerDynamo, Powering the New Economy, PowerScript, PowerSite, PowerSocket, Powersoft, PowerStage, PowerStudio,PowerTips, Powersoft Portfolio, Powersoft Professional, PowerWare Desktop, PowerWare Enterprise, ProcessAnalyst, Pylon, Pylon Anywhere,Pylon Application Server, Pylon Conduit, Pylon PIM Server, Pylon Pro, QAnywhere, Rapport, Relational Beans, RepConnector, Report Workbench,Report-Execute, Replication Agent, Replication Driver, Replication Server, Replication Server Manager, Replication Toolkit, Resource Manager,RFID Anywhere, RW-DisplayLib, RW-Library, SAFE, SAFE/PRO, Sales Anywhere, Search Anywhere, SDF, Search Anywhere, Secure SQLServer, Secure SQL Toolset, Security Guardian, ShareSpool, Sharelink SKILS, smart.partners, smart.parts, smart.script, SOA AnywhereTrademark,SQL Advantage, SQL Anywhere, SQL Anywhere Studio, SQL Code Checker, SQL Debug, SQL Edit, SQL Edit/TPU, SQLEverywhere, SQL Modeler, SQL Remote, SQL Server, SQL Server Manager, SQL SMART, SQL Toolset, SQL Server/CFT, SQL Server/DBM,SQL Server SNMP SubAgent, SQL Station, SQLJ, Stage III Engineering, Startup.Com, STEP, SupportNow, S.W.I.F.T. Message Format Libraries,Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development Framework, Sybase Financial Server, Sybase Gateways, SybaseIQ, Sybase Learning Connection, Sybase MPP, SyberLearning LIVE, Sybase SQL Desktop, Sybase SQL Lifecycle, Sybase SQL Workgroup,Sybase Synergy Program, Sybase Virtual Server Architecture, Sybase User Workbench, SybaseWare, Syber Financial, SyberAssist, SybFlex,SybMD, SyBooks, System 10, System 11, System XI (logo), SystemTools, Tabular Data Stream, The Enterprise Client/Server Company, TheExtensible Software Platform, The Future Is Wide Open, The Learning Connection, The Model For Client/Server Solutions, The Online InformationCenter, The Power of One, TotalFix, TradeForce, Transact-SQL, Translation Toolkit, Turning Imagination Into Reality, UltraLite, UltraLite.NET,UNIBOM, Unilib, Uninull, Unisep, Unistring, URK Runtime Kit for UniCode, Unwired Accelerator, Unwired Orchestrator,Viafone, Viewer,VisualWriter, VQL, WarehouseArchitect, Warehouse Control Center, Warehouse Studio, Warehouse WORKS, Watcom, Watcom SQL, WatcomSQL Server, Web Deployment Kit, Web.PB, Web.SQL, WebSights, WebViewer, WorkGroup SQL Server, XA-Library, XA-Server, XcelleNet, XPServer, XTNDConnect, and XTNDACCESS are trademarks of Sybase, Inc. or its subsidiaries.

All other trademarks are the property of their respective owners.

ii

Page 3: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Contents

About This Manual v

1 Resource Files and the Public Metamodel 1Working with PowerDesigner Resource Files . . . . . . . . . 2The PowerDesigner Public Metamodel . . . . . . . . . . . . . 12The PowerDesigner XML Model File Format . . . . . . . . . . 21

2 DBMS Reference Guide 27DBMS Definition File Overview . . . . . . . . . . . . . . . . . 28Managing Generation and Reverse Engineering . . . . . . . 31General Category . . . . . . . . . . . . . . . . . . . . . . . . 51Script/Sql Category . . . . . . . . . . . . . . . . . . . . . . . 53Script/Objects Category . . . . . . . . . . . . . . . . . . . . . 61Script/Data Type Category . . . . . . . . . . . . . . . . . . . . 126Profile Category . . . . . . . . . . . . . . . . . . . . . . . . . 129Physical Options . . . . . . . . . . . . . . . . . . . . . . . . . 135PDM Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 143

3 Managing Profiles 161Introduction to Profiles . . . . . . . . . . . . . . . . . . . . . . 162Metaclasses (Profile) . . . . . . . . . . . . . . . . . . . . . . . 165Stereotypes (Profile) . . . . . . . . . . . . . . . . . . . . . . . 168Criteria (Profile) . . . . . . . . . . . . . . . . . . . . . . . . . . 173Extended Attributes (Profile) . . . . . . . . . . . . . . . . . . . 175Extended Collections (Profile) . . . . . . . . . . . . . . . . . . 181Calculated Collections (Profile) . . . . . . . . . . . . . . . . . 184Forms (Profile) . . . . . . . . . . . . . . . . . . . . . . . . . . 187Custom Symbols (Profile) . . . . . . . . . . . . . . . . . . . . 202Custom Checks (Profile) . . . . . . . . . . . . . . . . . . . . . 204Event Handlers (Profile) . . . . . . . . . . . . . . . . . . . . . 211Methods (Profile) . . . . . . . . . . . . . . . . . . . . . . . . . 216Menus (Profile) . . . . . . . . . . . . . . . . . . . . . . . . . . 219Templates and Generated Files (Profile) . . . . . . . . . . . . 222Transformations and Transformation Profiles (Profile) . . . . . 225Using Profiles: a Case Study . . . . . . . . . . . . . . . . . . 231

iii

Page 4: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

4 Object Languages Reference Guide 257Introduction to Object Language Resource Files . . . . . . . 258Object Language Resource File Properties . . . . . . . . . . 259

5 Process Languages Reference Guide 273Introduction to Process Language Resource Files . . . . . . 274Process Language Resource File Properties . . . . . . . . . 275

6 XML Languages Reference Guide 279Introduction to XML Language Resource Files . . . . . . . . 280XML Language Resource File Properties . . . . . . . . . . . 281

7 Extended Model Definitions Reference Guide 283Managing Extended Model Definitions . . . . . . . . . . . . . 284Working with Extended Model Definitions . . . . . . . . . . . 293Generating for Extended Model Definitions . . . . . . . . . . 299

8 Generation Reference Guide (GTL) 303Introduction to the Generation Template Language . . . . . . 304GTL Templates . . . . . . . . . . . . . . . . . . . . . . . . . . 305GTL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323Generation tips and techniques . . . . . . . . . . . . . . . . 348

Index 355

iv

Page 5: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

About This Manual

Subject

This book describes the following PowerDesigner advanced features:

♦ Resource file management

♦ Profile management

♦ Generation template language (GTL) reference guide

♦ Metamodel overview

♦ File format overview

Audience

This book is for anyone already familiar with PowerDesigner standardfeatures who wants to use advanced design features. Some experience withprogramming will be helpful.

Typographic conventions

PowerDesigner documentation uses specific typefaces to help you readilyidentify specific items:

♦ monospace text (normal and bold)

Used for: Code samples, commands, compiled functions and files,references to variables.

Example: declare user_defined..., the BeforeInsertTriggertemplate.

♦ bold textAny new term.

Example: A shortcut has a target object.

♦ SMALL CAPS

Any key name.

Example: Press the ENTER key.

v

Page 6: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

vi

Page 7: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

CHAPTER 1

Resource Files and the Public Metamodel

About this chapter This document introduces PowerDesigner resource files, and the resourceeditor, along with the PowerDesigner public metamodel, and thePowerDesigner XML model file format.

Contents Topic: page

Working with PowerDesigner Resource Files 2

The PowerDesigner Public Metamodel 12

The PowerDesigner XML Model File Format 21

1

Page 8: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Working with PowerDesigner Resource Files

Working with PowerDesigner Resource FilesThe PowerDesigner modeling environment is powered by resource files,which define the objects available in each model along with the methods forgenerating and reverse-engineering them. These resource files are based upon the PowerDesigner public metamodel (see “The PowerDesigner PublicMetamodel” on page 12).

You can view, copy, and edit these XML-format resource files in order tocustomize and extend the behavior of the environment. The following typesof resource files are provided:

♦ Target languages: define the standard objects available in a model.Types of target language files include:• Process languages (.xpl) – define a specific business process language

in the BPM (see the “Process Language Reference Guide” chapter).

• Object languages (.xol) - define a specific object-oriented language inthe OOM (see the “Object Language Reference Guide” chapter).

• DBMSs (.xdb) - define a specific DBMS in the PDM (see the “DBMSReference Guide” chapter).

• XML languages (.xsl) - define a specific XML language definition inthe XSM (see the “XML Language Reference Guide” chapter).

♦ Extended model definitions (.xem) – extend the standard definitions oftarget languages to, for example, specify a persistence framework orserver in an OOM. You can create or attach one or more XEMs to amodel (see the “Extended Model Definitions Reference Guide” chapter).

♦ Report templates (.rtp) - specify the structure of a report. Editablewithin the Report Template Editor (see the Reports User’s Guide ).

♦ Report language files (.xrl) – translate the headings and other standardtext in a report (see the Reports User’s Guide ).

♦ Conversion tables (.csv) - define conversions between the name andcode of an object (see “Using a conversion table” in the “ManagingModels” chapter of the General Features Guide ).

Lists of resource files

You can review all the available resource files from the lists of resource files.You access a resource file list by selecting Tools ä Resources ä Type.

The following tools are available on each resource file list:

2

Page 9: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

Tool Description

Properties - Opens the resource file in the Resource Editor.

New - Creates a new resource file using an existing file as a model.

Save - Saves the selected resource file.

Save All - Saves all the resource files in the list

Path - Browses to the directory which contains the resource files

Compare - Selects two resource files for comparison (see “Compar-ing resource files” on page 8).

Merge - Selects two resource files for merging (see “Mergingresource files” on page 9).

Working with the Resource Editor

The resource editor allows you to view and edit the resources files providedwith PowerDesigner. The left-hand pane shows a tree view of the entriescontained within the resource file, and the right-hand pane displays theproperties of the currently-selected element:

3

Page 10: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Working with PowerDesigner Resource Files

Each entry is a part of the definition of a resource file. For example, you candefine entries for a database command, a characteristic of an objectlanguage, a report item, and so on.

Entries are organized into logical categories. For example, the Scriptcategory in a DBMS language file collects together all the entries relating todatabase generation and reverse engineering.

Each entry type is identified by a specific symbol in the resource editor tree.

You can drag and drop categories or entries in the tree view of the resourceeditor and also between two resource editors of the same type (for exampletwo XOL editors).

CautionYou should never modify the resource files shipped with PowerDesigner.To create your own resource file For each original resource file you want tomodify you should create a corresponding new resource file. To do so youhave to create a new resource file from the List of Resource Files, definea name and select the original resource file in the Copy From list. Thisallows you to create a new resource file that is identical to the original fileapart from the name.

Resource editor navigation tools

You can perform the following navigation and saving tasks from theresource editor toolbar:

4

Page 11: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

Tool Description

Back (ALT+LEFT) - Go to the previous visited entry or category. Ifyou click the down arrowhead, you can directly select the previousvisited entry or category to which you want to go back

Forward (ALT+RIGHT) - Go to the next visited entry or category. Ifyou click the down arrowhead, you can directly select the next visitedentry or category to which you want to go forth

Lookup - Search target items by name

Save (CTRL+SHIFT+S) – Save the current resource file. If you clickthe down arrowhead, you can save the current resource file under anew name

Find In Items (CTRL+SHIFT+F) - Search for text, command, template,custom check, criterion and generated file entries

Replace In Items (CTRL+SHIFT+H) - Search for and replace text,command, template, custom check, criterion and generated fileentries

Opening Resource files

When working with a BPM, PDM, OOM, or XSM, you can open the targetlanguage file that defines your modeling environment in the Resource Editorfor viewing and editing.

v To open the current target language file

1. In a BPM, select Language ä Edit Current Process Language.

2. In a PDM, select Database ä Edit Current DBMS.

3. In an OOM, select Language ä Edit Current Object Language.

4. In an XSM, select Language ä Edit Current Language.

In addition, you can, at any time, open, inspect, and edit any resource filefrom the lists of resource files.

v To open a resource file from a resource file list

1. Select Tools ä Resources ä Type to open the relevant resource file list.

2. Select a file in the list, and then click the Properties tool.

5

Page 12: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Working with PowerDesigner Resource Files

”Not Certified” resource files

Some resource files are delivered with “Not Certified” in their names.Sybase will perform all possible validation checks, however we do notmaintain specific environments to fully certify these resource files. We willsupport them by accepting bug reports and providing fixes as per standardpolicy, with the exception that there will be no final environmental validationof the fix. You are invited to assist us by testing fixes and reporting anycontinuing inconsistencies.

Sharing and copying resource files

Some resource files can be shared among different models or copied in alocal model. Modifications that you make to a resource file are applieddifferently depending on whether the resource file is shared or copied intothe model:

♦ Share - Any modifications made to the resource file are shared by othermodels using this resource file

♦ Copy - The current resource file is independent of the original resourcefile so modifications made to the resource file in the resource files libraryare not available to the model. The copied resource file is saved with themodel and cannot be used without it.

When you modify a shared resource file, you should always modify a newresource file created from the original resource files shipped withPowerDesigner.

The File Name box allows you to know where the resource file you aremodifying is defined:

Saving changes

If you make changes to a resource file and then click OK to close theresource editor without having clicked the Save tool, the changes are savedin memory, the editor is closed and you return to the list of resource files.When you click Close in the list of resource files, a confirmation box isdisplayed asking you if you really want to save the modified resource file. Ifyou click Yes, the changes are saved in the resource file itself. If you clickNo, the changes are kept in memory until you close the PowerDesignersession.

The next time you open any model that uses the customized resource file, the

6

Page 13: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

model will take modifications into account. However, if you have previouslymodified the same options directly in the model, the values in the resourcefile do not change these options.

Editing resource files

When you right-click a category or an entry in the resource file tree view, thefollowing editing options appear:

Edit option Description

New Adds a user-defined entry or category .

Add items. . . Opens a selection dialog box to allow you select one or moreof the predefined metamodel categories or entries to add tothe present node. You cannot edit the names of these itemsbut you can change their comments and values by selectingtheir node.

Remove Deletes the selected category or entry.

Restore Com-ment

Restores the default comment for the selected category orentry.

Restore value Restores the default value for the selected entry.

Renaming user-defined nodes in the tree viewYou can rename a category or an entry directly from the resource file treeby selecting it and pressing the F2 KEY.

Category and entry properties

Each category and entry you select in the resource editor tree view candisplay the following properties to the right hand side of the editor.

Property Description

Name Name of category or entry

Comment Description of selected category or entry

Value Value of entry

Searching in resource files

You can use the navigation list in the upper part of the resource editor tosearch for target items. This box lets you type queries on target items, you

7

Page 14: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Working with PowerDesigner Resource Files

can also use it to type the fully qualified path of the item you are looking for.

The lookup feature is triggered when you press ENTER or when you click theLookup tool.

You can use options to fine-tune your queries. The Lookup options dialogbox lets you define the following search options:

Syntax Description

Metaextension You select the type of extension to search, for example youcan search only stereotypes

Allow wild-card

If you select this option you can use the * wildcard to matchany string and the ? wildcard to match any single character.For example, type “is*” to retrieve all extensions of type“is. . . ”

Match case Use this option to search for extensions with matching case

If the query matches one item, this item is selected in the Resource editor.

If the query matches more than one item, a Results list is displayed. You candouble-click an item in the list to visualize it in the Resource editor.

Go to super-definition If an extension overrides another item you can use the Go to super-definitioncommand in the corresponding object contextual menu to access theoverriden item.

Comparing resource files

You can select two resource files and compare them.The comparison processallows you to highlight the differences between resource files.

8

Page 15: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

v To select resource files for comparison

1. Select Tools ä Resources ä Resource File to open the List of ResourceFile s.

2. Select a resource file in the list, and then click the Compare tool to openthe Select resource file to Compare dialog box. The selected resource fileis displayed in the second list in the lower part of the dialog.

3. Select a resource file from the first list.

If the resource file you want to compare is not in the list, click the Selecta Path tool and browse to its directory. Click OK and then select theresource file from the list.

4. Click OK to open the Compare resource files dialog box, in which youcan compare the selected resource files ..

+ For more information on the comparison process, see the “Comparingand Merging Models” chapter in the General Features Guide .

Merging resource files

You can select two resource files and merge them. Merging means that you

9

Page 16: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Working with PowerDesigner Resource Files

use information from a given resource file to modify another resource file.

Merge is performed from left to right, the resource file in the right pane iscompared to the resource file in the left pane, differences are highlighted andmerge actions are proposed in resource file to be merged.

v To select resource files for merging

1. Select Tools ä Resources ä Resource File to open the List of ResourceFile s.

2. Select a resource file in the list, and then click the Merge tool to open theSelect resource file to Merge dialog box. The selected resource file isdisplayed in the To list in the lower part of the dialog, and will bedisplayed in the right pane of the Merge dialog box, so that merge actionswill be applied to it.

3. Select a resource file from the From list. This file that will appear in theleft pane of the Merge dialog box.

If the resource file you want to compare is not in the list, click the Selecta Path tool and browse to its directory. Click OK and then select theresource file from the list.

10

Page 17: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

4. Click OK to open the Merge resource files dialog box, in which you canmerge the selected resource files ..

+ For more information on the merge process, see the “Comparing andMerging Models” chapter chapter in the General Features Guide .

11

Page 18: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

The PowerDesigner Public Metamodel

The PowerDesigner Public MetamodelA metamodel describes the elements of a model, and the syntax andsemantics of their manipulation. Where a model is an abstraction of data,and can be described using metadata, the metamodel is an abstraction of thatmetadata.

The PowerDesigner public metamodel is an abstraction of the metadata forall the PowerDesigner models, which is represented in an object-orientedmodel. It is intended to help you understand the overall structure of thePowerDesigner modeling metadata when working with:

♦ VB scripts

♦ Generation Template Language (GTL) templates

♦ PowerDesigner XML model files (see “The PowerDesigner XML ModelFile Format” on page 21)

The public metamodel OOM is documented in the Visual Basic help file(click Help ä Metamodel Objects Help) and is located at:

[PowerDesigner install dir]\Examples\MetaModel.oom

The metamodel is divided into the following main packages:

♦ PdBPM - Business Process Model

12

Page 19: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

♦ PdCDM - Conceptual Data Model

♦ PdCommon - contains all objects shared between two or more models,and the abstract classes of the model. For example, business rules, whichare available in all models, and the BaseObject class, from which allmodel objects are derived, are defined in this package. Other modelpackages are linked to PdCommon by generalization links indicating thateach model inherits common objects from the PdCommon package.

♦ PdFRM - Free Model

♦ PdILM - Information Liquidity Model

♦ PdMTM - Merise Model (available in French only)

♦ PdOOM - Object Oriented Model

♦ PdPDM - Physical Data Model

♦ PdRMG - Repository

♦ PdRQM - Requirements Model

♦ PdXSM - XML Model

♦ PdWSP – Workspace

Each of these top-level packages contains the follow kinds of sub-objects,organized by diagram or, in the case of PdCommon, by sub-packages:

♦ Features - All the features implemented by classes in the model. Forexample, Report (available in all models) belongs to PdCommon, andAbstractDataType belongs to PdPDM.

♦ Objects - Design objects in the model

♦ Symbols - Graphical representation of design objects

Metamodel concepts

The PowerDesigner public metamodel uses standard UML concepts:

♦ Public Names - Each object in the metamodel has a name and a codecorresponding to the public name of the object. The public name is theunique identifier of the object in a model library or package (for example,PdCommon) visible in the Modules diagram in the metamodel. Publicnames are used in the PowerDesigner XML model files (see “ThePowerDesigner XML Model File Format” on page 21) and in the GTL(see the Generation Reference Guide chapter ).The public name does notalways match the object’s name in the PowerDesigner interface.

13

Page 20: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

The PowerDesigner Public Metamodel

♦ Classes - are used to represent metadata in the following ways:• Abstract classes - are used only to share attributes and behaviors, and

are not visible in the PowerDesigner interface. Instantiable classesinherit from abstract classes via generalization links. For example,NamedObject is an abstract class, which stores standard attributes likename, code, comment, annotation, and description, which are inheritedby most PowerDesigner design objects.

• Instantiable/Concrete classes - correspond to objects displayed in theinterface. They have their own attributes, such as type or persistence,and they inherit attributes and behaviors from abstract classes throughgeneralization links.

♦ Class attributes - are class properties that can be derived or not. Classeslinked to other classes with generalization links usually contain derivedattributes that are calculated from the attributes or collections of theparent class. Neither derived attributes, nor attributes migrated fromnavigable associations, are stored in the model file. Non-derivedattributes are proper to the class, and are stored in the model and saved inthe model file.

♦ Associations - are used to express the semantic connections betweenclasses called collections. In the association property sheet, the rolescarry information about the end object of the association. In thePowerDesigner metamodel, this role has the same name as a collectionfor the current object. PowerDesigner objects are linked to other objectsusing collections.

Associations usually have only one role, which is at the far end of theassociation from the class for which it represents a collection. In thefollowing example, Identifier has a collection called Attributes:

When associations have two roles, both collections cannot be saved in theXML file, and only the collection with the navigable role will be saved(see “The PowerDesigner XML Model File Format” on page 21).

♦ Composition – expresses an association where the children live and diewith the parent and, when the parent is copied, the child is also copied.For example, in package PdCommon, diagram Option Lists, classNamingConvention is associated with class BaseModelOptions with 3composition associations: NameNamingConventions,

14

Page 21: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

CodeNamingConventions, and NamingConventionsTemplate. Thesecomposition associations express the fact that class NamingConventionwould not exist without class BaseModelOptions.

♦ Generalizations - show the inheritance links existing between a moregeneral, usually abstract, class and a more specific, usually instantiable,class. The more specific class inherits from the attributes of the moregeneric class, these attributes are called derived attributes.

♦ Comments and notes - explains the role of the object in the metamodel.Some internal implementation details are also available in the Notes ä

Annotation page of the classes property sheets.

Navigating in the metamodel

You can use the Browser to expand and collapse the packages in order toexplore their contents. Double-click a diagram to display it in the work area

Each diagram shows classes that relate to each other via associations andgeneralizations. Each class has a name (the public name) and is described byzero or more attributes. It may assume various roles in associations withother classes. Many associations display their roles which makes it possibleto identify object collections (see “Metamodel concepts” on page 13).

Classes in green are classes whose behavior is explained in the currentdiagram, while classes in purple are usually shortcuts of a class existing inanother package, and are presented only to help in understanding thecontext. The shortcut makes it easier to read the diagram and understand thegeneralization links between classes. If you want to understand a purpleclass, right-click it and select Open Related Diagram from the contextualmenu to open the diagram where the class is actually defined.

In the following example taken from PdCommon/Objects/CommonInstantiable Objects, BusinessRule (in green) is developed, whileNamedObject and BaseModel are present only to express inheritance andcomposition links with abstract classes.

Double-click any class to show its property sheet. The Dependencies tabcontains (among others) the following sub-tabs:

15

Page 22: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

The PowerDesigner Public Metamodel

♦ Associations - you can customize the filter in order to display associationroles, which provides a list of the collections of the current object

♦ Generalizations - lists the generalization links where the current objectis the parent. You can use this list to display all the children of the currentclass. Child classes inherit attributes from the parent class and do notdisplay derived attributes

♦ Specializations - Displays the parent of the current object. The currentclass inherits attributes from this parent

♦ Shortcuts - displays the list of shortcuts created for the current object

The Associations tab lists the migrated associations for the class.

Accessing the metamodel with VB Script

You can access and manipulate PowerDesigner internal objects using VBScript. The metamodel (and its online help, available by selecting Help ä

Metamodel Objects Help) provides useful information about objects:

Information Description

Public name The name and code of the metamodel objects are thepublic names of PowerDesigner internal objects.

Examples: AssociationLinkSymbol, ClassMapping,CubeDimensionAssociation

Object collections You can identify the collections of a class by observingthe associations linked to it in the diagram. The role ofeach association is the name of the collection.

Example: In PdBPM, the Format association connectsthe classes MessageFormat and MessageFlow. The roleof this association is Usedby, which corresponds to themessage flow collection of MessageFormat.

Object attributes You can view the attributes of a class together with theattributes it inherits from other classes via generalizationlinks.

Example: In PdCommon/Objects/Common InstantiableObjects, you can view the attributes of BusinessRule,FileObject, and ExtendedDependency, and also thosethat they inherit from abstract classes via generalizationlinks.

16

Page 23: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

Information Description

Object operations Operations in metamodel classes correspond to objectmethods used in VBS.

Example: BaseModel contains the operation Comparethat is can be used in VB scripting

<<notScriptable>>

stereotype

Objects that do not support VB scripting have the<<notScriptable>> stereotype.

Example: RepositoryGroup

+ For more information about public names and other metamodelconcepts, see “Metamodel concepts” on page 13.

+ For detailed information about using VB Script with PowerDesigner, seethe Working with Scripts manual.

Using the metamodel with GTL

The Generation Template Language (GTL) uses templates to generate files.A template is a piece of code defined on a given PowerDesigner metaclassand the metaclasses that inherit from this class. It can be used in differentcontexts for text and potentially code generation.

These templates can be considered as metamodel extensions as they arespecial kinds of metamodel class attributes. You can define as manytemplates as needed for any given metaclass using the following syntax:

<metamodel-classname> / <template-name>

Templates are inherited by all the descendants of the metaclass they aredefined for, and so can be used to share template code between metaclasseswith a common ancestor. For example, if you define a template for theBaseObjects abstract class, all the classes linked via generalization links tothis class inherit from this template.

The GTL uses macros such as foreach_item, for iterating over objectcollections. The template specified inside the block is translated over all theobjects contained in the specified collection. The metamodel provides usefulinformation about the collections of the metaclass on which you define atemplate containing an iteration macro.

Calculated attributes

The following calculated attributes are metamodel extensions specific to theGTL:

17

Page 24: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

The PowerDesigner Public Metamodel

Metaclass Attributes

PdCommon.-BaseObject

♦ isSelected (boolean) - True if the object is partof the selection in the generation dialog

♦ isShorctut (boolean) - True if the object was ac-cessed by dereferencing a shortcut

PdCommon.-BaseModel

♦ GenOptions (struct) - Gives access to user-defined generation options

PdOOM.*

♦ ActualComment (string) - Cleaned–up comment(with /**, /*, */ and // removed)

PdOOM.Association

♦ RoleAMinMultiplicity (string)

♦ RoleAMaxMultiplicity (string)

♦ RoleBMinMultiplicity (string)

♦ RoleBMaxMultiplicity (string)

PdOOM.Attribute

♦ MinMultiplicity (string)

♦ MaxMultiplicity (string)

♦ Overridden (boolean)

♦ DataTypeModifierPrefix (string)

♦ DataTypeModifierSuffix (string)

♦ @<tag> [Java-specific] (string) -Javadoc@<tag> extended attribute withadditional formatting

18

Page 25: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

Metaclass Attributes

PdOOM.Class

♦ MinCardinality (string)

♦ MaxCardinality (string)

♦ SimpleTypeAttribute [XML-specific]

♦ @<tag> [Java-specific] (string) -Javadoc@<tag> extended attribute withadditional formatting

PdOOM.Interface

♦ @<tag> [Java-specific] (string) -Javadoc@<tag> extended attribute withadditional formatting

PdOOM.Operation

♦ DeclaringInterface (object)

♦ GetSetAttribute (object)

♦ Overridden (boolean)

♦ ReturnTypeModifierPrefix (string)

♦ ReturnTypeModifierSuffix (string)

♦ @<tag> [Java-specific] (string) -Javadoc@<tag> extended attribute withadditional formatting (especially for @throws,@exception, @params)

PdOOM.Parameter

♦ DataTypeModifierPrefix (string)

♦ DataTypeModifierSuffix (string)

Calculated collections

The following calculated collections are metamodel extensions specific tothe GTL:

19

Page 26: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

The PowerDesigner Public Metamodel

Metaclass name Collection name

PdCommon.BaseModel Generated <metaclass-name>List - Collectionof all objects of type <metaclass-name> that arepart of the selection in the generation dialog

PdCommon. BaseClas-sifierMapping

SourceLinks

PdCommon. BaseAsso-ciationMapping

SourceLinks

20

Page 27: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

The PowerDesigner XML Model File FormatAll model files in PowerDesigner have an extension that corresponds to themodule in which they are saved. For example, a model saved in theobject-oriented module has the extension OOM. Beside the file extension,you can decide a format for saving your models:

♦ BIN (Binary) - files are smaller and significantly quicker to open and save

♦ XML – larger and slower than binary files, but manipulable with standardXML editors. There is a DTD for each different kind of model file in the\DTD folder in the PowerDesigner installation directory.

PowerDesigner XML model file markup

The following markups are used in PowerDesigner XML files:

Markup Description

<c:collection>

</c:collection>

Collection - A collection of objects linked to another object.You can use the PowerDesigner metamodel to visualize thecollections of an object. For example <c:Children>

<o:object>

</o:object>

Object - An object that you can create in PowerDesigner.For example <o:Model>. When an object is alreadydefined in the file, a reference is created the next time itis browsed in the XML file. For example <o:Class Ref=“xyz”/>

<a:attribute>

</a:attribute>

Attribute - An object is made up of a number of attributeseach of which you can modify independently. For example<a:ObjectID>

The format of XML files reflects the way model information is saved:PowerDesigner browses each object in order to save its definition.

The definition of an object implies the definition of its attributes and itscollections. This implies that PowerDesigner checks each object and drillsdown the collections of this object to define each new object and collectionin these collections, and so on, until the process finds terminal objects thatdo not need further analysis.

Since collections can overlap, the format of PowerDesigner model filesresemble a tree view, which starts from a root node (the root objectcontaining any model collection) and cascades through collections.

When an object is mentioned in a collection, PowerDesigner either definesthis object using the <o:object Id="XYZ"> syntax or references it with

21

Page 28: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

The PowerDesigner XML Model File Format

the <o:object Ref="XYZ"/> (empty tag) syntax. Object definition isonly used in composition collections, where the parent object owns thechildren in the association.

In both cases, XYZ is a unique identifier automatically assigned to an objectwhen it is found for the first time.

XML and the PowerDesigner metamodel

PowerDesigner models are made up of objects, the properties andinteractions of which are explained in the public metamodel (see “ThePowerDesigner Public Metamodel” on page 12).

You can use the PowerDesigner public metamodel to better understand theformat of PowerDesigner XML files:

Object names, as declared in markup <o:name of object>, correspond topublic names in the metamodel. You can search for an object in themetamodel using the object name found in the XML file.

Once you have found and located the object in the metamodel you can readthe following information:

♦ Each PowerDesigner object can have several collections corresponding toother objects to interact with, these collections are represented by theassociations existing between objects. The roles of the associations(aggregations and compositions included) correspond to the collectionsof an object. For example, each PowerDesigner model contains acollection of domains called Domains.

Usually associations have only one role, the role is displayed at theopposite of the class for which it represents a collection. However, themetamodel also contains associations with two roles, in such case, bothcollections cannot be saved in the XML file. You can identify thecollection that will be saved from the association property sheet: the rolewhere the Navigable check box is selected is saved in the file.

In the following example, association has two roles which meansClassifier has a collection Actors, and Actor2 has a collectionImplementationClasses:

22

Page 29: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

If you display the association property sheet, you can see that theNavigable check box is selected for role ImplementationClass, whichmeans that only collection ImplementationClass will be saved in file.

♦ Attributes with the IOBJECT data type are attributes in the metamodelwhile they appear as collections containing a single object in the XMLfile. This is not true for Parent and Folder that do not contain anycollection.

23

Page 30: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

The PowerDesigner XML Model File Format

Example: Simple OOM XML file

The following model contains two classes and one association. We are goingto explore the XML file corresponding to this model.

The file starts with several lines stating XML and model related details.

The first object to appear is the root of the model <o:RootObject Id=“01”>.RootObject is a model container that is defined by default whenever youcreate and save a model. RootObject contains a collection called Childrenthat is made up of models.

In our example, Children contains only one model object that is defined asfollows:

<o:Model Id="o2"><a:ObjectID>3CEC45F3-A77D-11D5-BB88-0008C7EA916D</a:ObjectID><a:Name>ObjectOrientedModel_1</a:Name><a:Code>OBJECTORIENTEDMODEL_1</a:Code><a:CreationDate>1000309357</a:CreationDate><a:Creator>arthur</a:Creator><a:ModificationDate>1000312265</a:ModificationDate><a:Modifier>arthur</a:Modifier><a:ModelOptionsText>

[ModelOptions]...

Below the definition of the model object, you can see the series ofModelOptions attributes. Note that ModelOptions is not restricted to theoptions defined in the Model Options dialog box of a model, it gathers allproperties saved in a model such as intermodel generation options.

After ModelOptions, you can identify collection <c:ObjectLanguage>.This is the object language linked to the model. The second collection of themodel is <c:ClassDiagrams>. This is the collection of diagrams linked tothe model, in our example, there is only one diagram defined in thefollowing paragraph:

24

Page 31: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 1. Resource Files and the Public Metamodel

<o:ClassDiagram Id="o4"><a:ObjectID>3CEC45F6-A77D-11D5-BB88-

0008C7EA916D</a:ObjectID><a:Name>ClassDiagram_1</a:Name><a:Code>CLASSDIAGRAM_1</a:Code><a:CreationDate>1000309357</a:CreationDate><a:Creator>arthur</a:Creator><a:ModificationDate>1000312265</a:ModificationDate><a:Modifier>arthur</a:Modifier><a:DisplayPreferences>

...

Like for model options, ClassDiagram definition is followed by a series ofdisplay preference attributes.

Within the ClassDiagram collection, a new collection called <c:Symbols>is found. This collection gathers all the symbols in the model diagram. Thefirst object to be defined in collection Symbols is AssociationSymbol:

<o:AssociationSymbol Id="o5"><a:CenterTextOffset>(1, 1)</a:CenterTextOffset><a:SourceTextOffset>(-1615, 244)</a:SourceTextOffset><a:DestinationTextOffset>(974, -

2)</a:DestinationTextOffset><a:Rect>((-6637,-4350), (7988,1950))</a:Rect><a:ListOfPoints>((-6637,1950),(7988,-

4350))</a:ListOfPoints><a:ArrowStyle>8</a:ArrowStyle><a:ShadowColor>13158600</a:ShadowColor><a:FontList>DISPNAME 0 Arial,8,N

AssociationSymbol contains collections <c:SourceSymbol> and<c:DestinationSymbol>. In both collections, symbols are referred to but notdefined: this is because ClassSymbol does not belong to the SourceSymbolor DestinationSymbol collections.

<c:SourceSymbol><o:ClassSymbol Ref="o6"/></c:SourceSymbol><c:DestinationSymbol><o:ClassSymbol Ref="o7"/></c:DestinationSymbol>

The association symbols collection is followed by the<c:Symbols>collection. This collection contains the definition of both class symbols.

<o:ClassSymbol Id="o6"><a:CreationDate>1012204025</a:CreationDate><a:ModificationDate>1012204025</a:ModificationDate><a:Rect>((-18621,6601), (-11229,12675))</a:Rect><a:FillColor>16777215</a:FillColor><a:ShadowColor>12632256</a:ShadowColor><a:FontList>ClassStereotype 0 Arial,8,N

25

Page 32: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

The PowerDesigner XML Model File Format

Collection <c:Classes> follows collection <c:Symbols>. In this collection,both classes are defined with their collections of attributes.

<o:Class Id="o10"><a:ObjectID>10929C96-8204-4CEE-911#-

E6F7190D823C</a:ObjectID><a:Name>Order</a:Name><a:Code>Order</a:Code><a:CreationDate>1012204026</a:CreationDate><a:Creator>arthur</a:Creator><a:ModificationDate>1012204064</a:ModificationDate><a:Modifier>arthur</a:Modifier><c:Attributes><o:Attribute Id="o14">

Attribute is a terminal object: there is not further ramification required todefine this object.

Each collection belonging to an analyzed object is expanded, and analyzedand the same occurs for collections within collections.

Once all objects and collections are browsed, the following markups appear:

</o:RootObject></Model>

Modifying an XML file

You can modify a model by editing its XML file using a standard text editorsuch as Notepad or in an XML editor, but you must be very careful, becauseeven a minor syntax error could render the file unusable.

If you create an object in an XML file by copying an existing object of thesame type, make sure that you remove the duplicated OID. It is better toremove a duplicated OID than try to create a new one because this new IDmay not be unique in the model. PowerDesigner will automatically assign anOID to the new object when you open the model.

26

Page 33: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

CHAPTER 2

DBMS Reference Guide

About this chapter This chapter describes the structure and contents of PowerDesigner DBMSdefinition files.

Before you begin Modifications to a DBMS definition file can change the way PowerDesignerfunctions work, especially when generating scripts. Make sure you createbackup copies of your database and thoroughly test generated scripts beforeexecuting them.

Contents Topic: page

DBMS Definition File Overview 28

Managing Generation and Reverse Engineering 31

General Category 51

Script/Sql Category 53

Script/Objects Category 61

Script/Data Type Category 126

Profile Category 129

Physical Options 135

PDM Variables 143

27

Page 34: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

DBMS Definition File Overview

DBMS Definition File OverviewA DBMS definition file is a PowerDesigner resource file that providesPowerDesigner with the information necessary to model, reverse-engineer,and generate a particular DBMS.

PowerDesigner provides definition files for most popular DBMSs. TheDBMS definition files are located in install_dir/Resource Files/DBMS, andhave an .xdb extension.

You can consult or modify a DBMS definition file using the Resource Editor.When you select a category or an item in the left-hand pane, the name,value, and related comment appear in the right side of the dialog box.

v To open your target DBMS definition file in the Resource Editor

1. Select Database ä Edit current DBMS

The DBMS Properties dialog box is displayed.

CautionYou should never modify the DBMS files shipped with PowerDesigner.You should instead copy the DBMS to create a new one. To do so, createa new DBMS from the List of DBMS, define a name, and then select theoriginal file in the Copy From list. For more information, see “Creating anew definition file” in the “The Resource Editor” chapter.

+ For more information on using the editor, see the “The Resource Editor”

28

Page 35: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

chapter.

DBMS definition file structure

All DBMS definition files have the same structure made up of a number ofcategories, each of which may contain items or other categories. The items,and their values are different for each DBMS. Each item is present only if itis relevant to the DBMS. Each value is a SQL statement or other parameterto define how to model, generate and reverse engineer for the DBMS.

Each DBMS file has the following structure:

♦ General - contains general information about the database, without anycategories (see “General Category” on page 51). All items defined in theGeneral category apply to all database objects.

♦ Script - used for generation and reverse engineering. Contains thefollowing sub-categories:• SQL - contains the following sub-categories, each of which contains

items whose values define general syntax for the database:

♦ Syntax - general parameters for SQL syntax (see “Syntax category”on page 53)

♦ Format - parameters for allowed characters (see “Format category”on page 54)

♦ File - header, footer and usage text items used during generation(see “File category” on page 56)

♦ Keywords - the list of SQL reserved words and functions (see“Keywords category” on page 58)

• Objects - contains commands to create, delete or modify all theobjects in the database. Also includes commands that define objectbehavior, defaults, necessary SQL queries, reverse engineering options,and so on (see “Script/Objects Category” on page 61).

• Data Type - contains the list of valid data types for the specifiedDBMS and the corresponding types in PowerDesigner (see“Script/Data Type Category” on page 126)

• Customize - Retrieves information from PowerDesigner Version 6DBMS definition files. It is not used in later versions.

♦ ODBC - present only if the DBMS does not support standard statementsfor generation. In this case the ODBC category contains additional itemsnecessary for live database connection generation .

♦ Transformation Profiles – contains group of transformations usedduring model generation when you need to apply changes to objects in

29

Page 36: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

DBMS Definition File Overview

the source or target models. For more information, see the “ManagingTransformations” chapter in the General Features Guide .

♦ Profile - allows you to define extended attribute types and extendedattributes for database objects. For more information, see “ProfileCategory” on page 129.

DBMS property page

A DBMS has a property page available when you click the root node in thetree view. The following properties are defined:

Property Description

Name Name of the DBMS. This name must be unique in a model

Code Code of the DBMS. This code must be unique in a model

File Name [read only] Path and name of the DBMS file.

Family Used to classify a DBMS, and to establish a link betweendifferent database resource files. For example, Sybase ASAnywhere, and Sybase AS Enterprise belong to the SQL Serverfamily.

Triggers are retained when you change target within the samefamily.

Merge interface allows to merge models from the same family

Comment Additional information about the DBMS

Triggers templates, trigger template items, and procedure templates

The DBMS Trigger templates, Trigger template items, and Proceduretemplates are accessible via the tabs in the Resource Editor window

Templates for stored procedures are defined under the Procedure category inthe DBMS tree view.

+ For more information, see the “Triggers and Procedures” chapter in thePDM User’s Guide .

30

Page 37: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Managing Generation and Reverse EngineeringPowerDesigner supports reverse engineering and generation through bothscripts and live database connections.

In this section:

♦ Statement is used to define a piece of SQL syntax. Statements oftencontain variables that will be evaluated during generation and scriptreverse engineering.

♦ Query is reserved for describing live database reverse engineering

Statements for script generation, script reverse engineering, and livedatabase generation are identical, whereas live database reverse engineeringmay require specific queries.

The processes of generation and reverse-engineering can be defined asfollows:

♦ Generation - statements are parsed and variables are evaluated andreplaced by their actual values taken from the current model. The samestatements are used for script and live database generation.

♦ Reverse engineering – may be performed by:• Script - PowerDesigner parses the script and identifies the different

statements thanks to the terminator (defined in Script\Sql\Syntax).Each individual statement is “associated” with an existing statement inthe DBMS definition file in order to commit the variables in thereversed statement as items in a PowerDesigner model.

• Live database connection - special queries are used to retrieveinformation from the database system tables. Each column of a queryresult set is associated with a variable. The query header specifies theassociation between the columns of the resultset and the variable. Thevalues of the returned records are stored in these variables which arethen committed as object attributes.

+ For more information on variables, see “Optional strings and variables”on page 155.

Script Category

The Script category contains the following kinds of items:

♦ Generation and reverse engineering statements - used for script andlive database generation and script reverse engineering. For example, thestandard statement for creating an index is:

31

Page 38: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

create index %INDEX%

These statements differ from DBMS to DBMS. For example in Oracle 9i,the index create statement contains the definition of an owner:

create [%UNIQUE%?%UNIQUE% :[%INDEXTYPE% ]]index[%QUALIFIER%]%INDEX% on [%CLUSTER%?cluster C_%TABLE%:[%TABLQUALIFIER%]%TABLE% (

%CIDXLIST%)][%OPTIONS%]

The following kinds of generation and reverse engineering statements arealso available:

♦ Drop for deleting an object

♦ Options for defining the physical options of an object

♦ ConstName to define the constraint name template for object checks

♦ Modify statements - used to modify the attributes of already existingobjects. Most start with the word “Modify”, but others include Renameor AlterTableFooter.

The statement for creating a key depending on where the key is defined.If the key is inside the table, then it will be created with a generationorder, and if it is created outside the table, it will be a modify order of thetable.

♦ Database definition items – used to customize the PowerDesignerinterface and behavior according to database features. For example, itemMaxlen in the table category, has to be set according to the maximumcode length tolerated for a table in the current database.

Permission, EnableOwner, AllowedADT are other examples of itemsdefined to adapt PowerDesigner to the current DBMS.

♦ Live database reverse engineering queries - most start with “Sql”. Forexample, SqlListQuery retrieves a list of objects, and SqlOptsQueryreverse engineers physical options. For more information, see “Livedatabase reverse engineering” on page 37.

ODBC category

The ODBC category contains items for live database generation when theDBMS does not support the generation statements defined in the Scriptcategory.

32

Page 39: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

For example, data exchange between PowerDesigner and MSACCESSworks with VB scprits and not SQL, this is the reason why these statementsare located in the ODBC category. You have to use a special program(access.mdb) to convert these scripts into MSACCESS database objects.

Script generation

Script generation statements are available in the Script category, under thedifferent object categories. For example, in Sybase ASA 8, the Createstatement in the Table category is the following:

create table [%QUALIFIER%]%TABLE%(

%TABLDEFN%)[%OPTIONS%]

This statement contains the parameters for creating the table together withits owner and physical options.

Extension mechanism You can extend script generation statements to complement generation usingthem extension statements. The extension mechanism allows you togenerate statements immediately before or after Create, Drop, and Modifystatements, and to retrieve these statements during reverse engineering.

+ For more information on reverse engineering additional statements seesection ““Script reverse engineering” on page 36”.

Generation TemplateLanguage

Extension statements are defined using the PowerDesigner GenerationTemplate Language (GTL) mechanism.

An extension statement can contain:

♦ Reference to other statements that will be evaluated during generation.These items are text items that must be defined in the object category ofthe extension statements

♦ Variables used to evaluate object properties and extended attributes.Variables are enclosed between % characters

♦ Macros such as “.if”, provide generic programming structures for testingvariables. Note: we recommend that you avoid using GTL macros ingeneration scripts, as they cannot be reconstituted when reverseengineering by script. Generating and reverse engineering via a livedatabase connection are not subject to this limitation.

+ For more information on the PowerDesigner Generation TemplateLanguage (GTL), see chapter “Generation Reference Guide”.

33

Page 40: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

+ During generation, the statements and variables are evaluated and theresult is added to the global script.

Example 1 The extension statement AfterCreate is defined in the table category tocomplement the table Create statement by adding partitions to the table if thevalue of the partition extended attribute requires it.

AfterCreate is defined in GTL syntax as follows:

.if (%ExtTablePartition% > 1)%CreatePartition%go.endif

The .if macro is used to evaluate variable %ExtTablePartition%. Thisvariable is an extended attribute that contains the number of table partitions.If the value of %ExtTablePartition% is higher than 1, then%CreatePartition% will be generated followed by “go”. %CreatePartition%is a statement defined in the table category as follows:

alter table [%QUALIFIER%]%TABLE%partition %ExtTablePartition%

%CreatePartition% generates the statement for creating the number of tablepartitions specified in %ExtTablePartition%.

Example 2 You create in Sybase ASE an extended statement to automatically create thelogin of a user before the Create user statement is executed. TheBeforeCreate statement is the following:

sp_addlogin %Name% %Password%go

The automatically generated login will have the same name as the user andits password. You can preview the statement in the user property sheet, theBeforeCreate statement is displayed before the user creation statement:

34

Page 41: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Modify statements You can also add BeforeModify and AfterModify statements to standardmodify statements.

Modify statements are executed to synchronize the database with the schemacreated in the PDM. By default, the modify database feature does not takeinto account extended attributes when it compares changes performed in themodel from the last generation. You can bypass this rule by adding extendedattributes in the ModifiableAttributes list item. Extended attributes definedin this list will be taken into account in the merge dialog box during databasesynchronization.

To detect that an extended attribute value has been modified you can use thefollowing variables:

♦ %OLDOBJECT% to access an old value of the object

♦ %NEWOBJECT% to access a new value of the object

For example, you can verify that the value of the extended attributeExtTablePartition has been modified using the following GTL syntax:

.if (%OLDOBJECT.ExtTablePartition% !=%NEWOBJECT.ExtTablePartition%)

If the extended attribute value was changed, an extended statement will begenerated to update the database. In the Sybase ASE syntax, the

35

Page 42: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

ModifyPartition extended statement is the following because in case ofpartition change you need to delete the previous partition and then recreate it:

.if (%OLDOBJECT.ExtTablePartition% !=%NEWOBJECT.ExtTablePartition%)

.if (%NEWOBJECT.ExtTablePartition% > 1).if (%OLDOBJECT.ExtTablePartition% > 1)

%DropPartition%.endif

%CreatePartition%.else

%DropPartition%.endif

.endif

+ For more information on the PowerDesigner Generation TemplateLanguage (GTL), see chapter “Generation Reference Guide”.

Script reverse engineering

The same statements are used for generation and reverse engineering.

If you are using the extension mechanism for script generation, you have todeclare statements in the list item ReversedStatements in order for them tobe properly reversed. Type one statement per line in the ReversedStatementlist.

For example, the extension statement AfterCreate uses statementCreatePartition. This text item must be declared in ReversedStatements to beproperly reverse engineered. You could declare other statements in thefollowing way:

36

Page 43: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Live database generation

In general, live database generation uses the same statements as scriptgeneration. However, when the DBMS does not support standard SQLsyntax, special generation statements are defined in the ODBC category.This is the case for MSACCESS that needs VB scripts to create databaseobjects during live database generation.

These statements are defined in the ODBC category of the DBMS.

Live database reverse engineering

The DBMS contains live database reverse engineering queries for retrievingobjects (like Table, Columns, and so on) from the database.

Most queries follow the same naming pattern “Sql. . . Query”.

37

Page 44: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

Item Description

SqlListQuery Lists objects for selection in the Selection box.SqlListQuery retrieves objects and fills thereverse engineering window. Then, each of the otherqueries below are executed for each selected object.

If SqlListQuery is not defined, stan-dard functions are used to retrieve objects.SqlAttrQuery, SqlOptsQuery etc. willthen be executed, if defined.

SqlListQuery must retrieve the smallest num-ber of columns possible as the process is memoryintensive

SqlAttrQuery Reverse engineers object attributes.SqlAttrQuery may be unnecessary ifSqlListQuery can retrieve all necessary in-formation. For example, in Sybase Adaptive ServerAnywhere 6, a tablespace list query is sufficient toretrieve all information required for use in a PDM

SqlOptsQuery Reverse engineers physical options

SqlListChildren-Query

Reverse engineers lists child objects, such as columnsof a specific index or key, joins of a specific reference

SqlSysIndexQuery Reverse engineers system indexes created by thedatabase

SqlChckQuery Reverse engineers object check constraints

SqlPermQuery Reverse engineers object permissions

You can define additional queries to recover more attributes during livedatabase reverse engineering. This is to avoid loading SqlListQuery withqueries for retrieving attributes not supported by SqlAttrQuery, or objectsnot selected for reverse engineering. These additional queries must be listedin the ReversedQueries item. For example, SqlColnListQuery is used toexclusively retrieve view columns. This query has to be declared in theReversedQueries item in order to be taken into account during reverseengineering.

Note: extended queries should not be defined in the ReversedQueries item.For more information on ReversedQueries, see section ““Extensionmechanism for live database reverse engineering queries” on page 41”.

38

Page 45: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Query structure

Each column of a query result set is associated with a variable. A scriptheader specifies the association between the columns of the result set and thevariable. The values of the returned records are stored in these variables,which are then committed as object attribute values.

The script header is contained within curly brackets { }. The variables arelisted within the brackets, each variable separated by a comma. There is amatching column for each variable in the Select statement that follows theheader.

For example:

{OWNER, @OBJTCODE, SCRIPT, @OBJTLABL}SELECT U.USER_NAME, P.PROC_NAME, P.PROC_DEFN, P.REMARKSFROM SYSUSERPERMS U,SYSPROCEDURE PWHERE [%SCHEMA% ? U.USER_NAME=’%SCHEMA%’ AND] P.CREATOR=U.USER_

IDORDER BY U.USER_NAME

The variables can be any listed in “PDM Variables” on page 143.

Each comma-separated part of the header is associated with the followinginformation:

♦ Name of variable (mandatory). See the example in Processing withvariable names

39

Page 46: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

♦ The ID keyword follows each variable name. ID means that the variableis part of the identifier

♦ The ... (ellipsis) keyword means that the variable must be concatenatedfor all the lines returned by the SQL query and having the same valuesfor the ID columns

♦ Retrieved_value = PD.value lists the association between aretrieved value and a PowerDesigner value. A conversion table convertseach value of the record (system table) to another value ( inPowerDesigner). This mechanism is optionally used. See the example inProcessing with conversion table

The only mandatory information is the variable name. All others areoptional. The ID and ... (ellipsis) keywords are mutually exclusive.

Processing with variablenames:

{TABLE ID, ISPKEY ID, CONSTNAME ID, COLUMNS ...}select

t.table_name,1,null,c.column_name + ’, ’,c.column_id

fromsystable t,syscolumn c

whereetc..

In this script, the identifier is defined as TABLE + ISKEY+ CONSTNAME.

In the result lines returned by the SQL script, the values of the fourth field isconcatenated in the COLUMNS field as long as these ID values are identical.

SQL Result setTable1,1,null,’col1,’Table1,1,null,’col2,’Table1,1,null,’col3,’Table2,1,null,’col4,’In PowerDesigner memoryTable1,1,null,’col1,col2,col3’Table2,1,null,’col4’

In the example, COLUMNS will contain the list of columns separated bycommas. PowerDesigner will process the contents of COLUMNS field toremove the last comma.

Processing withconversion table:

The syntax inserted just behind a field inside the header is:

(SQL value1 = PowerDesigner value1, SQL value2 = PowerDesignervalue2, * = PowerDesigner value3)

40

Page 47: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

where * means all other values.

For example:

{ADT, OWNER, TYPE(25=JAVA , 26=JAVA)}SELECT t.type_name, u.user_name, t.domain_idFROM sysusertype t, sysuserperms uWHERE [u.user_name = ’%SCHEMA%’ AND](domain_id = 25 OR domain_id = 26) ANDt.creator = u.user_id

In this example, when the SQL query returns the value 25 or 26, it isreplaced by JAVA in TYPE variable.

Extension mechanism for live database reverse engineering queries

During reverse engineering, PowerDesigner executes queries to retrieveinformation from the columns of the system tables. The result of the query ismapped to PowerDesigner internal variables via the query header. When thesystem tables of a DBMS store information in columns with LONG, BLOB,TEXT and other incompatible data types, PowerDesigner cannotconcatenate these data into strings.

You can bypass this limitation by using the EX keyword and creatinguser-defined queries and variables in the existing reverse engineering querieswith the syntax:

%UserDefinedQueryName.UserDefinedVariableName%

These user-defined variables will be evaluated by sub-queries which youwrite.

In the following example, the value of OPTIONS is marked as containing auser-defined query, and we see in the body of the query that the ‘globalpartition by range’ option contains a user-defined query called:’SqlPartIndexDef’, which seeks values for the variables ‘i.owner’ and‘i.index_name’:

{OWNER, TABLE, CONSTNAME, OPTIONS EX}

selectc.owner,c.table_name,c.constraint_name,...’global partition by range

(%SqlPartIndexDef.’||i.owner||i.index_name||’%)’,...

The following graphic illustrates the process of variable evaluation duringreverse engineering:

41

Page 48: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

ReversedQueriesExtended queries should not be defined in the ReversedQueries item.

Step1 A query is executed to evaluate variables in a set of string statements.

If the EX keyword is present in the query header, PowerDesigner searchesfor user-defined queries and variables to evaluate. These user-definedvariables are created to be filled with data proceeding from columns withLONG/BLOB/TEXT. . . data type.

You can create user-defined queries in any live database reverse engineeringquery. Each query must have a unique name.

Step 2 The execution of the user-defined query generates a resultset containing

42

Page 49: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

pairs of user-defined variable names (without %) and variable value for eachof the variables as needed.

For example, in the following resultset, the query returns 3 rows and 4columns by row:

Variable 1 1 Variable 2 2

Variable 3 3 Variable 4 4

Variable 5 5 Variable 6 6

Step 3 These values replace the user-defined variables in the original query.

The following sections explain user-defined queries defined to addressreverse engineering limitations.

Live database reverse engineering physical options

During reverse engineering, physical options are concatenated in a singlestring statement. However, when the system tables of a database arepartitioned (like in Oracle) or fragmented (like in Informix), thepartitions/fragments share the same logical attributes but their physicalproperties like storage specifications, are stored in each partition/fragment ofthe database. The columns in the partitions/fragments have a data type(LONG) that allows storing larger amount of unstructured binaryinformation.

Since physical options in these columns cannot be concatenated in the stringstatement during reverse engineering, SqlOptsQuery (Tables category inthe DBMS) contains a call to a user-defined query that will evaluate thesephysical options.

In Informix SQL 9, SqlOptsQuery is delivered by default with thefollowing user-defined queries and variables (the following is a subset ofSqlOptsQuery):

43

Page 50: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

selectt.owner,t.tabname,’%SqlFragQuery.FragSprt’||f.evalpos||’%

%FragExpr’||f.evalpos||’% in %FragDbsp’||f.evalpos||’%’,

f.evalposfrom

informix.systables t,informix.sysfragments f

wheret.partnum = 0and t.tabid=f.tabid

[ and t.owner = ’%SCHEMA%’][ and t.tabname=’%TABLE%’]

After the execution of SqlOptsQuery, the user-defined querySqlFragQuery is executed to evaluateFragDbsp n, FragExpr n, andFragSprt n. n stands forevalpos which defines fragment position in thefragmentation list. n allows to assign unique names to variables, whateverthe number of fragment defined in the table.

FragDbsp n, FragExpr n, and FragSprt n are user-defined variables thatwill be evaluated to recover information concerning the physical options offragments in the database:

User-defined variable Physical options

FragDbsp n Fragment location for fragment number n

FragExpr n Fragment expression for fragment number n

FragSprt n Fragment separator for fragment number n

SqlFragQuery is defined as follows:

{A, a(E="expression", R="round robin", H="hash"), B, b, C, c,D, d(0="", *=",")}

select’FragDbsp’||f.evalpos, f.dbspace,’FragExpr’||f.evalpos, f.exprtext,’FragSprt’||f.evalpos, f.evalpos

frominformix.systables t,informix.sysfragments f

wheret.partnum = 0and f.fragtype=’T’and t.tabid=f.tabid

[ and t.owner = ’%SCHEMA%’][ and t.tabname=’%TABLE%’]

44

Page 51: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

The header of SqlFragQuery contains the following variable names.

{A, a(E="expression", R="round robin", H="hash"), B, b, C, c,D, d(0="", *=",")}

Only the translation rules defined between brackets will be used duringstring concatenation: “FragSprt0”, which contains 0 (f.evalpos), will bereplaced by “ “, and “FragSprt1”, which contains 1, will be replaced by “,”

SqlFragQuery generates a numbered resultset containing as many pairs ofuser-defined variable name (without %) and variable value as needed, ifthere are many variables to evaluate.

The user-defined variable names are replaced by their values in the stringstatement for the physical options of fragments in the database.

Live database reverse engineering function-based index

In Oracle 8i and later versions, you can create indexes based on functionsand expressions that involve one or more columns in the table being indexed.A function-based index precomputes the value of the function or expressionand stores it in the index. The function or the expression will replace theindex column in the index definition.

An index column with an expression is stored in system tables with a LONGdata type that cannot be concatenated in a string statement during reverseengineering.

To bypass this limitation, SqlListQuery (Index category in the DBMS)contains a call to the user-defined query SqlExpression used to recoverthe index expression in a column with the LONG data type and concatenatethis value in a string statement (the following is a subset of SqlListQuery):

45

Page 52: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

select’%SCHEMA%’,i.table_name,i.index_name,decode(i.index_type, ’BITMAP’, ’bitmap’, ’’),decode(substr(c.column_name, 1, 6), ’SYS_NC’,

’%SqlExpression.Xpr’||i.table_name||i.index_name||c.column_position||’%’, c.column_name)||’’||c.descend||’, ’,

c.column_positionfrom

user_indexes i,user_ind_columns c

wherec.table_name=i.table_nameand c.index_name=i.index_name

[ and i.table_owner=’%SCHEMA%’][ and i.table_name=’%TABLE%’][ and i.index_name=’%INDEX%’]

The execution of SqlListQuery calls the execution of the user-definedquery SqlExpression.

SqlExpression is followed by a user-defined variable defined as follow:

{VAR, VAL}

select’Xpr’||table_name||index_name||column_position,column_expression

fromall_ind_expressions

where 1=1[ and table_owner=’%SCHEMA%’][ and table_name=’%TABLE%’]

The name of the user-defined variable is unique, it is the result of theconcatenation of “Xpr”, table name, index name, and column position.

Live database reverse engineering qualifiers

A qualifier allows the use of the object qualifier that is displayed in thedropdown list box in the upper left corner of the Database ReverseEngineering dialog box. You use a qualifier to select which objects are to bereverse engineered.

46

Page 53: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

You can add a qualifier section when you customize your DBMS. Thissection must contain the following items:

♦ enable: YES/NO

♦ SqlListQuery (script) : this item contains the SQL query that is executedto retrieve the qualifier list. You should not add a Header to this query

The effect of these items are shown in the table below:

Enable SqlListQuerypresent?

Result

Yes Yes Qualifiers are available for selection. Selectone as required. You can also type the name ofa qualifier. SqlListQuery is executed to fill thequalifier list

No Only the default (All qualifiers) is selected.You can also type the name of a qualifier

No No Dropdown list box is grayed.

+ For more information on qualifier filters, see section “Filters and optionsfor reverse engineering” in chapter “Reverse Engineering” in the PDMUser’s Guide .

Example In Adaptive Server Anywhere 7, a typical qualifier query is:

47

Page 54: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

.Qualifier.SqlListQuery :select dbspace_name from sysfile

Generating and reverse engineering extended objects

Some DBMSs have objects that cannot be represented by the standardPowerDesigner model objects. However, you can work with these objects,generate and reverse-engineer them through the use of extended objects. Todo this you must first create an extended object, and then define itsgeneration and reverse engineering scripts.

v To create an extended object

1. Select Database ä Edit Current DBMS to open the DBMS Propertieswindow, and then expand the Profile category in the left-hand pane.

2. If there is not an entry for Extended Object in this category, then createone by right-clicking Profile and selecting Add Metaclasses from thecontextual menu. In the Selection box, click the PdCommon sub-tab,select Extended Object and click OK to add it to the list of objects.

3. Right-click the Extended Object entry, and select New ä Stereotype fromthe contextual menu to create a new stereotype, which will be used todefine your new object.

4. Enter the name of your new object and select the Use as metaclasscheckbox. This will ensure that the new object appears in thePowerDesigner menus and has its own special browser category.

You can add attributes to the object, create templates to define its form forgeneration and reverse engineering, and produce custom forms for use inproperty sheets. For more information, see the “Managing Profiles”chapter.

Once you have defined your object, you need to enable its generation.

v To define generation and reverse engineering scripts for an ex-tended object

1. Right-click the Script/Objects category, and then select Add Items fromthe contextual menu to open a Selection dialog that lists all the objectsavailable in the model.

2. Select your new extended object in the list, and then click OK to add it tothe list of objects.

48

Page 55: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

3. Right-click the new object entry, and then select Add Items from thecontextual menu to open a Selection dialog that lists all the script itemsthat can be added to an extended object.

4. As a minimum, to enable the generation and reverse engineering of theobject, you should select the following items:

♦ Create

♦ Drop

♦ AlterStatementList

♦ SqlAttrQuery

♦ SqlListQuery

5. Click OK to add these script items to your object. You will need to entervalues for each of these items. For more information, and guidance onsyntax, see “Common object items” on page 63.

6. Your object will now be available for generation and reverse engineering.You can also control the order in which this and the other objects will begenerated. For more information, see “GenerationOrder - customizing theorder in which objects are generated” on page 61.

Adding scripts before or after generation and reverse engineering

You can specify scripts to be used before or after database generation orreverse engineering.

v To specify the scripts

1. Open the Profile folder. If there is no entry for Model, then right-click theProfile folder and select Add Metaclasses from the contextual menu toopen the Metaclass Selection dialog box.

2. On the PdPDM sub-tab, select Model and then click OK to return to theDBMS properties editor. The Model item now appears in the Profilefolder.

3. Right-click the Model item, and select New Event Handler from thecontextual menu to open a Selection dialog box.

4. Select one or more of the following event handlers depending on whereyou want to add a script:

♦ BeforeDatabaseGenerate

♦ AfterDatabaseGenerate

♦ BeforeDatabaseReverseEngineer

49

Page 56: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Generation and Reverse Engineering

♦ AfterDatabaseReverseEngineer

5. Click OK to return to the DBMS properties editor. The selected eventhandlers now appear beneath the Model item.

6. Select each of the event handlers in turn, click its Event Handler Scripttab, and enter the desired script.

7. Click OK to confirm your changes and return to the model.

50

Page 57: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

General CategoryThe General category is located directly beneath root, and contains thefollowing items:

Item Description

EnableCheck Specifies whether the generation of check parameters isauthorized. The following settings are available:♦ Yes - Check parameters generated

♦ No - All variables linked to Check parameters will notbe evaluated during generation and reverse

Enable Const-name

Specifies whether constraint names are used during gener-ation. The following settings are available:♦ Yes - Constraint names are used during generation

♦ No - Constraint names are not used

EnableIn-tegrity

Specifies whether there are integrity constraints in theDBMS. The following settings are available:♦ Yes - Primary, alternate, and foreign key check boxes

are available for database generation and modification

♦ No - Primary, alternate, and foreign key check boxes arenot available

EnableMultiCheck

Specifies whether the generation of multiple check param-eters for tables and columns is authorized. The followingsettings are available:♦ Yes - Multiple check parameters are generated. The first

constraint in the script corresponds to the concatenationof all validation business rules, the other constraints cor-respond to each constraint business rules attached to anobject

♦ No - All business rules (validation and constraint) areconcatenated into a single constraint expression

51

Page 58: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

General Category

Item Description

SqlSupport Specifies whether SQL syntax is allowed. The followingsettings are available:♦ Yes - SQL syntax allowed and SQL Preview available

♦ No - SQL syntax not allowed. SQL Preview is not avail-able

UniqConstName

Specifies whether unique constraint names for objects areauthorized . The following settings are available:♦ Yes - All constraint names (including index names) must

be unique in the database

♦ No - Constraint names must be unique for an objectCheck model takes this item into account in constraintname checking.

52

Page 59: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Script/Sql CategoryThe SQL category is located in the Root ä Script category. Itssub-categories define the SQL syntax for the DBMS

Syntax category

The Syntax category is located in the Root ä Script ä SQL category, andcontains the following items that define the DBMS-specific syntax:

Item Description

BlockCom-ment

Specifies the character used to enclose a multi-line com-mentary.

Example:/* */

Block Termi-nator

Specifies the end of block character, which is used to endexpressions for triggers and stored procedures.

Delimiter Specifies the field separation character.

Identifier De-limiter

Specifies the identifier delimiter character. When thebeginning and end delimiters are different, they must beseparated by a space character.

LineComment Specifies the character used to enclose a single line com-mentary.

Example:%%

Quote Specifies the character used to enclose string values.

Note that the same quote must be used in the checkparameter tab to enclose reserved words used as default.

SqlContinue Specifies the continuation character. Some databasesrequire a continuation character when a statement is longerthan a single line. For the correct character, refer to yourDBMS documentation. This character is attached to eachline just prior to the linefeed.

Terminator Specifies the end of statement character, which is usedto terminate create table, view, index, or the open/closedatabase, and other statements.

If empty, BlockTerminator is used instead.

53

Page 60: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Sql Category

Item Description

UseBlockTerm Specifies the use of BlockTerminator. The followingsettings are available:♦ Yes - BlockTerminator is always used

♦ No - BlockTerminator is used for triggers andstored procedures only

Format category

The Format category is located in the Root ä Script ä SQL category, andcontains the following items that define script formatting:

Item Description

AddQuote Specifies that object codes are systematically enquotedduring the generation. The following settings are available:♦ Yes – Quotes are systematically added to object codes

during generation

♦ No - Object codes are generated without quotes

CaseSensitiv-ity UsingQuote

Specifies if the case sensitivity for identifiers is managedusing double quotes. You should set this boolean to Yes ifthe DBMS you are using needs double quotes to preservethe case of object codes.

Date and Timeformats

See “Date and time format” on page 55.

EnableOwnerPrefix / En-ableDtbs Pre-fix

Specifies that object codes can be prefixed by the objectowner, the database name, or both, using the %QUALI-FIER% variable. The following settings are available:♦ Yes – enables the Owner Prefix and/or Database Pre-

fix check boxes in the Database Generation box. Selectone or both of these options to prefix objects. If you se-lect both, the owner and database are concatenated when%QUALIFIER% is evaluated.

♦ No - The Owner Prefix and Database Prefix options areunavailable

54

Page 61: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

IllegalChar [generation only] Specifies invalid characters for names.If there is an illegal character in a Code, the code is setbetween quotes during generation.

Example:+-*/!=<>’"()

If the name of the table is “SALES+PROFITS”, the gener-ated create statement will be:CREATE TABLE "SALES+PROFITS"

Double quotes are placed around the table name to indicatethat an invalid character is used. During reverse engineer-ing, any illegal character is considered as a separator unlessit is located within a quoted name.

LowerCaseOnly

When generating a script, all objects are generated inlowercase independently of the model Naming Conventionsand the PDM codes. The following settings are available:♦ Yes - Forces all generated script characters to lowercase

♦ No - Generates all script unchanged from the way ob-jects are written in the model

MaxScriptLen Specifies the maximum length of a script line.

UpperCaseOnly

When generating a script, all objects are generated inuppercase independently of the model Naming Conventionsand the PDM codes. The following settings are available:♦ Yes - Forces all generated script characters to uppercase

♦ No - Generates all script unchanged from the way ob-jects are written in the model

Note that the UpperCaseOnly and LowerCaseOnlyitems are mutually exclusive. In the event that both itemsare enabled, the script is generated in lowercase .

Date and time format

You can customize the date and time format for test data generation to ascript or live database connection using DBMS items in the Format category.

PowerDesigner uses the PhysDataType map item in the script\data typescategory to convert the physical data types of columns to conceptual datatypes because the DBMS items are linked with conceptual data types.

55

Page 62: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Sql Category

Example for Sybase AS Anywhere 7:

Physicaldata type

Conceptualdata type

DBMS entry usedfor SQL

DBMS entry used forlive connection

datetime DT DateTimeFormat OdbcDateTimeFormat

timestamp TS DateTimeFormat OdbcDateTimeFormat

date D DateFormat OdbcDateFormat

time T TimeFormat OdbcTimeFormat

If you want to customize the date and time format of your test datageneration, you have to verify the data type of the columns in your DBMS,then find the corresponding conceptual data type in order to know whichitem to customize in your DBMS. For example, if the columns use thedatetime data type in your model, you should customize theDateTimeFormat item in your DBMS.

The default date and time format is the following:

♦ SQL: ’yyyy-mm-dd HH:MM:SS’

♦ Live connection: {ts ’yyyy-mm-dd HH:MM:SS’}

Where:

Format Description

yyyy Year on 4 digits

yy Year on 2 digits

mm Month

dd Day

HH Hour

MM Minute

SS Second

For example, you can define the following value for the DateTimeFormatitem for SQL: yy-mm-dd HH:MM. For live database connections, this itemshould have the following value: {ts ’yy-mm-dd HH:MM’}.

File category

The File category is located in the Root ä Script ä SQL category, andcontains the following items that define script formatting:

56

Page 63: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

AlterHeader Specifies header text for a modify database script.

AlterFooter Specifies footer text for a modify database script.

EnableMultiFile

Specifies that multiple scripts are allowed. The followingsettings are available:♦ Yes – enables the One File Only check box in the Gen-

erate database, Generate Triggers and Procedures, andModify Database parameters windows. If you deselectthis option, a separate script is created for each table(named after the table, and with the extension defined inthe TableExt item), and a global script summarizesall the single table script items.

♦ The One File Only check box is unavailable, and a sin-gle script includes all the statements.

The file name of the global script is customizable in theFile Name field of the generation or modification windowsand has the extension specified in the ScriptExt item.

The default name for the global script is CREBAS fordatabase generation, CRETRG for triggers and stored pro-cedures generation, and ALTER for database modification.

Footer Specifies the text for the database generation script footer.

Header Specifies the text for the database generation script header.

ScriptExt Specifies the default script extension when you generate adatabase or modify a database for the first time.

Example:sql

StartCommand Specifies the statement for executing a script. Used insidethe header file of a multi-file generation to call all the othergenerated files from the header file.

Example (Sybase ASE 11):isql %NAMESCRIPT%

Corresponds to the %STARTCMD% variable (see “PDMVariables” on page 143).

57

Page 64: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Sql Category

Item Description

TableExt Specifies the extension of the scripts used to generate eachtable when the EnableMultiFile item is enabled and the“One File Only” check box is not selected in the Generateor Modify windows.

Example:sql

TrgFooter Specifies footer text for a triggers and procedures genera-tion script.

TrgHeader Header script for triggers and procedures generation.

TrgUsage1 [when using a single script] Specifies text to display inthe Output window at the end of trigger and proceduregeneration.

TrgUsage2 [when using multiple scripts] Specifies text to display inthe Output window at the end of trigger and proceduregeneration.

TriggerExt Specifies the main script extension when you generatetriggers and stored procedures for the first time.

Example:trg

Usage1 [when using a single script] Specifies text to display in theOutput window at the end of database generation.

Usage2 [when using multiple scripts] Specifies text to display inthe Output window at the end of database generation.

Keywords category

The Keywords category is located in the Root ä Script ä SQL category, andcontains the following items that reserve keywords.

The lists of SQL functions and operators are used to populate thePowerDesigner SQL editor to propose lists of available functions to help inentering SQL code.

58

Page 65: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

CharFunc Specifies a list of SQL functions to use with characters andstrings.

Example:char()charindex()char_length() etc

Commit Specifies a statement for validating the transaction by liveconnection.

ConvertFunc Specifies a list of SQL functions to use when convertingvalues between hex and integer and handling strings.

Example:convert()hextoint()inttohex() etc

DateFunc Specifies a list of SQL functions to use with dates.

Example:dateadd()datediff()datename() etc

GroupFunc Specifies a list of SQL functions to use with group key-words.

Example:avg()count()max() etc

ListOperators Specifies a list of SQL operators to use when comparingvalues, boolean, and various semantic operators.

Example:=!=not like etc

NumberFunc Specifies a list of SQL functions to use with numbers.

Example:abs()acos()asin() etc

59

Page 66: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Sql Category

Item Description

OtherFunc Specifies a list of SQL functions to use when estimating,concatenating and SQL checks.

Example:db_id()db_name()host_id() etc

Reserved De-fault

Specifies a list of keywords that may be used as defaultvalues. If a reserved word is used as a default value, it willnot be enquoted.

Example (SQL Anywhere 10) - USER is a reserved defaultvalue:Create table CUSTOMER (Username varchar(30) default USER)

When you run this script, CURRENT DATE is recognizedas a reserved default value.

ReservedWord Specifies a list of reserved keywords. If a reserved wordis used as an object code, it is enquoted during generation(using quotes only in DBMS ä Script ä SQL ä Syntax ä

Quote).

60

Page 67: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Script/Objects CategoryThe Objects category is located in the Root ä Script ä SQL category (and,possibly within Root ä ODBC ä SQL), and contains the following itemsthat define the database objects that will be available in your model.

Commands for All Objects

The following commands are located in the Root ä Script ä Objects andRoot ä ODBC ä Objects categories, and apply to all objects.

MaxConstLen – defining a maximum constraint name length

Command for defining the maximum constraint name length supported bythe target database for tables, columns, primary and foreign keys. This valueis implemented in the Check model and produces an error if the codeexceeds the defined value. The constraint name is also truncated atgeneration time.

Maximum length for constraint names:PowerDesigner has a maximum length of 254 characters for constraintnames. If your database supports longer constraint names, you must definethe constraint names to fit in 254 characters or less.

EnableOption – enabling physical options

Command for enabling physical options for the model, tables, indexes,alternate keys, and other objects that are supported by the target DBMS. Italso controls the availability of the Options tab from an object propertysheet. The following settings are available:

♦ Yes - The Physical Options tabs are available from the object propertysheet

♦ No - Physical Options tabs are not available from the object propertysheet.

+ For more information, see “Physical Options” on page 135

GenerationOrder – customizing the order in which objects are generated

Command for specifying the generation order of objects. Disabled bydefault.

61

Page 68: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

v To change the order in which objects are generated

1. Right-click the Script/Objects node and select Add Items from thecontextual menu to open a selection window listing all the availableobjects.

2. Select the GenerationOrder checkbox and click OK. TheGenerationOrder command is enabled and added at the foot of theObjects category list.

3. Click the GenerationOrder item to display its properties:

4. You can drag and drop entries in the Ordered List tab to adjust the orderin which objects will be created.

5. Note that not all object types are included in this list by default. You canadd and remove items to and from the list using the tools on the tab. If anobject does not appear on the list, it will still be generated, but after allthe other objects. Sub-objects, such as “Sequence::Permissions”, can beplaced directly below their parent object in the list (where they will beindented to demonstrate their parentage) or separately, in which case theywill be displayed without indentation.

6. Click OK to confirm your changes and return to the model.

62

Page 69: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Extended objectsBy default, extended objects (see “Generating and reverse engineeringextended objects” on page 48) are not automatically included in this list,and are generated after all other objects. To promote these objects in thegeneration order, simply add them to the list with the tab tools, and thenplace them in the desired generation position.

Common object items

The following items are available in various objects located in the Root ä

Script ä Objects category.

Item Description

Add Specifies the statement required to add the object insidethe creation statement of another object.

Example (adding a column):%20:COLUMN% %30:DATATYPE% [default

%DEFAULT%][%IDENTITY%?identity:[%NULL%][%NOTNULL%]]

[[constraint %CONSTNAME%] check(%CONSTRAINT%)]

AfterCreate/AfterDrop/ Af-terModify

Specifies extended statements executed after the mainCreate, Drop or Modify statements. For more information,see “Script generation” on page 33.

BeforeCreate/BeforeDrop/BeforeModify

Specifies extended statements executed before the mainCreate, Drop or Modify statements. For more information,see “Script generation” on page 33.

ConstName Specifies a constraint name template for the object. Thetemplate controls how the name of the object will begenerated.

The template applies to all the objects of this type forwhich you have not defined an individual constraint name.The constraint name that will be applied to an object isdisplayed in its property sheet.

Examples (ASE 15):♦ Table: CKT_%.U26:TABLE%

♦ Column: CKC_%.U17:COLUMN%_%.U8:TABLE%

♦ Primary Key: PK_%.U27:TABLE%

63

Page 70: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

Create [generation and reverse] Specifies the statement requiredto create the object.

Example:create table %TABLE%

DefOptions Specifies default values for physical options that will beapplied to all objects. These values must respect SQLsyntax.

Example:in default_tablespace

For more information, see “Physical Options” on page 135.

Drop Specifies the statement required to drop the object.

Example (SQL Anywhere 10):if exists( select 1 from

sys.systablewhere table_name=%.q:TABLE%and table_type in (’BASE’, ’GBLTEMP’)[%QUALIFIER%?and creator=user_id(%.q:OWNER%)]

) then drop table[%QUALIFIER%]%TABLE%

end if

Enable Specifies whether an object is supported.

64

Page 71: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

EnableOwner Enables the definition of owners for the object. The objectowner can differ from the owner of the parent table. Thefollowing settings are available:♦ Yes - The Owner list is enabled in the object’s property

sheet.

♦ No – Owners are not supported for the object.Note that, in the case of index owners, you must ensurethat the Create statement takes into account the tableand index owner. For example, in Oracle 9i, the Createstatement of an index is the following:create [%UNIQUE%?%UNIQUE%

:[%INDEXTYPE% ]]index[%QUALIFIER%]%INDEX% on[%CLUSTER%?cluster C_%TABLE%:[%TABLQUALIFIER%]%TABLE%(%CIDXLIST%

)][%OPTIONS%]

Where %QUALIFIER% refers to the current object (index)and %TABLQUALIFIER% refers to the parent table ofthe index.

EnableSyn-onym

Enables support for synonyms on the object.

Footer Specifies the object footer. The contents are inserteddirectly after each create object statement.

Header Specifies the object header. The contents are inserteddirectly before each create object statement.

MaxConstLen Specifies the maximum constraint name length supportedfor the object in the target database, where this valuediffers from the default. See also “MaxConstLen - defininga maximum constraint name length” on page 61).

MaxLen Specifies the maximum code length for an object. Thisvalue is used when checking the model and produces anerror if the code exceeds the defined value. The objectcode is also truncated at generation time.

65

Page 72: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

Modifiable At-tributes

Specifies a list of extended attributes that will be takeninto account in the merge dialog during database synchro-nization. For more information, see “Script generation” onpage 33.

Example (ASE 12.5):ExtTablePartition

Options Specifies physical options for creating an object.

Example (ASA 6):in %s : category=tablespace

For more information, see “Physical Options” on page 135.

Permission Specifies a list of available permissions for the object. Thefirst column is the SQL name of permission (SELECT forexample), and the second column is the shortname that isdisplayed in the title of grid columns.

Example (table permissions in ASE 15):SELECT / SelINSER / InsDELETE / DelUPDATE / UpdREFERENCES / Ref

ReversedQueries

Specifies a list of additional attribute queries to be calledduring live database reverse engineering. For more in-formation, see “Live database reverse engineering” onpage 37.

Reversed State-ments

Specifies a list of additional statements that will be reverseengineered. For more information, see “Script reverseengineering” on page 36.

66

Page 73: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

SqlAttrQuery Specifies a SQL query to retrieve additional informationon objects reversed by SQLListQuery.

Example (Join Index in Oracle 10g):{OWNER ID, JIDX ID, JIDXWHERE

...}select index_owner, index_name,outer_table_owner || ’.’ || outer_

table_name || ’.’ || outer_table_column || ’=’ || inner_table_owner || ’.’ || inner_table_name || ’.’ || inner_table_column || ’,’

from all_join_ind_columnswhere 1=1[ and index_owner=%.q:OWNER%][ and index_name=%.q:JIDX%]

SqlListQuery Specifies a SQL query for listing objects in the reverseengineering dialog. The query is executed to fill headervariables and create objects in memory.

Example (Dimension in Oracle 10g):{ OWNER, DIMENSION }select d.owner, d.dimension_namefrom sys.all_dimensions dwhere 1=1[ and d.dimension_

name=%.q:DIMENSION%][ and d.owner=%.q:SCHEMA%]order by d.owner, d.dimension_name

SqlOptsQuery Specifies a SQL query to retrieve physical options fromobjects reversed by SqlListQuery. The result of thequery will fill the variable %OPTIONS% and must respectSQL syntax.

Example (Table in SQL Anywhere 10):{OWNER, TABLE, OPTIONS}select u.user_name, t.table_name,

’in ’+ f.dbspace_namefrom sys.sysuserperms ujoin sys.systab t on (t.creator =u.user_id)

join sys.sysfile f on (f.file_id =t.file_id)

where f.dbspace_name <> ’SYSTEM’and t.table_type in (1, 3, 4)

[ and t.table_name = %.q:TABLE%][ and u.user_name = %.q:OWNER%]

67

Page 74: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

SqlPermQuery Specifies a SQL query to reverse engineer permissionsgranted on the object.

Example (Procedure in SQL Anywhere 10):{ GRANTEE, PERMISSION}selectu.user_name grantee, ’EXECUTE’from sysuserperms u, sysprocedure

s, sysprocperm pwhere (s.proc_name = %.q:PROC% )

and(s.proc_id = p.proc_id) and(u.user_id = p.grantee)

Default variable In a column, if the type of the default variable is text or string, the querymust retrieve the value of the default variable between quotes. Most DBMSautomatically add these quotes to the value of the default variable. If theDBMS you are using does not add quotes automatically, you have to specifyit in the different queries using the default variable.

For example, in IBM DB2 UDB 8 for OS/390, the following line has beenadded in SqlListQuery in order to add quotes to the value of the defaultvariable:...

case(default) when ’1’ then ’’’’ concat defaultvalue concat’’’’ when ’5’ then ’’’’ concat defaultvalue concat ’’’’else defaultvalue end,

...

Table

The Table category is located in the Root ä Script ä Objects category, andcan contain the following items that define how tables are modeled for yourDBMS.

68

Page 75: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

[Commonitems]

The following common object items may be defined fortables:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ ConstName

♦ Create, Drop

♦ Enable, EnableSynonym

♦ Header, Footer

♦ Maxlen, MaxConstLen

♦ ModifiableAttributes

♦ Options, DefOptions

♦ Permission

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQuery, SqlPer-mQuery

For a description of each of these common items, see“Common object items” on page 63.

Ad-dTableCheck

Specifies a statement for customizing the script to modifythe table constraints within an alter table statement.

Example (SQL Anywhere 10):alter table [%QUALIFIER%]%TABLE%

add [constraint %CONSTNAME%]check (%.A:CONSTRAINT%)

AllowedADT Specifies a list of abstract data types on which a table canbe based. This list populates the Based On field of thetable property sheet.

You can assign an abstract data type to a table, the tablewill use the properties of the type and the type attributesbecome table columns.

Example (Oracle 10g):OBJECT

AlterTableFooter

Specifies a statement to be placed after alter tablestatements (and before the terminator).

Example:AlterTableFooter = /* End of alter

statement */

69

Page 76: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

AlterTableHeader

Specifies a statement to be placed before alter tablestatements. You can place an alter table header in yourscripts to document or perform initialization logic.

Example:AlterTableHeader = /* Table name:

%TABLE% */

DefineTableCheck

Specifies a statement for customizing the script of tableconstraints (checks) within a create table statement.

Example:check (%CONSTRAINT%)

DropTableCheck

Specifies a statement for dropping a table check in analter table statement.

Example:alter table [%QUALIFIER%]%TABLE%

delete check

InsertIdentity-Off

Specifies a statement for enabling insertion of data into atable containing an identity column.

Example (ASE 15):set identity_insert

[%QUALIFIER%]%@OBJTCODE% off

InsertIdenti-tyOn

Specifies a statement for disabling insertion of data into atable containing an identity column.

Example (ASE 15):set identity_insert

[%QUALIFIER%]%@OBJTCODE% on

Rename [modify] Specifies a statement for renaming a table. If notspecified, the modify database process drops the foreignkey constraints, creates a new table with the new name,inserts the rows from the old table in the new table, andcreates the indexes and constraints on the new table usingtemporary tables.

Example (Oracle 10g):rename %OLDTABL% to %NEWTABL%

The %OLDTABL% variable is the code of the table beforerenaming, and the %NEWTABL% variable is the newcode.

70

Page 77: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

SqlChckQuery Specifies a SQL query to reverse engineer table checks.

Example (SQL Anywhere 10):{OWNER, TABLE, CONSTNAME,

CONSTRAINT}select u.user_name, t.table_name,

k.constraint_name,case(lcase(left(h.check_defn,5))) when ’check’ thensubstring(h.check_defn, 6) elseh.check_defn end

from sys.sysconstraint kjoin sys.syscheck h on (h.check_id = k.constraint_id)join sys.systab t on (t.object_id = k.table_object_id)join sys.sysuserperms u on(u.user_id = t.creator)

where k.constraint_type = ’T’and t.table_type in (1, 3, 4)

[ and u.user_name = %.q:OWNER%][ and t.table_name = %.q:TABLE%]order by 1, 2, 3

SqlListRefr Ta-bles

Specifies a SQL query used to list the tables referenced bya table.

Example (Oracle 10g):{OWNER, TABLE, POWNER, PARENT}select c.owner, c.table_name,

r.owner,r.table_name

from sys.all_constraints c,sys.all_constraints r

where (c.constraint_type = ’R’ andc.r_constraint_name =r.constraint_name and c.r_owner= r.owner)

[ and c.owner = %.q:SCHEMA%][ and c.table_name = %.q:TABLE%]union select c.owner, c.table_name,

r.owner, r.table_namefrom sys.all_constraints c,

sys.all_constraints rwhere (r.constraint_type = ’R’ and

r.r_constraint_name =c.constraint_name and r.r_owner= c.owner)

[ and c.owner = %.q:SCHEMA%][ and c.table_name = %.q:TABLE%]

71

Page 78: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

SqlListSchema Specifies a query used to retrieve registered schemas in thedatabase. This item is used with tables of XML type (areference to an XML document stored in the database).

When you define an XML table, you need to retrieve theXML documents registered in the database in order toassign one document to the table, this is done using theSqlListSchema query.

Example (Oracle 10g):SELECT schema_url FROM dba_xml_

schemas

SqlStatistics Specifies a SQL query to reverse engineer column andtable statistics. See SqlStatistics in “Column” on page 73.

SqlXMLTable Specifies a sub-query used to improve the performance ofSqlAttrQuery (see “Common object items” on page 63).

TableComment [generation and reverse] Specifies a statement for adding atable comment. If not specified, the Comment check boxin the Tables and Views tabs of the Database Generationbox is unavailable.

Example (Oracle 10g):comment on table

[%QUALIFIER%]%TABLE% is%.q:COMMENT%

The %TABLE% variable is the name of the table definedin the List of Tables, or in the table property sheet. The%COMMENT% variable is the comment defined in theComment textbox of the table property sheet.

TypeList Specifies a list of types (for example, DBMS: relational,object, XML) for tables. This list populates the Type listof the table property sheet.

The XML type is to be used with the SqlListSchema item.

UniqConstraintName

Specifies whether the same name for index and constraintname may be used in the same table. The followingsettings are available:♦ Yes – The table constraint and index names must be

different, and this will be tested during model checking

♦ No - The table constraint and index names can be iden-tical

72

Page 79: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Column

The Column category is located in the Root ä Script ä Objects category,and can contain the following items that define how columns are modeledfor your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forcolumns:♦ Add

♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ ConstName

♦ Create, Drop

♦ Enable

♦ Maxlen, MaxConstLen

♦ ModifiableAttributes

♦ Options, DefOptions

♦ Permission

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQuery, SqlPer-mQuery

For a description of each of these common items, see“Common object items” on page 63.

AddColnCheck Specifies a statement for customizing the script for modi-fying column constraints within an alter table statement.

Example (Oracle 10g):alter table [%QUALIFIER%]%TABLE%

add [constraint %CONSTNAME%]check (%.A:CONSTRAINT%)

AlterTableAddDefault

Specifies a statement for defining the default value of acolumn in an alter statement.

Example (SQL Server 2005):[[ constraint %ExtDeftConstName%]

default %DEFAULT% ]for %COLUMN%

73

Page 80: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

AltEnableAddColnChk

Specifies if a column check constraint, built from thecheck parameters of the column, can or cannot be added ina table using an alter table statement. The followingsettings are available:♦ Yes - AddColnChck can be used to modify the col-

umn check constraint in an alter table statement.

♦ No - PowerDesigner copies data to a temporary tablebefore recreating the table with the new constraints.

See also AddColnChck.

AltEnableTSCopy

Enables timestamp columns in insert statements.

Bind Specifies a statement for binding a rule to a column.

Example (ASE 15):[%R%?[exec ]][execute ]sp_bindrule

[%R%?[’[%QUALIFIER%]%RULE%’][[%QUALIFIER%]%RULE%]:[’[%QUALIFIER%]%RULE%’]], ’%TABLE%.%COLUMN%’

CheckNull Specifies whether a column can be null.

Column Com-ment

Specifies a statement for adding a comment to a column.

Example:comment on column

[%QUALIFIER%]%TABLE%.%COLUMN% is%.q:COMMENT%

DefineColnCheck

Specifies a statement for customizing the script of columnconstraints (checks) within a create table state-ment. This statement is called if the create, add, or alterstatements contain %CONSTDEFN%.

Example:[constraint %CONSTNAME%] check

(%CONSTRAINT%)

74

Page 81: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

DropColnChck Specifies a statement for dropping a column check in analter table statement. This statement is used in thedatabase modification script when the check parametershave been removed on a column.

If DropColnChck is empty, PowerDesigner copies datato a temporary table before recreating the table with thenew constraints.

Example (SQL Anywhere 10):alter table [%QUALIFIER%]%TABLE%

drop constraint %CONSTNAME%

DropCol-nComp

Specifies a statement for dropping a column computedexpression in an alter table statement.

Example (SQL Anywhere 10):alter table [%QUALIFIER%]%TABLE%

alter %COLUMN% drop compute

DropDefaultConstraint

Specifies a statement for dropping a constraint linked to acolumn defined with a default value

Example (SQL Server 2005):[%ExtDeftConstName%?alter table

[%QUALIFIER%]%TABLE%drop constraint%ExtDeftConstName%]

En-ableBindRule

Specifies whether business rules may be bound to columnsfor check parameters. The following settings are available:♦ Yes - The Create and Bind entry of Rule are generated

♦ No - The check is generated inside the column Add or-der

Enable Com-putedColn

Specifies whether computed columns are permitted.

75

Page 82: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

EnableDefault Specifies whether predefined default values are permitted.The following settings are available:♦ Yes - The default value (if defined) is generated for

columns. It can be defined in the check parametersfor each column. The %DEFAULT% variable containsthe default value. The Default Value check box forcolumns must be selected in the Tables & Views tabsof the Database Generation box

♦ No - The default value can not be generated, and theDefault Value check box is unavailable.

Example (AS IQ 12.6):

EnableDefault is enabled and the default value for the col-umn employee function EMPFUNC is Technical Engineer.The generated script is:create table EMPLOYEE(

EMPNUM numeric(5) notnull,EMP_EMPNUM numeric(5),DIVNUM numeric(5) notnull,EMPFNAM char(30),EMPLNAM char(30) notnull,EMPFUNC char(30)

default’Technical Engineer’,EMPSAL numeric(8,2),primary key (EMPNUM)

);

76

Page 83: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

EnableIdentity Specifies whether the Identity keyword is supported.Identity columns are serial counters maintained by thedatabase (for example Sybase and Microsoft SQL Server).The following settings are available:♦ Yes - Enables the Identity check box in the column

property sheet.

♦ No - The Identity check box is not available.When the Identity check box is selected, the Identitykeyword is generated in the script after the column datatype. An identity column is never null, and so the Manda-tory check box is automatically selected. PowerDesignerensures that:♦ Only one identity column is defined per table

♦ A foreign key cannot be an identity column

♦ The Identity column has an appropriate data type. Ifthe Identity check box is selected for a column withan unsupported data type, the data type is changed tonumeric . If the data type of an identity column ischanged to an unsupported type, the error Identity can-not be used with the selected data type is displayed.

Note that, during generation, the %IDENTITY% variablecontains the value “identity” but you can easily change it,if needed, using the following syntax :[%IDENTITY%?new identity keyword]

EnableNotNullWithDflt

Specifies whether default values are assigned to columnscontaining Null values. The following settings are avail-able:♦ Yes - The With Default check box is enabled in the col-

umn property sheet. When it is selected, a default valueis assigned to a column when a Null value is inserted.

♦ No - The With Default check box is not available.

77

Page 84: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

ModifyColnChck

Specifies a statement for modifying a column check in analter table statement. This statement is used in thedatabase modification script when the check parameters ofa column have been modified in the table.

If AddColnChck is empty, PowerDesigner copies datato a temporary table before recreating the table with thenew constraints.

Example (AS IQ 12.6):alter table [%QUALIFIER%]%TABLE%

modify %COLUMN% check(%.A:CONSTRAINT%)

The %COLUMN% variable is the name of the columndefined in the table property sheet. The % CONSTRAINT% variable is the check constraint built from the new checkparameters.

AltEnableAddColnChk must be set to YES to allowuse of this statement.

ModifyColnComp

Specifies a statement for modifying a computed expressionfor a column in an alter table.

Example (ASA 6):alter table [%QUALIFIER%]%TABLE%

alter %COLUMN% set compute(%COMPUTE%)

ModifyColnD-flt

Specifies a statement for modifying a column default valuein an alter table statement. This statement is used inthe database modification script when the default value ofa column has been modified in the table.

If ModifyColnDflt is empty, PowerDesigner copiesdata to a temporary table before recreating the table withthe new constraints.

Example (ASE 15):alter table [%QUALIFIER%]%TABLE%

replace %COLUMN% default%DEFAULT%

The %COLUMN% variable is the name of the columndefined in the table property sheet. The %DEFAULT%variable is the new default value of the modified column.

78

Page 85: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

Modify-ColnNull

Specifies a statement for modifying the null/not null statusof a column in an alter table statement.

Example (Oracle 10g):alter table [%QUALIFIER%]%TABLE%

modify %COLUMN% %MAND%

ModifyColumn Specifies a statement for modifying a column. This is adifferent statement from the alter table statement,and is used in the database modification script when thecolumn definition has been modified.

Example (SQL Anywhere 10):alter table [%QUALIFIER%]%TABLE%

modify %COLUMN% %DATATYPE%%NOTNULL%

NullRequired Specifies the mandatory status of a column. This item isused with the NULLNOTNULL column variable, whichcan take the “null”, “not null” or empty values. For moreinformation, see “Working with Null values” on page 81.

Rename Specifies a statement for renaming a column within analter table statement.

Example (Oracle 10g):alter table [%QUALIFIER%]%TABLE%

rename column %OLDCOLN% to%NEWCOLN%

79

Page 86: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

SqlChckQuery Specifies a SQL query to reverse engineer column checkparameters. The result must conform to proper SQLsyntax.

Example (SQL Anywhere 10):{OWNER, TABLE, COLUMN, CONSTNAME,

CONSTRAINT}select u.user_name, t.table_name,

c.column_name, k.constraint_name,case(lcase(left(h.check_defn,5))) when ’check’ thensubstring(h.check_defn, 6) elseh.check_defn end

from sys.sysconstraint kjoin sys.syscheck h on (h.check_id = k.constraint_id)join sys.systab t on (t.object_id = k.table_object_id)join sys.sysuserperms u on(u.user_id = t.creator)join sys.syscolumn c on(c.object_id = k.ref_object_id)

where k.constraint_type = ’C’[ and u.user_name=%.q:OWNER%][ and t.table_name=%.q:TABLE%][ and c.column_name=%.q:COLUMN%]order by 1, 2, 3, 4

80

Page 87: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

SqlStatistics Specifies a SQL query to reverse engineer column andtable statistics.

Example (ASE 15):[%ISLONGDTTP%?{ AverageLength }select

[%ISLONGDTTP%?[%ISSTRDTTP%?avg(char_length(%COLUMN%)):avg(datalength(%COLUMN%))]:null] as average_length

from [%QUALIFIER%]%TABLE%:{ NullValuesRate, DistinctValues,

AverageLength }select[%ISMAND%?null:(count(*) -

count(%COLUMN%)) * 100 /count(*)] as null_values,

[%ISMAND%?null:count(distinct%COLUMN%)] as distinct_values,

[%ISVARDTTP%?[%ISSTRDTTP%?avg(char_length(%COLUMN%)):avg(datalength(%COLUMN%))]:null] as average_length

from [%QUALIFIER%]%TABLE%]

Unbind Specifies a statement for unbinding a rule to a column.

Example (ASE 15):[%R%?[exec ]][execute ]sp_

unbindrule ’%TABLE%.%COLUMN%’

Working with Null values

The NullRequired item specifies the mandatory status of a column. Thisitem is used with the NULLNOTNULL column variable, which can take the“null”, “not null” or empty values. The following combinations are available

When the column is mandatory ”not null” is always generated whetherNullRequired is set to True or False as shown in the following example:

create domain DOMN_MAND char(33) not null;create domain DOMN_NULL char(33) null;

create table TABLE_1(COLN_MAND_1 char(33) not null,COLN_MAND_2 DOMN_MAND not null,COLN_MAND_3 DOMN_NULL not null,);

81

Page 88: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

When the column is not mandatory

♦ If NullRequired is set to True, “null” is generated. The NullRequireditem should be used in ASE for example, where nullability is a databaseoption, and the “null” or “not null” keywords are required.

In the following example, all “null” values are generated:

create domain DOMN_MAND char(33) not null;create domain DOMN_MAND char(33) null;

create table TABLE_1(COLN_NULL_1 char(33) null,COLN_NULL_2 DOMN_NULL null,COLN_NULL_3 DOMN_MAND null)

♦ If NullRequired is set to False, an empty string is generated. However, ifa column attached to a mandatory domain becomes non-mandatory,“null” will be generated.

In the following example, “null” is generated only forCOLUMN_NULL3 because this column uses the mandatory domain, theother columns generate an empty string:

create domain DOMN_MAND char(33) not null;create domain DOMN_NULL char(33) null;

create table TABLE_1(COLUMN_NULL1 char(33) ,COLUMN_NULL2 DOMN_NULL ,COLUMN_NULL3 DOMN_MAND null);

Index

The Index category is located in the Root ä Script ä Objects category, andcan contain the following items that define how indexes are modeled foryour DBMS.

82

Page 89: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

[Commonitems]

The following common object items may be defined forindexes:♦ Add

♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableOwner

♦ Header, Footer

♦ Maxlen

♦ ModifiableAttributes

♦ Options, DefOptions

♦ ReversedQueries

♦ ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQueryFor a description of each of these common items, see“Common object items” on page 63.

AddColIndex Specifies a statement for adding a column in the CreateIndex statement. This parameter defines each column inthe column list of the Create Index statement.

Example (ASE 15):%COLUMN%[ %ASC%]

%COLUMN% is the code of the column defined in thecolumn list of the table. %ASC% is ASC (ascendingorder) or DESC (descending order) depending on the Sortradio button state for the index column.

Cluster Specifies the value to be assigned to the Cluster key-word. If this parameter is empty, the default value of the%CLUSTER% variable is CLUSTER.

CreateBeforeKey

Controls the generation order of keys and indexes. Thefollowing settings are available:♦ Yes – Indexes are generated before keys.

♦ No – Indexes are generated after keys.

83

Page 90: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

DefIndexType Specifies the default type of an index.

Example (DB2):Type2

DefineIndexColumn

Specifies the column of an index.

EnableAscDesc Enables the Sort property in Index property sheets, whichallows sorting in ascending or descending order. Thefollowing settings are available:♦ Yes – The Sort property is enabled for indexes, with

Ascending selected by default. The variable %ASC%is calculated, and the ASC or DESC keyword is gener-ated when creating or modifying the database

♦ No – Index sorting is not supported.Example (SQL Anywhere 10):

A primary key index is created on the TASK table, withthe PRONUM column sorted in ascending order and theTSKNAME column sorted in descending order:create index IX_TASK on TASK

(PRONUM asc, TSKNAME desc);

EnableCluster Enables the creation of cluster indexes. The followingsettings are available:♦ Yes - The Cluster check box is enabled in index prop-

erty sheets.

♦ No – Cluster indexes are not supported.

EnableFunction Enables the creation of function-based indexes. Thefollowing settings are available:♦ Yes - You can define expressions for indexes.

♦ No – Function-based indexes are not supported.

IndexComment Specifies a Statement for adding a comment to an index.

Example (SQL Anywhere 10):comment on index

[%QUALIFIER%]%TABLE%.%INDEX% is%.q:COMMENT%

84

Page 91: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

IndexType Specifies a list of available index types.

Example (IQ 12.6):CMPHGHNGLFWDDATETIMEDTTM

MandIndex-Type

Specifies whether the index type is mandatory for indexes.The following settings are available:♦ Yes – The index type is mandatory.

♦ No - The index type is not mandatory.

MaxColIndex Specifies the maximum number of columns that may beincluded in an index. This value is used during modelchecking.

SqlSysIndexQuery

Specifies a SQL query used to list system indexes createdby the database. These indexes are excluded during reverseengineering.

Example (AS IQ 12.6):{OWNER, TABLE, INDEX, INDEXTYPE}select u.user_name, t.table_name,

i.index_name, i.index_typefrom sysindex i, systable t,

sysuserperms uwhere t.table_id = i.table_idand u.user_id = t.creatorand i.index_owner != ’USER’[and u.user_name=%.q:OWNER%][and t.table_name=%.q:TABLE%]unionselect u.user_name, t.table_name,

i.index_name, i.index_typefrom sysindex i, systable t,

sysuserperms uwhere t.table_id = i.table_idand u.user_id = t.creatorand i.index_type = ’SA’[and u.user_name=%.q:OWNER%][and t.table_name=%.q:TABLE%]

85

Page 92: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

UniqName Specifies whether index names must be unique within theglobal scope of the database. The following settings areavailable:♦ Yes – Index names must be unique within the global

scope of the database.

♦ No – Index names must be unique per object

Pkey

The Pkey category is located in the Root ä Script ä Objects category, andcan contain the following items that define how primary keys are modeledfor your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forprimary keys:♦ Add

♦ ConstName

♦ Create, Drop

♦ Enable

♦ Options, DefOptions

♦ ReversedQueriesFor a description of each of these common items, see“Common object items” on page 63.

EnableCluster Specifies whether clustered constraints are permitted onprimary keys.♦ Yes - Clustered constraints are permitted.

♦ No - Clustered constraints are not permitted.

86

Page 93: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

PkAutoIndex Determines whether a Create Index statement isgenerated for every Primary key statement. The followingsettings are available:♦ Yes - Automatically generates a primary key index with

the primary key statement. If you select the primarykey check box under create index when generating ormodifying a database, the primary key check box ofthe create table will automatically be cleared, and viceversa.

♦ No - Primary key indexes are not automatically gener-ated. Primary key and create index check boxes can beselected at the same time.

PKeyComment Specifies a statement for adding a primary key comment.

UseSpPrimKey Specifies the use of the Sp_primarykey statementto generate primary keys. For a database that supportsthe procedure to implement key definition, you can testthe value of the corresponding variable %USE_SP_-PKEY% and choose between the creation key in the tableor launching a procedure. The following settings areavailable:♦ Yes - The Sp_primarykey statement is used to gen-

erate primary keys.

♦ No - Primary keys are generated separately in an altertable statement.

Example (ASE 15):

If UseSpPrimKey is enabled the Add entry for Pkeycontains:UseSpPrimKey = YESAdd entry of

[%USE_SP_PKEY%?[execute] sp_primarykey %TABLE%,%PKEYCOLUMNS%

:alter table [%QUALIFIER%]%TABLE%add [constraint %CONSTNAME%]primary key [%IsClustered%](%PKEYCOLUMNS%)

[%OPTIONS%]]

87

Page 94: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Key

The Key category is located in the Root ä Script ä Objects category, andcan contain the following items that define how keys are modeled for yourDBMS.

Item Description

[Commonitems]

The following common object items may be defined forkeys:♦ Add

♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ ConstName

♦ Create, Drop

♦ Enable

♦ MaxConstLen

♦ ModifiableAttributes

♦ Options, DefOptions

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQueryFor a description of each of these common items, see“Common object items” on page 63.

AKeyComment Specifies a statement for adding an alternate key comment.

AllowNullableColn

Specifies whether non-mandatory columns are permitted.The following settings are available:♦ Yes - Non mandatory columns are permitted.

♦ No - Non mandatory column are not permitted.

EnableCluster Specifies whether clustered constraints are permitted onalternate keys.♦ Yes - Clustered constraints are permitted.

♦ No - Clustered constraints are not permitted.

88

Page 95: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

SqlAkeyIndex Specifies a reverse-engineering query for obtaining thealternate key indexes of a table by live connection.

Example (SQL Anywhere 10):select distinct i.index_namefrom sys.sysuserperms ujoin sys.systable t on(t.creator=u.user_id)

join sys.sysindex i on(i.table_id=t.table_id)

where i."unique" not in (’Y’, ’N’)[ and t.table_name = %.q:TABLE%][ and u.user_name = %.q:SCHEMA%]

UniqConstAutoIndex

Determines whether a Create Index statement isgenerated for every key statement. The following settingsare available:♦ Yes - Automatically generates an alternate key index

within the alternate key statement. If you select the al-ternate key check box under create index when gener-ating or modifying a database, the alternate key checkbox of the create table will automatically be cleared,and vice versa.

♦ No - Alternate key indexes are not automatically gen-erated. Alternate key and create index check boxes canbe selected at the same time.

Reference

The Reference category is located in the Root ä Script ä Objects category,and can contain the following items that define how references are modeledfor your DBMS.

89

Page 96: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

[Commonitems]

The following common object items may be defined forreferences:♦ Add

♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ ConstName

♦ Create, Drop

♦ Enable

♦ MaxConstLen

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

CheckOn Com-mit

Specifies that referential integrity testing is performed onlyafter the COMMIT. Contains the keyword used to specifya reference with the CheckOnCommit option.

Example:CHECK ON COMMIT

DclDelIntegrity Specifies a list of declarative referential integrity con-straints allowed for delete. The list can contain any or allof the following values, which control the availability ofthe relevant radio buttons on the Integrity tab of referenceproperty sheets:♦ RESTRICT

♦ CASCADE

♦ SET NULL

♦ SET DEFAULT

90

Page 97: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

DclUpdIn-tegrity

Specifies a list of declarative referential integrity con-straints allowed for update. The list can contain any or allof the following values, which control the availability ofthe relevant radio buttons on the Integrity tab of referenceproperty sheets:♦ RESTRICT

♦ CASCADE

♦ SET NULL

♦ SET DEFAULT

DefineJoin Specifies a statement to define a join for a reference. Thisis another way of defining the contents of the createreference statement, and corresponds to the %JOINS%variable.

Usually the create script for a reference uses the%CKEYCOLUMNS% and %PKEYCOLUMNS% vari-ables, which contain the lists of child and parent columnsseparated by commas.

If you use %JOINS%, you can refer to each paired parentand child columns separately. A loop is executed on Joinfor each paired parent and child columns, allowing to havea syntax mix of PK and FK.

Example (Access 2000):P=%PK% F=%FK%

EnableChangeJoinOrder

Specifies whether, when a reference is linked to a key asshown in the Joins tab of reference properties, the autoarrange join order check box and features are available.The following settings are available:♦ Yes - The join order can be established automatically,

using the Auto arrange join order check box. Selectingthis check box sorts the list according to the key columnorder. Clearing this check box allows manual sorting ofthe join order with the move buttons.

♦ No - The auto arrange join order property is unavail-able.

91

Page 98: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

EnableCluster Specifies whether clustered constraints are permitted onforeign keys.♦ Yes - Clustered constraints are permitted.

♦ No - Clustered constraints are not permitted.

EnablefKeyName

Specifies the foreign key role allowed during databasegeneration. The following settings are available:♦ Yes - The code of the reference is used as role for the

foreign key.

♦ No - The foreign key role is not allowed.

FKAutoIndex Determines whether a Create Index statement isgenerated for every foreign key statement. The followingsettings are available:♦ Yes - Automatically generates a foreign key index with

the foreign key statement. If you select the foreign keycheck box under create index when generating or mod-ifying a database, the foreign key check box of the cre-ate table will automatically be cleared, and vice versa.

♦ No – Foreign key indexes are not automatically gener-ated. Foreign key and create index check boxes can beselected at the same time.

FKeyComment Specifies a statement for adding an alternate key comment.

92

Page 99: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

SqlListChildrenQuery

Specifies a SQL query used to list the joins in a reference.

Example (Oracle 10g):{CKEYCOLUMN, FKEYCOLUMN}[%ISODBCUSER%?selectp.column_name, f.column_namefrom sys.user_cons_columns f,

sys.all_cons_columns pwhere f.position = p.positionand f.table_name=%.q:TABLE%

[ and p.owner=%.q:POWNER%]and p.table_name=%.q:PARENT%and f.constraint_name=%.q:FKCONSTRAINT%and p.constraint_name=%.q:PKCONSTRAINT%

order by f.position:select p.column_name, f.column_

namefrom sys.all_cons_columns f,

sys.all_cons_columns pwhere f.position = p.positionand f.owner=%.q:SCHEMA%and f.table_name=%.q:TABLE%

[ and p.owner=%.q:POWNER%]and p.table_name=%.q:PARENT%and f.constraint_name=%.q:FKCONSTRAINT%and p.constraint_name=%.q:PKCONSTRAINT%

order by f.position]

UseSpFornKey Specifies the use of the Sp_foreignkey statementto generate a foreign key. The following settings areavailable:♦ Yes - The Sp_foreignkey statement is used to cre-

ate references.

♦ No - Foreign keys are generated separately in an altertable statement using the Create order of reference.

See also UseSpPrimKey (“Pkey” on page 86).

View

The View category is located in the Root ä Script ä Objects category, andcan contain the following items that define how views are modeled for yourDBMS.

93

Page 100: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

[Commonitems]

The following common object items may be defined forviews:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableSynonym

♦ Header, Footer

♦ ModifiableAttributes

♦ Options

♦ Permission

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQuery, SqlPer-mQuery

For a description of each of these common items, see“Common object items” on page 63.

EnableIndex Specifies a list of view types for which a view index isavailable.

Example (Oracle 10g):MATERIALIZED

SqlListSchema Specifies a query used to retrieve registered schemas in thedatabase. This item is used with views of XML type (areference to an XML document stored in the database).

When you define an XML view, you need to retrieve theXML documents registered in the database in order toassign one document to the view, this is done using theSqlListSchema query.

Example (Oracle 10g):SELECT schema_url FROM dba_xml_

schemas

SqlXMLView Specifies a sub-query used to improve the performance ofSqlAttrQuery.

TypeList Specifies a list of types (for example, DBMS: relational,object, XML) for views. This list populates the Type listof the view property sheet.

The XML type is to be used with the SqlListSchema item.

94

Page 101: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

ViewCheck Specifies whether the With Check Option check box inthe view property sheet is available. If the check box isselected and the ViewCheck parameter is not empty, thevalue of ViewCheck is generated at the end of the viewselect statement and before the terminator.

Example (SQL Anywhere 10):

If ViewCheck is set to with check option, the generatedscript is:create view TEST asselect CUSTOMER.CUSNUM,

CUSTOMER.CUSNAME,CUSTOMER.CUSTEL

from CUSTOMERwith check option;

ViewComment Specifies a statement for adding a view comment. If thisparameter is empty, the Comment check box in the Viewsgroupbox in the Tables and Views tabs of the GenerateDatabase box is unavailable.

Example (Oracle 10g):[%VIEWSTYLE%=view? comment on table

[%QUALIFIER%]%VIEW% is%.q:COMMENT%]

ViewStyle Specifies a view usage. The value defined is displayed inthe Usage list of the view property sheet.

Example (Oracle 10g):materialized view

Tablespace

The Tablespace category is located in the Root ä Script ä Objects category,and can contain the following items that define how tablespaces are modeledfor your DBMS.

95

Page 102: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

[Commonitems]

The following common object items may be defined fortablespaces:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ ModifiableAttributes

♦ Options, DefOptions

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQueryFor a description of each of these common items, see“Common object items” on page 63.

TablespaceComment

Specifies a statement for adding a tablespace comment.

Storage

The Storage category is located in the Root ä Script ä Objects category, andcan contain the following items that define how storages are modeled foryour DBMS.

Item Description

[Commonitems]

The following common object items may be defined forstorages:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ ModifiableAttributes

♦ Options, DefOptions

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

Storage Com-ment

Specifies a statement for adding a storage comment.

96

Page 103: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Database

The Database category is located in the Root ä Script ä Objects category,and can contain the following items that define how databases are modeledfor your DBMS.

Item Description

[Commonitems]

The following common object items may be defined fordatabases:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ ModifiableAttributes

♦ Options, DefOptions

♦ Permission

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQuery, SqlPer-mQuery

For a description of each of these common items, see“Common object items” on page 63.

BeforeCreateDatabase

Controls the order in which databases, tablespaces, andstorages are generated. The following settings are avail-able:♦ Yes – [default] Create Tablespace and Create Storage

statements are generated before the Create Databasestatement.

♦ No - Create Tablespace and Create Storage statementsare generated after the Create Database statement

CloseDatabase Specifies the command for closing the database. If thisparameter is empty, the Database/Close option on theOptions tab of the Generate Database box is unavailable.

EnableManyDatabases

Enables support for multiple databases in the same model.

97

Page 104: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

OpenDatabase Specifies the command for opening the database. If thisparameter is empty, the Database/Open option on theOptions tab of the Generate Database box is unavailable.

Example (ASE 15):use %DATABASE%

The %DATABASE% variable is the code of the databaseassociated with the generated model.

Domain

The Domain category is located in the Root ä Script ä Objects category,and can contain the following items that define how domains are modeledfor your DBMS.

Item Description

[Commonitems]

The following common object items may be defined fordomains:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableOwner

♦ Maxlen

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

Bind Specifies the syntax for binding a business rule to adomain.

Example (ASE 15):[%R%?[exec ]][execute ]sp_bindrule

[%R%?[’[%QUALIFIER%]%RULE%’][[%QUALIFIER%]%RULE%]:[’[%QUALIFIER%]%RULE%’]], %DOMAIN%

98

Page 105: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

En-ableBindRule

Specifies whether business rules may be bound to domainsfor check parameters. The following settings are available:♦ Yes - The Create and Bind entry of Rule are generated

♦ No - The check inside the domain Add order is gener-ated

EnableCheck Specifies whether check parameters are generated.

This item is tested during column generation. If User-defined Type is selected for columns in the Generationdialog box, and EnableCheck is set to Yes for domains,then the check parameters are not generated for columns,since the column is associated with a domain with checkparameters. When the checks on the column diverge fromthose of the domain, the column checks are generated.

The following settings are available:♦ Yes - Check parameters are generated

♦ No - Variables linked to check parameters are not eval-uated during generation and reverse

EnableDefault Specifies whether default values are generated. Thefollowing settings are available:♦ Yes - Default values defined for domains are generated.

The default value can be defined in the check parame-ters. The %DEFAULT% variable contains the defaultvalue

♦ No - Default values are not generated

SqlListDefaultQuery

Specifies a SQL query to retrieve and list domain defaultvalues in the system tables during reverse engineering.

UddtComment Specifies a statement for adding a user-defined data typecomment.

Unbind Specifies the syntax for unbinding a business rule from adomain.

Example (ASE 15):[%R%?[exec ]][execute ]sp_

unbindrule %DOMAIN%

99

Page 106: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Abstract Data Type

The Abstract Data Type category is located in the Root ä Script ä Objectscategory, and can contain the following items that define how abstract datatypes are modeled for your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forabstract data types:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ ModifiableAttributes

♦ Permission

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlPermQueryFor a description of each of these common items, see“Common object items” on page 63.

ADTComment Specifies a statement for adding an abstract data typecomment.

AllowedADT Specifies a list of abstract data types which can be used asdata types for abstract data types.

Example (Oracle 10g):OBJECTTABLEVARRAY

Authorizations Specifies a list of those users able to invoke abstract datatypes.

CreateBody Specifies a statement for creating an abstract data typebody.

Example (Oracle 10g):create [or replace ]type body

[%QUALIFIER%]%ADT% [.O:[as][is]]%ADTBODY%

end;

100

Page 107: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

EnableAdtOnColn

Specifies whether abstract data types are enabled forcolumns. The following settings are available:♦ Yes - Abstract Data Types are added to the list of col-

umn types provided they have the valid type.

♦ No - Abstract Data Types are not allowed for columns.

EnableAdtOnDomn

Specifies whether abstract data types are enabled fordomains. The following settings are available:♦ Yes - Abstract Data Types are added to the list of do-

main types provided they have the valid type

♦ No - Abstract Data Types are not allowed for domains

Enable Inheri-tance

Enables inheritance for abstract data types.

Install Specifies a statement for installing a Java class as anabstract data class (in ASA, abstract data types are installedand removed rather than created and deleted). This item isequivalent to a create statement.

Example (SQL Anywhere 10):install JAVA UPDATE from file

%.q:FILE%

JavaData Specifies a list of available instantiation mechanisms forSQL Java abstract data types.

Remove Specifies a statement for installing a Java class as anabstract data class.

Example (SQL Anywhere 10):remove JAVA class %ADT%

Abstract Data Type Attribute

The Abstract Data Types Attribute category is located in the Root ä Script ä

Objects category, and can contain the following items that define howabstract data type attributes are modeled for your DBMS.

101

Page 108: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

[Commonitems]

The following common object items may be defined forabstract data type attributes:♦ Add

♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop, Modify

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

AllowedADT Specifies a list of abstract data types which can be used asdata types for abstract data type attributes.

Example (Oracle 10g):OBJECTTABLEVARRAY

If you select the type OBJECT for an abstract data type,an Attributes tab appears in the abstract data type propertysheet, allowing you to specify the attributes of the objectdata type.

User

The User category is located in the Root ä Script ä Objects category, andcan contain the following items that define how users are modeled for yourDBMS.

102

Page 109: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

[Commonitems]

The following common object items may be defined forusers:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ Maxlen

♦ ModifiableAttributes

♦ Options, DefOptions

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQuery, SqlPer-mQuery

For a description of each of these common items, see“Common object items” on page 63.

UserComment Specifies a statement for adding a user comment.

Rule

The Rule category is located in the Root ä Script ä Objects category, andcan contain the following items that define how rules are modeled for yourDBMS.

Item Description

[Commonitems]

The following common object items may be defined forrules:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ Maxlen

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

103

Page 110: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

ColnDefaultName

Specifies the name of a default for a column. This item isused with DBMSs that do not support check parameterson columns. When a column has a specific default valuedefined in its check parameters, a name is created for thisdefault value.

The corresponding variable is %DEFAULTNAME%.

Example (ASE 15):D_%.19:COLUMN%_%.8:TABLE%

The EMPFUNC column of the EMPLOYEE table has adefault value of Technical Engineer. The D_-EMPFUNC_EMPLOYEE column default name is created:create default D_EMPFUNC_EMPLOYEEas ’Technical Engineer’goexecute sp_bindefault D_EMPFUNC_

EMPLOYEE, "EMPLOYEE.EMPFUNC"go

ColnRuleName Specifies the name of a rule for a column. This item isused with DBMSs that do not support check parameterson columns. When a column has a specific rule defined inits check parameters, a name is created for this rule.

The corresponding variable is %RULE%.

Example (ASE 15):R_%.19:COLUMN%_%.8:TABLE%

The TEASPE column of the Team table has a list of values- Industry, Military, Nuclear, Bank, Marketing - defined inits check parameters:

The R_TEASPE_TEAM rule name is created and associ-ated with the TEASPE column:create rule R_TEASPE_TEAMas @TEASPE in

(’Industry’,’Military’,’Nuclear’,’Bank’,’Marketing’)

goexecute sp_bindrule R_TEASPE_TEAM,

"TEAM.TEASPE"go

MaxDefaultLen Specifies the maximum length that the DBMS supports forthe name of the column Default name

RuleComment Specifies a statement for adding a rule comment.

104

Page 111: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

UddtDefaultName

Specifies the name of a default for a user-defined datatype. This item is used with DBMSs that do not supportcheck parameters on user-defined data types. When auser-defined data type has a specific default value definedin its check parameters, a name is created for this defaultvalue.

The corresponding variable is %DEFAULTNAME%.

Example (ASE 15):D_%.28:DOMAIN%

The FunctionList domain has a default value definedin its check parameters: Technical Engineer. Thefollowing SQL script will generate a default name for thatdefault value:create default D_FunctionListas ’Technical Engineer’go

UddtRuleName Specifies the name of a rule for a user-defined data type.This item is used with DBMSs that do not support checkparameters on user-defined data types. When a user-defined data type has a specific rule defined in its checkparameters, a name is created for this rule.

The corresponding variable is %RULE%.

Example (ASE 15):R_%.28:DOMAIN%

The Domain_speciality domain has to belong toa set of values. This domain check has been definedin a validation rule. The SQL script will generate therule name following the template defined in the itemUddtRuleName:create rule R_Domain_specialityas (@Domain_speciality in

(’Industry’,’Military’,’Nuclear’,’Bank’,’Marketing’))

goexecute sp_bindrule R_Domain_

speciality, T_Domain_specialitygo

Procedure

The Procedure category is located in the Root ä Script ä Objects category,

105

Page 112: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

and can contain the following items that define how procedures are modeledfor your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forprocedures:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableOwner, EnableSynonym

♦ Maxlen

♦ ModifiableAttributes

♦ Permission

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlPermQueryFor a description of each of these common items, see“Common object items” on page 63.

CreateFunc Specifies the statement for creating a function.

Example (SQL Anywhere 10):create function

[%QUALIFIER%]%FUNC%[%PROCPRMS%?([%PROCPRMS%])] %TRGDEFN%

CustomFunc Specifies the statement for creating a user-defined function,a form of procedure that returns a value to the callingenvironment for use in queries and other SQL statements.

Example (SQL Anywhere 10):create function [%QUALIFIER%]%FUNC%

(<arg> <type>) RETURNS <type>beginend

CustomProc Specifies the statement for creating a stored procedure.

Example (SQL Anywhere 10):create procedure

[%QUALIFIER%]%PROC% (IN <arg><type>)

beginend

106

Page 113: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

DropFunc Specifies the statement for dropping a function.

Example (SQL Anywhere 10):if exists(select 1 from

sys.sysprocedure where proc_name= %.q:FUNC%[ and user_name(creator) = %.q:OWNER%])thendrop function[%QUALIFIER%]%FUNC%

end if

EnableFunc Specifies whether functions are allowed. Functions areforms of procedure that return a value to the callingenvironment for use in queries and other SQL statements.

Function Com-ment

Specifies a statement for adding a function comment.

Implementa-tionType

Specifies a list of available procedure template types.

MaxFuncLen Specifies the maximum length of the name of a function.

ProcedureComment

Specifies a statement for adding a procedure comment.

Trigger

The Trigger category is located in the Root ä Script ä Objects category, andcan contain the following items that define how triggers are modeled foryour DBMS.

107

Page 114: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

[Commonitems]

The following common object items may be defined fortriggers:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableOwner

♦ Maxlen

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

DefaultTriggerName

Specifies a template to define default trigger names.

Example (SQL Anywhere 10):%TEMPLATE%_%.L:TABLE%

EnableMultiTrigger

Enables the use of multiple triggers per type.

Event Specifies a list of trigger event attributes to populate theEvent list on the Definition tab of Trigger property sheets.

Example:DeleteInsertUpdate

EventDelimiter Specifies a character to separate multiple trigger events.

Implementa-tionType

Specifies a list of available trigger template types.

Time Specifies a list of trigger time attributes to populate theTime list on the Definition tab of Trigger property sheets.

Example:BeforeAfter

Trigger Com-ment

Specifies a statement for adding a trigger comment.

108

Page 115: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

UniqName Specifies whether trigger names must be unique within theglobal scope of the database. The following settings areavailable:♦ Yes – Trigger names must be unique within the global

scope of the database.

♦ No – Trigger names must be unique per object

UseErrorMsgTable

Specifies a macro for accessing trigger error messagesfrom a message table in your database.

Enables the use of the User-defined radio button on theError Messages tab of the Trigger Rebuild dialog box (see“Creating and generating user-defined error messages”in the Generating Triggers and Procedures chapter of thePDM User’s Guide).

If an error number in the trigger script corresponds toan error number in the message table, the default errormessage of the .ERROR macro is replaced your message.

Example (ASE 15):begin

select @errno = %ERRNO%,@errmsg = %MSGTXT%

from %MSGTAB%where %MSGNO% = %ERRNO%goto error

end

Where:♦ %ERRNO% - error number parameter to the .ERROR

macro

♦ %ERRMSG% - error message text parameter to the .-ERROR macro

♦ %MSGTAB% - name of the message table

♦ %MSGNO% - name of the column that stores the errormessage number

♦ %MSGTXT% - name of the column that stores the er-ror message text

See also UseErrorMsgText.

109

Page 116: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

UseErrorMsgText

Specifies a macro for accessing trigger error messagesfrom the trigger template definition.

Enables the use of the Standard radio button on the ErrorMessages tab of the Trigger Rebuild dialog box.

The error number and message defined in the templatedefinition are used.

Example (ASE 15):begin

select @errno = %ERRNO%,@errmsg = %MSGTXT%

goto errorend

See also UseErrorMsgTable.

ViewTime Specifies a list of available times available for trigger onview.

Join Index

The Join Index category is located in the Root ä Script ä Objects category,and can contain the following items that define how join indexes aremodeled for your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forjoin indexes:♦ Add

♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableOwner

♦ Header, Footer

♦ Maxlen

♦ ModifiableAttributes

♦ Options, DefOptions

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlOptsQueryFor a description of each of these common items, see“Common object items” on page 63.

110

Page 117: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

AddJoin Specifies the SQL statement used to define joins for joinindexes.

Example:Table1.coln1 = Table2.coln2

EnableJidxColn Enables support for attaching multiple columns to a joinindex. In Oracle 9i, this is called a bitmap join index.

JoinIndex Com-ment

Specifies a statement for adding a join index comment.

Qualifier

The Qualifier category is located in the Root ä Script ä Objects category,and can contain the following items that define how qualifiers are modeledfor your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forqualifiers:♦ Enable

♦ ReversedQueries

♦ SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

Label Specifies a label for <all> in the qualifier selection list.

Sequence

The Sequence category is located in the Root ä Script ä Objects category,and can contain the following items that define how sequences are modeledfor your DBMS.

111

Page 118: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

[Commonitems]

The following common object items may be defined forsequences:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableOwner, EnableSynonym

♦ Maxlen

♦ ModifiableAttributes

♦ Options, DefOptions

♦ Permission

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlPermQueryFor a description of each of these common items, see“Common object items” on page 63.

Rename Specifies the command for renaming a sequence.

Example (Oracle 10g):rename %OLDNAME% to %NEWNAME%

Sequence Com-ment

Specifies a statement for adding a sequence comment.

Synonym

The Synonym category is located in the Root ä Script ä Objects category,and can contain the following items that define how synonyms are modeledfor your DBMS.

112

Page 119: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

[Commonitems]

The following common object items may be defined forsynonyms:♦ Create, Drop

♦ Enable, EnableSynonym

♦ Maxlen

♦ ReversedQueries

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

EnableAlias Specifies whether synonyms may have a type of alias.

Group

The Group category is located in the Root ä Script ä Objects category, andcan contain the following items that define how groups are modeled for yourDBMS.

Item Description

[Commonitems]

The following common object items may be defined forgroups:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ Maxlen

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlPermQueryFor a description of each of these common items, see“Common object items” on page 63.

Bind Specifies a command for adding a user to a group.

Example (SQL Anywhere 10):grant membership in group %GROUP%

to %USER%

Group Com-ment

Specifies a statement for adding a group comment.

113

Page 120: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

ObjectOwner Allows groups to be object owners.

SqlListChildrenQuery

Specifies a SQL query for listing the members of a group.

Example (ASE 15):{GROUP ID, MEMBER}select g.name, u.namefrom

[%CATALOG%.]dbo.sysusers u,[%CATALOG%.]dbo.sysusers g

whereu.suid > 0 andu.gid = g.gid andg.gid = g.uid

order by 1, 2

Unbind Specifies a command for removing a user from a group.

Example (SQL Anywhere 10):revoke membership in group %GROUP%

from %USER%

Role

The Role category is located in the Root ä Script ä Objects category, andcan contain the following items that define how roles are modeled for yourDBMS.

Item Description

[Commonitems]

The following common object items may be defined forroles:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ Maxlen

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlPermQueryFor a description of each of these common items, see“Common object items” on page 63.

114

Page 121: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

Bind Specifies a command for adding a role to a user or toanother role.

Example (ASE 15):grant role %ROLE% to %USER%

SqlListChildrenQuery

Specifies a SQL query for listing the members of a group.

Example (ASE 15):{ ROLE ID, MEMBER }SELECT r.name, u.nameFROM

master.dbo.sysloginroles l,[%CATALOG%.]dbo.sysroles s,[%CATALOG%.]dbo.sysusers u,[%CATALOG%.]dbo.sysusers r

wherel.suid = u.suidand s.id =l.sridand r.uid = s.lrid

Unbind Specifies a command for removing a role from a user oranother role.

DB Package

The DB Package category is located in the Root ä Script ä Objectscategory, and can contain the following items that define how databasepackages are modeled for your DBMS.

115

Page 122: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

[Commonitems]

The following common object items may be defined fordatabase packages:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableSynonym

♦ Maxlen

♦ ModifiableAttributes

♦ Permission

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQuery, SqlPermQueryFor a description of each of these common items, see“Common object items” on page 63.

Authorizations Specifies a list of those users able to invoke databasepackages.

CreateBody Specifies a template for defining the body of the databasepackage. This statement is used in the extension statementAfterCreate.

Example (Oracle 10g):create [or replace ]package body

[%QUALIFIER%]%DBPACKAGE%[.O:[as][is]][%IsPragma% ?pragma serially_reusable]%DBPACKAGEBODY%

[begin%DBPACKAGEINIT%

]end[ %DBPACKAGE%];

DB Package sub-objects

The following categories are located in the Root ä Script ä Objectscategory:

♦ DB Package Procedure

♦ DB Package Variable

♦ DB Package Type

♦ DB Package Cursor

116

Page 123: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

♦ DB Package Exception

♦ DB Package Pragma

Each contains many of the following items that define how databasepackages are modeled for your DBMS.

Item Description

[Commonitems]

The following common object items may be defined fordatabase packages:♦ Add

♦ ReversedQueriesFor a description of each of these common items, see“Common object items” on page 63.

DBProcedureBody

[database package procedures only] Specifies a templatefor defining the body of the package procedure in theDefinition tab of its property sheet.

Example (Oracle 10g):beginend

ParameterTypes [database package procedures and cursors only] Specifiesthe available types for procedures or cursors.

Example (Oracle 10g: procedure):inin nocopyin outin out nocopyoutout nocopy

Parameter

The Parameter category is located in the Root ä Script ä Objects category,and can contain the following items that define how parameters are modeledfor your DBMS.

117

Page 124: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

[Commonitems]

The following common object items may be defined fordatabase packages:♦ Add

♦ ReversedQueriesFor a description of each of these common items, see“Common object items” on page 63.

Privilege

The Privilege category is located in the Root ä Script ä Objects category,and can contain the following items that define how privileges are modeledfor your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forprivileges:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatementsFor a description of each of these common items, see“Common object items” on page 63.

GrantOption Specifies the grant option for a privileges statement.

Example (Oracle 10g):with admin option

RevokeInher-ited

Allows you to revoke inherited privileges from groups androles.

RevokeOption Specifies revoke option for a privileges statement.

118

Page 125: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

System Specifies a list of available system privileges.

Example (ASE 15):CREATE DATABASECREATE DEFAULTCREATE PROCEDURECREATE TRIGGERCREATE RULECREATE TABLECREATE VIEW

Permission

The Permission category is located in the Root ä Script ä Objects category,and can contain the following items that define how permissions aremodeled for your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forpermissions:♦ Create, Drop

♦ Enable

♦ ReversedQueries

♦ SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

GrantOption Specifies the grant option for a permissions statement.

Example (ASE 15):with grant option

RevokeInher-ited

Allows you to revoke inherited permissions from groupsand roles.

RevokeOption Specifies the revoke option for a permissions statement.

Example (ASE 15):cascade

119

Page 126: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Default

The Default category is located in the Root ä Script ä Objects category, andcan contain the following items that define how defaults are modeled foryour DBMS.

Item Description

[Commonitems]

The following common object items may be defined fordefaults:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableOwner

♦ Maxlen

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

Bind Specifies the command for binding a default object to adomain or a column.

When a domain or a column use a default object, abinddefault statement is generated after the domainor table creation statement. In the following example,column Address in table Customer uses default objectCITYDFLT:create table CUSTOMER (

ADDRESS char(10) null)sp_bindefault CITYDFLT,

’CUSTOMER.ADDRESS’

If the domain or column use a default value directly typedin the Default list, then the default value is declared in thecolumn creation line:ADDRESS char(10) default

’StdAddr’ null

PublicOwner Enables PUBLIC to own public synonyms.

120

Page 127: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

Unbind Specifies the command for unbinding a default object froma domain or a column.

Example (ASE 15):[%R%?[exec ]][execute ]sp_

unbindefault %.q:BOUND_OBJECT%

Web Service and Web Operation

The Web Service and Web Operation categories are located in the Root ä

Script ä Objects category, and can contain the following items that definehow web services and web operations are modeled for your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forweb services and web operations:♦ AfterCreate, AfterDrop, AfterModify

♦ Alter

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable, EnableOwner

♦ Header, Footer

♦ MaxConstLen (web operations only)

♦ Maxlen

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

Enable Names-pace

Specifies whether namespaces are supported.

EnableSecurity Specifies whether security options are supported.

121

Page 128: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

OperationTypeList

[web operation only] Specifies a list of web serviceoperation types.

Example (DB2 UDB 8.x CS):queryupdatestoreXMLretrieveXMLcall

ServiceType-List

[web service only] Specifies a list of web service types.

Example (SQL Anywhere 10):RAWHTMLXMLDISH

UniqName Specifies whether web service operation names must beunique in the database.

WebServiceComment/ We-bOperationComment

Specifies the syntax for adding a comment to web serviceor web service operation.

Web Parameter

The Web Parameter category is located in the Root ä Script ä Objectscategory, and can contain the following items that define how webparameters are modeled for your DBMS.

Item Description

[Commonitems]

The following common object items may be defined forweb parameters:♦ Add

♦ EnableFor a description of each of these common items, see“Common object items” on page 63.

EnableDefault Allows default values for web service parameters.

ParameterDttpList

Specifies a list of data types that may be used as webservice parameters.

122

Page 129: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Result Column

The Result Column category are located in the Root ä Script ä Objectscategory, and can contain the following items that define how web servicesand web operations are modeled for your DBMS.

Item Description

ResultColumnDttpList

Specifies a list of data types that may be used for resultcolumns.

Dimension

The Dimension category is located in the Root ä Script ä Objects category,and can contain the following items that define how dimensions are modeledfor your DBMS.

Item Description

[Commonitems]

The following common object items may be defined fordimensions:♦ AfterCreate, AfterDrop, AfterModify

♦ Alter

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ Enable

♦ Header, Footer

♦ Maxlen

♦ ReversedQueries

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

AddAttr Hierar-chy

Specifies the syntax for defining a list of hierarchy at-tributes.

Example (Oracle 10g):child of %DIMNATTRHIER%

123

Page 130: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Objects Category

Item Description

AddAttribute Specifies the syntax for defining an attribute.

Example (Oracle 10g):attribute %DIMNATTR% determines

[.O:[(%DIMNDEPCOLNLIST%)][%DIMNDEPCOLN%]]

AddHierarchy Specifies the syntax for defining a dimension hierarchy.

Example (Oracle 10g):hierarchy %DIMNHIER% (%DIMNATTRHIERFIRST%

%DIMNATTRHIERLIST%)

AddJoin Hier-archy

Specifies the syntax for defining a list of joins for hierarchyattributes.

Example (Oracle 10g):

join key [.-O:[(%DIMNKEYLIST%)][%DIMNKEYLIST%]]references %DIMNPARENTLEVEL%

AddLevel Specifies the syntax for dimension level (attribute).

Example (Oracle 10g):

level %DIMNATTR% is [.-O:[(%DIMNCOLNLIST%)][%DIMNTABL%.%DIMNCOLN%]]

Extended Object

The Extended Object category is located in the Root ä Script ä Objectscategory, and can contain the following items that define how extendedobjects are modeled for your DBMS.

124

Page 131: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

[Commonitems]

The following common object items may be defined forextended objects:♦ AfterCreate, AfterDrop, AfterModify

♦ BeforeCreate, BeforeDrop, BeforeModify

♦ Create, Drop

♦ EnableSynonym

♦ Header, Footer

♦ ModifiableAttributes

♦ ReversedQueries, ReversedStatements

♦ SqlAttrQuery, SqlListQueryFor a description of each of these common items, see“Common object items” on page 63.

AlterStatementList

Specifies a list of text items representing statementsmodifying the corresponding attributes

Comment Specifies the syntax for adding a comment to an extendedobject.

125

Page 132: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Data Type Category

Script/Data Type CategoryThe Data type category defines mappings between PowerDesigner andDBMS data types.

The following variables may be used:

♦ %n - Length of the data type

♦ %s - Size of the data type

♦ %p - Precision of the data type

Item Description

AmcdDataType Lists mappings between PowerDesigner data types andDBMS data types.

These mappings are used during CDM to PDM generationand with the Change Current DBMS command. Thefollowing variables are used to qualify the data type:

Examples (ASE 15 ä PowerDesigner):♦ A%n ä char(%n)

♦ VA%n ä varchar(%n)

♦ LA% ä varchar(%n)

PhysDataType Lists mappings between DBMS data types and PowerDe-signer data types.

These mappings are used during PDM to CDM generationand with the Change Current DBMS command.

Examples (PowerDesigner ä ASE 15):♦ sysname ä VA30

♦ integer ä I

PhysDttpSize Lists the storage sizes of non-default DBMS data types.Used when estimating the size of the database.

Examples (ASE 15):♦ smallmoney ä 8

♦ smalldatetime ä 4

126

Page 133: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Item Description

OdbcPhysDataType

Lists mappings between database data types and internalPowerDesigner data types. Used during live databasereverse engineering.

The way data types are stored in the database may differfrom the DBMS notation. For example, Sybase SQLAnywhere stores a decimal data type as decimal(30,6).

Examples (ASA 10 ä PowerDesigner):♦ char(1) ä char

♦ decimal(30,6) ä decimal

PhysOdbcDataType

Lists mappings between DBMS data types and PowerDe-signer data types.

Examples (Access 2000 ä PowerDesigner):♦ Integer ä Short

♦ LongInteger ä Long

PhysLogADTType

Lists mappings between DBMS abstract data types andPowerDesigner abstract data types.

Examples (Oracle 10g ä PowerDesigner):♦ VARRAY ä Array

♦ SQLJ_OBJECT ä JavaObject

LogPhysADTType

Lists mappings between PowerDesigner abstract datatypes and DBMS abstract data types.

Examples (PowerDesigner ä Oracle 10g):♦ Java ä <Undefined>

♦ List ä TABLE

AllowedADT Lists the abstract data types that may be used as types forcolumns and domains.

Example (ASE 15):♦ JAVA

127

Page 134: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Script/Data Type Category

Item Description

HostDataType Lists mappings between DBMS data types and data typesused in PowerDesigner procedures and trigger code.

Examples (Oracle 10g ä PowerDesigner):♦ DEC ä number

♦ SMALLINT ä integer

128

Page 135: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Profile CategoryThe profile category is used to define PowerDesigner profiles.

In a DBMS, you can define extended attribute types and extended attributesfor database objects.

The Profile category contains the following categories:

Category Description

Shared\Extendedattributetypes

For defining extended attribute types and shared templates.Extended attribute types are data types reused among ex-tended attributes. Shared templates are pieces of code usedin text generation

Metaclasses For defining metaclass extensions like custom symbol,stereotypes, criteria, or generated files

+ For more information on profiles, see chapter “Managing Profiles”.

+ For more information on templates and generated files, see chapter“Generation Reference Guide”.

Extended attributes When you create an extended attribute in a metaclass, an ExtendedAttributes tab is displayed in the corresponding object property sheet. Youcan customize the extended attribute display using user-defined tabs. Thesetabs allow you to add an extended attribute value to the object definition.

Some DBMS are delivered with extended attributes that are needed duringgeneration, this is why we advise you not to modify these extendedattributes, or at least to make a backup copy of each DBMS file before youstart modifying them.

If you wish to enhance model generation, you can copy the pattern ofexisting extended attributes and assign them to other object categories.

Extended modeldefinition

If you want to complement the definition of modeling objects and expandthe PowerDesigner metamodel, you should define extended attributes in anextended model definition. Such extended attributes are not used during thegeneration process.

+ For more information on extended model definitions, see chapter“Extended Model Definitions Reference Guide”.

The Extended Attribute Category is divided into the following categories:

♦ Types

♦ Objects

129

Page 136: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Profile Category

Defining an extended attribute in a DBMS

Each extended attribute has the following properties:

Property Description

Name Name of category or item.

Comment Description of selected category or item.

Data type Predefined or user-defined extended attributes types.

Default value Default value from the list of values. Depends on the datatype.

v To add an extended attribute

1. Right-click a metaclass category in the Profile category and select New ä

Extended Attributes from the contextual menu.

A new extended attribute is created.

2. Enter a name and comment, and then select a data type from the DataType dropdown list box.

3. [optional] Select a default value in the Default Value list.

4. Click Apply.

Example In DB2 UDB 7 OS/390, the extended attribute WhereNotNull allows youto add a clause enforcing the uniqueness of index names if they are not null.

In the Create index order, WhereNotNull is evaluated as follows:

create [%INDEXTYPE% ][%UNIQUE% [%WhereNotNull%?where notnull ]]index [%QUALIFIER%]%INDEX% on[%TABLQUALIFIER%]%TABLE% (

%CIDXLIST%

)

[%OPTIONS%]

If the index name is unique, and if you set the type of the WhereNotNullextended attribute to True, the “where not null” clause is inserted in thescript.

In the SqlListQuery item:

130

Page 137: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

{OWNER, TABLE, INDEX, INDEXTYPE, UNIQUE, INDEXKEY, CLUSTER,WhereNotNull}

selecttbcreator,tbname,name,case indextype when ’2’ then ’type 2’ else ’type 1’ end,case uniquerule when ’D’ then ’’ else ’unique’ end,case uniquerule when ’P’ then ’primary’ when ’U’ then

’unique’ else ’’ end,case clustering when ’Y’ then ’cluster’ else ’’ end,case uniquerule when ’N’ then ’TRUE’ else ’FALSE’ end

fromsysibm.sysindexes

where 1=1[ and tbname=%.q:TABLE%][ and tbcreator=%.q:OWNER%][ and dbname=%.q:CATALOG%]order by

1 ,2 ,3

Using extended attributes in the PDM

Extended attributes are used in a DBMS to control model generation.

You can also define extended attributes in an extended model definition, tofurther define an object. These extended attributes are not used duringgeneration.

+ For more information on extended model definitions, see chapter“Extended Model Definitions Reference Guide”.

By default, extended attributes appear in the Extended Attributes tab, in auser-defined tab or in object lists.

Each extended attribute has the following properties:

Property Description

Name Name of extended attribute

Data type Extended attribute data type including boolean, color, date, file,float, font, etc or customized data types

Value Value of the extended attribute. This field displays the defaultvalue defined for the extended attribute data type

R Redefined value. Selected if you modify the default value in theValue column, using either the arrow or the ellipsis button

131

Page 138: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Profile Category

The name and data type of the extended attributes can only be edited in theResource Editor. The value can be modified in its property sheet.

v To define the value of an extended attribute

1. Open the property sheet of an object.

or

Select Model ä Object to display a list of objects.

2. Click the Extended Attributes tab or the user-defined tab to display thecorresponding tab.

or

Click the Customize Columns and Filter tool, select extended attributes inthe list of columns, and click OK.

The extended attributes appear in different tabs or as additional columnsin the list.

3. Click the Value column of an extended attribute if you want to modify itsvalue and select a value from the list.

or

Type a value in the corresponding box.

or

Type or select a value in the value cell in the list.

The Ellipsis button allows you to further define the value of the selectedextended attribute.

4. Click OK.

Using extended attributes during generation

Extended attributes are created to control generation: each extended attributevalue can be used as a variable that can be referenced in the scripts definedin the Script category.

Some DBMS include predefined extended attributes. For example inPostgreSQL, domains include default extended attributes used for thecreation of user-defined data types.

132

Page 139: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

You can create as many extended attributes as you need, for each DBMSsupported object.

PowerDesigner is case-sensitivePowerDesigner variable names are case sensitive. The variable name mustbe an exact match of the extended attribute name.

Example In DB2 UDB 7, extended attribute WhereNotNull allows you to add aclause that specifies that index names must be unique provided they are notnull.

In the Create index order, WhereNotNull is evaluated as shown below:

create [%INDEXTYPE% ][%UNIQUE% [%WhereNotNull%?where notnull ]]index [%QUALIFIER%]%INDEX% on[%TABLQUALIFIER%]%TABLE% (

%CIDXLIST%

)

[%OPTIONS%]

If the index name is unique, and if you set the type of the WhereNotNullextended attribute to True, the “where not nul” clause will be inserted in thescript.

133

Page 140: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Profile Category

In the SqlListQuery item:

{{OWNER, TABLE, INDEX, INDEXTYPE, UNIQUE, INDEXKEY, CLUSTER,WhereNotNull}

selecttbcreator,tbname,name,case indextype when ’2’ then ’type 2’ else ’type 1’ end,case uniquerule when ’D’ then ’’ else ’unique’ end,case uniquerule when ’P’ then ’primary’ when ’U’ then

’unique’ else ’’ end,case clustering when ’Y’ then ’cluster’ else ’’ end,case uniquerule when ’N’ then ’TRUE’ else ’FALSE’ end

fromsysibm.sysindexes

where 1=1[ and tbname=%.q:TABLE%][ and tbcreator=%.q:OWNER%][ and dbname=%.q:CATALOG%]order by

1 ,2 ,3

134

Page 141: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Physical OptionsIn some DBMSs, physical options are used to specify how an object isoptimized or stored in a database. You define physical options in objectproperty sheets on the following tabs:

♦ Physical Options (Common) – displays the physical options mostcommonly set for the object in a standard form format:

♦ Physical Options – displays all the available physical options for theobject in a tree format:

135

Page 142: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Physical Options

Adding options to the Physical Options (Common) tabThe Physical Options (Common) tab is configurable and the options thatappear on it are associated with extended attributes. You can add otheroptions to this tab or to your own custom tab by associating them withextended attributes. For more information, see “Adding DBMS physicaloptions to your forms” in the Managing Profiles chapter.

+ For information about setting physical options, see “Physical Options”in the Building Physical Diagrams chapter of the PDM Users Guide .

Physical option syntax

If physical options are supported for an object, they are stored in the Optionsentry beneath the object in the Script/Object category of the DBMS resourcefile (see “Common object items” on page 63). Default values are stored inthe DefOptions entry.

During generation, the options selected in the model for each object arestored as a SQL string in the %OPTIONS% variable, which must appear atthe end of the Create statement of the object, and cannot be followed byanything else. The following example uses the correct syntax:

create table[%OPTIONS%]

During reverse engineering by script, the section of the SQL query

136

Page 143: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

determined as being the physical options is stored in %OPTIONS%, and willthen be parsed when required by an object property sheet.

During live database reverse engineering, the SqlOptsQuery SQLstatement is executed to retrieve the physical options which is stored in%OPTIONS% to be parsed when required by an object property sheet.

You can use PowerDesigner variables (see “PDM Variables” on page 143) toset physical options for an object. For example, in Oracle, you can set thefollowing variable for a cluster to make the cluster take the same name as thetable.

Cluster %TABLE%

Defining physical options specified by a value

Option items contain text that is used to display the option on the PhysicalOptions tabs. Entries may contain %d or %s variables to let the user specifya value. For example:

with max_rows_per_page=%don %s: category=storage

♦ the %d variable - requires a numeric value

♦ %s variable - requires a string value

Variables between % signs (%–%) are not allowed inside physical options.

You can specify a constraint (such as a list of values, default values, thevalue must be a storage or a tablespace, some lines can be grouped) on anyline containing a variable. Constraints are introduced by a colon directlyfollowing the physical option and separated by commas.

Example With max_rows_per_page is a physical option for Sybase ASE11.x,which limits the number of rows per data page. The syntax is asfollows:

with max_row_per_page = x

The with max_rows_per_page option is shown on the Options tabs witha default value of zero (0):

This option is defined in the DBMS definition file as follows:

with max_rows_per_page=%don %s : category=storage

The %d and %s variables must be in the last position and they must not befollowed by other options.

137

Page 144: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Physical Options

Physical options without names

A line in an option entry must have a name in order to be identified byPowerDesigner. If a physical option does not have any name, you must add aname between angled brackets <> before the option.

For example, the syntax to define a segment in Sybase ASE 11, is as follows:

sp_addsegment segmentname, databasename, devicename

segmentname corresponds to the storage code defined in PowerDesigner,and databasename corresponds to the model code. These two entries areautomatically generated. devicename must be entered by the user, andbecomes an option.

In SYSTEM11, this option is defined as follows:

Create = execute sp_addsegment %STORAGE%, %DATABASE%, %OPTIONS%OPTIONS = <devname> %s

Note that a physical option without name must be followed by the %d or %svariable.

Defining a default value for a physical option

A physical option can have a default value specified by the Default= x

keyword, which is placed after the option name or after the %d or %s value,and separated by a colon.

Example The default value for max_row_per_page is 0. In Sybase Adaptive ServerEnterprise 11, this default value for the index object is defined as follows:

max_rows_per_page=%d : default=0

Defining a list of values for a physical option

When you use the %d and %s variables, a physical option value cancorrespond to a list of possible options specified by the list= x | y

keyword, which is placed after the option name or after the %d or %s value,and separated by a colon. Possible values are separated by the | character.

For example, the dup_prow option of a Sybase ASE 11 index has twomutually exclusive options for creating a non-unique, clustered index:

IndexOption =<duprow> %s: list=ignore_dup_row | allow_dup_row

A list with the values is displayed on the Physical Options tabs.

138

Page 145: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Use a comma to separate default and listIf Default= and List= are used at the same time, they must be separatedby a comma. For example IndexOption = <duprow> %s: default=

ignore_dup_row, list=ignore_dup_row | allow_dup_row

Defining a physical option for a tablespace or a storage

A physical option can use the code of a tablespace or a storage. TheCategory=tablespace and category=storage options build lists of allthe tablespace or storage codes defined in the model.

For example, in Sybase ASE 11, the on segmentname option specifies thatthe index is created on the segment specified. An ASE segment correspondsto a PowerDesigner storage. The syntax is:

on segmentname

The default value for the index object is defined in option items as follows:

on %s: category=storage

A list with the values is displayed on the Physical Options tabs.

Composite physical option syntax

A composite physical option is a physical option that includes otherdependent options. These options are selected together in the right pane ofthe physical options tab.

The standard syntax for composite physical options is as follows:

with : composite=yes, separator=yes, parenthesis=no{fillfactor=%d : default=0max_rows_per_page=%d : default=0}

The With physical option includes the other options between curly brackets{ }, separated by a comma. To define a composite option, a compositekeyword is necessary.

Keyword Value and result

composite The following settings are available:♦ yes - brackets can be used to define a composite physical

option

♦ no – brackets cannot be used

139

Page 146: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Physical Options

Keyword Value and result

separator The following settings are available:♦ yes - options are separated by a comma

♦ no [default] - options have no separator character

parenthesis The following settings are available:♦ yes - the composite option is delimited by parenthesis,

including all the other options, for example: with (max_-row_per_page=0, ignore_dup_key)

♦ no [default] - nothing delimits the composite option

nextmand The following settings are available:♦ yes - the next line in the physical option is mandatory.

♦ no - you will not be able to generate/reverse the entirecomposite physical option

prevmand The following settings are available:♦ yes - the previous line in the physical option is mandatory

♦ no - you will not be able to generate/reverse the entirecomposite physical option

chldmand The following settings are available:♦ yes - at least one child line is mandatory

♦ no – children are not mandatory

category The following settings are available:♦ tablespace - the item is linked to a tablespace

♦ storage - the item is linked to a storageNote that, in Oracle, the storage category is used as atemplate to define all the storage values in a storage entry.This is to avoid having to set values independently each timeyou need to use the same values in a storage clause. Thus,the Oracle physical option does not include the storage name(%s):storage : category=storage,

composite=yes, separator=no,parenthesis=yes

{

140

Page 147: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Keyword Value and result

list List in which values are separated by a pipe (|)

dquoted The following settings are available:♦ yes - the value is enclosed in double quotes (“” “”)

♦ no - the value is not enclosed in double quotes (“” “”)

squoted The following settings are available:♦ yes - the value is enclosed in single quotes (‘ ‘)

♦ no - the value is not enclosed in single quotes (‘ ‘)

enabledbpre-fix

The following settings are available:♦ yes - the database name is used as prefix (see tablespace

options in DB2 OS/390)

♦ no - the database name is not used as prefix

Default= and/or List= can also be used with the composite=,separator= and parenthesis= keywords. Category= can be used withthe three keywords of a composite option.

Example The IBM DB2 index options contain the following composite option:

<using_block> : composite=yes{

using vcat %susing stogroup %s : category=storage, composite=yes{

priqty %d : default=12secqty %derase %s : default=no, list=yes | no

}

Repeating options several times

Certain databases repeat a block of options, grouped in a composite option,several times. In this case, the composite definition contains the multiplekeyword:

with: composite=yes, multiple=yes

For example, the Informix fragmentation options can be repeated n times asfollows:

141

Page 148: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Physical Options

IndexOption =fragment by expression : composite=yes, separator=yes{

<list> : composite=yes, multiple=yes{

<frag-expression> %sin %s : category=storage

}remainder in %s : category=storage

}

The <list> sub-option is used to avoid repeating the fragment keywordwith each new block of options.

When you repeat a composite option, the option is displayed with <*> inthe available physical options pane (left pane) of the physical options tab.

max_rows_per_page=0 <*>

You can add the composite option to the right pane several times using theAdd button between the panes of the physical options tab.

If the selection is on the composite option in the right pane and you click thesame composite option in the left pane to add it, a message box asks you ifyou want to reuse the selected option. If you click No, the composite optionis added to the right pane as a new line.

142

Page 149: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

PDM VariablesThe SQL queries recorded in the DBMS definition file items make use ofvarious PDM variables. These variables are replaced with values from yourmodel when the scripts are generated, and are evaluated to createPowerDesigner objects during reverse engineering.

PowerDesigner variables are written between percent signs (%).

Example

CreateTable = create table %TABLE%

The evaluation of variables depends on the parameters and context. Forexample, the %COLUMN% variable cannot be used in a CreateTablespaceparameter, because it is only valid in a column parameter context.

When referencing object attributes you can use the following variables or,alternately, the public names available through the PowerDesignermetamodel (see the “Generation Reference Guide (GTL)” and “ResourceFiles and the Public Metamodel” chapters.

Variables for database generation, and triggers and proceduresgeneration

Variable Comment

%DATE% Generation date & time

%USER% Login name of User executing Generation

%PATHSCRIPT% Path where File script is going to be generated

%NAMESCRIPT% Name of File script where SQL orders are going to bewritten

%STARTCMD% Description to explain how to execute Generatedscript

%ISUPPER% TRUE if upper case generation option is set

%ISLOWER% TRUE if lower case generation option is set

%DBMSNAME% Name of DBMS associated with Generated model

%DATABASE% Code of Database associated with Generated model

%USE_SP_PKEY% Use stored procedure primary key to create primarykeys (SQL Server specific)

143

Page 150: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

Variable Comment

%USE_SP_FKEY% Use stored procedure foreign key to create primarykeys (SQL Server specific)

Variables for reverse engineering

Variable Comment

%R% Set to TRUE during reverse engineering

%S% Allow to skip a word. The string is parsed for reversebut not generated

%D% Allow to skip a numeric value. The numeric value isparsed for reverse but not generated

%A% Allow to skip all Text. The text is parsed for reversebut not generated

%ISODB-CUSER%

True if Current user is Connected one

%CATALOG% Catalog name to be used in live database connectionreverse queries

%SCHEMA% Variable representing a user login and the objectbelonging to this user in the database. You should usethis variable for queries on objects listed in databasereverse dialog boxes, because their owner is not definedyet. Once the owner of an object is defined, you canuse SCHEMA or OWNER

%SIZE% Data type size of column or domain. Used for livedatabase reverse, when the length is not defined in thesystem tables

%VALUE% One value from the list of values in a column or domain

%PERMISSION% Allow to reverse engineer permissions set on a databaseobject

%PRIVILEGE% Allow to reverse engineer privileges set on a user, agroup, or a role

Variables for database synchronization

144

Page 151: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Variable Comment

%OLDOWNER% Old owner name of Object. See also OWNER

%NEWOWNER% New owner name of Object. See also OWNER

%OLDQUALI-FIER%

Old qualifier of Object. See also QUALIFIER

%NEWQUALI-FIER%

New qualifier of Object. See also QUALIFIER

%OLDTABL% Old code of Table

%NEWTABL% New code of Table

%OLDCOLN% Old code of Column

%NEWCOLN% New code of Column

%OLDNAME% Old code of Sequence

%NEWNAME% New code of Sequence

Variables for database security

Variable Comment

%PRIVLIST% List of privileges for a grant/revoke order

%PERMLIST% List of permissions for a grant/revoke order

%USER% Name of the user

%GROUP% Name of the group

%ROLE% Name of the role

%GRANTEE% Generic name used to design a user, a group, or arole

%PASSWORD% Password for a user, group, or role

%OBJECT% Database objects (table, view, column, and so on)

%GRANTOPTION% Option for grant: with grant option / with adminoption

%REVOKEOP-TION%

Option for revoke: with cascade

145

Page 152: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

Variables for metadata

Variable Comment

%@CLSSNAME% Localized name of Object class. Ex: Table, View,Column, Index

%@CLSSCODE% Code of Object class. Ex: TABL, VIEW, COLN,INDX

Common variables for all named objects

Variable Comment

%@OBJTNAME% Name of Object

%@OBJTCODE% Code of Object

%@OBJTLABL% Comment of Object

%@OBJTDESC% Description of Object

Common variables for objects

These objects can be Tables, Indexes, Views, etc.

Variable Comment

%COMMENT% Comment of Object or its name (if no commentdefined)

%OWNER% Generated code of User owning Object or its parent.You should not use this variable for queries on objectslisted in live database reverse dialog boxes, becausetheir owner is not defined yet

%DBPREFIX% Database prefix of objects (name of Database + ‘.’ ifdatabase defined)

%QUALIFIER% Whole object qualifier (database prefix + ownerprefix)

%OPTIONS% SQL text defining physical options for Object

%CONSTNAME% Constraint name of Object

%CONSTRAINT% Constraint SQL body of Object. Ex: (A <= 0) AND(A >= 10)

146

Page 153: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Variable Comment

%CONSTDEFN% Column constraint definition. Ex: constraint C1checks (A>=0) AND (A<=10)

%RULES% Concatenation of Server expression of business rulesassociated with Object

%NAMEISCODE% True if the object (table, column, index) name andcode are identical (AS 400 specific)

Variables for DBMS, database options

Variable Comment

%TABLESPACE% Generated code of Tablespace

%STORAGE% Generated code of Storage

Variables for tables

Variable Comment

%TABLE% Generated code of Table

%TNAME% Name of Table

%TCODE% Code of Table

%TLABL% Comment of Table

%PKEYCOLUMNS% List of primary key columns. Ex: A, B

%TABLDEFN% Complete body of Table definition. It containsdefinition of columns, checks and keys

%CLASS% Abstract data type name

%CLUSTER-COLUMNS%

List of columns used for a cluster

Variables for domains and columns checks

Variable Comment

%UNIT% Unit attribute of standard check

147

Page 154: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

Variable Comment

%FORMAT% Format attribute of standard check

%DATATYPE% Data type. Ex: int, char(10) or numeric(8, 2)

%DTTPCODE% Data type code. Ex: int, char or numeric

%LENGTH% Data type length. Ex: 0, 10 or 8

%PREC% Data type precision. Ex: 0, 0 or 2

%ISRDONLY% TRUE if Read-only attribute of standard check hasbeen selected

%DEFAULT% Default value

%MINVAL% Minimum value

%MAXVAL% Maximum value

%VALUES% List of values. Ex: (0, 1, 2, 3, 4, 5)

%LISTVAL% SQL constraint associated with List of values. Ex:C1 in (0, 1, 2, 3, 4, 5)

%MINMAX% SQL constraint associated with Min and max values.Ex: (C1 <= 0) AND (C1 >= 5)

%ISMAND% TRUE if Domain or column is mandatory

%MAND% Contains Keywords “null” or “not null” dependingon Mandatory attribute

%NULL% Contains Keyword “null” if Domain or column is notmandatory

%NOTNULL% Contains Keyword “not null” if Domain or columnis mandatory

%IDENTITY% Keyword “identity” if Domain or Column is identity(Sybase specific)

%WITHDEFAULT% Keyword “with default” if Domain or Column iswith default

%ISUPPERVAL% TRUE if the upper-case attribute of standard checkhas been selected

%ISLOWERVAL% TRUE if the lower-case attribute of standard checkhas been selected

148

Page 155: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Variables for columns

Parent Table variables are also available.

Variable Comment

%COLUMN% Generated code of Column

%COLNNO% Position of Column in List of columns of Table

%COLNNAME% Name of Column

%COLNCODE% Code of Column

%PRIMARY% Contains Keyword “primary” if Column is primarykey column

%ISPKEY% TRUE if Column is part of Primary key

%FOREIGN% TRUE if Column is part of one foreign key

%COMPUTE% Compute constraint text

%NULLNOT-NULL%

Mandatory status of a column. This variable isalways used with NullRequired item, see “Workingwith Null values” on page 81

Variables for abstract data types

Variable Comment

%ADT% Generated code of Abstract data type

%TYPE% Type of Abstract data type. It contains keywords like“array”, “list”, . . .

%SIZE% Abstract data type size

%FILE% Abstract data type Java file

%ISARRAY% TRUE if Abstract data type is of type array

%ISLIST% TRUE if Abstract data type is of type list

%ISSTRUCT% TRUE if Abstract data type is of type structure

%ISOBJECT% TRUE if Abstract data type is of type object

%ISJAVA% TRUE if Abstract data type is of type JAVA class

%ADTDEF% Contains Definition of Abstract data type

149

Page 156: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

Variable for abstract data type attributes

Variable Comment

%AD-TATTR%

Generated code of Abstract data type attribute

Variable for domains

Variable Comment

%DOMAIN% Generated code of Domain (also available forcolumns)

%DEFAULT-NAME%

Name of the default object associated with thedomain (SQL Server specific)

Variables for rules

Variable Comment

%RULE% Generated code of Rule

%RULENAME% Rule name

%RULECODE% Rule code

%RULECEXPR% Rule client expression

%RULESEXPR% Rule server expression

Variables for ASE & SQL Server

Variable Comment

%RULENAME% Name of Rule object associated with Domain

%DEFAULT-NAME%

Name of Default object associated with Domain

%USE_SP_PKEY% Use sp_primary key to create primary keys

%USE_SP_FKEY% Use sp_foreign key to create foreign keys

150

Page 157: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Variables for sequences

Variable Comment

%SQNC% Name of sequence

%SQNCOWNER% Name of the owner of the sequence

Variables for indexes

Variable Comment

%INDEX% Generated code of Index

%TABLE% Generated code of the parent of an index, can be a tableor a query table (view)

%INDEX-NAME%

Index name

%INDEX-CODE%

Index code

%UNIQUE% Contains Keyword “unique” when Index is unique

%INDEXTYPE% Contains Index type (available only for a few DBMS)

%CIDXLIST% List of index columns with separator, on the same line.Example: A asc, B desc, C asc

%INDEXKEY% Contains Keywords “primary”, “unique” or “foreign”depending on Index origin

%CLUSTER% Contains Keyword “cluster” when Index is cluster

%INDXDEFN% Used for defining an index within a table definition

Variables for join indexes (IQ)

Variable Comment

%JIDX% Generated code for join index

%JIDXDEFN% Complete body of join index definition

%REFRLIST% List of references (for live database connections)

%RFJNLIST% List of reference joins (for live database connections)

151

Page 158: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

Variables for index columns

Variable Comment

%ASC% Contains Keywords “ASC” or “DESC” depending onsort order

%ISASC% TRUE if Index column sort is ascending

Variables for references

Variable Comment

%REFR% Generated code of Reference

%PARENT% Generated code of Parent table

%PNAME% Name of Parent table

%PCODE% Code of Parent table

%PQUALIFIER% Qualifier of Parent table. See also QUALIFIER.

%CHILD% Generated code of Child table

%CNAME% Name of Child table

%CCODE% Code of Child table

%CQUALIFIER% Qualifier of Child table. See also QUALIFIER.

%REFRNAME% Reference name

%REFRCODE% Reference code

%FKCON-STRAINT%

Foreign key (reference) constraint name

%PKCON-STRAINT%

Constraint name of Primary key used to referenceobject

%CKEY-COLUMNS%

List of parent key columns. Ex: C1, C2, C3

%FKEY-COLUMNS%

List of child foreign key columns. Ex: C1, C2, C3

%UPDCONST% Contains Update declarative constraint keywords“restrict”, “cascade”, “set null” or “set default”

152

Page 159: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Variable Comment

%DELCONST% Contains Delete declarative constraint keywords“restrict”, “cascade”, “set null” or “set default”

%MINCARD% Minimum cardinality

%MAXCARD% Maximum cardinality

%POWNER% Parent table owner name

%COWNER% Child table owner name

%CHCKON-CMMT%

TRUE when check on commit is selected on Refer-ence (ASA 6.0 specific)

%REFRNO% Reference number in child table collection of refer-ences

%JOINS% References joins.

Variables for reference columns

Variable Comment

%CKEYCOL-UMN%

Generated code of Parent table column (primary key)

%FKEYCOL-UMN%

Generated code of Child table column (foreign key)

%PK% Generated code of Primary key column

%PKNAME% Primary key column name

%FK% Generated code of Foreign key column

%FKNAME% Foreign key column name

%AK% Alternate key column code (same as PK)

%AKNAME% Alternate key column name (same as PKNAME)

%COLTYPE% Primary key column data type

%DEFAULT% Foreign key column default value

%HOST-COLTYPE%

Primary key column data type used in proceduredeclaration. For example: without length

153

Page 160: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

Variables for keys

Variable Comment

%COLUMN-SCOLNLIST%

List of columns of Key. Ex: “A, B, C”

%ISPKEY% TRUE when Key is Primary key of Table

%PKEY% Constraint name of primary key

%AKEY% Constraint name of alternate key

%KEY% Constraint name of the key

%ISMULTICOLN% True if the key has more than one column

%CLUSTER% Cluster keyword

Variables for views

Variable Comment

%VIEW% Generated code of View

%VIEWNAME% View name

%VIEWCODE% View code

%VIEWCOLN% List of columns of View. Ex: “A, B, C”

%SQL% SQL text of View. Ex: Select * from T1

%VIEWCHECK% Contains Keyword “with check option” if this option isselected in View

%SCRIPT% Complete view creation order. Ex: create view V1 asselect * from T1

Variables for triggers

Parent Table variables are also available.

Variable Comment

%ORDER% Order number of Trigger (in case DBMS support morethan one trigger of one type)

%TRIGGER% Generated code of trigger

154

Page 161: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

Variable Comment

%TRGTYPE% Trigger type. It contains Keywords “beforeinsert”,“afterupdate”, . . . etc.

%TRGEVENT% Trigger event. It contains Keywords “insert”, “update”,“delete”

%TRGTIME% Trigger time. It contains Keywords NULL, “before”,“after”

%REFNO% Reference order number in List of references of Table

%ERRNO% Error number for standard error

%ERRMSG% Error message for standard error

%MSGTAB% Name of Table containing user-defined error messages

%MSGNO% Name of Column containing Error numbers in User-defined error table

%MSGTXT% Name of Column containing Error messages in User-defined error table

%SCRIPT% SQL script of trigger or procedure.

%TRGBODY% Trigger body (only for Oracle live database reverseengineering)

%TRGDESC% Trigger description (only for Oracle live database reverseengineering)

%TRGDEFN% Trigger definition

Variables for procedures

Variable Comment

%PROC% Generated code of Procedure (also available for trigger whenTrigger is implemented with a procedure)

%FUNC% Generated code of Procedure if Procedure is a function (witha return value)

Optional strings and variables

You can use square brackets [ ] to:

155

Page 162: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

♦ Include optional strings and variables, or lists of strings and variables inthe syntax of SQL statements [%–%]

♦ Test the value of a variable and insert or reconsider a value depending ofthe result of the test. [%–%? is true : is false]

♦ Test the content of a variable [%–%=–? if true : if false]

Variable Generation Reverse

[%–%] Generated if variable isdefined. If the variable isempty or assigned NO orFALSE it is not generated

Valuated if the parserdetects a piece of SQLorder correspondingto the variable. If thevariable is empty or as-signed NO or FALSEit is not valuated

[%–%? Is true : Isfalse]

to test the value of thevariable (conditionalvalue)

If the variable is notempty, Is true is gen-erated, if the variable isempty, Is false isgenerated

If the parser detectsIs true, Is true isreversed, if the parserdetects Is false, Isfalse is reversedand the % % variableis set to True or Falserespectively

[%–%=–? Is true :Is false] to test thecontent of the variable(conditional value)

If the variable equalsthe constant value, Istrue is generated, if thevariable is different, Isfalse is generated

If the parser detectsIs true, Is true isreversed, if the parserdetects Is false, Isfalse is reversed

[.Z: [s1][s2]. . . ] .Z is ignored Specifies that thestrings and variablesbetween square brack-ets are not ordered

[.O: [s1][s2]. . . ] Only first item listed isgenerated

Specifies that the re-verse parser must findone of the listed itemto validate the fullstatement

Examples

♦ [%–%]

156

Page 163: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

[%OPTIONS%]

If %OPTIONS% is not FALSE, nor empty or assigned NO, the variable isgenerated, this text is replaced by the value of %OPTIONS% (physicaloptions for the objects visible in the object property sheet).

[default %DEFAULT%]

In reverse engineering, if a text default 10 is found during reverseengineering, %DEFAULT% is filled with the value 10. However thisspecification is not mandatory and the SQL statement is reversed even if thespecification is absent. In script generation, if default has a value (10 forexample) during generation, the text is replaced by default 10 otherwisenothing is generated for the block.

♦ [%–%? Is true : Is false]

You can use a conditional value for an optional string or variable. Thetwo conditions are separated by a colon within the brackets used with theoptional string or variable. For example, [%MAND%?Is true:Is false]. If%MAND% is evaluated as true or filled with a value (different fromFalse or NO) during generation, this text is replaced by Is true. If nottrue, it is replaced by Is false.

♦ [%–%=–? Is true : Is false]

You can also use keywords to test the content of a variable.

[%DELCONST%=RESTRICT?:[on delete %DELCONST%]]

♦ Create table abc (a integer not null default 99)

Create table abc (a integer default 99 not null)

Both creation orders are identical but attributes are inverted.

Usually, the target XDB file supports only one notation with a specific orderin the strings and variables. If you reverse engineer both orders, one of themwill not go through because of the variable order. You can bypass thislimitation using the .Z macro in the following way:

%COLUMN% %DATATYPE%[.Z: [%NOTNULL%][%DEFAULT%]]

With this macro, the reverse engineering parser no longer considers orderwithin variables.

♦ [.O:[procedure][proc]]

This statement will generate “procedure”.

157

Page 164: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

During reverse engineering, the parser will match either “procedure” and“proc” keywords, if none of them is present in the script, matching willfail.

Use of strings A string between square brackets is always generated; however, whether thisstring is present or not in the SQL statement will not cancel the reverseengineering of the current statement since it is optional in the SQL syntax ofthe statement. For example, the syntax for creating a view includes a string:

create [or replace] view %VIEW% as %SQL%

When you reverse a script, if it contains only create or create or

replace, in both situations the statement is reversed

because the string is optional.

Variable formatting options

Variables have a syntax that can force a format on their values. Typical usesare as follows:

♦ Force values to lowercase or uppercase characters

♦ Truncate the length of values

♦ Enquote text

You embed formatting options in variable syntax as follows:

%[[?][-][width][.[-]precision][c][H][F][U|L][T][M][q][Q]:]<varname>%

The variable formatting options are the following:

option Description

? Mandatory field, if a null value is returned the translate callfails

n (where n isan integer)

Blanks or zeros added to the right to fill the width and justifythe output to the left

-n Blanks or zeros added to the left to fill the width and justifythe output to the right

width Copies the specified minimum number of characters to theoutput buffer

.[-]precision Copies the specified maximum number of characters to theoutput buffer

158

Page 165: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 2. DBMS Reference Guide

option Description

.L Lower-case characters

.U Upper-case characters

.F Combined with L and U, applies conversion to first character

.T Leading and trailing white space trimmed from the variable

.H Converts number to hexadecimal

.c Upper-case first letter and lower-case next letters

.n Truncates to n first characters

.-n Truncates to n last characters

M Extracts a portion of the variable name, this option uses thewidth and precision parameters to identify the portion toextract

q Enquotes the variable (single quotes)

Q Enquotes the variable (double quotes)

You can combine format codes. For example, %.U8:CHILD% formats thecode of the child table with a maximum of eight uppercase letters.

Example The following examples show format codes embedded in the variable syntaxfor the constraint name template for primary keys, using a table calledCUSTOMER_PRIORITY:

Format Use

.L Lower-case characters.

Example: PK_%.L:TABLE%

Result: PK_customer_priority

.Un Upper-case characters + left justify variable text to fixed lengthwhere n is the number of characters.

Example: PK_%.U12:TABLE%

Result: PK_CUSTOMER_PRI

.T Trim the leading and trailing white space from the variable.

Example: PK_%.T:TABLE%

Result: PK_customer_priority

159

Page 166: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

PDM Variables

Format Use

.n Maximum length where n is the number of characters.

Example: PK_%.8:TABLE%

Result: PK_Customer

-n Pad the output with blanks to the right to display a fixed lengthwhere n is the number of characters.

Example: PK_%-20:TABLE%

Result: PK_ Customer_priority

M Extract a portion of a variable.

Example: PK%3.4M:TABLE%

Result: PK_CUST

160

Page 167: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

CHAPTER 3

Managing Profiles

About this chapter This chapter explains how to manage PowerDesigner profiles.

Contents Topic: page

Introduction to Profiles 162

Metaclasses (Profile) 165

Stereotypes (Profile) 168

Criteria (Profile) 173

Extended Attributes (Profile) 175

Extended Collections (Profile) 181

Calculated Collections (Profile) 184

Forms (Profile) 187

Custom Symbols (Profile) 202

Custom Checks (Profile) 204

Event Handlers (Profile) 211

Methods (Profile) 216

Menus (Profile) 219

Templates and Generated Files (Profile) 222

Transformations and Transformation Profiles (Profile) 225

Using Profiles: a Case Study 231

161

Page 168: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Introduction to Profiles

Introduction to ProfilesAll PowerDesigner resource files contain a Profile category directly beneathroot. A profile is a UML extension mechanism, which is used for extendinga metamodel for a particular target.

Profiles are used in PowerDesigner for adding additional metadata to objectsand creating new kinds of links between them, sub-dividing object types (viastereotypes and criteria), customizing symbols, menus, and forms, andmodifying generation output. For example:

♦ The Java 5.0 object language resource file - extends the Componentmetaclass via several levels of criteria to model various forms of EJBs.

♦ The BPEL4WS 1.1 process language resource file - extends the Eventmetaclass through stereotypes to model Compensation, Fault, and Timerevents.

♦ The MSSQLSRV2005 DBMS resource file - uses stereotyped extendedobjects in order to model aggregates, assemblies, and other SQLServer-specific objects.

You can review and edit the profile in a resource file by opening it in theResource Editor and expanding the top-level Profile category. You can addextensions to a metaclass (a type of object, such as Class in an OOM orTable in a PDM), or to a stereotype or criterion, which has previously beendefined on a metaclass:

In the example above:

♦ Class is a metaclass. Metaclasses are drawn from the PowerDesignermetamodel, and always appear at the top level, directly beneath theProfile category

♦ MyCriterion is a criterion that refines the Class metaclass. Those classesthat meet the criterion can be presented and processed differently fromother classes.

162

Page 169: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

♦ MyStereotype is a stereotype that refines the Class metaclass. Thoseclasses that bear the MyStereotype stereotype can be presented andprocessed differently from other classes.

♦ AnotherCriterion is a criterion that refines further those classes that bearthe MyStereotype stereotype. Classes bearing the stereotype ANDmeeting the criterion can be presented and processed differently fromthose that merely bear the stereotype.

Extensions are inherited, so that any extensions made to a metaclass areavailable to its stereotyped children, and those that are subject to criteria.

Thus, in the example above, classes that bear the MyStereotype stereotypehave available the Attribute_5 extended attribute, and those that bear thisstereotype AND meet AnotherCriterion have Attribute_4 and Attribute_5available.

Working with a profile

You can extend the metamodel in the following ways:

♦ Add new kinds of objects:• “Metaclasses (Profile)” on page 165 - sub-classify objects.

• “Stereotypes (Profile)” on page 168 [for metaclasses and stereotypesonly] - sub-classify objects.

• “Criteria (Profile)” on page 173 - evaluate conditions to subclassifyobjects.

♦ Add new properties to objects:• “Extended Attributes (Profile)” on page 175 – provide extra metadata.

• “Extended Collections (Profile)” on page 181 – enable manual linkingbetween objects.

163

Page 170: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Introduction to Profiles

• “Calculated Collections (Profile)” on page 184 – automate linkingbetween objects.

• “Forms (Profile)” on page 187 - are custom property tabs or dialogboxes.

• “Custom Symbols (Profile)” on page 202 - help you visuallydistinguish objects.

♦ Add constraints and validation rules to objects:• “Custom Checks (Profile)” on page 204 – provide data testing.

• “Event Handlers (Profile)” on page 211 – invoke methods whentriggered by an event.

♦ Execute commands on objects:• “Methods (Profile)” on page 216 – are written in VBScript and are

invoked by other profile extensions such as menus and form buttons.

• “Menus (Profile)” on page 219 [for metaclasses and stereotypes only]– customize PowerDesigner menus.

♦ Generate objects in new ways:• “Templates and Generated Files (Profile)” on page 222 - customize

generation.

• “Transformations and Transformation Profiles (Profile)” on page 225 –automate changes to objects at generation or on demand.

Extension conflict You can attach several resource files to a model. For example, an OOMalways has an object language resource file, and could additionally haveseveral extended model definitions attached. A conflict would occur if twoextensions with identical names were defined on the same metaclass in twoor more of these resource files.

For example, the stereotype <<document>> is defined for components intwo extended model definitions attached to the same OOM and each has adifferent custom symbol. When you create a component and assign the<<document>> stereotype,:PowerDesigner may select either of thesymbols.

In case of such conflicts, the extended model definition extension usuallyprevails. When two XEMs are in conflict, priority is given to the one highestin the list.

164

Page 171: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Metaclasses (Profile)Metaclasses are classes drawn from the PowerDesigner metamodel (see the“Resource Files and the Public Metamodel” chapter), and appear at the toplevel of the Profile category.

Abstract and concrete metaclassesConcrete metaclasses are defined for specific object types that can becreated in a model, while abstract metaclasses are never instantiated but areinstead used to define common extensions. For example BasePackage is anancestor to both model and package.

v To add a metaclass to a profile

1. Right-click the Profile category and select Add Metaclasses from thecontextual menu to open the Metaclass Selection dialog box:

2. Select one or several metaclasses to add to the profile. You can use thesub-tabs to switch between metaclasses belonging to the present module(for example, the OOM), and standard metaclasses belonging to thePdCommon module. You can also use the Modify Metaclass Filter tool todisplay all metaclasses, or only concrete or abstract conceptualmetaclasses in the list.

3. Click OK to add the selected metaclasses to your profile:

165

Page 172: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Metaclasses (Profile)

Metaclass properties

The following properties are available for metaclasses:

Property Description

Name [not editable] Specifies the name of the metaclass.

Parent [not editable] Specifies the parent of the metaclass. If theparent metaclass is not present in the profile, when you clickthe Properties tool beside the Parent metaclass, a message isdisplayed to let you automatically insert it.

Code namingconvention

[concrete metaclasses only] Specifies a name to code con-version script for instances of the metaclass.

The following conversion scripts are available:♦ firstLowerWord - First word in lowercase, then other first

letters of other words in uppercase

♦ FirstUpperChar - First character of all words in uppercase

♦ lower_case - All words in lowercase and separated by anunderscore

♦ UPPER_CASE - All words in uppercase and separated byan underscore

For more information on conversion scripts and namingconventions, see the “Naming Conventions” section in the“Managing Models” chapter in the General Features Guide .

166

Page 173: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Property Description

Illegal char-acters

[concrete metaclasses only] Specifies a list of illegal char-acters that may not be used in code generation for themetaclass. The list must be placed between double quotes,for example:"/!=<>""’()"

When working with an OOM, this object-specific list over-rides any values specified in the IllegalChar parameter forthe object language (see the “Object Languages ReferenceGuide” chapter).

Enable selec-tion in filegeneration

Specifies that the corresponding metaclass instances willappear in the Selection tab of the extended generation dialogbox. If a parent metaclass is selected for file generation,children metaclasses also appear in the Selection tab.

Exclude frommodel

[concrete metaclasses only] Prevents the creation of in-stances of the metaclass in the model and removes allreferences to the metaclass from the menus, palette, propertysheets and so on, to simplify the interface. For example, ifyou do not use business rules, you can select this check boxin the business rule metaclass page to hide them.

When several resource files are attached to a model, themetaclass is excluded if at least one file excludes it and theothers do not explicitly enable it. For models that alreadyhave instances of this metaclass, the objects will be preservedbut it will not be possible to create new ones.

Comment Specifies a descriptive comment for the metaclass.

167

Page 174: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Stereotypes (Profile)

Stereotypes (Profile)Stereotypes are a per-instance extension mechanism. When a stereotype isapplied to a metaclass instance (by selecting it in the Stereotype field of theobject’s property sheet), any extensions that you add to the stereotype arethen applied to the instance.

Stereotypes can be promoted to the status of metaclasses to give themgreater visibility in the interface, with a specific list, Browser category and,optionally custom symbol and palette tool. For more information, see““Defining a stereotype as a metaclass” on page 170”.

You can define more than one stereotype for a given metaclass, but you canonly apply a single stereotype to each instance. Stereotypes supportinheritance: extensions to a parent stereotype are inherited by its children.

You can create a stereotype within a metaclass, a criterion, or anotherstereotype.

v To create a stereotype

1. Right-click a metaclass, criterion, or stereotype, and select New ä

Stereotype in the contextual menu.

A new stereotype is created with a default name.

2. Type a stereotype name in the Name box, and fill in any of the otherproperties that are relevant.

Once you have created the stereotype, you can define extensions like acustom tool, or custom checks for the stereotype. These extensions will

168

Page 175: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

apply to all metaclass instances that carry the stereotype.

Stereotype properties

The following properties are available for stereotypes:

Property Description

Name Specifies the name of the stereotype that will appear in theStereotype list in the object property sheet.

Parent Specifies a parent stereotype of the stereotype. You can selecta stereotype defined in the same metaclass or in a parentmetaclass. Click the Properties button to go to the parentstereotype in the tree and display its properties.

Abstract Specifies that the stereotype cannot be applied to metaclassinstances. The stereotype will not appear in the stereotype listin the object property sheet, and can only be used as a parent ofother child stereotypes. If you select this property, the Use asmetaclass check box is not available.

Use asmetaclass

Specifies that the stereotype is a sub-classification for instancesof the selected metaclass. The stereotype will have its own listof objects and Browser category, and its own tab in multi-paneselection boxes such as those used for generation. For moreinformation, see “Defining a stereotype as a metaclass” onpage 170.

No Sym-bol

[available when Use as metaclass is selected] Specifies thatwhen instances of the stereotyped metaclass are created, theywill not have diagram symbols. This can be useful when youwant to model sub-objects or other objects that do not needto appear in the diagram. The Palette custom tool option isdisabled when this option is selected.

Icon Specifies an icon for stereotyped instances of the metaclass.Click the tools to the right of this field in order to browse for.cur or .ico files.

PaletteCustomTool

Associates a tool in a palette to the current stereotype. Thisoption is available for objects supporting symbols, it cannot beused for the stereotype of an attribute for example. For moreinformation, see “Attaching a tool to a stereotype” on page 172.

169

Page 176: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Stereotypes (Profile)

Property Description

Defaultname

[available when Use as metaclass or Palette Custom Tool isselected] Specifies a default name for objects created. A counterwill be automatically appended to the name specified to generateunique names.

A default name can be useful when designing for a targetlanguage or application with strict naming conventions. Notethat the default name does not prevail over model namingconventions, so if a name is not correct it is automaticallymodified.

Comment Additional information about the stereotype.

Defining a stereotype as a metaclass

You can promote a stereotype to metaclass status by selecting the Use asMetaclass check box in the stereotype property page. This can be usefulwhen you need to:

♦ Create new kinds of objects that share much of the behavior of anexisting object type, such as business transactions and binarycollaborations in a BPM for ebXML.

♦ Have objects with identical names but different stereotypes in the samenamespace (a metaclass stereotype creates a sub-namespace in thecurrent metaclass).

Sub-objectsStereotypes defined on sub-objects (such as table columns or entity at-tributes), cannot be turned into metaclass stereotypes.

v To define a stereotype as a metaclass

1. In the Stereotype property page, select the Use as metaclass check box

The new metaclass stereotype enjoys all the attributes of a standardmetaclass:

♦ A separate list in the Model menu - the parent metaclass list will nolonger display objects with the new metaclass stereotype. Theseobjects will be displayed in the new list, which is displayed below theparent metaclass list. Objects created in the new list bear the newmetaclass stereotype by default. If you change the stereotype, theobject will be removed from the list the next time it is opened.

♦ Its own Browser folder and command in the New contextual menu.

170

Page 177: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

♦ Property sheet titles based on the metaclass stereotype.

Attaching an icon to a stereotype

You can attach an icon to the stereotype you have defined in order to identifystereotyped instances of the metaclass. You can create your own icons orcursors using 3rd party editors or you can purchase them from graphicdesigners.

v To attach an icon to a stereotype

1. In the Stereotype property page, click the Browse for Icon and ToolCursor File tool to display a standard Open dialog box in which you canselect a file with the .cur or .ico extension.

2. Click Apply.

If you select the Palette Custom Tool check box, the icon is automaticallyinitialized with the default system icon, this does not prevent you fromchanging it using the browse tool.

When you select a new icon, this icon is copied and saved within theresource file. It is displayed in the list of icons available for the CustomGraphic Tools category in the Customize Toolbars dialog box:

171

Page 178: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Stereotypes (Profile)

Attaching a tool to a stereotype

You can attach a tool to the stereotype you have defined in order to simplifythe creation of stereotyped instances of the metaclass. Custom tools appearin a tool palette named after the resource file to which they belong.

The tool is identical to the stereotype icon. If you do not select an icon, thedefault system icon is assigned to the tool. You have to select an icon tomodify the custom tool of the stereotype.

+ For more information on how to attach an icon to a stereotype, see the““Attaching an icon to a stereotype” on page 171” section.

v To attach a tool to a stereotype

1. In the Stereotype property page, select the Palette Custom Tool check boxto enable the fields in the lower part of the dialog box.

2. [optional] Select an icon to modify the default tool. You can click insidethe <Cursor Click Text Area> to verify how the cursor looks.

3. [optional] Type a default name in the corresponding box, and then

4. Click Apply to save the changes.

172

Page 179: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Criteria (Profile)You can control the treatment of metaclass instances based on whether theyconform to one or more criteria. Whereas you can apply only one stereotypeto a metaclass instance, you can test the instance against multiple forms ofcriteria.

You define one or several criteria for a selected metaclass. Criteria let youdefine the same extensions as stereotypes.

When a metaclass instance meets the criterion condition, the extensionsdefined on the criterion are applied to this instance. In case of sub-criteria,both the criterion and sub-criterion conditions must be met for the relevantextensions to be applied to the instance.

v To create a criterion

1. Right-click a metaclass and select New ä Criterion in the contextualmenu.

A new criterion is created with a default name.

2. Modify the default name in the Name box, and type a condition inCondition box. You can use any valid expression used by the .if macro(see “Using macros” in the Generation Reference Guide chapter) but youshould not type the macro itself.

3. Click Apply to save your changes.

173

Page 180: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Criteria (Profile)

Criterion properties

The following properties are available for criteria:

Property Description

Name Specifies the name of the criterion.

Condition Specifies the condition which instances must meet in order toaccess the criterion extensions. You can use any expressionsvalid for the PowerDesigner GTL .if macro (see the GenerationReference Guide chapter). You can reference the extendedattributes defined at the metaclass level in the condition, but notthose defined in the criterion itself.

For example, in a PDM, you can customize the symbols of facttables by creating a criterion that will test the type of the tableusing the following condition:(%DimensionalType%) == "1"

DimensionalType is an attribute of the BaseTable object, whichhas a set of defined values, including “1”, which corresponds to“fact”. For more information, select Help ä Metamodel ObjectsHelp, and navigate to Libraries ä PdPDM ä Abstract Classesä BaseTable.

Parent Specifies a parent criterion of the criterion. You can select acriterion defined in the same metaclass or in a parent metaclass.Click the Properties tool to go to the parent in the tree and viewits properties.

Comment Additional information about the criterion.

174

Page 181: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Extended Attributes (Profile)Extended attributes allow you to define additional metadata for your objects,and can be defined for metaclasses, stereotypes, and criteria, in order to:

♦ Control generation for a given generation target. In this case, extendedattributes are defined in the target language or DBMS of the model. Forexample, in the Java object language, several metaclasses have extendedattributes used for generating Javadoc comments.

♦ Further define model objects in extended model definitions. Forexample, in the extended model definition for Sybase ASA Proxy tables,the extended attribute called GenerateAsProxyServer in the DataSourcemetaclass is used to define the data source as a proxy server.

Extended attributes in property sheetsBy default, extended attributes are listed on a generic Extended Attributestab in the object property sheet. You can customize the display of attributesby inserting them into forms (see “Forms (Profile)” on page 187). If allthe extended attributes are allocated to forms, the generic page will not bedisplayed.

v To create an extended attribute

1. Right-click a metaclass, stereotype, or criterion in the Profile categoryand select New ä Extended Attribute.

2. Specify the appropriate properties.

3. Click Apply to save your changes.

175

Page 182: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Extended Attributes (Profile)

Extended attribute properties

The following properties are available for extended attributes:

Property Description

Name Specifies the name of the extended attribute.

Comment Provides additional information about the extended attribute.

Data type Specifies the form of the data to be held by the extendedattribute, such as String, Font, Boolean, Object, or others.

You can create your own data types (see “Creating an extendedattribute type” on page 179), or you can link one objectto another by way of an extended attribute, by selectingthe [Object] type (see “Linking objects through extendedattributes” on page 178).

Computed Specifies that the extended attribute is calculated from othervalues using Get and/or Set VBScript methods. If an attributeis not computed, the value is stored in the object.

You can select from the following access types:♦ Read/Write (Get+Set methods) - read and write access to

the extended attribute value is defined by VBScript Get andSet methods.

♦ Read only (Get method) – read-only access is defined by aVBScript Get method.

This checkbox enables the display of Get Method Script, SetMethod Script, and Global Script tabs, on which you mustdefine the relevant scripts.

In the following example script, the FileGroup computedextended attribute gets and sets its value from the physicaloptions of the table object:Function %Get%(obj)%Get% =

obj.GetPhysicalOptionValue("on/<filegroup>")

End Function

Sub %Set%(obj, value)obj.SetPhysicalOptionValue

"on/<filegroup>", valueEnd Sub

176

Page 183: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Property Description

Defaultvalue

[if not “computed”] Specifies a default value for the extendedattribute type. You can specify the value in any of the followingways:♦ Type the value directly in the list.

♦ [predefined data types] Click the Ellipsis button to obtain arange of possible default values. For example, if the datatype is set to Color, the Ellipsis button opens a palette win-dow.

♦ [user-defined data types] Select a value from the list.

Template [if not “computed”] Specifies that the extended attribute istreated as a GTL template and its code is replaced by modelvalues during generation. For example, the string %Code%,will be replaced by the value of the code attribute of the relevantobject.

If this checkbox is cleared, the extended attribute is treatedliterally during generation. For example, the string %Code%,will be generated as %Code%.

List of val-ues

Specifies a list of possible values for the extended attribute.You can enter static values in the list (separated by a semi-colonor by a carriage return) or generate them using a GTL template.

You can use the tools to the right of the list to create a GTLtemplate or to select an existing template in the resource file.The template is evaluated each time the list is called.

For example, the following GTL template uses the foreach_-item macro to iterate on the Storages collection (when theextended attribute is an object, the list of values must containthe OID of the object, then a tab, and then the name that will bedisplayed in the list, and ends with a carriage return):.foreach_item (Model.Storages)%ObjectID%\t %Name% (\n).next (\n)

The following template returns all the storages in the model:.collection (Model.Storages)

If the extended attribute is based on an extended attribute type,the List of values box is unavailable because the values of theextended attribute type will be used.

Complete Specifies that all possible values for the extended attribute aredefined in the list of values, from which the user must choose.

177

Page 184: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Extended Attributes (Profile)

Property Description

Editmethod

[if not “complete”] Specifies a method to override the defaultaction associated with the tool or the Ellipsis button to theright of the extended attribute in the object property sheet.See the Table metaclass in the Profile category of the OracleVersion 10g DBMS resource file for an example of a customedit method.

Objecttype

[for [Object] data types only] Specifies the type of the objectthat the extended attribute will be (for example, User, Table,Class).

Objectstereotype

[for [Object] data types only] Specifies the stereotype thatobjects of this type must bear to be available in the extendedattribute list.

Inversecollectionname

[for [Object] data types only, if not “computed”] Specifies thename under which the links to the object will be listed on theDependencies tab of the target object.

An extended collection with the same name as the extendedattribute, which handles these links, is automatically createdfor all non-computed extended attributes of the Object type,and is deleted when you delete the extended attribute, changeits type, or select the Computed checkbox.

Physicaloption

[for [Physical Option] data types only] Specifies the physicaloption with which the attribute is associated. Click the ellipsisto the right of this field to select a physical option. For moreinformation, see “Adding DBMS physical options to yourforms ” on page 192

Linking objects through extended attributes

When you specify the [Object] data type, you enable the display of theObject type, Object stereotype, and Inverse collection name fields.

The Object type field specifies the kind of object you want to link to, and thestereotype field allows you to filter the objects that are available for selection.

For example, under the Table metaclass, I create an extended attribute calledOwner, select [Object] in the Data type field, and User in the Object typefield. I name the inverse collection “Tables owned”. I can set the Ownerattribute in the property sheet of a table, and the table will be listed on theDependencies tab of the user property sheet, under the name of “Tablesowned”.

178

Page 185: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Creating an extended attribute type

You can create an extended attribute type in the Shared folder in order todefine the data type and authorized values of extended attributes. Creatingextended attribute types allows you to reuse the same list of values forseveral extended attributes without having to write code. These types areavailable in the extended attribute Data Type list.

You can also define a list of values for a given extended attribute from itsproperty page using the Data Type list. For more information see “Extendedattribute properties” on page 176.

v To create an extended attribute type

1. Right-click the Profile\Shared category and select New ä ExtendedAttribute Type in the contextual menu.

2. Enter the appropriate properties, including a list of values and a defaultvalue.

3. Click Apply to save your changes.

Once created the new type is available to all other extended attributes with aname as follows: <Attribute Name> type. You can click the Properties toolto the right of the Data type field to edit the type.

Data types display as tools in custom forms helping you to specify a defaultvalue for the extended attribute type, as in the following example:

179

Page 186: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Extended Attributes (Profile)

180

Page 187: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Extended Collections (Profile)An extended collection allows you to associate multiple instances of onemetaclass with an instance of another. For example, you can associatemultiple column objects with a table. When you create an extendedcollection in a metaclass, its property sheet will contain a tab with the nameof the extended collection.

This feature is useful when you want to create additional collections onexisting metaclasses, and can also help you manage new kinds of objectslike extended objects or extended links. For example, to attach documentscontaining use case specifications to the different packages of a model youcan create an extended collection in the package metaclass and defineFileObject as the target metaclass.

You can also use extended collections to complement the definition of anobject using other objects. For example, you can create an extendedcollection on the process metaclass that shows the OOM components usedas resources to the process, this allows you to have a more accurate vision ofthe physical implementation of the process.

When you define an extended collection, the metaclass it references isdisplayed like a new list of objects in the property sheet of the parentmetaclass, and the parent metaclass is displayed in the Dependencies tab ofthe target metaclass.

v To create an extended collection

1. Right-click a metaclass, stereotype, or criterion and select New ä

Extended Collection.

2. Enter a name in the Name box. This name will be used as the name of therelated tab in the object property sheet.

3. [optional] Enter a comment and an inverse name.

4. Select a metaclass in the Target Type list to form the basis of thecollection.

5. [optional] Select or enter a stereotype to further refine the instances of thetarget metaclass that may appear in the collection.

181

Page 188: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Extended Collections (Profile)

6. Click Apply or OK to save your changes and return to your model.

You can view the tab associated with the collection by opening theproperty sheet of a metaclass instance. The tab contains Add Objects andCreate an Object tools, which allow you to populate the collection.

Note that if you create an extended collection on a stereotype or criterion,the corresponding tab is displayed only if the metaclass instance bears thestereotype or meets the criterion.

Extended collection properties

The following properties can be set for extended collections:

182

Page 189: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Property Description

Name Specifies the name of the extended collection.

Comment Describes the extended collection.

InverseName

Specifies the name to appear in the Dependencies tab of thetarget metaclass. If you do not enter a value, an inverse name isautomatically generated.

TargetType

Specifies the metaclass whose instances will appear in thecollection. The list displays only metaclasses that can bedirectly instantiated in the current model or package, such asclasses or tables, and not sub-objects such as class attributes ortable columns.

Click the Select a Metaclass tool to the right of this field tochoose a metaclass from another type of model.

TargetStereo-type

Specifies a stereotype to filter the target type. You can select anexisting stereotype from the list or enter a new one.

When you open a model containing extended collections with a resource filethat does not support extended collections, the collections are still visible inthe different property sheets, in order to let you delete objects in thecollections no longer supported.

If you copy and paste an object with extended collections The relatedobjects are not copied.

If you move an object with extended collections The link with therelated objects is preserved (using shortcuts if required).

183

Page 190: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Calculated Collections (Profile)

Calculated Collections (Profile)You define a calculated collection on a metaclass, stereotype, or criterion,when you need to display a list of associated objects with a user-definedsemantic. Calculated collections (unlike extended collections) cannot bemodified by the user (see “Extended Collections (Profile)” on page 181).

You create calculated collections to:

♦ Display user-defined dependencies for a selected object, the calculatedcollection is displayed in the Dependencies tab of the object propertysheet. You can double-click items and navigate among user-defineddependencies.

♦ Fine-tune impact analysis by creating your own calculated collections inorder to be able to better evaluate the impact of a change. For example, ina model where columns and domains can diverge, you can create acalculated collection on the domain metaclass that lists all the columnsthat use the domain and have identical data type.

♦ Improve your reports. You can drag and drop any book or list item underany other report book and modify its default collection in order todocument a specific aspect of the model (see the “Modifying thecollection of a report item” section in the “Using the Report Editor”chapter in the Reports User’s Guide ).

♦ Improve GTL generation since you can loop on user-defined calculatedcollections.

For example, in an OOM, you may need to create a list of sequencediagrams using an operation, and can create a calculated collection on theoperation metaclass that retrieves this information.

In a BPM, you could create a calculated collection on the process metaclassthat lists the CDM entities created from data associated with the process.

v To create a calculated collection

1. Right-click a metaclass, stereotype, or criterion and select New ä

Calculated Collection.

2. Enter a name in the Name box. This name will be used as the name of therelated tab in the object property sheet.

3. [optional] Enter a comment to describe the collection.

4. Select a metaclass in the Target Type list to form the basis of thecollection.

184

Page 191: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

5. [optional] Select or enter a stereotype to further refine the instances of thetarget metaclass that may appear in the collection.

6. Click the Calculated Collection Script tab and enter a script that willcalculate which objects will form the collection. If appropriate, you canreuse functions on the Global Script tab.

7. Click Apply to save your changes.

Calculated collection properties

The following properties can be set for extended collections:

Property Description

Name Specifies the name of the calculated collection.

Comment Describes the calculated collection.

Target Type Specifies the metaclass whose instances will appear in thecollection. The list displays only metaclasses that can bedirectly instantiated in the current model or package, such asclasses or tables, and not sub-objects such as class attributesor table columns.

Click the Select a Metaclass tool to the right of this field tochoose a metaclass from another type of model.

TargetStereotype

Specifies a stereotype to filter the target type. You can selectan existing stereotype from the list or enter a new one.

The Calculated Collection Script tab contains the definition of the body ofthe calculated collection function.

185

Page 192: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Calculated Collections (Profile)

The Global Script tab is used for sharing library functions and staticattributes in the resource file. You can declare global variables on this tab,but you should be aware that they will not be reinitialized each time thecollection is calculated, and keep their value until you modify the resourcefile, or the PowerDesigner session ends. This may cause errors, especiallywhen variables reference objects that can be modified or deleted. Make sureyou reinitialize the global variable if you do not want to keep the value froma previous run.

+ For more information on defining a script and using the Global Scripttab, see the ““Defining the script of a custom check” on page 205” and““Using the global script” on page 208” sections.

186

Page 193: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Forms (Profile)You can create your own property sheet tabs to organize and displayextended attributes. You can also create dialog boxes that are launched frommenus or by clicking on buttons in your property sheet tabs. Building a newform is fast and easy, using the form tools in the resource editor.

By default, extended attributes are listed alphabetically on the ExtendedAttributes tab of the object’s property sheet. By creating your own form, youcan make these attributes more visible and easy to use, by organizing themlogically, grouping related ones, and emphasizing those that are mostimportant. Custom forms are used in PDMs to emphasize the mostcommonly-used physical options on the “Physical Options (Common)” tabs.

You can create a form on any metaclass that has a property sheet, or on astereotype or a criterion. For property tabs, if the tab is linked to a stereotypeor criterion, it is displayed only when the metaclass instance bears thestereotype or meets the criterion.

v To create a form

1. Right-click a metaclass, stereotype or criterion and select New ä Form.

The form is created.

2. Enter a descriptive name for the form. This name will display in the tabof the property tab or in the title bar of the dialog box. You can also,optionally, enter a description of the form in the Comment field.

3. Select a Type. You can choose from the following:

187

Page 194: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Forms (Profile)

♦ Property Tab – creates a new tab in the property sheet of the metaclass,stereotype or criterion

♦ Dialog Box – creates a dialog box that can be launched from a menu orvia a form button

4. [optional, for property tabs only] Select the Add to favorite tabs checkbox to have the tab displayed by default in the property sheet.

5. Insert and arrange extended attributes and other controls using the toolbaron the Form tab at the bottom of the form (see “Adding extendedattributes and other controls to your form” on page 188).

6. Click the Preview button to review the layout of your form and, whensatisfied, click Apply to save your changes.

Adding extended attributes and other controls to your form

You insert controls into your form using the tools in the Form tab toolbar.

You can reorder controls in the form control tree by dragging and droppingthem. To place a control inside a container control (group box or horizontalor vertical layout), drop it onto the container. For example, if you want theextended attributes GUID, InputGUID, and OutputGUID to be displayed ina GUI group box, you should create a group box, name it GUI and drag anddrop all three extended attributes under the GUI group box.

Tool Description

Group Box - inserts a group box, intended to contain other controlswithin a named box.

Horizontal Layout - inserts a horizontal layout, intended to containother controls placed side by side.

Vertical Layout - inserts a vertical layout, intended to contain othercontrols placed one under the other.

188

Page 195: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Tool Description

Extended Attribute – opens a selection box in which you select oneor more extended attributes to insert into the form. This list is limitedto extended attributes defined under the same metaclass in the profile.Select one or more attributes and then click OK to insert them intothe form.

The type of control associated with the attribute depends on its type:booleans are associated with check boxes, lists with combo boxes,text fields with multi-line edit boxes, and so on.

Unless you enter a label, the attribute name is used as its form label.Any comment that you have entered for the attribute is displayed asits tooltip in the form.

Method Push Button - opens a selection box in which you selectone or more methods, which will be associated with the form viaform buttons. This list is limited to methods defined under the samemetaclass in the profile. Select one or more methods and then clickOK to insert them into the form.

Each method is displayed as a button on the form that, when clicked,invokes the method. Unless you enter a label, the method name isused as the button label. Any comment that you have entered for themethod is displayed as its tooltip in the form.

Edit Field [dialog boxes only] inserts an edit field.

Multi-Line Edit Field [dialog boxes only] - inserts a multi-line editfield below the selected item in the tree.

Combo Box [dialog boxes only] - inserts a combo box.

List Box [dialog boxes only] - inserts a list box.

Check Box [dialog boxes only] - inserts a check box.

Text - inserts a text control.

Separator Line – inserts a separator line. The line is vertical when itsparent control is a vertical layout.

189

Page 196: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Forms (Profile)

Tool Description

Spacer – inserts an area of blank space.

Delete – deletes the currently selected control.

Form control properties

The following properties can be set for form controls:

Property Definition

Name Internal name of the control. This name must be unique withinthe form. The name can be used in scripts to get and setdialog box control values (see “Example: Creating a dialog boxlaunched from a menu” on page 199).

Label Label identifying the control on the form. If this field is leftblank, the name of the control is used. If you enter a space,then no label is displayed.

The label accepts line breaks in the form of \n.

You can create keyboard shortcuts to navigate among controlsby prefixing the letter that will serve as the keyboard shortcutwith an & character. If you do not specify a shortcut key,PowerDesigner will choose one by default.

To use the & character in a label, you must escape it with asecond & (for example: “&Johnson && Son” will display as“Johnson & Son”.

Indentation [container controls only] Specifies the space in pixels betweenthe left margin of the container (form, group box, or horizontalor vertical layout) and the beginning of the labels of its childcontrols.

Labelspace

[container controls only] Specifies the space in pixels reservedfor displaying the labels of child controls between the indenta-tion of the container control (form, group box, or horizontal orvertical layout) and the control fields.

If a child control label is larger than this value, the label spaceproperty is ignored; to display this label, you need to type anumber of pixels greater than 50.

190

Page 197: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Property Definition

Show con-trol as label

[group boxes only] Use the first control contained within thegroup box as its label.

Show Hid-den At-tribute

[extended attributes only] Displays controls that are not validfor a particular form (because they do not bear the relevantstereotype, or do not meet the criteria) as greyed. If this optionis not set, irrelevant options are hidden.

Value [dialog box entry fields only] Specifies a default value for thecontrol. Note that default values for extended attributes must bespecified in the attribute’s properties (see “Extended attributeproperties” on page 176).

List of Val-ues

[combo and list boxes only] Specifies a list of possible valuesfor the control. Note that lists of values for extended attributesmust be specified in the attribute’s properties (see “Extendedattribute properties” on page 176).

Exclusive [combo box only] Specifies that only the values defined in theList of values can be entered in the combo box.

Mini-mum Size(chars)

Specifies the minimum width (in characters) to which thecontrol may be reduced when the window is resized.

MinimumLine Num-ber

Specifies the minimum number of lines to which a multilinecontrol may be reduced when the window is resized.

HorizontalResize

Specifies that the control may be resized horizontally when thewindow is resized.

Verticalresize

Specifies that the multiline control may be resized verticallywhen the window is resized.

Read-Only [dialog box entry fields only] Specifies that the control isread-only, and will be greyed in the form.

Width [spacer only] Specifies the width, in pixels, of the spacer.

Height [spacer only] Specifies the height, in pixels, of the spacer.

191

Page 198: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Forms (Profile)

Adding DBMS physical options to your forms

Many of the DBMSs supported in the PowerDesigner Physical data Modeluse “physical options” as part of the definition of their objects.PowerDesigner displays all of the available options on the Physical Optionstab of the relevant object’s property sheet, which is powered by the Optionsentry in the Script/Objects/<object> category in the DBMS resource file.

+ For more information about physical options, see “Physical Options” inthe DBMS Reference Guide chapter

The most commonly-used physical options are displayed on a pre-configuredcustom form, which is called Physical Options (Common), and is located inthe object’s profile. You can edit this form by adding or removing controls,or create your own form to manage your preferred physical options.

For a physical option to be displayed in a profile form, it must be promotedto the status of an extended attribute (with a “physical option” type), and isthen added to the form in the same way as other attributes.

192

Page 199: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

v To add a physical option to a form

1. Right-click the metaclass and select New ä Extended Attribute fromPhysical Options to open the Select Physical Options dialog:

Note that this dialog will be empty if no physical options are defined inthe Options entry in the Script/Objects/<object> category.

2. Select the physical option required and click OK to create an extendedattribute associated with it.

3. Specify any other appropriate properties.

4. Select the form in which you want to insert the physical option and clickthe Extended Attribute tool to insert it as a control (see “Adding extendedattributes and other controls to your form” on page 188).

Changing the associated physical optionYou can access the Select Physical Options dialog to change the associatedphysical option by clicking the ellipsis to the right of the Physical Optionsfield in the Extended Attribute property sheet.

Example: Creating a property sheet tab

This example guides you through creating a form for presenting extendedattributes in a Teradata v2r5 PDM. Note that this is just an example, and thatTeradata extended attributes are already organized in forms.

To follow along with this example, create a new Teradata v2r5 PDM andthen select Database ä Edit Current DBMS to open the Resource Editor.

193

Page 200: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Forms (Profile)

Expand the Profile ä User ä Extended Attributes folder to review theextended attributes defined for the user object.

We will create a new property tab to present the most commonly-used ofthese attributes.

v To create a property sheet tab for the Teradata user object

1. Right-click the User metaclass and select New ä Form.

2. In the new form property sheet, enter “Teradata” in the Name box, selectProperty Tab from the Type list, and then clear the Add to favorite tabscheck box.

3. Click the Extended Attribute tool in the Form tab toolbar to open the AddExtended Attributes dialog box:

Select the attributes as in the above screenshot and then click OK to addthem to the form.

4. Click the Group Box tool to create a group box control, and enter thename “Space” in its Name field.

5. Create two additional group boxes, name them “Regional Settings” and“User Profile”, and then drag and drop the attributes in the list in order toorganize them into the group boxes as follows:.

194

Page 201: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

6. Click the Preview button to view the new tab. The different input boxesare not aligned, so click Cancel to return to the Resource Editor.

7. Click the Space group box control in the list and enter 140 in its LabelSpace field. Then repeat this process for the two other group boxes. Now,when you click Preview, all the controls are aligned together:

195

Page 202: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Forms (Profile)

Continue with the next example to add a dialog box that will be launchedby clicking on a button on the form.

Example: Creating a dialog box to launch from a property tab

In this example, we will continue to work with the Teradata property tab (see“Example: Creating a property sheet tab” on page 193), by creating a dialogbox for editing more specific attributes. This dialog will be launched whenyou click a button on the property tab.

You call a dialog box by invoking a method (see “Methods (Profile)” onpage 216). You need first to create the method, and then to add it to theproperty tab to create a button for calling the dialog.

196

Page 203: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

v To create the method to call the dialog

1. Right-click the User metaclass and select New ä Method.

2. Name the new method ShowAdvancedExtendedAttributes, and then clickthe Method Script tab and enter the following script:

Sub %Method%(obj)’ Show custom dialog for advanced extended attributesDim dlgSet dlg =

obj.CreateCustomDialog("%CurrentTargetCode%.AdvancedTeradata Attributes")

If not dlg is Nothing Thendlg.ShowDialog()

End IfEnd Sub

1. Select the Teradata property tab in the ProfileUserForms folder, click theMethod Push Button tool in the Form tab toolbar, select the new method,and then click OK to add it to the form.

2. Enter Advanced. . . in the Label field, and then click Preview to see thenew button at the bottom of the property tab:

Now we will continue on to create the dialog box

v To create the advanced attributes dialog box

1. Right-click the Forms category in the User metaclass and select New tocreate a new form.

2. Enter Advanced Teradata Attributes in the Name box and select DialogBox in the type list. Note that additional tools appear in the Form tabtoolbar.

3. Click the Extended Attribute tool in the palette, select the followingattributes, and then click OK to add them to the form:

197

Page 204: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Forms (Profile)

4. Click the Group Box tool to create a group box control and name itJournal. Then drag the Journal, AfterJournal, and DefaultJournalTableextended attributes into the group box.

5. Click the Form entry in the controls tree and enter 140 in the Label Spacebox to ensure that all the controls are aligned. Then click Preview.

6. You cannot test launching the dialog box in preview mode, so click OK tosave your changes and close the Resource Editor. Then, create a user,open its property sheet, select the Teradata tab, and click the Advancedbutton to launch the dialog box:

198

Page 205: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Example: Creating a dialog box launched from a menu

You can create a dialog box when you need to enter parameters during OLEautomation through VB scripts.

In this example, we will create a new dialog box that will be launched from anew “Export command in the contextual menu of extended objects, andwhich allows you to enter a path to where the extended object should beexported.

v To create the dialog box

1. Right-click the ExtendedObject metaclass in the resource editor andselect New ä Form.

2. Type Export in the Name box, and select Dialog Box in the type list.

3. Click the Edit Field tool to add an edit field control, and name it“Filename”.

4. Right-click the ExtendedObject metaclass and select New ä Method.This creates a new method, you can call it Export.

5. Name the method “Export”, click the Method Script tab and enter thefollowing code:

199

Page 206: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Forms (Profile)

Sub %Method%(obj)’ Exports an object in a file

’ Create a dialog to input the export file nameDim dlgSet dlg = obj.CreateCustomDialog

("%CurrentTargetCode%.Export")If not dlg is Nothing Then

’ Initialize filename control valuedlg.SetValue "Filename", "c:\temp\MyFile.txt"

’ Show dialogIf dlg.ShowDialog() Then

’ Retrieve customer value for filename controlDim filenamefilename = dlg.GetValue("Filename")

’ Process the export algorithm...Output "Exporting object " + obj.Name + " to file " +filename

End If

’ Free dialog objectdlg.DeleteSet dlg = Nothing

End If

End Sub

1. Right-click the ExtendedObject metaclass and select New ä Menu tocreate a new menu entry in its contextual menu (see “Menus (Profile)” onpage 219).

2. Enter the name “Export” and then click the Add Commands fromMethods and Transformations tool and select the Export method.

3. Click OK to save your changes and close the Resource Editor.

4. Right-click an extended object and select the Export command in itscontextual menu to launch the Export dialog box.

200

Page 207: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

201

Page 208: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Custom Symbols (Profile)

Custom Symbols (Profile)A custom symbol allows you to modify the appearance of instances of themetaclass, stereotype, or criterion.

v To create a custom symbol

1. Right-click a metaclass, stereotype, or criterion in the Profile categoryand select New ä Custom Symbol.

A new custom symbol is created under the selected category.

2. Specify a default width and height in the Default Size groupbox.

3. Click the Modify button to open the Symbol Format dialog box, and setthe required properties on the various tabs:

202

Page 209: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

+ For more information on the Symbol Format dialog box, see the“Modifying symbol appearance” section in the “Model Graphics” chapterin the General Features Guide .

4. Click OK to return to the resource editor, where you can view yourchanges in the Preview field.

5. Click Apply to save your changes.

Custom symbol for a link When you customize the line style of a link symbol, such as a PDMreference for example, the parameters you select in the Style list and in theArrow groupbox in the Line Style tab replace the one you may have selectedin the Display Preferences dialog box. This can provoke confusion in themodel coherence. To avoid that confusion and preserve the method definitionof your model, you should use the Notation attribute in the Style list and orin the Arrow groupbox. This attribute is only available in the Profile.

203

Page 210: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Custom Checks (Profile)

Custom Checks (Profile)Custom checks are model checks, written in VBScript, which enable you toverify that your model objects are well-defined. Custom checks are listedwith standard model checks in the Check Model Parameters dialog box.

+ For more information about using VBScript, see the Scripting User’sGuide .

Custom check properties

When you create custom checks you have to define the following generalproperties:

Parameter Description

Name Name of the custom check. This name is displayed underthe selected object category in the Check Model Param-eters dialog box. This name is also used (concatenated)in the check function name to uniquely identify it

Comment Additional information about the custom check

Help Message Text displayed in the message box that is displayed whenthe user selects Help in the custom check context menuin the Check Model Parameters dialog box

Output message Text displayed in the Output window during checkexecution

Default severity Allows you to define if the custom check is an error(major problem that stops generation) or a warning(minor problem or just recommendation)

Execute thecheck by default

Allows you to make sure that this custom check isselected by default in the Check Model Parametersdialog box

Enable automaticcorrection

Allows you to authorize automatic correction for thecustom check

Execute the auto-matic correctionby default

Allows you to make sure that automatic correction forthis custom check is executed by default

Check Script This tab contains the custom check script. See “Definingthe script of a custom check” on page 205.

204

Page 211: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Parameter Description

Autofix Script This tab contains the autofix script. See “Defining thescript of an autofix” on page 207

Global Script This tab is used for sharing library functions and staticattributes in the resource file. See “Using the globalscript” on page 208.

Defining the script of a custom check

This section also applies for defining the script of a custom method, acalculated collection, an event handler, or a transformation.

You type the script of a custom check in the Check Script tab of the customcheck properties. By default, the Check Script tab displays the followingscript items:

♦ %Check% is the function name, it is passed on parameter obj. It isdisplayed as a variable, which is a concatenation of the name of theresource file, the name of the current metaclass, the name of thestereotype or criterion, and the name of the check itself defined in theGeneral tab. If any of these names contains an empty space, it is replacedby an underscore

♦ A comment explaining the expected script behavior

♦ The return value line that indicates if the check succeeded (true) or not(false)

Example In Sybase AS IQ, you need to create additional checks on indexes in order toverify their columns. The custom check you are going to create verifies ifindexes of type HG, HNG, CMP, or LF are linked with columns which datatype VARCHAR length is higher than 255.

v To define the script of a custom check

1. Right-click a metaclass, stereotype or a criterion under Profile, and selectNew ä Custom Check.

2. Click the Check Script tab in the custom check properties to display thescript editor.

By default, the function is declared at the beginning of the script. Youshould not modify this line.

205

Page 212: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Custom Checks (Profile)

3. Type a comment after the function declaration in order to document thecustom check, and then declare the different variables used in the script.

Dim c ’temporary index columnDim col ’temporary columnDim positionDim DT_col

4. Enter the function body.

%Check%= True

if obj.type = "LF" or obj.type = "HG" or obj.type = "CMP" orobj.type ="HNG" then

for each c in obj.indexcolumnsset col = c.column

position = InStr(col.datatype,"(")if position <> 0 then

DT_col = left(col.datatype, position -1)else

DT_col = col.datatypeend if

if ucase(DT_col) = "VARCHAR" and col.length > 255 thenoutput "Table " & col.parent.name & " Column "

& col.name & " : Data type is not compatible withIndex " & obj.name & " type " & obj.type

%Check% = Falseend if

5. Click Apply to save your changes.

206

Page 213: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Defining the script of an autofix

If the custom check you have defined supports an automatic correction, youcan type the body of this function in the Autofix Script tab of the customcheck properties.

The autofix is visible in the Check Model Parameters dialog box, it isselected by default if you select the Execute the Automatic Correction byDefault check box in the General tab of the custom check properties.

By default, the Autofix Script tab displays the following script items:

♦ %Fix% is the function name, it is passed on parameter obj. It is displayedas a variable, which is a concatenation of the name of the resource file,the name of the current metaclass, the name of the stereotype or criterion,and the name of the fix. If any of these names contains an empty space, itis replaced by an underscore

♦ The variable outmsg is a parameter of the fix function. You need tospecify the fix message that will appear when the fix script will beexecuted

♦ The return value line that indicates if the fix succeeds or not

We will use the same example as in section Defining the script of a customcheck, to define an autofix script that removes the columns with incorrectdata type from index.

v To define the script of an autofix

1. Click the Autofix Script tab in the custom check properties.

By default, the function is declared at the beginning of the script. Youshould not modify this line.

2. Type a comment after the function declaration in order to document thecustom check, and then declare the different variables used in the script:

Dim c ’temporary index columnDim col ’temporary columnDim positionDim DT_col

3. Enter the function body:

207

Page 214: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Custom Checks (Profile)

%Fix% = FalseIf obj.type = "LF" or obj.type = "HG" or obj.type = "CMP"

or obj.type ="HNG" ThenFor Each c In obj.IndexColumns

Set col = c.columnposition = InStr(col.datatype,"(")If position <> 0 ThenDT_col = Left(col.datatype, position -1)

ElseDT_col = col.datatype

End IfIf (Ucase(DT_col) = "VARCHAR") And (col.length >255) Then

outmsg = "Automatic correction has removedcolumn " & col.Name & " from index."

c.Delete%Fix% = True

End IfNext

End If

4. Click Apply to save your changes.

Using the global script

This section also applies for defining the script of a custom method, acalculated collection, an event handler, or a transformation.

The Global Script tab is used to store functions and static attributes that maybe reused among different functions. This tab displays a library of availablesub-functions.

208

Page 215: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Example In the Sybase AS IQ example, you could have a function calledDataTypeBase that retrieves the data type of an item in order to furtheranalyze it.

This function is defined as follows:

Function DataTypeBase(datatype)Dim positionposition = InStr(datatype, "(")If position <> 0 Then

DataTypeBase = Ucase(Left(datatype, position -1))Else

DataTypeBase = Ucase(datatype)End If

End Function

In this case, this function only needs to be referenced in the check andautofix scripts:

Function %Check%(obj)Dim c ’temporary index column

Dim col ’temporary columnDim position%Check%= TrueIf obj.type = "LF" or obj.type = "HG" or obj.type = "CMP" or

obj.type ="HNG" thenFor Each c In obj.IndexColumns

Set col = c.columnIf (DataTypeBase(col.datatype) = "VARCHAR") And(col.length > 255) Then

Output "Table " & col.parent.name & " Column " &col.name & " : Data type is not compatible with Index "& obj.name & " type " & obj.type

%Check% = FalseEnd If

NextEnd If

End Function

Global variables You can also declare global variables in the Global Script. These variablesare reinitialized each time you run the custom check.

Running custom checks and troubleshooting scripts

All custom checks defined in any resource files attached to the model aremerged and all the functions for all the custom checks are appended to buildone single script. The Check Model Parameters dialog box displays allcustom checks defined on metaclasses, stereotypes and criteria under thecorresponding categories.

If there are errors in your custom check scripts, the user will be promptedwith the following options:

209

Page 216: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Custom Checks (Profile)

Button Action

Ignore Allows you to skip the problematic script and resume check

Ignore All Allows you to skip all problematic scripts and resume processwith standard checks

Abort Stops check model

Debug Stops check model, opens the resource editor and indicate onwhich line the problem is. You can correct error and restartcheck model

210

Page 217: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Event Handlers (Profile)An event handler can automatically launch a VBScript when an event occurson an object. You can associate an event handler with a metaclass or astereotype; criteria do not support event handlers.

The following kinds of event handlers are available in PowerDesigner:

Event han-dler

Description

CanCreate Used to implement a creation validation rule to prevent ob-jects from being created in an invalid context. For example,in a BPM for ebXML, a process with a Business Transactionsstereotype can only be created under a process with a BinaryCollaboration stereotype. The script of the CanCreate eventhandler associated with the Business Transaction processstereotype is the following:Function %CanCreate%(parent)if parent is Nothing or

parent.IsKindOf(PdBpm.Cls_Process) then

%CanCreate% = Falseelse

%CanCreate% = Trueend if

End Function

If this event handler is set on a stereotype and returns True,then you can use the custom tool to create the stereotypedobject. Otherwise the tool is not available, and the stereotypelist excludes corresponding stereotype. If it is set on ametaclass and returns True, then you can create the objectfrom the palette, from the Browser or in a list.

Note that, when you import or reverse engineer a model, theCanCreate functions are ignored since they could modify themodel and make it diverge from the source.

211

Page 218: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Event Handlers (Profile)

Event han-dler

Description

Initialize Used to instantiate objects with predefined templates. Forexample, in a BPM, a Business Transaction must be acomposite process with a predefined sub-graph. The scriptof the Initialize event handler associated with the BusinessTransaction process stereotype contains all the functionsneeded to create the sub-graph. The following piece of scriptis a subset of the Initialize event handler for a BusinessTransaction....’ Search for an existing requesting

activitysymbol

Dim ReqSymSet ReqSym = NothingIf Not ReqBizAct is Nothing

ThenIf ReqBizAct.Symbols.Count >

0 ThenSet ReqSym =

ReqBizAct.Symbols.Item(0)End If

End If

’ Create a requestingactivity if not foundIf ReqBizAct is Nothing ThenSet ReqBizAct =

BizTrans.Processes.CreateNewReqBizAct.Stereotype =

"RequestingBusinessActivity"ReqBizAct.Name = "Request"

End If...

If the Initialize event handler is set on a stereotype andreturns True, the initialization script will be launched when-ever the stereotype is assigned, either with a custom tool inthe palette, or from the object property sheet. If it is set ona metaclass and returns True, the initialization script will belaunched when you create a new object from the tool palette,from the Browser, in a list or in a property sheet.

If it is set on the model metaclass and returns True, theinitialization script is launched when you assign a target(DBMS or object, process, or schema language) to the modelat creation time, when you change the target of the model orwhen you assign an extended model definition to the model.

212

Page 219: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Event han-dler

Description

Validate Used to validate changes to object properties and to imple-ment cascade updates. It is triggered when change tabs orclick OK or Apply in the object property sheet.

You can define an error message that will appear when thecondition is not satisfied. To do so, fill the message variableand set the %Validate% variable to False.

In the following example, the validate event handler verifiesthat a comment is added to the definition of an object whenthe user validates the property sheet. A message is displayedto explain the problem.Function %Validate%(obj, ByRef

message)if obj.comment = "" then

%Validate% = Falsemessage = "Comment cannot be

empty"else

%Validate% = Trueend if

End Function

CanLinkKind [link objects only] Used to restrict the kind and stereotype ofthe objects that can be linked together. It is triggered whenyou create a link with a palette tool or modify link ends in aproperty sheet.

This event handler has two input parameters: its sourceand destination extremities. You can also use the sourceS-tereotype and destinationStereotype parameters. These areoptional and used to perform additional checks on stereo-types.

In the following example, the source of the extended linkmust be a start object:Function %CanLinkKind%(sourceKind,

sourceStereotype,destinationKind,

destinationStereotype)if sourceKind = cls_Start Then%CanLinkKind% = Trueend if

End Function

213

Page 220: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Event Handlers (Profile)

v To add an event handler to a metaclass or a stereotype

1. Right-click a metaclass or a stereotype and select New ä Event Handlerto open a selection box, listing the available event handlers.

2. Select one or more event handlers and click OK to add them to themetaclass.

3. Click on the event handler in the tree view, and enter a name andcomment.

4. Click the Event Handler Script tab and enter your script:

5. Click Apply to save your changes.

Event handler properties

The following properties are available for event handlers:

214

Page 221: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Property Description

Name Specifies the name of the event handler.

Comment Provides a description of the event handler.

Event Han-dler Script

This tab specifies the VBScript that will run when the eventoccurs. Note that you should not use statements such asmsgbox, or input box to open a dialog box in the eventhandler function.

Global Script This tab can be used for sharing library functions and staticattributes in the resource file.

For more information on defining a script and using theGlobal Script tab, see the ““Defining the script of a customcheck” on page 205” and ““Using the global script” onpage 208” sections.

215

Page 222: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Methods (Profile)

Methods (Profile)Methods allow you to perform actions on objects. They are written inVBScript, and are invoked by other profile components, such as menu items(see “Menus (Profile)” on page 219) or form buttons (see “Forms (Profile)”on page 187).

The following example method, created in the Class metaclass, convertsclasses into interfaces. It copies class basic properties and operations, deletesthe class (to avoid namespace problems), and creates the new interface.

Note that this script does not deal with other class properties, or withinterface display, but a method can be used to launch a custom dialog box toask for end-user input before performing its action (see “Example: Creatinga dialog box launched from a menu” on page 199).

Sub %Mthd%(obj)’ Convert class to interface

’ Copy class basic propertiesDim Folder, Intf, ClassName, ClassCodeSet Folder = obj.ParentSet Intf = Folder.Interfaces.CreateNewClassName = obj.NameClassCode = obj.CodeIntf.Comment = obj.Comment

’ Copy class operationsDim OpFor Each Op In obj.Operations

’ ...Output Op.Name

Next

’ Destroy classobj.Delete

’ Rename interface to saved nameIntf.Name = ClassNameIntf.Code = ClassCode

End Sub

+ For detailed information about using VBScript in PowerDesigner, seeWorking with Scripts .

216

Page 223: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

v To create a method

1. Right-click a metaclass, stereotype or criterion and select New ä Method.

2. Enter a name and a comment to describe the method.

3. Click the Method Script tab, and enter the VBscript. If appropriate, youcan reuse functions on the Global Script tab.

By default, this tab contains the following skeleton script:

Sub %Method%(obj)’ Implement your method on <obj> here

End Sub

%Method% is a concatenation of the name of the resource file, themetaclass (and any stereotype or criterion), and the name of the methoditself defined in the General tab. If any of these names contains an emptyspace, it is replaced by an underscore.

4. Click Apply.

Method properties

The following properties can be set for methods:

Property Description

Name Name of the method that identifies a script

Comment Additional information about the method

217

Page 224: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Methods (Profile)

The Method Script tab contains the body of the method function.

The Global Script tab is used for sharing library functions and staticattributes in the resource file. This tab is shared with event handlers andtransformations.

You can declare global variables on this tab, but you should be aware thatthey will not be reinitialized each time the method is executed, and keeptheir value until you modify the resource file, or the PowerDesigner sessionends. This may cause errors, especially when variables reference objects thatcan be modified or deleted. Make sure you reinitialize the global variable atthe beginning of a method if you do not want to keep the value from aprevious run.

+ For more information on defining a script and using the Global Scripttab, see the ““Defining the script of a custom check” on page 205” and““Using the global script” on page 208” sections.

218

Page 225: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Menus (Profile)You can add menus in the PowerDesigner interface and fill them withcommands that call method (see “Methods (Profile)” on page 216) ortransformations (see “Transformations and Transformation Profiles(Profile)” on page 225).

Menus can be added to the PowerDesigner File, Tools, and Help menuswhen defined on the model or a diagram metaclass, or on the contextualmenus of diagram symbols and browser items. Menus defined on a parentmetaclass are inherited by its children. For example, you could generalize acontextual menu by defining it on a parent metaclass like BaseObject.

v To create a menu

1. Right-click a metaclass, stereotype or criterion and select New ä Menu.

2. Enter a name and comment (and, in the case of model or diagrammetaclasses, a location).

3. Use the tools on the Menu sub-tab to create the items in your menu (see“Adding commands and other items to your menu” on page 220).

4. Click Apply to save your changes.

219

Page 226: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Menus (Profile)

Menu properties

The following properties are available for menus:

Property Description

Name Specifies the internal name of the menu. This name will notappear in the menu

Comment Provides a description of the menu.

Location [model and diagram only] Specifies where the menu will bedisplayed. You can choose between:♦ File > Export menu

♦ Help menu

♦ Object Contextual Menu

♦ Tools menuMenus created on other metaclasses are only available on thecontextual menu, and do not display a Location field.

Menu This sub-tab provides tools to add items to your menu(see “Adding commands and other items to your menu”on page 220).

XML This sub-tab displays the XML generated from the Menusub-tab.

Adding commands and other items to your menu

You insert items into your menu using the tools in the Menu tab toolbar.

You can reorder items in the menu tree by dragging and dropping them. Toplace an item inside a submenu item, drop it onto the submenu.

220

Page 227: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Tool Function

Add Command - Opens a selection dialog box to allow you to addone or more methods or transformations to the menu as commands.This list is limited to methods and transformations defined in thecurrent metaclass and its parents.

When you click OK, each selected method is added to your menu inthe format: <Caption> (<Method/Transformation name>).

The caption is the command name that will appear in the menu.You can define a shortcut key in the caption by adding an ampersandbefore the shortkey letter.

Methods or transformations associated with menu commands are notsynchronized with those defined in a metaclass. Thus, if you modifythe name or the script of a method or transformation, you shoulduse the Find tool to locate and update all the commands using thismethod or transformation..

Add Separator -Creates a menu separator under the selected item.

Add Submenu - Creates a submenu under the selected item.

Deletes the selected item.

221

Page 228: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Templates and Generated Files (Profile)

Templates and Generated Files (Profile)The PowerDesigner Generation Template Language (GTL) is used togenerate files from metaclasses and for scripting. You write a template inGTL, using variables that allow you to access properties of the current objector any other object in the model.

You can define templates and generated files for metaclasses, stereotypes,and criteria. If a template applies to all metaclasses, then you should create itin the Shared category.

+ For detailed information about the GTL, see the “Generation ReferenceGuide” chapter.

Creating a template

Templates can be created in the Shared category when they apply to allmetaclasses. They can also be created at the metaclass level or for a givenstereotype or criterion.

Binding a template to a stereotypePreviously, you would bind the use of a particular template to a stereotypeusing the template name <<stereotype>> syntax. Now, you create thetemplate beneath the stereotype in the profile.

Browse tool (F12) You can use the Browse tool to find all templates of the same name. To doso, open a template, position the cursor on a template name in-between %characters, and click Browse (or F12). This opens a Result window thatdisplays all templates prefixed by their metaclass name. You candouble-click a template in the result window to locate its definition in theresource editor.

v To create a template

1. Right-click a metaclass, a stereotype, or a criterion and select New ä

Template to create a template.

2. Enter a name in the Name box. We recommend that you do not usespaces in the name.

3. [optional] Enter a comment to explain the use of the template.

4. Enter the template body using GTL in the central box.

Creating a generated file

The Generated Files category contains an entry for each type of file that will

222

Page 229: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

be generated for the metaclass, stereotype, or criterion. Only files defined forobjects belonging directly to a model or a package collection will begenerated. Sub-objects, like attributes, columns, or parameters do notsupport file generation, but it can be interesting to see the code generated forthese sub-objects in their Preview tab.

Priority of generated filesIf an extended model definition attached to the model contains a generatedfile name identical to one defined in the main resource file, then theextended model definition generated file will be generated.

v To define a generated file

1. Right-click a metaclass, stereotype, or criterion, and select New ä

Generated File.

2. Enter a name in the Name box, specify a file name, and select a file typeto provide syntax coloring..

3. Enter the template for the contents of the generated file in the text zone:

4. Click Apply to save your changes.

Each generated file has the following properties:

Property Description

Name Specifies a name for the file entry in the resource editor.

223

Page 230: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Templates and Generated Files (Profile)

Property Description

File Name Specifies the name of the file that will be generated. This fieldcan contain GTL variables. For example, to generate an XMLfile with the code of the object for its name, you would enter%code%.xml.

If you leave this field empty, then no file will be generated,but you can view the code produced in the object’s Previewtab.

Type Specifies the type of file to provide appropriate syntax color-ing in the Preview window.

Encoding Specifies the encoding format for the file. Click the ellipsistool to the right of the field to choose an alternate encodingfrom the Text Output Encoding Format dialog box.. In thisdialog box, select the Abort on Character Loss check box tostop generation if characters will be lost.

Comment Specifies additional information about the generated file

Use packagehierarchy asfile path

Specifies that the package hierarchy should be used to gener-ate the hierarchy of file directories.

Generatedfile template(text zone)

Specifies the template of the file to generate. You can enterthe template directly here or reference a template definedelsewhere in the profile. (see the “Generation ReferenceGuide” chapter).

224

Page 231: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Transformations and Transformation Profiles(Profile)

A transformation defines a set of actions to be executed during generation orupon request. You define a transformation in the profile category of anextended model definition on a metaclass or a stereotype or other criteria.

You define a transformation when you want to:

♦ modify objects for a special purpose. For example, you can create atransformation in an OOM that converts <<control>> classes intocomponents

♦ modify objects in a reversible way. This can be useful during round-tripengineering. For example, if you generate a PDM from an OOM in orderto create O/R mappings, and the source OOM contains components, youcan pre-transform components into classes for easy mapping to PDMtables. When you update the source OOM from the generated PDM, youcan use a post-transformation to recreate the components from theclasses.

Transformations can be used:

♦ In a transformation profile (see “Creating a Transformation Profile” onpage 229) during model generation, or on demand. For more information,see “Applying Model Transformations” in the Managing Models chapterof the General Features Guide .

♦ As a command in a user-defined menu (see “Menus (Profile)” onpage 219)

Transformations can be used to implement Model Driven Architecture(MDA), a process defined by the OMG, and which separates the businesslogic of an application from the technological means used to implement it.The goal is to improve the integration and interoperability of applicationsand as a result, reduce the time and effort spent in application developmentand maintenance.

MDA development uses UML modeling to describe an application atdifferent levels of detail, starting with the construction of aPlatform-independent model (PIM) which models the basic business logicand functionality, and ending in a Platform-Specific Model (PSM) whichincludes implementation technologies (like CORBA, .NET, or Java).Between the initial PIM and the final PSM, there may be other intermediatemodels.

225

Page 232: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Transformations and Transformation Profiles (Profile)

PowerDesigner allows you to create an initial PIM and refine it progressivelyin different models containing increasing levels of implementation andtechnology-dependent information. You can define transformations that willgenerate a more refined version of a model, based on the desired targetplatform. When changes are made to the PIM, they can be cascaded down tothe generated models.

Transformations can also be used to apply design patterns to your modelobjects.

v To create a transformation

1. Right-click a metaclass or stereotype, and select New ä Transformationfrom the contextual menu.

2. Enter the appropriate properties including a transformation script.

Transformation properties

A transformation has the following properties:

Property Description

Name Name of the transformation. Make sure you type understandablenames in order to easily identify them in selection lists

Comment Additional information about the transformation used to explainthe script

Transformation script tab

Name Definition

CopyObject Duplicates an existing object and set a source for the dupli-cated object.

Parameters:♦ source: object to duplicate

♦ tag [optional]: identifierReturns: A copy of the new object

226

Page 233: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Name Definition

SetSource Sets the source object of a generated object. It is recom-mended to always set the source object to keep track of theorigin of a generated object.

Parameters:♦ source: source object

♦ target: target object

♦ tag [optional]: identifierReturns:

GetSource Retrieves the source object of a generated object.

Parameters:♦ target: target object

♦ tag [optional]: identifierReturns: Source object

GetTarget Retrieves the target object of a source object.

Parameters:♦ source: source object

♦ tag [optional]: identifierReturns: Target object

Generation history Since a source object can be transformed and have several targets, you mayhave problems identifying the origin of an object, especially in the mergedialog box. The following mechanism is used to help identify the origin ofan object:

If the source object is transformed into a single object Then thetransformation is used as an internal identifier of the target object.

If the source object is transformed into several objects Then you candefine a specific tag to identify the result of transformation. You should useonly alphanumeric characters, and we recommend that you use a “stable”value such as a stereotype, which will not be modified during repetitivegenerations.

For example, OOM1 contains the class Customer, to which you apply atransformation script to create an EJB. Two new classes are created from thesource class, one for the home interface, and one for the remote interface. Inthe transformation script, you should assign a tag “home” for the homeinterface, and “remote” for the remote interface. The tag is displayedbetween <> signs in the Version Info tab of an object, beside the sourceobject.

227

Page 234: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Transformations and Transformation Profiles (Profile)

In the following example, the tag mechanism is used to identify the classesattached to a component:

’setting tag for all classes attached to componentfor each Clss in myComponent.Classes

if clss <> obj thentrfm.SetSource obj,Clss," GenatedFromEJB"+ obj.name

+"target" +Clss.NameFor each ope in clss.Operations

if Ope.Name = Clss.Code Then ’then it is aconstructor _Bean operation

trfm.SetSource obj,Ope," GenatedFromEJB"+ obj.name+"target" +Ope.Nameend if

if Ope.Name = Clss.Name Then ’then it is aconstructor operation

trfm.SetSource obj,Ope," GenatedFromEJB"+ obj.name+"target" +Ope.Nameend if

if Ope.name = "equals" Then ’then it is an equalsoperation and should be tagged

trfm.SetSource obj,Ope," GenatedFromEJB"+ obj.name+"target" +Ope.Nameend if

nextend ifnext

Script checks Transformation scripts do not require as many checks as standard scripts,which require that you verify the content of a model in order to avoid errors,because transformations are always implemented in a temporary modelwhere there is no existing object. The temporary model is merged with thegeneration target model if the Preserve modification option is selectedduring update.

If you create a transformation using an existing script, you can remove thesecontrols.

Internal transformationobject

Internal transformation objects do not appear in the PowerDesignerinterface; they are created as temporary objects passed to the script so thatthe user can access the helper functions, and also to record the execution of asequence of transformations in order to be able to execute them later.

Internal transformation objects are preserved when the transformations areused by the Apply Transformations feature or in a menu, so that when youupdate a model (regenerate) in which these kind of transformations havebeen executed, the transformations can be re-executed in the source model inorder to maintain an equality between the source and the target model.

For example, CDM1 contains an entity A. You generate an OOM fromCDM1 and class B is created. You apply some transformations to class B in

228

Page 235: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

OOM1 in order to create class C. When you re-generate CDM1 and updateOOM1, class B will be generated from entity A but class C is missing in thegenerated model, and shows as a difference in the merge dialog box.However, thanks to the internal transformation objects, the transformationswhich were executed in the generated OOM are re-executed and you obtainclass C and the models to be merged are more similar than before.

Global Script and Dependencies tabs

The Global Script tab provides access to definitions shared by all VBScriptfunctions defined in the profile, and the Dependencies tab lists thetransformation profiles in which the transformation is used.

Creating a Transformation Profile

A transformation profile is a group of transformations applied during modelgeneration when you want to apply changes to objects in the source or targetmodels.

You define a transformation profile in the Transformation Profiles categoryof an extended model definition (see the “Transformation profile category”section in the “Extended Model Definitions Reference Guide” chapter).Each profile is identified by the model in which the current extended modeldefinition is defined, a model type, a family and a subfamily.

v To create a transformation profile

1. [if the Transformation Profiles category is not present] Right-click theroot node, select Add Items from the contextual menu, selectTransformation Profiles and click OK to create this folder beneath theroot node.

2. Right click the Transformation Profiles folder, and select New from thecontextual menu. A new transformation profile is created in the folder.

3. Define the appropriate properties and add one or more transformationsusing the Add Transformations tool on the Pre-generation orPost-generation tabs. These transformations should have been previouslydefined in the Profile\Transformations category.

Transformation profile properties

You define a transformation profile using the following properties:

229

Page 236: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Transformations and Transformation Profiles (Profile)

Property Description

Name Name of the transformation profile

Comment Additional information about the transformation profile

ModelType

[optional] Specifies the type of model with which the transfor-mation profile can be used. This is a way to filter profiles duringgeneration. For example, if you select OOM when the currentextended model definition is in a PDM, the transformationprofile can be used during PDM to OOM generation or reverseengineering

Familyand sub-family

[optional] If the model type supports a target resource file, youcan also define a family and subfamily to filter the displayof profiles in the generation dialog box. The family is usedto establish a link between the resource file of a model andan extended model definition. When the resource file familycorresponds to the extended model definition family, it suggeststhat the extended model definition complements the resourcefile

Pre-generation

The Pre-generation tab lists the transformations to be executedbefore model generation. These transformations are executedwhen the current model in which you have created the extendedmodel definition is the source model, and when the constraintsdefined in the model type, family, and subfamily boxes are met.

Any object created during pre-generation is automatically addedto the list of objects used in generation.

These changes to the source model are temporary and arereversed after generation is complete.

For example, you can define a transformation profile with atransformation that cancels the creation of EJBs from classesbefore generating an OOM into a PDM in order to establish abetter mapping between classes and tables during generation.

Post-generation

The Post-generation tab lists the transformations to be executedafter generation. These transformations are executed when thecurrent model in which you have created the extended modeldefinition is the target model.

For example, you can define a transformation profile with atransformation that automatically applies the correct namingconventions to the generated model.

230

Page 237: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Using Profiles: a Case StudyTo illustrate the concept of profile, you are going to build an extended modeldefinition for an OOM. This model extension will let you design arobustness diagram.

Robustness diagram The robustness diagram is used to get across the gap between what thesystem has to do, and how it is actually going to accomplish this task. In theUML analysis, the robustness diagram is between use case and sequencediagram analysis. It allows you to verify that the use case is correct and thatyou have not specified a system behavior that is unreasonable given the setsof objects you have. The robustness diagram also enables to verify if noobject is missing in the model.

You are going to build a robustness diagram using the communicationdiagram in the OOM, together with an extended model definition containinga user-defined profile. This profile contains the following extensions:

♦ Stereotypes for objects

♦ Custom tool and symbol for each object stereotype

♦ Custom checks for instance links

♦ Generated file to output a description of messages exchanged betweenobjects

You will follow this case study to create a new extended model definition.This extended model definition corresponds to the resource fileRobustness.XEM, delivered by default and located in the \ResourceFiles\Extended Model Definitions folder of the PowerDesigner installationdirectory.

Scenario

You are going to build the robustness extended model definition startingfrom a concrete example. The following use case represents a very basicWeb transaction: a customer wants to know the value of his stocks in orderto decide to sell or not. He sends a stock value query from his InternetBrowser. The query is transferred from the browser to the database servervia the application server.

231

Page 238: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

You are going to use the robustness diagram to verify this use case diagram.

To do so, you will use a standard communication diagram and extend it witha profile.

Attaching a new extended model definition to the model

In your workspace, you already have created an OOM with a use casediagram containing an actor and 3 use cases.

You have to create a new extended model definition and import it into thecurrent model before starting the profile definition.

v To attach an extended model definition to the model

1. Select Tools ä Resources ä Extended Model Definitions ä

Object-Oriented Model.

The List of Extended Model Definitions for an OOM is displayed.

2. Click the New tool in the list toolbar.

The New Extended Model Definition dialog box is displayed.

3. Type Robustness_Extension in the Name box.

4. Keep <Default Template> in the Copy From box.

5. Click OK.

A standard Save As dialog box is displayed. By default the file name isidentical to the name of the extended model definition.

232

Page 239: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

6. Click Save.

The Extended Model Definition editor is displayed.

7. Clear the Complement Language Generation check box.

This extended model definition does not belong to any object languagefamily and will not be used to complement any object languagegeneration.

8. Click OK to close the Extended Model Definition editor.

9. Click Close in the List of Extended Model Definitions.

A Confirmation box asks you to save the extended model definition file.

10. Click Yes.

11. Select Model ä Extended Model Definitions.

The List of Extended Model Definitions is displayed.

12. Click the Import an Extended Model Definition tool in the List toolbar.

The Extended Model Definition Selection dialog box is displayed.

13. Click the General Purpose tab and select the Robustness_Extensioncheck box.

233

Page 240: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

14. Click OK, the extended model definition is displayed in the List ofExtended Model Definitions.

15. Click OK in the list.

16. Right-click the model in the Browser, and select New ä CommunicationDiagram in the contextual menu.

The diagram property sheet is displayed.

17. Type Robustness Diagram in the name box and click OK in the propertysheet.

Create object stereotypes

The robustness analysis classifies objects in three categories:

♦ Boundary objects are used by actors when communicating with thesystem; they can be windows, screens, dialog boxes or menus

♦ Entity objects represent stored data like a database, database tables, orany kind of transient object such as a search result

♦ Control objects are used to control boundary and entity objects, andrepresent transfer of information

To implement the robustness analysis in PowerDesigner, you are going tocreate stereotypes for objects in the communication diagram. Thesestereotypes correspond to the three object categories defined above. You willalso attach custom tools in order to create a palette specially designed forcreating objects with the <<Entity>>, <<Control>>, or<<Boundary>> stereotype.

You create these stereotypes in the Profile category of the extended modeldefinition attached to your model.

234

Page 241: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

v To create object stereotypes

1. Select Model ä Extended Model Definition and double-click the arrowbeside Robustness Extension in the list to display the resource editor.

2. Right-click the Profile category and select Add Metaclasses.

The Metaclass Selection dialog box is displayed.

3. Select UMLObject in the list of metaclasses displayed in the PdOOM taband click OK.

The UMLObject category is displayed under Profile.

4. Right-click the UMLObject category and select New ä Stereotype.

A new stereotype is created under the UMLObject category.

5. Type Boundary in the Name box.

6. Select the Palette Custom Tool check box.

7. Click the Browse tool and select file boundary.cur in folder\Examples\Tutorial.

8. Repeat steps 4 to 7 to create the following stereotypes and tools:

Stereotype Cursor file

Entity entity.cur

Control control.cur

You should see the 3 stereotypes under the UMLObject metaclasscategory.

235

Page 242: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

9. Click OK.

10. Click Yes to save the extended model definition.

The tool palette with the stereotype tools is displayed in the diagram.

11. Move the List of Extended Model Definitions to the bottom of the screen.

12. Click one of the tools and click in the communication diagram.

An object with the predefined stereotype is created:

13. Right-click to release the tool.

Define custom symbols for stereotypes

You are going to define a custom symbol for UMLObjects related to theBoundary, Control, or Entity stereotypes. The Custom Symbol feature letsyou apply the standard robustness graphics into your communicationdiagram.

236

Page 243: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

v To define custom stereotypes for stereotypes

1. Double-click the arrow beside Robustness Extension in the list ofextended model definitions to display the resource editor.

2. Right-click stereotype Boundary in the UMLObject category and selectNew ä Custom Symbol.

A custom symbol is created.

3. Click the Modify button.

The Symbol Format dialog box is displayed.

4. Click the Custom Shape tab.

5. Select the Enable Custom Shape check box.

6. Select Predefined Symbol in the Shape Type list.

7. Select Boundary Object in the Shape Name list.

8. Click OK.

The custom symbol is displayed in the Preview box.

237

Page 244: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

9. Repeat steps 2 to 8 for the following stereotypes:

Stereotype Shape Name

Entity Entity Object

Control Control Object

10. Click OK in each of the dialog boxes.

The symbol of the object you had previously created changes accordingto its stereotype:

238

Page 245: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

11. In the communication diagram, create an object corresponding to eachstereotype.

Your diagram now contains 3 objects with different symbolscorresponding to different stereotypes.

12. Select Model ä Objects to display the list of objects.

13. Click the Customize Columns and Filter tool in the list toolbar and selectStereotype in the list of columns.

The object stereotypes appear in the list. You are going to define thename and code of each object based on their stereotype.

Object Stereotype Name & Code

Object_1<<Boundary>>

Internet Browser

Object_2 <<Control>> Application Server

Object_3 <<Entity>> Database Server

239

Page 246: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

14. Click OK in the List of Objects.

15. Drag the actor Customer from the Browser to the communicationdiagram in order to create a symbol for Customer.

Create instance links and messages between objects

You are going to create instance links between objects to express thecollaboration between objects:

Source Destination

Customer Internet Browser

Internet Browser Application Server

Application Server Database Server

For more information on how to create instance links in the communicationdiagram, see “Creating an instance link in a communication diagram” in the“Building Dynamic Diagrams” chapter in the OOM User’s Guide .

You then define messages on the different instance links to express the datacarried by the links.

For more information on how to create messages on instance links in thecommunication diagram, see “Creating a message in a communicationdiagram” in the “Building Dynamic Diagrams” chapter in the OOM User’sGuide .

+ You are going to create the following messages:

240

Page 247: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Direction Message name Sequencenumber

Customer - Internet Browser Stock value query 1

Internet Browser - ApplicationServer

Ask value to app server 2

Application Server - DatabaseServer

Ask value to db 3

Database Server - ApplicationServer

Return value from db 4

Application Server - InternetBrowser

Return value from appserver

5

Internet Browser - Customer Return value 6

Create custom checks on instance links

The robustness analysis implies some behavioral rules between objects. Forexample, an actor should always communicate with a boundary object (an

241

Page 248: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

interface), entity objects should always communicate with control objects,and so on. To represent these constraints, you are going to define customchecks on the instance links.

Custom checks do not prevent users from performing a syntacticallyerroneous action, but they allow you to define rules that will be verified bythe Check Model function.

You define custom checks with VB scripting.

+ For more information on VBS syntax, see the Scripting User’s Guide .

v To create custom checks on instance links

1. Double-click the arrow beside Robustness Extension in the List ofExtended Model Definitions to display the resource editor.

2. Right-click the Profile category and select Add Metaclass.

The Metaclass Selection dialog box is displayed.

3. Select InstanceLink in the list of metaclasses displayed in the PdOOMtab and click OK.

The InstanceLink category is displayed under Profile.

4. Right-click the InstanceLink category and select New ä Custom Check.

A new check is created.

5. Type Incorrect Actor Collaboration in the Name box.

This check verifies if actors are linked to boundary objects. Linkingactors to control or entity objects is not allowed in the robustness analysis.

6. Type “This check ensures that actors only communicate with boundaryobjects.” in the Help Message box.

This text is displayed in the message box that is displayed when the userselects Help in the custom check context menu in the Check ModelParameters dialog box.

7. Type “ The following instance links are incorrect:” in the OutputMessage box.

8. Select Error as default severity.

9. Select the Execute the Check by Default check box.

242

Page 249: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

10. Click the Check Script tab.

The Check Script tab is the tab where you type the script for theadditional check.

11. Type the following script in the text zone.

243

Page 250: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

Function %Check%(link)’ Default return is True%Check% = True’ The object must be an instance linkIf link is Nothing or not link.IsKindOf(PdOOM.cls_

InstanceLink) thenExit Function

End If’ Retrieve the link extremitiesDim src, dstSet src = link.ObjectASet dst = link.ObjectB’ Source is an Actor’ Call CompareObjectKind() global function defined in

Global Script paneIf CompareObjectKind(src, PdOOM.Cls_Actor) Then

’ Check if destination is an UML Object with"Boundary" Stereotype

If not CompareStereotype(dst, PdOOM.Cls_UMLObject,"Boundary") Then%Check% = False

End IfElsif CompareObjectKind(dst, PdOOM.Cls_Actor) Then

’ Check if source is an UML Object with "Boundary"Stereotype

If not CompareStereotype(src, PdOOM.Cls_UMLObject,"Boundary") Then%Check% = False

End IfEnd If

End Function

12. Click the Global Script tab.

The Global Script tab is the tab where you store functions and staticattributes that may be reused among different functions.

13. Type the following script in the text zone.

244

Page 251: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

’ This global function check if an object is of given kind’ or is a shortcut of an object of given kindFunction CompareObjectKind(Obj, Kind)

’ Default return is falseCompareObjectKind = False

’ Check objectIf Obj is Nothing Then

Exit FunctionEnd If

’ Shortcut specific case, ask to its target objectIf Obj.IsShortcut() Then

CompareObjectKind =CompareObjectKind(Obj.TargetObject)

Exit FunctionEnd If

If Obj.IsKindOf(Kind) Then’ Correct object kindCompareObjectKind = True

End IfEnd Function’ This global function check if an object is of given kind’ and compare its stereotype valueFunction CompareStereotype(Obj, Kind, Value)

’ Default return is falseCompareStereotype = False’ Check objectIf Obj is Nothing or not Obj.HasAttribute("Stereotype")

ThenExit Function

End If’ Shortcut specific case, ask to its target object

If Obj.IsShortcut() ThenCompareStereotype =

CompareStereotype(Obj.TargetObject)Exit Function

End IfIf Obj.IsKindOf(Kind) Then

’ Correct object kindIf Obj.Stereotype = Value Then

’ Correct Stereotype valueCompareStereotype = True

End IfEnd If

End Function

14. Click Apply.

You are going to repeat steps 4 to 14 and create one check to verify thatan instance link is not defined between two boundary objects:

245

Page 252: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

Check definition Content

Name Incorrect Boundary to BoundaryLink

Help Message This check ensures that an instancelink is not defined between twoboundary objects

Output Message The following links between bound-ary objects are incorrect:

Default Severity Error

Execute the check by default Selected

15. Type the following check in the Check Script tab:

Function %Check%(link)

’ Default return is True%Check% = True

’ The object must be an instance linkIf link is Nothing or not

link.IsKindOf(PdOOM.cls_InstanceLink) thenExit Function

End If

’ Retrieve the link extremitiesDim src, dstSet src = link.ObjectASet dst = link.ObjectB

’ Error if both extremities are ’Boundary’ objectsIf CompareStereotype(src, PdOOM.Cls_UMLObject,

"Boundary") ThenIf CompareStereotype(dst, PdOOM.Cls_UMLObject,

"Boundary") Then%Check% = False

End IfEnd If

End Function

16. Repeat steps 4 to 14 and create one check to verify that entity objects areaccessed only from control objects:

246

Page 253: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

Check definition Content

Name Incorrect Entity Access

Help Message This check ensures that entity ob-jects are accessed only from controlobjects

Output Message The following links are incorrect:

Default Severity Error

Execute the check by default Selected

17. Type the following check in the Check Script tab:

Function %Check%(link)’ Default return is True%Check% = True’ The object must be an instance linkIf link is Nothing or not link.IsKindOf(PdOOM.cls_

InstanceLink) thenExit Function

End If’ Retrieve the link extremitiesDim src, dstSet src = link.ObjectASet dst = link.ObjectB’ Source is and UML Object with "Entity" stereotype?’ Call CompareStereotype() global function defined in

Global Script paneIf CompareStereotype(src, PdOOM.Cls_UMLObject, "Entity")

Then’ Check if destination is an UML Object with"Control" Stereotype

If not CompareStereotype(dst, PdOOM.Cls_UMLObject,"Control") Then%Check% = False

End IfElsif CompareStereotype(dst, PdOOM.Cls_UMLObject,

"Entity") Then’ Check if source is an UML Object with "Control"Stereotype

If not CompareStereotype(src, PdOOM.Cls_UMLObject,"Control") Then%Check% = False

End IfEnd If

End Function

18. Click Apply.

247

Page 254: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

19. Click OK in the resource editor.

20. Select Tools ä Check Model to display the Check Model Parametersdialog box.

The custom checks appear in the Instance Link category.

You can test the checks by creating instance links between Customer andApplication server for example, and then press F4 to start the checkmodel feature.

248

Page 255: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

+ For more information on the Check Model feature, see sections onchecking a model in the different user’s guides.

Generate a textual description of messages

You are going to generate a textual description of the messages existing inthe communication diagram. The description should provide for eachdiagram in the model, the name of the message sender, the name of themessage and the name of the receiver.

You generate this description using templates and generated files, because bydefault PowerDesigner does not provide such a feature. Templates andgenerated files use the PowerDesigner Generation Template Language(GTL). Generated files evaluate templates defined on metaclasses and outputthe evaluation result in files.

+ For more information on GTL, see the “Generation Reference Guide”chapter.

What template to defineand where?

To generate a textual description of the communication diagram message,you have to define templates on the following metaclasses:

♦ Message: this metaclass contains details about the message sequencenumber and the message name, sender and receiver, this is why youdefine a template to evaluate the message sequence number anddescription in this metaclass

♦ CommunicationDiagram: you define in this metaclass the templatesthat will sort the messages in the diagram and gather all messagedescriptions from the current diagram

+ For more information on the PowerDesigner metaclasses, see the“Resource Files and the Public Metamodel” chapter.

The generated file is defined on metaclass BasePackage in order to scan theentire model, that is to say the model itself and the packages it may contain.This is to make sure that all messages in the model and its packages aredescribed in the generated file. There will be one generated file sincemetaclass BasePackage has only one instance.

Defining a template for generation

A generated file uses templates defined in metaclasses. The first templateyou have to define is on messages. The role of this template is to evaluate themessage sequence number and to provide the name of the sender, the nameof the message, and the name of the receiver for each message in thediagram.

249

Page 256: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

The syntax for defining this template is the following:

.set_value(_tabs, "", new)

.foreach_part(%SequenceNumber%, ’.’)

.set_value(_tabs, " %_tabs%")

.next%_tabs%%SequenceNumber%) %Sender.ShortDescription% sends message

"%Name%" to %Receiver.ShortDescription%

The first part of the template aims at creating indentation according to thesequence number of the message. The macro foreach_parts loops on thesequence numbers:

.foreach_part(%SequenceNumber%, ’.’)

.set_value(_tabs, " %_tabs%")

It browses each sequence number, and whenever a dot is found, it adds 3empty spaces automatically for indentation. This calculates the _tabvariable, which is later used to create the correct indentation based on thesequence numbering.

The last line contains the actual generated text of the template: for eachsequence number, the appropriate tab value is created, followed by the nameof the sender (short description), the text “sends message”, then the name ofthe message, the text “to”, and the name of the receiver.

v To define a template used for generation

1. Select Model ä Extended Model Definition and double-click the arrowbeside Robustness Extension in the List of Extended Model Definitionsto display the resource editor.

2. Right-click the Profile category and select Add Metaclasses.

The Metaclass Selection dialog box is displayed.

3. Select Message in the list of metaclasses displayed in the PdOOM taband click OK.

The Message category is displayed under Profile.

4. Right-click the Message category and select New ä Template.

A new template is created.

5. Type description in the Name box of the template

6. (optional) Type a comment in the Comment box of the template.

7. Type the following code in the text area:

250

Page 257: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

.set_value(_tabs, "", new)

.foreach_part(%SequenceNumber%, ’.’).if (%Separator% == ".")

.set_value(_tabs, " "%_tabs%).endif

.next%_tabs%%SequenceNumber%) %Sender.ShortDescription% sends

message "%Name%" to %Receiver.ShortDescription%

8. Click Apply.

Defining the templates for the communication diagram metaclass

Once you have defined the template used to evaluate each message sequencenumber, you have to create a template to sort these sequence numbers(compareCbMsgSymbols), and another template to retrieve all messagesfrom the communication diagram (description).

The template compareCbMsgSymbols is a boolean that allows verifying ifa message number is greater than another message number. The syntax ofthis template is the following:

.bool (%Item1.Object.SequenceNumber% >=%Item2.Object.SequenceNumber%)

The returned value for this template is used with parameter compare intemplate description which code is the following:

Communication Scenario %Name%:\n.foreach_item(Symbols,,, %ObjectType% ==

CommunicationMessageSymbol, %compareCbMsgSymbols%)%Object.description%

.next(\n)

251

Page 258: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

In this template, the first line is used to generate the title of the scenariousing the name of the communication diagram %Name%. Then it creates anew line.

Then the macro for each item loops on each message symbol, verifies andsorts the message number, and outputs the message description using thesyntax defined in previous section.

v To define templates for the communication diagram metaclass

1. Right-click the Profile category and select Add Metaclasses.

The Metaclass Selection dialog box is displayed.

2. Click the Modify Metaclass Filter tool and select Show All Metaclasses.

3. Select CommunicationDiagram in the list of metaclasses displayed in thePdOOM tab and click OK.

The CommunicationDiagram category is displayed under Profile.

4. Right-click the CommunicationDiagram category and select New ä

Template.

A new template is created.

5. Type compareCbMsgSymbols in the Name box of the template

6. (optional) Type a comment in the Comment box of the template.

7. Type the following code in the text area:

.bool (%Item1.Object.SequenceNumber% >=%Item2.Object.SequenceNumber%)

8. Click Apply.

9. Right-click the CommunicationDiagram category and select New ä

Template.

A new template is created.

10. Type description in the Name box of the template

11. (optional) Type a comment in the Comment box of the template.

12. Type the following code in the text area:

Communication Scenario %Name%:\n.foreach_item(Symbols,,, %ObjectType% ==

CommunicationMessageSymbol, %compareCbMsgSymbols%)%Object.description%

.next(\n)

252

Page 259: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

13. Click Apply.

Defining a generated file

You are going to define the generated file in order to list the messages ofeach communication diagram existing in your model. To do so, you have todefine the generated file in the BasePackage metaclass. This metaclass is thecommon class for all packages and models, it owns objects, diagrams andother packages.

The generated file will contain the result of the evaluation of the templatedescription defined on the CommunicationDiagram metaclass. The codeof the generated file also contains a foreach_item macro in order to loop onthe different communication diagrams of the model.

v To define a generated file

1. Right-click the Profile category and select Add Metaclasses.

The Metaclass Selection dialog box is displayed.

2. Click the Modify Metaclass Filter tool, select Show Abstract ModelingMetaclasses, and click the PdCommon tab.

3. Select BasePackage in the list of metaclasses and click OK.

The BasePackage category is displayed under Profile.

4. Right-click the BasePackage category and select New ä Generated File.

A new generated file is created.

253

Page 260: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Using Profiles: a Case Study

5. Type Communications Textual Descriptions in the Name box.

This name is used in the resource editor.

6. Type %Name% Communication Description.txt in the File Name box.

This is the name of the file that will be generated. It will be a .txt file, andit will contain the name of the current model thanks to variable %Name%.

7. Keep the Encoding value to ANSI.

8. (optional) Type a comment in the Comment box.

9. Deselect the check box Use Package Hierarchy as file path because youdo not need the hierarchy of files to be generated.

10. Type the following code in the text box:

.foreach_item(CommunicationDiagrams)%description%

.next(\n\n)

11. Click OK and accept to save the extended model definition.

12. Click OK to close the List of Extended Model Definitions.

Preview the textual description of the communication diagram

Since the generated file is defined in the metaclass BasePackage, you canpreview the generated text in the Preview tab of the model property sheet.This also allows you to verify that the syntax of the templates and the outputcorrespond to what you want to generate.

254

Page 261: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 3. Managing Profiles

v To preview the textual description of the communication diagram

1. Right-click the communication diagram background and selectProperties.

The model property sheet is displayed.

2. Click the Preview tab to display the Preview tab.

The Preview tab displays the content of the file to generate.

3. Click OK.

255

Page 262: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development
Page 263: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

CHAPTER 4

Object Languages Reference Guide

About this chapter This document describes the structure and contents of .xol object languageresource files, which define the particularities of each object languagesupported in the PowerDesigner OOM.

Before you begin You should never modify an object language shipped with PowerDesigner.Always create new object languages from the original files. The objectlanguage is saved in a file with the XOL extension.

Modifications to an object language can change the way PowerDesignerfunctions, especially when generating objects. You should ensure that youthoroughly test generated objects.

+ For more information on creating a new object language that is a copy ofan existing object language, see section Creating a new resource file, inchapter The Resource Editor in the General Features Guide .

Contents Topic: page

Introduction to Object Language Resource Files 258

Object Language Resource File Properties 259

257

Page 264: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Introduction to Object Language Resource Files

Introduction to Object Language Resource FilesObject language (.xol) resource files extend the PowerDesigner metamodelto model the specific features of a particular object-oriented language. Aseparate .xol file is supplied for each language supported by the OOM.

The resource file defines the syntax and guidelines for generating objectsand implementing stereotypes, data types, scripts and constants for theobject language. You select the relevant resource file automatically whenyou create a new OOM.

v To open a .xol file in the Resource Editor

1. From an OOM, select Language ä Edit Current Object Language.

or

Select Tools ä Resources ä Object Languages to display the List ofObject Languages and double-click an entry in the list.

CautionYou should not modify the original .xol files shipped with PowerDesigner.To create a copy of an .xol file, select Tools ä Resources ä ObjectLanguages, click the New tool, enter a name, select the .xol to copy fromthe list, and click OK and then Save.

+ For general information about editing resource files, see the “ResourceFiles and the Public Metamodel” chapter.

258

Page 265: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 4. Object Languages Reference Guide

Object Language Resource File PropertiesAll object languages have the same basic category structure, but the detailand values of entries differs for each language. The root node of each filecontains the following properties:

Property Description

Name Specifies the name of the object language.

Code Specifies the code of the object language.

File Name [read-only] Specifies the path to the .xol file. If the objectlanguage is a copy, this field is empty.

Family Enables certain non-default features in the model. Forexample, object languages of the Java, XML, IDL andPowerBuilder families support reverse engineering.

Subfamily Fine-tunes the features for a given family. For example, in theJava family, the J2EE subfamily supports EJBs, servlets andJSPs.

Enable TraceMode

Lets you preview the templates used during generation.Before starting the generation, click the Preview page ofthe relevant object, and hit the Refresh tool to display thesetemplates.

When you double-click on a trace line from the Preview page,the Resource Editor opens to the corresponding templatedefinition in the Profile\Object\Templates category. The codeof the template may be colored (see Syntactic coloring insection “Generated Files category” on page 265).

Comment Specifies additional information about the object language.

The following sections describe the main categories and entries available in.xol files:

Settings category

The Settings category contains data types, constants, namings, and eventscategories used to customize and manage OOM generation features:

♦ Data Types - Tables for mapping internal data types with object languagedata types. The following data types values are defined by default:• BasicDataTypes – lists the most commonly-used data types. The

259

Page 266: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Object Language Resource File Properties

Value column indicates the conceptual data type used for CDM andPDM model generations.

• ConceptualDataTypes – lists internal PowerDesigner data types. TheValue column indicates the object language data type used for CDMand PDM model generations.

• AdditionalDataTypes – lists additional data types added to data typelists. Can be used to add or change data types of your own. The Valuecolumn indicates the conceptual data type used for CDM and PDMmodel generations.

• DefaultDataType – specifies the default data type.

♦ Constants - contains mapping between the following constants and theirdefault values: Null, True, False, Void, Bool.

♦ Namings - contains parameters that influence what will be included inthe files that you generate from an OOM:• GetterName - Name and value for getter operations

• GetterCode - Code and value for getter operations

• SetterName - Name and value for setter operations

• SetterCode - Code and value for setter operations

• IllegalChar - lists illegal characters for the object language. This listpopulates the Invalid characters field on the Model Options ä NamingConvention tab. For example, "/!=<>""’()"

♦ Events - defines standard events on operations. This category maycontain default existing events such as constructors and destructors,

260

Page 267: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 4. Object Languages Reference Guide

depending on the object language. An event is linked to an operation, andthe contents of the Events category is displayed in the Event list inoperation property sheets to describe the events that can be used by anoperation. In PowerBuilder for example, the Events category is used toassociate operations with PowerBuilder events.

Generation category

The Generation category contains categories and entries to define andactivate a generation process:

♦ Commands - contains generation commands, which can be executed atthe end of the generation process, after the generation of all files.Commands are written in GTL (see the “Generation Reference Guide”chapter), and must be included within tasks (see below) to be evoked.

♦ Options – contains options, available on the Options tab of theGeneration dialog box, the values of which can be tested by generationtemplates or commands. You can create options that take boolean, string,or list values. The value of an option may be accessed in a template usingthe following syntax:

’%’ ’GenOptions.’<option-name> ’%’

For example, for a boolean option named GenerateComment,%GenOptions.GenerateComment% will evaluate to either true or false in atemplate, depending on the value specified in the Generation dialog Optionstab.

♦ Tasks – contains tasks, available on the Tasks tab of the Generationdialog box, and which contain lists of generation commands (see above).When a task is selected in the Tasks tab, the commands included in thetask are retrieved and their templates evaluated and executed.

Example: Adding a generation command and task

In this example, we will add a generation command and associated task to

261

Page 268: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Object Language Resource File Properties

the Java object language

1. Create a new OOM for Java, and then select Language ä Edit CurrentObject Language to open the Java resource file.

2. Expand the Generation category, and then right-click the Commandscategory and select New in the contextual menu to create a newcommand.

3. Name the command DoCommand and enter an appropriate template:

4. Right-click the Tasks category and select New from the contextual menu,to create a new task. Name the task Execute, click the Add Commandstool, select DoCommand from the list and then click OK to add it to thenew task:

262

Page 269: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 4. Object Languages Reference Guide

5. Click OK to save your changes and return to the model. Then selectGenerate Java code to open the Generation dialog, and click the Taskstab. The new task is listed on the tab under its comment (or its name, ifno comment has been provided):

Example 2: Adding a generation option

In this example, we will add a generation option to the Java object language.

263

Page 270: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Object Language Resource File Properties

1. Select Language ä Edit Current Object Language to open the Javaresource file.

2. Expand the Generation category, and then right-click the Optionscategory and select New in the contextual menu to create a new option:

3. Click OK to save your changes and return to the model. Then selectGenerate Java code to open the Generation dialog, and click the Optionstab. The new option is listed on the tab under its comment (or its name, ifno comment has been provided):

264

Page 271: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 4. Object Languages Reference Guide

Generation Reference GuideThe PowerDesigner generation process is defined in this manual in theGeneration Reference Guide chapter. It is strongly advised that you firstread this chapter in order to get familiar with the concepts and features ofthe generation process.

Profile category

Each metaclass in the profile has a category identified by its name that maycontain several categories like Stereotypes, Extended attributes, Methodsand so on.

+ For more information on the Profile category, see the “ManagingProfiles” chapter.

+ In this section, we shall observe in more details the Generated Files andTemplate categories of the profile.

Generated Files category

Some objects in the Profile category include a Generated Files entry thatcontains file entries. These entries define the files that will be generated for agiven metaclass or for the instances of a metaclass with a selected stereotypeor criterion.

265

Page 272: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Object Language Resource File Properties

Example The Generated Files category for file objects in Java contains theEmbeddedArtifact entry that applies to all embedded files of type Artifact tobe generated. The EmbeddedArtifact entry contains the File name box thatcontains the template for the name of the file to be generated.

At the bottom, it contains a text zone that displays the code of the templateof the file to generate.

+ For more information on the Generated Files entry, see section Definingtemplates and generated files in a profile, in chapter Managing profiles.

Encoding + You can define the format for generated files in the Encoding box foreach file you generate. A default encoding format is provided to you, butyou can also click the Ellipsis button beside the Encoding box to change it.This opens the Text Output Encoding Format dialog box in which you canselect the encoding format of your choice.

+ This dialog box includes the following properties:

Property Description

Encoding Encoding format of the generated file

Abort on characterloss

Allows you to stop generation if characters cannot beidentified and are to be lost in current encoding

Syntactic coloring If the File Name box in the Generated Files entry is empty, there is no filegenerated. However, it can be very useful to leave this column empty so asto preview the content of the file before generation. You can use the Preview

266

Page 273: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 4. Object Languages Reference Guide

page of the corresponding object at any time for this purpose.

During generation, the template in File Name is evaluated and if one of thefollowing extensions is found, the code is displayed with the correspondinglanguage editor and syntactic coloring (example: .cs for C++):

Extension Syntactic coloring

.java Java

.c, .h C

.sru PowerBuilder

.html HTML

.xml, .xsd, .dtd, .xmi, .jsp, .wsdl, .asp, .aspx,

.asmxXML

.cpp, .hpp CPP

.cs C++

.cls, .vb Visual Basic 6

.vbs VB Script

.sql SQL

.idl CORBA

.txt Default text editor

There are two possible scenarii during generation:

♦ A file is generated

♦ No file is generated

File generated The mechanism of file generation is the following for each object having aGenerated Files entry that is not empty:

267

Page 274: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Object Language Resource File Properties

A file is generated when the File name box contains the name of the file orthe template for the name of the file to generate. You can type the name ofthe file to generate as follows:

♦ file_name.extension (for example, ejb-jar.xml)

♦ %extensionfile_name% (for example, %asmxFileName%)

In this example, a file called ejb-jar.xml located in the META-INF folder isgenerated.

No file generated In this example, there is no file generated since the File name box starts witha . (dot) character. The contents of the file is only available in the Previewpage of the component (EJB - Entity Bean) property sheet.

268

Page 275: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 4. Object Languages Reference Guide

Templates category

Templates are used to define what to generate for the current object.

+ For more information about the Templates category, see “Templates andGenerated Files” in the “Managing Profiles” chapter. For detailedinformation about writing templates, see the “Generation Reference Guide”chapter.

Use the F12 key to find templates You can find all templates of the samename using the F12 key. To do so, open a template, position the cursor ona template name in-between % characters, and hit the F12 key. This opensa Browse window that displays all templates prefixed by their metaclassname. Example: position the cursor on %definition% inside a template, hitF12. The Browse window displays all <metaclass_name>::definition. Youcan then double-click the template of your choice in the Browse window todirectly position the cursor on the selected template

+ In the following example, the Generated Files category for classifierscontains a ‘Java Source’ entry. This entry contains the template named%source% in the text zone.

269

Page 276: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Object Language Resource File Properties

When you open the Templates category for classifiers, the template named‘source’ is displayed. When the file is generated for a given classifier or forthe instances of a classifier with a selected stereotype or criterion, thetemplate evaluated is the ‘source’ template. The name of the file generatedcorresponds to the entry in the File name box.

270

Page 277: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 4. Object Languages Reference Guide

Association roles You can define implementation collections for associations. The evaluatedassociation attributes are: RoleName, Visibility, Multiplicity,Implementation (RoleAContainer or RoleBContainer),ImplementationClass, Ordering, Navigability, Changeability, Initial Value,Persistent, Volatile, Minimum Multiplicity, Maximum Multiplicity,Classifier (ClassA or ClassB). You have to set the active role of theassociation using attributes RoleAActive or RoleBActive. When youreference RoleAActive for example, then role A of association becomesactive and the implementation script can return attributes corresponding torole A.

Shared/Extended Attribute Types category

This section contains various attributes used to control object languagesupport within PowerDesigner.

Default AssociationContainer

Specifies the default container for implementing associations. This attributehas an editable list of possible values for each object language. You canselect here a default value for your language and, if necessary, override thisdefault using the “Default association container” model option.

271

Page 278: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development
Page 279: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

CHAPTER 5

Process Languages Reference Guide

About this chapter This document describes the structure and contents of .xpl process languageresource files, which define the particularities of each process languagesupported in the PowerDesigner BPM.

Before you begin You should never modify a process language shipped with PowerDesigner.Always create new process languages from the original files. The processlanguage is saved in a file with the .XPL extension.

Modifications to a process language can change the way PowerDesignerfunctions, especially when generating objects. You should ensure that youthoroughly test generated objects.

+ For more information on creating a new process language that is a copyof an existing process language, see section Creating a new resource file, inchapter The Resource Editor in the General Features Guide .

Contents Topic: page

Introduction to Process Language Resource Files 274

Process Language Resource File Properties 275

273

Page 280: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Introduction to Process Language Resource Files

Introduction to Process Language Resource FilesProcess language (.xpl) resource files extend the PowerDesigner metamodelto model the specific features of a particular process language. A separate.xpl file is supplied for each language supported by the BPM.

The resource file defines the syntax and guidelines for generating objectsand implementing stereotypes, data types, scripts and constants for theprocess language. You select the relevant resource file automatically whenyou create a new BPM.

v To open a .xpl file in the Resource Editor

1. From a BPM, select Language ä Edit Current Process Language.

or

Select Tools ä Resources ä Process Languages to display the List ofProcess Languages and double-click an entry in the list.

CautionYou should not modify the original .xpl files shipped with PowerDesigner.To create a copy of an .xpl file, select Tools ä Resources ä ProcessLanguages, click the New tool, enter a name, select the .xpl to copy fromthe list, and click OK and then Save.

+ For general information about editing resource files, see the “ResourceFiles and the Public Metamodel” chapter.

274

Page 281: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 5. Process Languages Reference Guide

Process Language Resource File PropertiesAll process languages have the same basic category structure, but the detailand values of entries differs for each language. The root node of each filecontains the following properties:

Property Description

Name Specifies the name of the process language.

Code Specifies the code of the process language.

File Name [read-only] Specifies the path to the .xpl file. If the processlanguage is a copy, this field is empty.

Family Enables certain non-default features in the model. For exam-ple, process languages of the Service Orchestration familyare SOA, BPEL4WS, and Sybase Integration Orchestrator.

Subfamily Fine-tunes the features for a given family.

Enable TraceMode

Lets you preview the templates used during generation.Before starting the generation, click the Preview page ofthe relevant object, and hit the Refresh tool to display thesetemplates.

When you double-click on a trace line from the Preview page,the Resource Editor opens to the corresponding templatedefinition in the Profile\Object\Templates category. The codeof the template may be colored (see the “Object LanguagesReference Guide” chapter for details).

Comment Specifies additional information about the object language.

Generation category

The Generation category contains categories and entries to define andactivate a generation process. You can use the following categories:

♦ Generation commands

♦ Generation tasks

♦ Generation options

For more information about these categories, see the “Object LanguagesReference Guide” chapter.

275

Page 282: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Process Language Resource File Properties

Settings category

The Settings category contains items to customize and manage BPMgeneration features:

♦ Implementation – [executable BPM only] Gathers options that influencethe process implementation possibilities. The following constants aredefined by default:• LoopTypeList - This list defines the type of loop supported by the

language. The value must be an integer

• OperationTypeList - This list defines the type of operation supportedby the language. An unsupported operation type cannot be associatedwith a process. The value must be an integer

• EnableEmissionCorrelation - enables the definition of a correlationfor an emitted message

• EnableProcessReuse - allows a process to be implemented by anotherprocess

• AutomaticInvokeMode - indicates if the action type of a processimplemented by an operation can be automatically deducted from theoperation type. You can specify:

♦ 0 (default) - the action type cannot be deduced and must be specified♦ 1 - the language enforces a Request-Response and a One-Way

operation to be received by the process and a Solicit-Response and aNotification operation to be invoked by the process

♦ 2 the language ensures that a Solicit-Response and a Notificationoperation are always received by the process whileRequest-Response and One-Way operations are always invoked bythe process

276

Page 283: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 5. Process Languages Reference Guide

♦ DataHandling - [executable BPM only] Gathers options for managingdata in the language. The following constant values are defined bydefault:• EnableMessageOnFlow - indicates if a message format can be

associated to a flow or not. The default value is Yes

• EnableMessageVariable - enables a variable object to store the wholecontent of a message format. In this case, the message format objectswill appear in the data type combo box of the variable

♦ Choreography - Gathers objects that allow the design of the graph ofactivities (start, end, decision, synchronization, transition. . . ) Containsthe following constant values defined by default:• EnableMultipleStarts - When set to No, ensures that no more than

one start is defined under a composite process

• EnableTopLevelChoreography - When set to No, ensures that noflow or choreography object (start, end, decision. . . ) is defined directlyunder the model or a package. These objects can be defined only undera composite process

277

Page 284: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development
Page 285: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

CHAPTER 6

XML Languages Reference Guide

About this document This document describes the structure and contents of .xsl XML languageresource files, which define the particularities of each XML languagesupported in the PowerDesigner XSM.

Before you begin You should never modify an XML language shipped with PowerDesigner.Always create new XML languages from the original files. The XMLlanguage is saved in a file with the .XSL extension.

Modifications to an XML language can change the way PowerDesignerfunctions, especially when generating objects. You should ensure that youthoroughly test generated objects.

+ For more information on creating a new XML language that is a copy ofan existing XML language, see section Creating a new resource file, inchapter The Resource Editor in the General Features Guide .

Contents Topic: page

Introduction to XML Language Resource Files 280

XML Language Resource File Properties 281

279

Page 286: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Introduction to XML Language Resource Files

Introduction to XML Language Resource FilesXML language (.xsl) resource files extend the PowerDesigner metamodel tomodel the specific features of a particular XML language. A separate .xslfile is supplied for each language supported by the XSM.

The resource file defines the syntax and guidelines for generating XML files.You select the relevant resource file automatically when you create a newXSM.

v To open a .xsl file in the Resource Editor

1. From an XSM, select Language ä Edit Current Language.

or

Select Tools ä Resources ä XML Languages to display the List of XMLLanguages and double-click an entry in the list.

CautionYou should not modify the original .xsl files shipped with PowerDesigner.To create a copy of an .xsl file, select Tools ä Resources ä XML Lan-guages, click the New tool, enter a name, select the .xsl to copy from thelist, and click OK and then Save.

+ For general information about editing resource files, see the “ResourceFiles and the Public Metamodel” chapter.

280

Page 287: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 6. XML Languages Reference Guide

XML Language Resource File PropertiesAll XML languages have the same basic category structure, but the detailand values of entries differs for each language. The root node of each filecontains the following properties:

Property Description

Name Specifies the name of the XML language.

Code Specifies the code of the XML language.

File Name [read-only] Specifies the path to the .xsl file. If the objectlanguage is a copy, this field is empty.

Family Enables non-default features in the model.

Subfamily Fine-tunes the features for a given family.

Enable TraceMode

Lets you preview the templates used during generation.Before starting the generation, click the Preview page ofthe relevant object, and hit the Refresh tool to display thesetemplates.

When you double-click on a trace line from the Preview page,the Resource Editor opens to the corresponding templatedefinition in the Profile\Object\Templates category.

Comment Specifies additional information about the object language.

The following sections describe the main categories and entries available in.xol files:

Settings category

The Settings category contains the Data types category that shows amapping of internal data types with XML language data types.

The following data types values are defined by default:

♦ ConceptualDataTypes - The Value column indicates the XML languagedata type used for model generations. Conceptual data types are theinternal data types of PowerDesigner, and cannot be modified

♦ XsmDataTypes- Data types for generations from the XML model

Generation category

The Generation category contains categories and entries to define and

281

Page 288: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

XML Language Resource File Properties

activate a generation process. You can use the following categories:

♦ Generation commands

♦ Generation tasks

♦ Generation options

These categories are further defined in the “Object Languages ReferenceGuide” chapter.

Generation Reference GuideThe PowerDesigner generation process is defined in this manual in chapterGeneration Reference Guide. It is strongly advised that you first readthis chapter in order to get familiar with the concepts and features of thegeneration process.

Profile and Transformation Profiles categories

The profile category can be used to extend the definitions and generationcapabilities of model objects. Transformations, which you can define as partof a profile, are collected in the Transformation Profiles category. For moreinformation about these categories, see the “Managing Profiles” chapter.

282

Page 289: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

CHAPTER 7

Extended Model Definitions ReferenceGuide

About this chapter This document describes the structure and contents of a PowerDesignerextended model definition. This guide is a reference for working with anyextended model definition.

Contents Topic: page

Managing Extended Model Definitions 284

Working with Extended Model Definitions 293

Generating for Extended Model Definitions 299

283

Page 290: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Extended Model Definitions

Managing Extended Model DefinitionsExtended model definitions provide means for customizing and extendingPowerDesigner metaclasses, parameters and generation.

Extended model definitions belong to the resource files category and areused to complement or further define standard PowerDesigner features. Ifyou need more information about resource files, see chapter The ResourceEditor in the General Features Guide .

CautionYou should never modify the extended model definitions shipped withPowerDesigner. For each original extended model definition you want tomodify, you should create a corresponding new extended model definition.To do so you have to create a new extended model definition from the Listof Extended Model Definitions, define a name and select the original filein the Copy From list. This allows you to create a new extended modeldefinition that is identical to the original file apart from the name.

+ For more information on creating a new extended model definition froman existing extended model definition, see section Creating a new resourcefile in chapter The Resource Editor in the General Features Guide .

What is an extendedmodel definition?

An extended model contains a profile definition and generation parameters.The profile is a set of metamodel extensions defined on metaclasses.

+ For more information on profiles, see chapter Managing Profiles.

The generation parameters are used to develop or complement the defaultPowerDesigner object generation or for separate generation.

Extended model definitions are typed like models in PowerDesigner. Youcreate an extended model definition for a specific type of model and youcannot share these files between heterogeneous models.

You can attach one or several extended model definitions to a model. Someextended model definitions are delivered with PowerDesigner, and you cancreate your own extensions. Extended model definitions are global to amodel, they cannot be attached to a particular package.

+ For more information on the generation of extended model definitions,see section “Generating for Extended Model Definitions” on page 299.

What is contained in anextended modeldefinition?

All extended model definitions have the same structure made up of a numberof categories. A category can contain other categories, entries, and values.These entries are parameters recognizable by PowerDesigner.

The values for extended model definition categories and entries vary for

284

Page 291: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

each extended model definition. Some entries may not exist in the extendedmodel definition file if they are not applicable to the particular extendedmodel definition.

How to use extendedmodel definitions?

You can create generic and specific extended model definitions.

♦ A generic extended model definition is a library of metamodel extension,and generation parameters. This file is stored in a central area and can bereferenced by models to guarantee data consistency and save time to theuser

♦ A specific extended model definition is embedded into a model anddevelops object definitions and generation parameters in this particularmodel

Creating an extended model definition

When you create a new extended model definition you can choose to:

♦ Create a generic extended model definition file to reuse between models

♦ Create a specific extended model definition for the needs of a given model

The creation procedure differs according to the type of extended modeldefinition you want to create.

Creating a generic extended model definition

You can create generic extended model definitions to share between modelsof the same type.

v To create a generic extended model definition

1. Open a model.

2. Select Tools ä Resources ä Extended Model Definitions ä Model type.

The List of Extended Model Definitions is displayed.

3. Click the New tool to display the New Extended Model Definitionwindow.

285

Page 292: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Extended Model Definitions

4. Type a name for the new extended model definition in the Name box.

5. <optional> Select a template from the Copy From list. This list displaysthe existing extended model definitions.

6. Click OK.

A standard Save As dialog box is displayed.

7. Type a name and select a directory for the new extended model definition.If you do not save the extended model definition in the PowerDesignerdefault directory, it does not appear in the List of Extended ModelDefinitions. You have to click the Path tool to browse to the directorywhere you saved the file.

8. Click Save.

The Extended Model Definition Properties dialog box is displayed. TheGeneral page displays categories in a tree view together with an editor onthe right side.

9. Define the extended model definition.

10. Click OK.

The extended model definition is saved in a file with the .XEM extension.

The List of Extended Model Definitions displays the new extended modeldefinition if you saved the file in the PowerDesigner default directory.

286

Page 293: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

11. Click Close.

Importing an extended model definition fileIf you want to integrate a generic extended model definition into amodel, you can import an extended model definition file.

+ For more information on importing extended model definitions, seesection “Importing an extended model definition into a model” onpage 291.

Creating a specific extended model definition for a model

You can create a specific extended model definition for a model, in this case,it has the same type as the current model.

v To create a specific extended model definition for a model

1. Open a model.

2. Select Model ä Extended Model Definitions.

The List of Extended Model Definitions is displayed.

3. Click the Add a Row tool to create a new extended model definition.

4. Click Apply.

5. Click the Properties tool to display the property sheet of the extendedmodel definition.

The Extended Model Definition Properties dialog box is displayed.

287

Page 294: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Extended Model Definitions

6. Define the extended model definition.

7. Click OK.

You return to the List of Extended Model Definitions.

8. Click OK.

Exporting an extended model definitionIf you want to share an extended model definition created for a modelwith other models, you can export this extended model definition inorder to reuse it with other models.

+ For more information on exporting extended model definitions, seesection “Exporting an extended model definition” on page 292.

Importing extended attributes from previous versions

You can import the extended attributes defined in a previous version into thecurrent version of PowerDesigner. The import process transfers mostextended attributes in a model or in an EXA file into an extended modeldefinition.

You can import extended attributes using one of the following methods:

♦ Open a model with extended attributes that was saved with a previousversion of PowerDesigner

♦ Open a file with the .EXA extension

288

Page 295: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

Importing model extended attributes from a previous version

When you open a model saved with a PowerDesigner version 5 or 6, and thismodel contains extended attributes, these are automatically imported into aspecific extended model definition embedded into the imported model.

If you open a model with PowerBuilder extended attributes, thePowerBuilder extended model definition is automatically attached to theimported model.

+ For more information on how to import PowerBuilder extendedattributes, see section Importing models with PowerBuilder extendedattributes from a previous version in chapter Working with Physical DataModels in the PDM User’s Guide .

v To import model extended attributes from a previous version

1. Open a model saved with a previous version of PowerDesigner.

2. Select Model ä Extended Model Definitions.

A new extended model definition is displayed in the list, with the defaultname Imported Attributes.

3. Double-click the new extended model definition to display its propertysheet.

You can expand the Extended Attributes category in the Profile\metaclasscategory and see the imported extended attributes.

289

Page 296: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Extended Model Definitions

Importing the extended attributes from a .EXA file

You can import an extended attribute file (with the .EXA extension) into ageneric extended model definition, available for all models of the same type.This feature allows you to recover the extended attributes defined in aprevious version of PowerDesigner.

v To import the extended attributes from a .EXA file

1. Select Tools ä Resources ä Extended Model Definitions ä Physical DataModel.

The List of Extended Model Definitions is displayed.

2. Click the Extended Attributes Import tool.

A standard Open dialog box is displayed.

3. Select an extended attribute file with the .EXA extension.

4. Click OK.

A standard Save As dialog box is displayed.

5. Select the name and path of the new extended model definition (with the.XEM extension) that will be created from the .EXA file.

6. Click OK.

The new extended model definition is displayed in the List of ExtendedModel Definitions.

290

Page 297: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

7. <optional> Double-click the new extended model definition to displayits property sheet.

Importing an extended model definition into a model

You can import a generic extended model definition file into your currentmodel. When you import an existing extended model definition, you reusethe profile and generation parameters defined in a library available on yourmachine.

When you import an extended model definition, you attach it to the model.You can choose one of the following import options:

Import option Description

Share: Use se-lected shared ex-tended model defi-nition

You use a shared version of the extended model defi-nition. This definition is shared by all models or evenall users in a design team. Any change in the extendedmodel definition properties applies to all models thatshare the extended model definition

Copy: Create acopy of the se-lected extendedmodel definition

You create a copy of the Extended model definitionin the model. You can modify this definition in yourmodel. Any change in the extended model definitionproperties applies only to the current model

Naming conventionsWhen you import an extended model definition and copy it into a model,the name and code of the extended model definition may be modified inorder to respect the naming conventions of the Other Objects category inthe Model Options dialog box.

v To import an extended model definition into a model

1. Select Model ä Extended Model Definitions.

The List of Extended Model Definitions is displayed.

2. Click the Import an Extended Model Definition tool.

The Extended Model Definitions Selection dialog box is displayed.

3. Use the Path tool to select the directory where the extended modeldefinition files are stored.

4. Select the Share or Copy radio button.

291

Page 298: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Managing Extended Model Definitions

5. Click OK

The imported extended model definition file is displayed in the List ofExtended Model Definitions of the model.

Exporting an extended model definition

You can export an extended model definition created in a model if you wishto share this definition with other models. Export allows you to create a filewith the .XEM extension that will be stored into your extended modeldefinition library directory. When you export an extended model definition,the specific extended model definition remains embedded in the model.

An extended model definition created in a model does not appear in the Listof Extended Model Definitions. Whereas an exported extended modeldefinition is displayed in the List of Extended Model Definitions.

v To export an extended model definition into a model

1. Select Model ä Extended Model Definitions.

The List of Extended Model Definitions is displayed.

2. Select an extended model definition in the list.

3. Click the Export an Extended Model Definition tool.

A standard Save As dialog box is displayed.

4. Type a name and select a directory for the extended model definition.

5. Click Save.

The extended model definition is saved in a library directory where it canbe shared with other models.

292

Page 299: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

Working with Extended Model DefinitionsYou use extended model definitions to:

♦ Extend the PowerDesigner metamodel and develop the definition ofmetaclasses using profiles

♦ Complement the generation targets and commands of an objectlanguage

♦ Generate for an extended model definition

Extended modeldefinition editor

You can consult or modify an extended model definition using the extendedmodel definition editor.

The extended model definition editor lets you navigate through categoriesand entries. When you select a category in the extended model definitioneditor, the name, code, and related comment appear in the right side of thedialog box. When you select an entry in the extended model definitioneditor, the name, value, and related comment appear in the right side of thedialog box.

+ For more information on how to use the extended model definitioneditor, see chapter The Resource Editor in the General Features Guide .

An extended model definition contains the following main categories:

Category Description

Generation Is used to define and/or activate a generation

Profile Is used to define extensions for the PowerDesigner meta-classes in order to define stereotypes, criteria, extendedattributes, generated files, generation templates, customsymbols, and custom checks

These categories are further analyzed in the following sections of thischapter.

Extended model definition properties

An extended model definition has a property page available when you clickthe root node in the tree view. The following properties are defined:

Property Description

Name Name of the extended model definition. This name must beunique in a model for generic or specific extended modeldefinitions

293

Page 300: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Working with Extended Model Definitions

Property Description

Code Code of the extended model definition. This code must beunique in a model for generic or specific extended modeldefinitions

File Name Path and name of the extended model definition file. This boxis filled when the extended model definition is shared. If theextended model definition is a copy, the box is empty. Youcannot modify the content of this box

Family Used to classify an extended model definition. Family is de-signed to help establish a link between the object language ofan OOM and an extended model definition. When the objectlanguage family corresponds to the extended model definitionfamily, it suggests that the extended model definition may beused to complement the object language. For example, whenan extended model definition has the family JAVA, it impliesthat it is designed to work with the JAVA object language.This feature is available for the OOM only

Subfamily Used to refine the family. For example, EJB 2.0 is a sub-family of Java

Auto attach Used to link the extended model definition to the currentobject language. If the Auto attach check box is selected, thecorresponding extended model definition will be selected inthe Extended Model Definition page of the New model dialogbox

Category Used to group concurrent extended model definitions forgeneration. For example, a category called “Applicationservers” can be created to group extended model definitionsdedicated to different servers. Extended model definitionshaving the same category cannot be generated simultaneously.The category also corresponds to the different tabbed pagesavailable in the Choose Targets dialog box. See section below.

Enable TraceMode

When selected, displays the generation templates used for thegenerated text in the Preview page of an object property sheet

Complementlanguagegeneration

Indicates that the extended model definition is used to com-plement the generation of an object language. See sectionbelow

Comment Comments of the extended model definition

294

Page 301: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

Enable trace mode The Enable Trace mode check box allows you to preview which templatesare used during generation. Before starting the generation, click the Previewpage of the object involved in the generation to see these templates. Whenyou double-click on a trace line in the Preview page, the correspondingtemplate definition is displayed in the resource editor in the category whereit is located. The code of the template may appear with distinct colors.

For more information on syntactic coloring, see section Creating a generatedfile in chapter Managing Profiles.

Generation targets

The Category entry influences the layout of the Targets page of theGeneration dialog box. Extended model definitions are grouped by categoryin this page: each extended model definition is displayed beside a radiobutton and within the category it belongs to. If you do not define a category,the extended model definition is considered as a generation target.

In the following example, the category Application Server gathers twoexclusive extended model definitions; you have to select one of them. “Othergeneration” corresponds to an extended model definition where the Categoryentry is not defined.

295

Page 302: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Working with Extended Model Definitions

Language generation complement

Extended model definitions can be used to extend generation or tocomplement the generation of an object language. In the later case, theComplement Language Generation check box should be selected in orderto authorize the generation of the extended model definition with the objectlanguage.

PowerBuilder object languagePowerBuilder does not support extended model definitions for complemen-tary generation.

The generation items of the object language are merged with those of theextended model definition before generation.

Generated files All generated files defined in extended model definitions and objectlanguages are generated. In case of generated files with identical names, thefile in the extended model definition overrides the file defined in the objectlanguage.

Transformation profile category

A transformation profile is a group of transformations used during modelgeneration when you need to apply changes to objects in the source or targetmodels.

For information about creating transformations and transformation profiles,see the “Managing Profiles” chapter. For information about invokingtransformations, see “Applying Model Transformations” in the “ManagingModels” chapter of the General Features Guide .

Generation category

The Generation category contains categories and entries to define andactivate a generation process. You can use the following categories:

♦ Generation commands

♦ Generation tasks

♦ Generation options

296

Page 303: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

An extended model definition can be used either to complement thegeneration of an object model, or for extended generation. You define thiswith the Complement Language Generation check box located in theextended model definition property page.

In the following example, three tasks are defined in the WebLogic extendedmodel definition; the other tasks proceed from the object language of themodel (Java):

297

Page 304: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Working with Extended Model Definitions

For more information about these categories, see the “Object LanguagesReference Guide” chapter.

298

Page 305: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

Generating for Extended Model Definitions+ You attach an extended model definition to a model to:

♦ Complement the main generation of the model

♦ Generate for a separate target

Complement main generation

The extended model definition generation parameters influence the contentof the generation dialog box. The following table shows how you cancustomize the generation from the extended model definition editor.

Generationdialog box

Extended model definition

Targets page The Target page is displayed if the Complement LanguageGeneration check box in the extended model definitionproperties is set to Yes and if the extended model definitioncontains at least one task or one generated file

Options page Define options in Generation\Options using boolean, listand string entry types

Tasks page Define commands using command entries and referencethese commands in tasks

Generate for a separate target

Extended model definitions can be used to create new generation targetsprovided the following conditions are respected:

♦ The Complement Language Generation check box in the extended modeldefinition property sheet should not be selected

♦ The extended model definition should contain generated files andtemplates. The Templates are used to generate files, their role is toproduce text for generation purposes. During generation, the evaluationof a template always generates text which can be stored in a file and usedto gather information about a given object. To output the generated codein a file you have to type a name in the File Name box of the generatedfile property sheet

This generation is called extended generation. It is available from the Toolsä Extended Generation command.

299

Page 306: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Generating for Extended Model Definitions

If you have several extended model definitions designed for extendedgeneration, these will appear in the Targets page of the extended generationdialog box.

Specific menu command You can create commands in the Tools menu to directly access extendedgeneration for a selected target. To do so you have to:

♦ Create a menu in the Model metaclass in the Profile category of theextended model definition, name this menu with the command name youwant to display in the Tools menu and select the Tools menu in theLocation list

+ For more information on how to create a menu, see section Definingmenus in a profile in chapter Managing Profiles.

♦ Create the method for extended generation using the following syntax:

300

Page 307: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 7. Extended Model Definitions Reference Guide

Sub %Method%(obj)

Dim selection ’ as ObjectSelection

’ Create a new selectionset selection = obj.CreateSelection

’ Add object of the active selection in the createdselection

selection.AddActiveSelectionObjects

’ Generate scripts for specific targetInteractiveMode = im_Dialogobj.GenerateFiles "", selection, "specific target"

End Sub

Where “specific target” is used to type the code of the extended generationtarget. With this parameter, you no longer need to select a generation targetfor extended generation.

+ For more information on how to create a method, see section Definingmethods in a profile in chapter Managing Profiles.

♦ Add the method for extended generation to the menu in order to create aspecific command

♦ Save the extended model definition

The new command is displayed in the Tools menu.

301

Page 308: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Generating for Extended Model Definitions

There is no more Targets page because the method lying behind thecommand already specifies a generation target.

302

Page 309: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

CHAPTER 8

Generation Reference Guide (GTL)

About this chapter This chapter provides a complete reference to the concepts used in the GTL,the Generation Template Language available in PowerDesigner. It alsoprovides some hints and tips for using the GTL.

Contents Topic: page

Introduction to the Generation Template Language 304

GTL Templates 305

GTL Macros 323

Generation tips and techniques 348

303

Page 310: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Introduction to the Generation Template Language

Introduction to the Generation Template LanguageThe PowerDesigner Generation Template Language (GTL) is atemplate-based language for text generation. You can use GTL to generatepieces of text for any metaclass (object type) in a model, in order to generatecode or reports, or to produce external formats, such as XMI.

A GTL template contains plain text and variables that resolve to informationextracted from the model, such as the name of a class or data type of anattribute, or a collection of objects, such as the list of attributes of a class.You can also test variables and control their formatting.

When you generate a model, PowerDesigner evaluates which metaclassesmust have files generated, and creates one file for each object that belongs tothis metaclass, by applying the appropriate templates and resolving anyvariables.

GTL operates on the metaclasses defined in the PowerDesigner metamodel(see the “Resource Files and the Public Metamodel” chapter), and on anyextensions that are defined in the model profile (see the “Managing Profiles”chapter).

GTL is object-oriented, and supports inheritance and polymorphism forreusability and maintainability. Macros provide generic programmingstructures for testing variables (example: .if), and for iterating through thedependent items of an object (example: .foreach.). Conditional, iterative andtext formatting macros are also available.

In this chapter, most examples proceed from the Java language. However,the mechanism explained in this section also applies to all object languagesand all extended model definitions.

304

Page 311: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

GTL TemplatesA template consists of plain text, variables, and may contain macros. It is apiece of text generated for an object. It behaves like a special type propertywhose value is recalculated each time you try to obtain it. The content of atemplate is code that is generated in a text format.

A template is associated with a given metaclass, you may define as manytemplates as you want for any given metaclass, it is available to all objects(instances) of this metaclass. A metaclass is a class of the metamodel (orabstract class). It can be an entity attribute from the Conceptual Data Model(CDM), a table from the Physical Data Model (PDM), an operation from theObject-Oriented Model (OOM), etc . . . Templates give full access to thePowerDesigner metamodel attributes, collections, and all elements of themodel.

Templates are used to generate files, their role is to produce text forgeneration purposes. During generation, the evaluation of a template alwaysgenerates text which can be stored in a file and used to gather informationabout a given object.

A template may also refer to any template (including itself) to promoterecursion and sharing of template code, the second template is evaluated andits value is located in the result of the first template.

Example Here is an example of a template:

.foreach_item (Parameters)%definition%.next(", ")

ExamplesYou will find specific examples on the use of templates in the differentsections of this chapter.

A template is built with the following syntax:

template = <complex-template>complex-template = (<block-macro> | <simple-macro> | <simple-

template<)*simple-template = (<text> | <variable-block> | <conditional-

block>)*

+ For more information on some pieces of the above syntax, see theirdefinition later in this chapter.

You can use simple or complex templates. A simple template does notcontain any macros, whereas a complex template does.

305

Page 312: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

Simple template example Here is an example of a simple template syntax:

%Visibility% %DataType% %Code% [= %InitialValue%]

When the above template is evaluated, the four variables Visibility,DataType, Code and InitialValue will be replaced with the values for thecurrent object from the model. Since the = sign and the value for the lastvariable InitialValue are in brackets, this section of the template will only begenerated if InitialValue is not void.

Complex templateexample

Here is an example of a complex template syntax:

Each variable enclosed in % characters is either the name of an attribute, or aproperty of the current object, or the name of a template.

+ For more information on variables, see the ““Variables” on page 306”section.

Java templates example In Java, open the Profile\Operation\Templates folder in the object languageto display all templates used for generation for existing operations in theOOM.

Variables

Variables are qualified values enclosed in % characters and optionallypreceded by formatting options. At evaluation-time, they are substituted bytheir corresponding value in the active translation scope.

A variable can be of the following types:

♦ An attribute of an object

♦ A member of a collection or an extended collection

♦ A template

♦ An environment variable

306

Page 313: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

For example, the variable %Name% of an interface can be directly evaluatedby a macro and replaced by the name of the interface in the generated file.

Case sensitivityBe careful when using variable names as they are case sensitive. Thevariable name must have the first letter with an upper case, as in %Code%.

Variables syntax The following variables are shown with their possible syntaxes:

Variable Syntax

variable-block ‘%’ [’.’ <formatting-options> ‘:’] <variable> ‘%’

variable [<outer-scope> ‘.’] [<variable-object> ‘.’] [<object-scope> ‘.’] <object-member>

[<outer-scope> ‘.’] [<variable-object> ‘.’][<collection-scope> ‘.’] <collection-member>

[<outer-scope> ‘.’] <local-variable>

[<outer-scope> ‘.’] <global-variable>

object-member <volatile-attribute>

<property>

[<target-code> ‘::’] <extended-attribute>

[<target-code> ‘::’] [<metaclass-name>‘::’]<template-name> [’(‘<parameter-list>’)’]

[’*’]+ <local-value> [’(‘<parameter-list>’)’]

object-member-object =

<objecttype-property>

<oid-valued-object-member>

‘this’

collection-member ‘First’

‘IsEmpty’

‘Count’

collection-member-object=

‘First’

local-variable <local-object>

[’ * ‘] <local-value>

global-variable <global-object>

<global-value>

‘$’ <environment variable>

307

Page 314: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

Variable Syntax

variable-object <global-object>

<local-object>

outer-scope [<outer-scope> ‘.’] ‘Outer’

object-scope [<object-scope> ‘.’] <object-member-object>

<collection-scope> ‘.’ <collection-member-object>

collection-scope [<object-scope> ‘.’] <collection>

[<object-scope> ‘.’] <semi-colon-terminated-oid-valued object-member>

+ For more information on extended collections, see “Defining anextended collection in a profile” in the “Managing Profiles” chapter.

Object members

An object member can be a volatile attribute, a standard property, a templateor an extended attribute. There can be three types of standard property:boolean, string or object. The value of a standard property can be:

♦ ‘true’ or ‘false’ if it is of boolean type

♦ ‘null’ or object OID if it is of object type

The value of a template is the result of its translation (note that a templatemay be defined in terms of itself, that is to say recursively).

The value of an extended attribute may itself be a template, in which case itis translated. This allows for the definition of templates on a per object(instance) basis instead of a per metaclass basis.

To avoid name collisions when a template evaluation spans multiple targets,one may prefix both extended attributes and templates by their parent targetcode. For example: %Java::strictfp% or %C++::definition%

Template names may also be prefixed by their parent metaclass name. Thisallows for the invocation of an overridden template, actually bypassing thestandard dynamic template resolution mechanism. For example :%Classifier::definition%

A parameter list can optionally be specified. Parameter values should notcontain any % characters and should be separated by commas. Parametersare passed as local variables @1, @2, @3. . . defined in the translation scopeof the template.

308

Page 315: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

If the template MyTemplate is defined as:

Parameter1 = %@1%

Parameter2 = %@2%

Then the evaluation of %MyTemplate(MyParam1, MyParam2)% will yield:

Parameter1 = MyParam1

Parameter2 = MyParam2

Volatile attributes Volatile attributes may be defined through the .set_object and .set_valuemacros.

If the scope is an object scope, a volatile attribute is defined. Thisattribute will be available on the corresponding object regardless of thescope hierarchy. Volatile attributes shadow standard attributes. Oncedefined, they remain available until the end of the current generation process.

The “this” keyword returns an object scope and allows you to define volatileattributes on the object which is active in the current scope.

If the scope is a template scope , a standard local variable is defined.

Examples:

.set_value(this.key, %Code%-%ObjectID%)

defines the key volatile attribute on the current object

eg. .set_object(this.baseClass,ChildGeneralizations.First.ParentObject)

defines the baseClass object-type volatile attribute on the current object.

Operators

The following operators are supported in GTL:

Dereferencing operator The syntax [’*’]+ <local-value> [’(‘<parameter-list>’)’] returns the objectmember defined by the evaluation of [’*’]+ <local-value>. If the givenobject member happens to be a template, a parameter list may be specified.Applying the star operator corresponds to a double evaluation (the * operatoracts as a dereferencing operator).

Suppose a local variable is defined as: .set_value(C, Code)

Then %C% will return “Code” and %*C% will return the result of theevaluation of %Code%. In other words, %*C% can be thought of as %(%C%)%

309

Page 316: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

(the latter syntax being invalid).

! power evaluationoperator

Evaluates the results of the evaluation of the variable as a template.

For example, you define a comment containing a variable like %Code%.When you use the ! operator in %!Comment%, the actual value of %Code%is substituted for the variable block. Without the ! operator, the variableremains unevaluated.

The ! operator may be applied any number of times. For example:

%!!template%

This outputs the results of the evaluation of the evaluation of the evaluationof template ‘template’

? operator The ? operator is used to test the existence of a template, a local variable, avolatile or an extended attribute. It returns “true” if the variable exists,“false” otherwise.

Example:

Template

.set_value(foo, tt)%custname?%%custid?%

outputs:

truefalse

as custname is defined whereas custid is not.

+ operator The + operator is used to test if an object property is visible in the interface.

Example:

You can test if the Type box is displayed in the General tab of a databaseproperty sheet in the Information Liquidity Model, this indicates if theReplication Server or MobiLink extended model definitions are attached tothe current model.

You have to define the %Database.Type+% template, it will output false ifno extended model definition is associated with the current model.

Collection members

The available collection members are:

310

Page 317: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Name Type Description

First Object Returns the first element of the collection

IsEmpty Boolean Used to test whether a collection is empty or not.True if the collection is empty, false otherwise

Count Integer Number of elements in the collection

Note: Count is particularly useful for defining criteria based on collectionsize, for example (Attributes.Count>=10).

Local variables

Local variables are only visible in the scope where they are defined andinside its inner scopes.

Local variables may be defined through the use of the set_object andset_value macros.

+ For more information on the set_object and set_value macros, see“.set_object macro” on page 342 and “.set_value macro” on page 343.

Dereferencing operator Variables defined through the set_object macro are referred to as localobjects, whereas those defined with the set_value macro are called localvalues. The * dereferencing operator may be applied to local values.

The * operator allows for the evaluation of the variable whose name is thevalue of the specified local variable.

’%’[’.’ <formatting-options> ’:’] ’*’ <local-variable>’%’

For example, the following code:

.set_value(i, Code)%*i%

Is equivalent to:

%Code%

Global variables

Global variables are available regardless of the current scope. A number ofGTL-specific variables are defined as global as listed in the following table:

311

Page 318: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

Name Type Description

ActiveModel Object Active model

GenOptions struct Gives access to the user-defined generationoptions

PreviewMode boolean True if in Preview mode, false if in File Genera-tion mode

CurrentDate String Current system date and time formatted usinglocal settings

CurrentUser String Current user login

NewUUID String Returns a new UUID

Outer scope

An outer scope may be accessed using the Outer keyword. Specifying ascope effectively changes the current translation scope used for evaluatingthe variable.

+ For more information and examples on the outer scope, see the figuresin the ““Translation scope” on page 314” section.

Object scope

To gain access to the members of an object that is not active in the currenttranslation scope, one may specify an object scope. Specifying an objectscope changes the current translation scope used to evaluate the variable.

The ‘.’ (dot) character behaves as an indirection operator as in the Javaprogramming language, the right-hand side corresponds to a member of theobject referred to by the left-hand side.

Collection scope

To gain access to the members of a collection, one should specify acollection scope. The ‘.’ (dot) character behaves as an indirection operator asin the Java programming language, the right-hand side corresponds to amember of the collection referred to by the left-hand side.

For example:

312

Page 319: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Defining variable formatting options

Variables have a syntax that can force a format on their values. Typical usesare as follows:

♦ Force values to lowercase or uppercase characters

♦ Truncate the length of values

♦ Enquote text

You embed formatting options in variable syntax as follows:

%.format:variable%

The variable formatting options are the following:

Format option Description

n (where n is aninteger)

Extracts the first n characters. Blanks or zeros added tothe left to fill the width and justify the output to the right

-n Extracts the last n characters. Blanks or zeros added tothe right to fill the width and justify the output to the left

L Converts to lowercase characters

U Converts to uppercase characters

c Upper-case first letter and lower-case next letters

A Automatically removes indentation and aligns text on theleft border

D Gives access to the human-readable value of an attribute(as it is displayed in the product interface) when thisactual value differs from the internal representation ofthis attribute. In the following example, ‘public’ isthe visibility as it is shown in the product interface,whereas it is stored as ‘+’ in the model. %Visibility% =+ %.D:Visibility% = public

F Combined with L and U, applies conversion on the firstcharacter

T Leading and trailing white space trimmed from thevariable

q Enquotes the variable with single quotes

Q Enquotes the variable with double quotes

313

Page 320: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

Format option Description

X Escapes XML forbidden characters

E [deprecated – use the ! power evaluation operatorinstead, see “Operators” on page 309]

You can combine format codes. For example, %.U8:CHILD% formats thefirst eight characters of the code of the CHILD table in uppercase letters.

Translation scope

Templates are instantiated through a process called translation. Translationis done in a well-defined scope and consists in substituting the variables bytheir corresponding values in the scope. All templates are defined withrespect to metamodel classes, they are considered special type propertiesthat take on the result of their translation as value.

A scope is a context for evaluating a template, it comprises the active objectand local variables. At any given point during translation, only one object isactive; it is the object which the template is applied onto. In a translationscope, all metamodel attributes and collections defined on the active objectmetaclass and its parents are visible, as well as the corresponding extendedattributes and templates. When the translation engine starts evaluating atemplate, a new translation scope is created.

+ For more information on object collections, see the “Resource Files andthe Public Metamodel” chapter.

Whenever a scope is created it is the current translation scope, the oldtranslation scope being the outer scope for the current translation scope

Whenever a scope is exited its outer scope is restored as the currenttranslation scope

314

Page 321: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

+ For more information on the outer scope, see the ““Variables” onpage 306” section.

New scopes may be created during evaluation of a template that forces theactive object to change. For example, the foreach_item macro that allowsfor iteration on collections defines a new scope, as well as theforeach_line macro. The outer scope is restored when leaving the block.

+ For more information on both macros, see the ““.foreach_item macro”on page 333”, and the “section “.foreach_line macro” on page 335” sections.

Nested scopes form a hierarchy that can be viewed as a tree, the top levelscope being the root.

Example The following example shows the scope mechanism using a Class template:

315

Page 322: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

Inheritance

Templates are defined with respect to a given metamodel class and areinherited by its children. They are inherited by all the children of themetaclass they are defined for. This mechanism is useful for sharingtemplate code between metaclasses having a common parent.

Example Example of inheritance: Classifier/definition is available through inheritanceof Class and Interface. In the following example, the definition templatedefined on the parent metaclass is used in the evaluation of the contenttemplate on the child metaclass.

Template overriding

Overriding a template means that a template defined with respect to a givenmetaclass may be redefined on a child class, in this case the template of theparent metaclass is said to be overridden. The new definition effectivelyhides the previous one for objects of the child metaclass. You can view theoverridden parent using the Go to super-definition command in the childclass contextual menu.

In order to use the definition of a specific parent metaclass, GTL providesthe “::” qualifying operator:

Example

The same template name “isAbstract” is used in two different categories:Classifier and Class. “false” is the original value that has just been

316

Page 323: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

overridden by the new “true” value. You retrieve the original value back byusing the following syntax: <metaclassName::template>, in this case:

%isAbstract%%Classifier::isAbstract%

Polymorphism

Templates are dynamically bound. In other words, the choice of the templateto be evaluated is made at translation-time based on the type of object it isapplied to. This mechanism is comparable to the virtual method invocationmechanism found in object-oriented languages.

Polymorphism is achieved by allowing template redefinition in derivedclasses. For instance, it is useful in Java to define Generated Files on theclassifier. Polymorphism allows template code defined on a classifier to usetemplates defined on its children (class, interface), the template being useddoes not have to be defined on the parent metaclass. Coupled withinheritance, this feature helps you share template code.

Example

The content of %definition% is the one defined in Classifier for an interface,and the one defined in Class for a class.

Template overloading

You may have different definitions of the same template that apply indifferent conditions. If it is the case, the template is only defined for objectsthat satisfy the actual condition (templates are always dynamically bound).The overloading feature can be used as a powerful switching mechanism:you can sort items in alphabetic order to provide more readability whengathering different versions of the same template. It also provides morereadability because it avoids long .if conditions.

At translation-time, the translation engine evaluates each conditionsuccessively until it finds one that is verified. When it does, it takes thecorresponding template definition. If no condition is satisfied, theunconditioned template, if defined, is used as default (see syntax1 in the

317

Page 324: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

following figure).

Conditions must be mutually exclusive to guarantee deterministic behavior.

Templates may be defined under criteria or stereotypes as well, in whichcase the corresponding conditions are combined.

+ For more information on criteria and stereotypes, see “Defining acriterion” and “Defining a stereotype” in the “Managing profiles” chapter.

Example

+ For more information on <simple-condition>, see the ““.if macro” onpage 337” section.

Shortcut translation

Shortcuts are dereferenced during translation: the scope of the target objectreplaces the scope of the shortcut.

For example, the following generated file defined in the package metaclassprovides the list of classes in the package. If a class shortcut is found, thecode of its target object followed by (Shortcut) is generated, followed by theparent object ID and the shortcut ID which clearly shows that the scope ofthe shortcut is replaced by the scope of the shortcut target object:

.foreach_item(Classes).if (%IsShortcut%)

%Code% (Shortcut)oid = %ObjectID%shortcut oid = %Shortcut.ObjectID%

.else%Code%%Shortcut%

.endif.next(\n)

This is the opposite behavior as in VB Script where shortcut translationretrieves the shortcut itself.

If you want the shortcut itself to be generated instead of the target object,you can use the %Shortcut% variable.

External shortcut If the target model of an external shortcut is not open, a confirmation dialogbox is displayed to let you open the target model. You can use theset_interactive_mode macro to change this behavior. This macro allows youto decide if the GTL execution must interact with the user or not.

318

Page 325: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

+ For more information on the set_interactive_mode macro, see the““.set_interactive_mode macro” on page 341” section.

Escape sequences

Escape sequences are specific characters sequences used for layout of thegenerated file output.

The following escape sequences can be used inside templates:

Escape sequence Description

\n New line character, creates a new line

\t Tab character, creates a tab

\\ Creates a backslash

\at the end of a line Creates a continuation character (ignores thenew line)

. at the beginning of a line Ignores the line

.. at the beginning of aline

Creates a dot character (to generate a macro)

%% Creates a percent character

+ For more information on escape sequences, see the ““Using new lines inhead and tail string” on page 349” section.

Conditional blocks

Conditional blocks can be used to specify different templates based on thevalue of a variable.

{syntax 1}: ’[’ <variable> ’?’ <simple-template> [’:’

<simple-template>] ’]’

{syntax 2}: ’[’ <text> <variable> <text> ’]’

Syntax 1 is similar to C and Java ternary expressions. If the value of thevariable is false, null, or the null string, the second template, if specified, isevaluated, otherwise the first one is evaluated.

Syntax 2 has a slightly different meaning. The simple template<text><variable><text> is translated if, and only if the value of thevariable is not the null string.

Example: an attribute declaration in Java:

%Visibility% %DataType% %Code% [= %InitialValue%]

319

Page 326: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

Error messages

Error messages stop the generation of the file in which errors have beenfound, these errors are displayed in the Preview tab of the correspondingobject property sheet.

Error messages have the following format:

You can find the following types of errors:

♦ Syntax errors

♦ Translation errors

Syntax errors

You may encounter the following syntax errors:

Syntax error message Description and correction

condition parsing error Syntax error in a boolean expression

expecting .endif Add a .endif

.else with no matching .if Add a .if to the .else

.endif with no matching .if Add a .if to the .endif

expecting .next Add a .next

expecting .end%s Add a .end%s (for example, .endunique,.endreplace, . . . )

.end%s with no matching .%s Add a .<macro> to the .end<macro>

.next with no matching .foreach Add a .foreach to the .next

missing or mismatched paren-theses

Correct any mismatched braces

unexpected parameters: <extra-params>

Remove unnecessary parameters

unknown macro The macro is not valid

320

Page 327: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Syntax error message Description and correction

.execute_command incorrectsyntax

The correct syntax is displayed inthe Preview tab, or in the Outputwindow. It should be: .execute_-command(<executable>[,<arguments>[,{cmd_-ShellExecute|cmd_PipeOutput}]])

Change_dir incorrect syntax The syntax should be: .change_-dir(<path>)

convert_name incorrect syntax The syntax should be: .convert_-name(<name>)

convert_code incorrect syntax The syntax should be: .convert_-code(<code>)

set_object incorrect syntax The syntax should be: .set_object(<local-var-name>[,[<scope>.] <object-scope>[,{new|update}]])

set_value incorrect syntax The syntax should be: .set_-value(<local-var-name>,<simple-template>[,{new|update}])

execute_vbscript incorrect syn-tax

The syntax should be: .execute_-vbscript(<script-file>[,<script-input_-params>])

Translation errors

Translation errors are evaluation errors on a variable when evaluating atemplate.

You may encounter the following translation errors:

321

Page 328: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Templates

Translation error message Description and correction

unresolved collection:<collection>

Unknown collection

unresolved member: <member> Unknown member

no outer scope Invalid use of Outer keyword

null object Occurs when trying to access a nullobject member

expecting object variable: <object> Occurs when using string instead ofobject

VBScript execution error VB script error

Deadlock detected Deadlock due to an infinite loop

322

Page 329: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

GTL MacrosMacros can be used to express template logic, and to loop on objectcollections. Each macro keyword must be preceded by a . (dot) characterand has to be the first non blank character of a line. Make sure you alsorespect the macro syntax in terms of line breaks.

You define a macro inside a template, or a command entry.

There are three types of macros:

♦ Block macros consist of a begin and an end keyword delimiting an inputblock over which the macro is applied. They have the following structure:

’.’<macro-name> [’(’ <parameters> ’)’ ]<macro-block-input>’.’end<macro-name > [ ’(’ <tail> ’)’ ]

<tail> is an optional string constant appended to the generated text, if thereis one.

♦ Loop macros are used for iteration. At each iteration, a new scope iscreated. The template specified inside the block is translated successivelywith respect to the iteration scope.

’.’foreach_<macro-name> [’(’ <parameters> [’,’ <head> [’,’<tail>]] ’)’ ]

<complex-template>’.’next [ ’(’ <separator> ’)’ ]

<head> and <tail> are both optional string constants. <head> is generatedbefore, and <tail> is appended to the generated text, if there is one.

A <separator> may optionally be specified as an argument to the .nextkeyword, it is placed between non-empty evaluations of<complex-template>.

♦ Simple macros are macros that hold on a single line.

Macro parameters delimitersMacro parameters may be delimited by double quotes. The delimiters arerequired whenever the parameter value includes commas, braces, leading ortrailing blanks. The escape sequence for double quotes inside a parametervalue is \”.

You can use the following macros:

♦ Conditional and loop / iterative macros:• “.if macro” on page 337

323

Page 330: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

• “.foreach_item macro” on page 333 – iterates on object collections

• “.foreach_line macro” on page 335 – iterates on lines

• “.foreach_part macro” on page 335 – iterates on parts

• “.break macro” on page 326 – breaks the loop

♦ Assignment macros - define a local variable of object or value type aswell as volatile attributes:• “.set_object macro” on page 342

• “.set_value macro” on page 343

• “.unset macro” on page 345

♦ Output and error reporting macros:• “.log macro” on page 338

• “.warning macro” on page 347

• “.error macro” on page 331

♦ Command macros - only available in the context of the execution of ageneric command:• “.vbscript macro” on page 346 - embed VB script code inside a

template

• “.execute_vbscript macro” on page 332 - launch vbscripts

• “.execute_command macro” on page 331 - launch executables

• “.abort_command macro” on page 325 - stop command execution

• “.change_dir macro” on page 326 - changing a directory

• “.create_path macro” on page 330 - creating a specified path

♦ Formatting macros:• “.lowercase macro” on page 339

• “.uppercase macro” on page 345

• “.convert_name macro” on page 329 - converts names into codes

• “.convert_code macro” on page 328 – converts codes into names

♦ String manipulation macros:• “.replace macro” on page 340

• “.delete macro” on page 330

• “.unique macro” on page 344

• “.block macro” on page 325 - adds a header and a footer to a text block

♦ Miscellaneous macros:

324

Page 331: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

• “.comment and .// macro” on page 327 - inserts a comment in atemplate

• “.collection macro” on page 327 - returns a collection of objects basedon the specified scope and condition

• “.object macro” on page 339 - returns an object based on the specifiedscope and condition

• “.bool macro” on page 326 - evaluates a condition

• “.set_interactive_mode macro” on page 341 – defines whether the GTLexecution must interact with the user

.abort_command macro

This macro stops command execution altogether. It is available to executegeneration commands only, and may be used in addition to standard GTLmacros when defining commands.

Example:

.if %_JAVAC%.execute (%_JAVAC%,%FileName%)

.else.abort_command

.endif

.block macro

The .block macro is used to add a header and/or a footer to its content whenit is not empty.

.block [’(’<head> ’)’]<block-input>.endblock[’(’ <tail> ’)’]

Parameters

Parameter Type Description

<head> (op-tional)

Simple template Generated before output, if there is one

<tail> (op-tional)

Text Appended to the output, if there is one

<block-input>

Complex tem-plate

Parameter used to input text

Output The output is the concatenation of <head>, the evaluation of the<block-input> and the <tail>.

325

Page 332: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

Example:

.block (<b>)The current text is in bold.endblock (</b>)

.bool macro

This macro returns ‘true’ or ‘false’ depending on the value of the conditionspecified.

.bool ’(’ <condition> ’)’

Parameters

Parameter Type Description

<condition> Condition Condition to be evaluated

Example:

.bool(%.3:Code%= =ejb)

.break macro

This macro may be used to break out of .foreach loops.

break = .break

Example:

.set_value(_hasMain, false, new)

.foreach_item(Operations).if (%Code% == main)

.set_value(_hasMain, true)

.break.endif

.next%_hasMain%

.change_dir macro

This macro changes the current directory. It is available to executegeneration commands only, and may be used in addition to standard GTLmacros when defining commands.

.change_dir ’(’ <path> ’)’

Parameters

326

Page 333: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Parameter Type Description

<path> Simple tem-plate (escape se-quences ignored)

New current directory

Example:

.change_dir(C:\temp)

.collection macro

This macro returns a collection of objects based on the specified scope andcondition. Collections are represented as the concatenation of semi-colonterminated OID.

For example, a collection containing a single element:

E40D4254-DA4A-4FB6-AEF6-3E7B41A41AD1;

A collection of three element:

C3ADA38A-994C-4E15-91B2-08A6121A514C;58CE2951-7782-49BB-B1BB-55380F63A8C9;F522C0AE-4080-41C2-83A6-2A2803336560;

.collection ’(’ <collection-scope> [’,’ <filter>] ’)’

Parameters

Parameter Type Description

<collection-scope>

<simple-template> return-ing a collectionscope

Scope over which we should iterate.

<filter> <condition> Filter condition

Example:

The following macro returns a subset of the attributes defined on the currentclassifier whose code starts with a letter between a and e included.

.object(Attributes, (%.1:Code% >= a) and (%.1:Code% <= e))

.comment and .// macro

The comment, and // macro is helpful for inserting comments in a template.Lines starting with .// or .comment are ignored during generation.

Example:

327

Page 334: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

.// This is a user defined comment

.convert_code macro

The .convert_code macro uses the conversion table of a code into a name.When no occurrence is found in the table, the code is returned.

.convert_code (<Expression> [<separator character> [,<patternseparator>]])

The expression <Expression> is the code to be converted in thecorresponding conversion table.

Parameters

Parameter Type Description

<patternseparator> (op-tional)

Text Declaration of the different separators likelyto exist in a code. These separators will bereplaced by the <separator character>. Youcan declare several separators, for example“_ “ and “tab”

<separatorcharacter> (op-tional)

Text Character generated each time a separatordeclared in <pattern separator> is found inthe code. For example, this character can be“space “

You can use this macro together with a user-defined conversion table thatyou select in the Conversion Table list. To do so, open the Model Optionsdialog box, select the required object in the Naming Convention folder andclick the Code To Name tab.

Conversion tables are not case sensitive. You can indifferently uselower-or-uppercases in tables. This macro is particularly useful when youwork with naming conventions.

+ For more information about naming conventions, see “Defining namingconventions” in the “Managing Models” chapter in the General FeaturesGuide.

Note You can also use this macro outside the naming conventions contextprovided the conversion table is the table of the current object of the script.

+ For more information on the .convert_code macro, see “.convert_name& .convert_code macros” in the “Managing Models” chapter in the GeneralFeatures Guide .

328

Page 335: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

.convert_name macro

The .convert_name macro uses the conversion table of a name into a code.When no occurrence is found in the table, the name is returned.

.convert_name (<Expression> [,<separator character> [,<patternseparator>]])

The expression <Expression> is the name to be converted in thecorresponding conversion table.

Parameters

Parameter Type Description

<patternseparator> (op-tional)

Text Declaration of the different separators likelyto exist in a name. These separators will bereplaced by the <separator character>. Youcan declare several separators, for example“space “ and “tab”

<separatorcharacter> (op-tional)

Text Character generated each time a separatordeclared in <pattern separator> is found inthe name. For example, this character canbe “_”

You can use the .convert_name macro together with a user-definedconversion table that you select in the Conversion Table list. To do so, openthe Model Options dialog box, select the required object in the NamingConvention folder and click the Name To Code tab.

Conversion tables are not case sensitive. You can indifferently use lower oruppercases in tables. This macro is particularly useful when you work withnaming conventions.

+ For more information about naming conventions, see “Defining namingconventions” in the “Managing Models” chapter in the General FeaturesGuide.

Note You can also use this macro outside the naming conventions contextprovided the conversion table is the table of the current object of the script.Here is an example of a macro that can be added from the Profile\Columnfolder in a new Generated Files entry:

329

Page 336: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

.foreach_item(Columns)%Name%,.foreach_part(%Name%)

.convert_name(%CurrentPart%).next("_")

.next(\n)

+ For more information on the .convert_name macro, see “.convert_name& .convert_code macros” in the “Defining name/code conversions” chapterin the General Features Guide .

.create_path macro

This macro creates a specified path if it does not exist.

.create_path ’(’ <path> ’)’

Parameters

Parameter Type Description

<path> Simple tem-plate (escape se-quences ignored)

Path to be created

Example:

.create_path(C:\temp)

.delete macro

The .delete macro deletes all occurrences of a string in a text block. In thefollowing script, it deletes the string <del-string> in its block content.

.delete ’(’<del-string> ’)’<delete-block-input>.enddelete

This macro is particularly useful when you work with naming conventions.

+ For more information about naming conventions, see “Defining namingconventions” in the “Managing Models” chapter in the General FeaturesGuide.

Parameters

330

Page 337: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Parameter Type Description

<del-string> Text String to be deleted in the input block

<delete-block-input>

Complex tem-plate

Parameter used to input text

Output The output is that all instances of the string <del-string> are removed in thedelete block input.

In the following example, ‘GetCustomerName’ is converted to‘CustomerName’.

.delete( get )GetCustomerName.enddelete

In the following example, the variable %Code% is ‘m_myMember’ and it isconverted to ‘myMember’.

.delete(m_)%Code%.enddelete

.error macro

The error macro is similar to the warning macro as it does not appear in thegenerated file, however it stops generation. The error message is thespecified template translated over the active object. It is displayed in bothPreview tab of the object, and the Output window.

.error <message>

Parameters

Parameter Type Description

<message> Simple template Error message

Example:

.error no initial value supplied for attribute %Code% of class%Parent.Code%

.execute_command macro

This macro is used to launch executables as separate processes. It isavailable to execute generation commands only, and may be used in additionto standard GTL macros when defining commands.

.execute_command ’(’ <cmd> [’,’ <args> [’,’ <mode>]] ’)’

331

Page 338: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

Parameters

Parameter Type Description

<cmd> Simple tem-plate (escape se-quences ignored)

Executable path

<args> (op-tional)

Simple tem-plate (escape se-quences ignored)

Arguments for the executable

<mode>(optional)

cmd_-ShellExecute orcmd_PipeOutput

cmd_ShellExecute runs as independentprocess cmd_PipeOutput blocks untilcompletion, and shows the executableoutput in the output window

Note that if an .execute_command fails for any given reason (executables notfound, or output sent to stderr), the command execution is stopped.

Example:

.execute_command(notepad, file1.txt, cmd_ShellExecute)

.execute_vbscript macro

This macro is used to execute a VB script specified in a separate file.

.execute_vbscript ’(’ <vbs-file> [’,’ <script-parameter>] ’)’

Parameters

Parameter Type Description

<vbs-file> Simple tem-plate (escape se-quences ignored)

VB script file path

<script-parameter>(optional)

Simple template Parameter passed on to the script throughthe ScriptInputParameters global prop-erty

Output The output is the ScriptResult global property value.

Example:

.execute_vbscript(C:\samples\vbs\login.vbs, %username%)

Note: the active object of the current translation scope can be accessedthrough the ActiveSelection collection as ActiveSelection.Item(0).

332

Page 339: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

+ For more information on ActiveSelection, see “Global properties” in the“Accessing objects using VBScript” chapter in the General Features Guide .

.foreach_item macro

The foreach_item macro is used for iterating on object collections. Thetemplate specified inside the block is translated over all objects contained inthe specified collection. The block defines a new scope wherein the activeobject at iteration i is the i-th collection member.

If a comparison is specified, items in the collection are pre-sorted accordingto the corresponding rule before being iterated upon:

.foreach_item ’(’ <collection-scope> [’,’ <head> [’,’ <tail>[’,’ <simple-condition> [’,’ <comparison> ]]]]’)’

<complex-template>.next [’(’ <separator> ’)’]

Defining collections All collections are accessible for a given object. Each PowerDesigner objectcan have one or several collections corresponding to the objects it interactswith. Collections express the link between objects, for example a table hascollections of columns, indexes, business rules and so on.

Collections are represented in the PowerDesigner public metamodel byassociations between objects. The roles of the associations correspond to thecollections of an object.

+ For more information about object collections, see the “Resource Filesand the Public Metamodel” chapter.

Parameters

333

Page 340: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

Parameter Type Description

<collection-scope>

Simpletemplate

Collection over which iteration is per-formed

<head> (optional) Text Generated before output, if there is one

<tail> (optional) Text Appended to the output, if there is one

<simple-condition> (op-tional)

Simplecondition

If specified, only objects satisfying thegiven condition are considered during theiteration

<comparison> Simplecondition

<comparison> is evaluated in a scopewhere two local objects respectivelynamed ‘Item1’ and ‘Item2’ are defined.These correspond to items in the collec-tion. <comparison> should evaluate totrue if Item1 is to be placed after Item2in the iteration

<separator> (op-tional)

Text Generated between non empty evalua-tions of <complex-template>

Macro parameters delimitersMacro parameters may be delimited by double quotes. The delimiters arerequired whenever the parameter value includes commas, braces, leading ortrailing blanks. The escape sequence for double quotes inside a parametervalue is \".

Output The output is the concatenated evaluations of <complex-template> over allthe objects in the collection.

Example:

Attribute Data type Initial value

cust_name String __

cust_foreign Boolean false.foreach_item(Attributes,,,,%Item1.Code% >= %Item2.Code%))Attribute %Code%[ = %InitialValue%];.next(\n)

The result is:

Attribute cust_foreign = false

Attribute cust_name;

334

Page 341: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Note The four commas after (Attributes„„ means that all parameters (head, tail,condition and comparison) are skipped.

.foreach_line macro

The foreach_line macro is a simple macro that iterates on the lines of theinput template specified as the first argument to the macro. The templatespecified inside the block is translated for each line of the input. This macrocreates a new scope with the local variable CurrentLine. This one is definedinside the block to be the i-th line of the input template at iteration i.

.foreach_line ’(’ <input> [’,’ <head> [’,’ <tail>]] ’)’<complex-template>

.next [’(( <separator> ’)’]

Parameters

Parameter Type Description

<input> Simple template Input text over which iteration is per-formed

<head> (op-tional)

Text Generated before output, if there is one

<tail> (op-tional)

Text Appended to the output, if there is one

<separator>(optional)

Text Generated between non empty evalua-tions of <complex-template>

Output The output is the concatenated evaluations of <complex-template> for eachline of the translated template <input>.

Example:

.foreach_line(%Comment%)// %CurrentLine%.next(\n)

.foreach_part macro

The .foreach_part macro iterates on the part of the input template specifiedas the first argument to the macro. The template specified inside the block istranslated for each part of the input.

A part is delimited with a separator pattern. There are two kinds of separator:

♦ Char separator: for each char separator, the separator specified in the nextstatement of the macro is returned (even for consecutive separators)

335

Page 342: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

♦ Word separator: they are specified as interval, for example [A-Z]specifies that all capital letters are separator. For a word separator, noseparator (specified in next statement) is returned

.foreach_part ’(’ <input> [’,’ <separator-pattern> [’,’ <head>[, <tail>]]] ’)’

<simple-template>.next[’(’ <separator> ’)’]

This macro creates a new scope wherein the local variable CurrentPart isdefined to be the i-th part of the input template at iteration i. The Separatorlocal variable contains the following separator.

This macro is particularly useful when you work with naming conventions.

+ For more information about naming conventions, see “ Defining namingconventions” in the “Managing Models” chapter in the General FeaturesGuide.

Separator-pattern The <separator-pattern> is defined in a double quote string “ “ and behavesas follows:

♦ Any character specified in the pattern can be used as separator

♦ [<c1> - <c2>] specifies a character within the range defined betweenboth characters <c1> and <c2>

For example, the following pattern “ -_,[A-Z]” specifies that each part can beseparated by a space, a dash, an underscore, a comma or a character betweenA and Z (in capital letter).

By default, the <separator-pattern> is initialized with the pattern (“ -_,\t”).If the specified pattern is empty, the pattern is initialized using the defaultvalue.

A separator <separator> can be concatenated between each part. <head>and <tail> expressions can be added respectively at the bottom or at the endof the generated expression.

Parameters

336

Page 343: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Parameter Type Description

<input> Simpletemplate

Input text over which iteration is per-formed

<separator-pattern>

Text Char and word separators

<head> (optional) Text Generated before output, if there is one

<tail> (optional) Text Appended to the output, if there is one

<separator> (op-tional)

Text Generated between non empty evalua-tions of <complex-template>

Output The output is the concatenated evaluations of <simple-template> for eachpart of the translated template <input>.

Examples:

Convert a name into a class code (Java naming convention). In the followingexample, the variable %Name% is equal to ‘Employee shareholder’, and itis converted to ‘EmployeeShareholder’:

.foreach_part (%Name%, " _-’")%.FU:CurrentPart%.next

Convert a name into a class attribute code (Java naming convention). In thefollowing example, the variable %Name% is equal to ‘Employeeshareholder’, and it is converted to ‘employeeShareholder’:

.set_value(_First, true, new)

.foreach_part(%Name%,"’ _-’")

.if (%_First%)%.L:CurrentPart%.set_value(_First, false, update).else%.FU:CurrentPart%.endif.next

.if macro

The if macro is used for conditional generation, it has the following syntax:

337

Page 344: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

if= .if[not] <condition><complex-template>[(.elsif[not] <condition><complex-template>)*][.else<complex-template>].endif [’(’ <tail> ’)’]

condition= ’(’ <condition> ’)’ or ’(’ <condition> ’)’ |’(’ <condition> ’)’ and ’(’ <condition> ’)’|’(’ <condition> ’)’|<simple-condition>

simple-condition= <variable> [ <comparison-operator><condition-rhs> ]

comparison-operator= ’==’ |’!=’ |’<=’ |’>=’ |’<’ |’>’ |

condition-rhs= <simple-template> |<string-constant> |true |false |null |notnull |

string constant= ’"’ <text> ’"’

Parameters

Parameter Type Description

<tail> Text Appended to the output, if there is one

When a simple condition consists of a single variable without anycomparison operator, the condition is false if the value of the variable is“false”, “null” or the null string, otherwise it is considered to be true.

The <, >, >=, and <= comparison operators perform integer comparisons ifboth operands are integers, otherwise they induce an intelligent stringcomparison that takes into account embedded numbers (example: Class_10is greater than Class_2).

.log macro

This macro logs a message to the Generation tab of the Output window,located in the lower part of the main window. It is available to executegeneration commands only, and may be used in addition to standard GTLmacros when defining commands.

.log <message>

338

Page 345: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Parameters

Parameter Type Description

<message> Simple template Message to be logged

Example:

.log undefined environment variable: JAVAC

.lowercase macro

The .lowercase macro transforms a text block in lowercase characters.

.lowercase<lowercase-block-input>.endlowercase

This macro is particularly useful when you work with naming conventions.

+ For more information about naming conventions, see “ Defining namingconventions”, in the “Managing Models” chapter in the General FeaturesGuide.

Parameters

Parameter Type Description

<lowercase-block-input>

Complex tem-plate

Parameter used to input text

Output The output is the lowercase block input that is changed to lowercasecharacters.

In the following example, the variable %Comment% is ‘HELLO WORLD’and it is converted to ‘hello world’.

.lowercase%Comment%.endlowercase

.object macro

This macro returns a collection of objects based on the specified scope andcondition. Object references are represented as OID; for example:E40D4254-DA4A-4FB6-AEF6-3E7B41A41AD1.

object = .object ’(’ <collection-scope:simple-template>[’,’

<filter>] ’)’

Parameters

339

Page 346: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

Parameter Type Description

<scope> <simple-template> return-ing either an objector a collectionscope

Collection over which we should iterate,the macro will return the first matchingobject in the collection

<filter> <condition> Filter condition

Example1:

The following macro returns the first attribute in the collection defined onthe current classifier whose code starts with a letter comprised between a ande included.

.object(Attributes, (%.1:Code% >= a) and (%.1:Code% <= e))

Example 2:

Define template ::myPackage2 as follows:

.object(ActiveModel.Packages, %Name% == MyPackage2)

Define template OOM.Model::MyTemplate as follows:

.foreach_item(myPackage2.Classes)%Code%.next(\n)

In OOM.Model M = { OOM.Package MyPackage1, OOM.PackageMyPackage2 { OOM.Class C1, OOM.Class C2} }TemplateOOM.Model::MyTemplate evaluates to in model M:

C1

C2

Example 3:

ILM.Publication::getConsolDataConnection

.object(Process.DataConnections, %AccessType% == "RO")

This template returns the first read-only data connection for the processassociated with the current publication.

.replace macro

The .replace macro replaces all occurrences of a string with another string ina text block.

340

Page 347: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

This macro is particularly useful when you work with naming conventions.

+ For more information about naming conventions, see “Defining namingconventions” in the “Managing Models” chapter in the General FeaturesGuide.

The .replace macro replaces the old string <OldString> with the<NewString> string in the text block <Block>.

.replace ’(’ <old-string> ’,’ <new-string> ’)’<replace-block-input>.endreplace

Parameters

Parameter Type Description

<old-string> Text String containing the character to bereplaced by <new-string>

<new-string>

Text String containing the character replacing<old-string>

<replace-block-input>

Complex tem-plate

Parameter used to input text

Output The output is that all instances of the string <old-string> are replaced byinstances of the string <new-string> in the replace block input.

In the following example, ‘GetCustomerName’ is converted to‘SetCustomerName’.

.replace( get , set )GetCustomerName.endreplace

In the following example, the variable %Name% is ‘Customer Factory’ andit is converted to ‘Customer_Factory’.

.replace(" ", "_")%Name%.endreplace

.set_interactive_mode macro

This macro is used to define if the GTL execution must interact with the useror not. You can decide to display dialog boxes during execution, to executethe entire script without interruption, or to stop execution in case oftranslation error. This macro can be used for resolving external shortcuts asexplained in the example below.

341

Page 348: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

.set_interactive_mode(<interactive-mode>)

The following modes are supported:

Mode Code Description

im_Batch.set_interactive_mode(im_Batch)

Never displays dialog boxes andalways uses default values

im_Dialog.set_interactive_mode(im_Dialog)

Displays information and con-firmation dialog boxes that re-quire user interaction for theexecution to keep running

im_Abort.set_interactive_mode(im_Abort)

Never displays dialog boxesand aborts execution instead ofusing default values each time adialog is encountered

Example You can use this macro when your model contains external shortcuts. If thetarget model of an external shortcut is closed and if you use the im_Dialogmode, then a dialog box is displayed to let you open the target model.

.set_object macro

This macro is used to define a local variable of object type (local object).

.set_object ’(’ [<scope>’.’]<local-var-or-volatile-attr-name>[’,’ <object-ref>[’,’ <new> ]]’)’

Parameters

342

Page 349: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Parameter Type Description

<scope>(optional)

Simple-templatereturning eitheran object or acollection scope

Qualifying scope.

<local-var-or-volatile-attr-name>

Simple-template Variable name

<object-ref>(optional) [<scope>.]<object-

scope>]

Describes an object reference. If it isnot specified or is an empty string, thevariable is a reference to the active objectin the current translation scope

<new> (op-tional, defaultvalue = up-date)

new or update ornewifundef

If new, (re)define the variable in thecurrent scope. If update, if a variable withthe same name already exists, update theexisting variable otherwise define a newone. If newifundef, define the variablein the current scope if it has not beendefined in an outer scope, otherwise donothing.

The variable is a reference to the object specified using the second argument.

Example:

.set_object(Attribute1, Attributes.First)

NoteWhen specifying a new variable, it is recommended to specify ‘new’ asthird argument to ensure that a new variable is created in the current scope.

.set_value macro

This macro is used to define a local variable of value type.

.set_value ’(’ [<scope>’.’]<local-var-or-volatile-attr-name> ’,’<value>[’,’ <new> ]’)’

Parameters

343

Page 350: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

Parameter Type Description

<scope>(optional)

Simple-templatereturning eitheran object or acollection scope

Qualifying scope.

<local-var-or-volatile-attr-name>

Simple template Local variable or volatile attribute name

<value> Simple tem-plate (escape se-quences ignored)

Value

<new> (op-tional, defaultvalue = up-date)

new or update ornewifundef

If new, (re)define the variable in thecurrent scope. If update, if a variable withthe same name already exists, update theexisting variable otherwise define a newone. If newifundef, define the variablein the current scope if it has not beendefined in an outer scope, otherwise donothing.

The variable value is set to be the translated template value specified as thesecond argument.

Example:

.set_value(FirstAttributeCode, %Attributes.First.Code%)

NoteWhen specifying a new variable, it is recommended to specify ‘new’ asthird argument to ensure that a new variable is created in the current scope.

.unique macro

The purpose of the unique macro is to define a block in which each line ofthe text generated is guaranteed to be unique. It can be useful for calculatingimports, includes, typedefs, or forward declarations in languages such asJava, C++ or C#.

.unique<unique-block-input>.endunique[’(’ <tail> ’)’]

Parameters

344

Page 351: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Parameter Type Description

<unique-block-input>

Complex tem-plate

Parameter used to input text

<tail> Text Appended to the output, if there is one

Output The output is the unique block input where every redundant line has beenremoved.

Example:

.uniqueimport java.util.*;import java.lang.String;%imports%.endunique

.unset macro

Permits the undefining of both local variables and volatile attributes definedthrough the .set_value and .set_object macros

.unset([<scope>.]<local-var-or-volatile-attr-name>)

Parameters

Parameter Type Description

<scope>(optional)

Simple-templatereturning eitheran object or acollection scope

Qualifying scope.

<local-var-or-volatile-attr-name>

Simple template Local variable or volatile attribute name.

Example:

.set_value(i, 1, new)%i?%.unset(i)%i?%

The second line outputs true as the variable ‘i’ is defined while the last oneoutputs false.

.uppercase macro

The .uppercase macro transforms a text block in uppercase characters.

345

Page 352: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

GTL Macros

.uppercase<uppercase-block-input>.enduppercase

This macro is particularly useful when you work with naming conventions.

+ For more information about naming conventions, see “Defining namingconventions”, in the “Managing Models” chapter in the General FeaturesGuide.

Parameters

Parameter Type Description

<uppercase-block-input>

Complex tem-plate

Parameter used to input text

Output The output is the uppercase block input that is changed to uppercasecharacters.

In the following example, the variable %Comment% is ‘hello world’ and itis converted to ‘HELLO WORLD’.

.uppercase%Comment%.enduppercase

.vbscript macro

The vbscript macro is used to embed VB script code inside a template. It is ablock macro.

A vbscript macro has the following syntax:

.vbscript [’(’ <script-param-list> ’)’]<vbscript-block-input>.endvbscript [’(’ <tail> ’)’]

Parameters

Parameter Type Description

<script-param-list>(optional)

List of argumentsof type simple-template separatedby commas

Parameters that are passed onto thescript through the ScriptInputArraytable

<vbscript-block-input>

Text VB script text

<tail> Text Appended to the output, if there is one

346

Page 353: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

Output The output is the ScriptResultArray value.

Example:

.vbscript(hello, world)ScriptResult = ScriptInputArray(0) + " " + ScriptInputArray(1).endvbscript

The output is:

hello world

Note: the active object of the current translation scope can be accessedthrough the ActiveSelection collection as ActiveSelection.Item(0).

+ For more information on ActiveSelection, see “Global properties”, in the“Accessing objects using VBScript” chapter in the General Features Guide .

.warning macro

The warning macro is used to output a warning during translation. It may beuseful to display a message when an inconsistency is detected whileapplying the template on a particular object. Warnings do not stopgeneration, they do not appear in the generated file either. The content of thewarning message is the evaluated simple-template, passed by parameter.

It is displayed in the Output window (located in the lower part of the mainwindow) during generation, and is shown in the code from the Preview tabof the object, if at least one error has been encountered.

.warning <message>

Parameters

Parameter Type Description

<message> Simple template Warning message

Example:

.warning bidirectional associations between inner classes arenot supported

347

Page 354: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Generation tips and techniques

Generation tips and techniquesThis section provides additional information about the GTL mechanism.

Sharing templates

In the GTL mechanism you can share conditions, templates andsub-templates to ease object language maintenance and readability.

Sharing conditions

A template can contain a condition expression. You can also createtemplates to share long and fastidious condition expressions:

Template name Template value

%ConditionVariable% .bool (condition)

Instead of repeating the condition in other templates, you simply use%ConditionVariable% in the conditional macro:

.if (%ConditionVariable%)

Example The template %isInner% contains a condition that returns true if theclassifier is inner to another classifier.

.bool (%ContainerClassifier%!=null)

This template is used in the %QualifiedCode% template used to define thequalified code of the classifier:

.if (%isInner%)%ContainerClassifier.QualifiedCode%::%Code%.else%Code%.endif

Using recursive templates

A recursive template is a template that is defined in terms of itself.

Example Consider three classes X, Y, and Z. X is inner to Y, and Y is inner to Z.

The variable %topContainerCode% is defined to retrieve the value of theparent container of a class.

The value of the template is the following:

348

Page 355: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

.if (%isInner%)%ContainerClassifier.topContainerCode%.else%Code%.endif

If the class is inner to another class, %topContainerCode% is applied to thecontainer class of the current class(%ContainerClassifier.topContainerCode%).

If the class is not an inner class, the code of the class is generated.

Using environment variables

In GTL, you can access variables located in the General Options feature ofthe Tools menu. If the variable has not been set, a null string is returned.

Using new lines in head and tail string

The head and tail string are useful because they are only generated whennecessary, it is especially useful when using new lines ‘\n’. They are addedrespectively at the beginning, and at the end of the generated code from amacro. If no code is generated, the head and tail string do not appear in thegenerated code.

Example You want to generate the name of a class and its attributes under thefollowing format (one empty line between attributes and class):

Attribute 1 attr1Attribute 2 attr2

Class

You can insert the separator “\n” after the .foreach statement to make sureeach attribute is displayed in a separate line. You can also add “\n\n “ afterthe .endfor statement to insert an empty line after the attribute list and beforethe word “Class”.

.foreach (Attribute) ("\n")Attribute %Code%.endfor ("\n\n")Class

Additional example Consider a class named Nurse, with a class code Nurse, and two attributes:

Attribute name Data type Initial value

NurseName String __

NurseGender Char ‘F’

349

Page 356: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Generation tips and techniques

The following templates are given as examples, together with the textgenerated for each of them, and a description of each output:

Template 1

class "%Code%" {// Attributes.foreach_item(Attributes)%DataType% %Code%.if (%InitialValue%)

= %InitialValue%.endif

.next// Operations.foreach_item(Operations)%ReturnType% %Code%(...).next}

Text generated 1

class "Nurse" {

// Attributes String nurseName char nurseGender = ’F’ // Operations}

Description 1 Below the class code, the code is generated on one line. It is an example of ablock macro (.if, .endif macro).

Template 2 (new line)

class "%Code%" {// Attributes.foreach_item(Attributes)%DataType% %Code%.if (%InitialValue%)

= %InitialValue%.endif

.next(\n)// Operations.foreach_item(Operations)%ReturnType% %Code%(...).next(\n)}

Text generated 2

class "Nurse" {

// Attributes String nurseName

char nurseGender = ’F’ // Operations}

Description 2 String nurseName and char nurseGender are on two lines

350

Page 357: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

In Template 1, String nurseName and char nurseGender were on the sameline, whereas in Template 2, the addition of the \n at .next(\n) puts StringnurseName and char nurseGender on two different lines.

In addition, // Operations is displayed in the output even if there is nooperation (see Description 3).

Template 3 (blank space)

class "%Code%" {.foreach_item(Attributes, // Attributes\n,\n)%DataType% %Code%.if (%InitialValue%)= %InitialValue%.endif.next(\n).foreach_item(Operations, // Operations\n,\n)%ReturnType% %Code%(...).next(\n)}

Text generated 3

class "Nurse" {// Attributes

String nurseName

char nurseGender = ’F’

}

Description 3 The blank space between .foreach_item(Attributes, and // Attributes\n,\n)is not generated, as shown in the output: class “Nurse” {// Attributes insteadof . . . . { // Attributes

// Operations is not displayed in the output because it is positioned in the.foreach_item macro. It is positioned in the head of the macro for thispurpose.

Template 4 (blank space)

class "%Code%" {\n.foreach_item(Attributes," // Attributes\n",\n)%DataType% %Code%[ = %InitialValue%].next(\n).foreach_item(Operations," // Operations\n",\n)%ReturnType% %Code%(...).next(\n)}

Text generated 4

class "Nurse" {

351

Page 358: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Generation tips and techniques

// Attributes

String nurseName

char nurseGender = ’F’

}

Description 4 The double quote characters (“”) in “ // Attributes\n” allows you to insert ablank space as shown in the output: // Attributes

Newline preceding the macroThe newline immediately preceding a macro is ignored as well as the oneimmediately following it, as in the following example:

Jack .set_value(v, John) Paul

yields: JackPaul

instead of: Jack

Paul

Using parameter passing

You can pass in, out or in/out parameters to a template through localvariables by taking advantage of nested translation scopes. You can accessparameters with the %@<number>% variable.

Example Class templates:

Template 1

<show> template<<<Class "%Code%" attributes :// Public%publicAttributes%

// Protected%protectedAttributes%

// Private%privateAttributes%>>>

Template 2

352

Page 359: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Chapter 8. Generation Reference Guide (GTL)

<publicAttributes> template<<<.foreach_item(Attributes).if (%Visibility% == +)%DataType %Code%.endif.next(\n)>>>

Template 3

<protectedAttributes> template<<<.foreach_item(Attributes).if (%Visibility% == #)%DataType %Code%.endif.next(\n)>>>

Template 4

<privateAttributes> template<<<.foreach_item(Attributes).if (%Visibility% == -)%DataType %Code%.endif.next(\n)>>>

To give you more readability and to enhance code reusability, these fourtemplates can be written in just two templates by using parameters:

First template

<show> template<<<Class "%Code%" attributes :// Public%attributes(+)%

// Protected%attributes(#)%

// Private%attributes(-)%>>>

Second template

353

Page 360: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Generation tips and techniques

<attributes> template<<<.foreach_item(Attributes).if (%Visibility% == %@1%)%DataType %Code%.endif.next(\n)>>>

Description The first parameter in this example %attributes(+, or #, or -)% can beaccessed using the variable %@1%, the second parameter when it exists, isaccessed using the %@2% variable, etc . . .

354

Page 361: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

Symbols+ operator 310? operator 310

Aabort_command macro 325abstract

class 13data type 100data type attribute 101

Add 63AddColIndex 82AddColnChck 73AddColnCheck 73AdditionalDataTypes 259AddJoin 110AddQuote 54AddTableCheck 68ADTComment 100AfterCreate 63, 115AfterDatabaseGenerate 49AfterDatabaseReverseEngineer 49AfterDrop 63AfterModify 63AKeyComment 88AllowedADT 68, 100, 101AllowNullableColn 88AltEnableAddColnChk 73AlterFooter 56AlterHeader 56AlterTableFooter 68AlterTableHeader 68assignment macro 323association 13association role 271auto attach 293autofix 204, 207

Bbackup

resource file 3

BasicDataTypes 259BeforeCreate 63BeforeCreateDatabase 97BeforeDatabaseGenerate 49BeforeDatabaseReverseEngineer 49BeforeDrop 63BeforeModify 63Bind 73, 98, 113, 114BinDefault 98bitmap join index 110block 307

macro 323, 325terminator 53

BlockComment 53bool macro 326break macro 326browse 222browse tool 222

Ccalculated collection 184

dependencies 184GTL 184impact analysis 184properties 185reports 184script 185target stereotype 185target type 185

CanCreate event handler 211CanLinkKind event handler 211CaseSensitivityUsingQuote 54category 293

add to resource editor 7change_dir macro 326CharFunc 58check script 204CheckNull 73CheckOnCommit 89choreography category (process language) 276class

abstract 13

355

Page 362: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

attribute 13concrete 13metamodel 13

CloseDatabase 97Cluster 82code naming conventions 166collection 13

composition 13member 307, 310navigable 13scope 312

collection macro 327ColnDefaultName 103ColnRuleName 103column 73

default variable 68ColumnComment 73command macro 323commands category 261comment & // macro 327Commit 58compare

resource file 8complement language generation 293composition 13ConceptualDataTypes 259concrete class 13conditional block 319conditional macro 323constants category (object language) 259ConstName 68, 73, 86, 88, 89conversion table

resource 2convert_code macro 328convert_name macro 329ConvertFunc 58copied resource 6Count 310Create 63create_path macro 330CreateBeforeKey 82CreateBody 115CreateDefault 98CreateFunc 105criteria 163, 173custom check 163, 204

define autofix 207

define global script 208define script 205global variables 209properties 204run 209troubleshooting 209

custom symbol 163custom symbol (profile) 202custom tool 163

stereotype 172CustomFunc 105CustomProc 105

Ddata type

extended attribute 179data type category 29, 126data types 281data types category (object language) 259database 97

generation 37redefining generation order 61

datahandling category (process language) 276date format 55DateFunc 58db package 115

cursor 116exception 116parameter 117pragma 116procedure 116type 116variable 116

DBMS 27category 28data type category 29editor 28extended attributes 130family 30file name 30general category 29, 51generation 31modify 28object category 29, 61ODBC category 29overview 28profile category 129

356

Page 363: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

properties 30query 31resource 2reverse engineering 31script category 29SQL category 53sql category 29statement 31

DBProcedureBody 116DclDelIntegrity 89DclUpdIntegrity 89default 120

name 169variable 68variable quotes 68

DefaultDataType 259DefaultTriggerName 107DefIndexColumn 82DefIndexType 82DefineColnCheck 73DefineJoin 89DefineTableCheck 68DefOptions 63delete macro 330delimiter 53dependency 15, 184dereferencing operator 309derived attribute 13destinationKind 211destinationStereotype 211dimension 123domain 98Drop 63DropColnChck 73DropColnComp 73DropFunc 105DropTableCheck 68

Eenable 63

selection in file generation 166trace mode 259, 275, 281, 293

EnableAdtOnColn 100EnableAdtOnDomn 100EnableAlias 112EnableAscDesc 82EnableBindRule 73, 98

EnableChangeJoinOrder 89EnableCheck 51, 98EnableCluster 82, 86, 88, 89EnableComputedColn 73EnableConstname 51EnableDefault 73, 98EnableDtbsPrefix 54EnablefKeyName 89EnableFunc 105EnableFunction 82EnableIdentity 73EnableIntegrity 51EnableManyDatabases 97EnableMultiCheck 51EnableMultiFile 56EnableMultiTrigger 107EnableNotNullWithDflt 73EnableOption 61EnableOwner 82, 98, 105, 107, 111EnableOwnerPrefix 54encoding 265entry

add to resource editor 7resource editor 4, 7type 7

error macro 331error message 320

syntax 320translation error 321

error reporting macro 323escape sequence 319Event 107event handler 211

CanCreate 211CanLinkKind 211global variable 211Initialize 211input box 211msgbox 211properties 211script 211validate 211

EventDelimiter 107events category (object language) 259.EXA file 290exclude metaclass from model 166execute_command macro 331

357

Page 364: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

execute_vbscript macro 332export extended model definition 292extended attribute 130, 163, 175

complete 176computed 176data type 176, 179default value 176edit method 176form 187generation 175import from previous versions 288list of values 176, 179object definition extension 175profile 187properties 176specific tab 187template 176type 179

extended attributesphysical option 136

extended collection 181inverse name 182properties 182target stereotype 182target type 182

extended generation 299specific menu command 300

extended model definition 283, 284auto attach 293category 284, 293complement language generation 293complement main generation 299create 285editor 293enable trace mode 293entry 284export 292extended generation 299family 293generate 299generate for separate target 299generation category 296generation parameters 284generation targets 295generic 285import 287, 291language generation complement 296

modify 284profile 284properties 293resource 2specific 285, 287subfamily 293

extended object 124extended objects

generation 48reverse engineering 48

extended queries 41extension 33, 41external shortcut

set_interactive_mode 341

FF12 222family 30, 259, 275, 281, 293file

AlterFooter 56AlterHeader 56EnableMultiFile 56Footer 56Header 56ScriptExt 56StartCommand 56TableExt 56TrgFooter 56TrgHeader 56TrgUsage1 56TrgUsage2 56TriggerExt 56Usage1 56

file formatbin 21case study 24DTD 21metamodel 22modify 26object definition 21object reference 21OID 26overlapping collections 21XML 21XML editor 21XML markups 21

First 310

358

Page 365: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

FKAutoIndex 89FKeyComment 89Footer 56foreach_item macro 333foreach_line macro 335foreach_part macro 335form

dialog box 187extended attributes 187getting started with forms 193physical option 136physical options 192profile 187property tab 187

format category (DBMS) 54format macro 323format variables 313function based index 45FunctionComment 105

Ggeneral category (DBMS) 28, 29, 51

EnableCheck 51EnableConstname 51EnableIntegrity 51EnableMultiCheck 51SqlSupport 51UniqConstName 51

generalization 13generate 31

for an extended model definition 299post-generation 229pre-generation 229

generated file 163, 222, 305create 222

generated files category (object language) 265generation

extended objects 48redefining order 61script after 49script before 49

generation category (extended model definition) 296generation category (object language) 261generation category (process language) 275generation category (XML language) 281generation commands category 261generation options category 261

generation targets 295generation tasks category 261Generation Template Language (GTL) 303GenerationOrder 61global

script 204, 208, 209variable 209variables 311

global script 185go to super-definition 7GrantOption 118, 119group 113GroupFunc 58GTL 17, 33, 184, 261, 275, 281, 303

calculated attributes 17calculated collections 19conditional block 319define 304environment variables 349error message 320escape sequences 319head string 349inheritance 304, 316macros 323metadata documentation 304Metamodel Objects Help 304parameter passing 352polymorphism 304, 317recursive templates 348share templates 348shortcut translation 318tail string 349template 305template overloading 317template overriding 316tips and techniques 348translation scope 314variables 306

Hhead string 349Header 56

Iicon for stereotype 171identifierdelimiter 53if macro 337

359

Page 366: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

illegal characters 166illegal characters (object language) 259IllegalChar 54impact analysis 184implementation category (process language) 276import

.EXA file 290extended attributes 288extended model definition 291

index 82Footer 82Header 82

IndexComment 82IndexType 82inheritance 13, 304, 316Initialize event handler 211input box 211Install 100internal transformation object 226IsEmpty 310iterative macro 323

Jjoin index 110

EnableJidxColn 110EnableOwner 110

JoinIndexComment 110

Kkey 88keyword 58

LLineComment 53list

resource file 6ListOperators 58live database

extend reverse engineering query 41reverse engineering 37reverse engineering function-based index 45reverse engineering physical options 43reverse engineering qualifiers 46

local variables 311log macro 338loop macro 323

lowercase macro 339LowerCaseOnly 54

Mmacro 323

abort_command 325assignment 323block 323, 325bool 326break 326change_dir 326collection 327command 323comment & // 327conditional 323convert_code 328convert_name 329create_path 330delete 330error 331error reporting 323execute_command 331execute_vbscript 332foreach_item 333foreach_line 335foreach_part 335format 323if 337iterative 323log 338loop 323lowercase 339object 339output 323replace 340set_interactive_mode 341set_object 342set_value 343simple 323unique 344unset 345uppercase 345vbscript 346warning 347

MandIndexType 82MaxColIndex 82MaxConstLen 61, 68, 73, 88, 89

360

Page 367: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

MaxDefaultLen 103MaxFuncLen 105Maxlen 63MaxScriptLen 54MDA 225menu 219

add command tool 220add separator tool 220add submenu tool 220contextual 219create command tool 220location 220main 219menu tab 220properties 220xml tab 220

menu for extended generation 300merge

resource file 9metaclass 165, 166

code naming conventions 166enable selection in file generation 166exclude from model 166illegal characters 166sub-classing stereotype 170use as 170use stereotype as metaclass 170

metamodelassociation 13calculated attributes 17calculated collections 19classes 13collection 13color code 15concepts 13features 13navigate 15objects 13packages 12PdCommon 12PowerDesigner 12public names 13symbols 13use with GTL 17use with VBS 16

Metamodel Objects Help 304method 216

global variable 217properties 217script 217type 217

ModifiableAttributes 63modify

DBMS 28extended model definition 284object language 258process language 274XML language 280

ModifyColnComp 73ModifyColnDflt 73ModifyColnNull 73ModifyColumn 73msgbox 211

Nnamings category (object language) 259navigable collection 13not certified 6NullRequired 73, 81NumberFunc 58

O.O formatting syntax 155object

definition 21member 307, 308reference 21scope 307, 312

object category (DBMS) 29abstract data type 100abstract data type attribute 101Add 63column 73Create 63database 97db package 115db package cursor 116db package exception 116db package parameter 117db package pragma 116db package procedure 116db package type 116db package variable 116default 120

361

Page 368: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

DefOptions 63dimension 123domain 98Drop 63enable 63extended object 124group 113index 82join index 110key 88Maxlen 63ModifiableAttributes 63permission 119pkey 86privilege 118procedure 105qualifier 111reference 89result column 123ReversedStatements 63role 114rule 103sequence 111SqlAttrQuery 63SqlListQuery 63SqlOptsQuery 63storage 96synonym 112table 68tablespace 95trigger 107user 102view 93web operation 121web parameter 122web service 121

object language 257, 258association role 271constants category 259data types category 259enable trace mode 259events category 259family 259generated files category 265generation category 261modify 258namings category 259

ObjectContainer 271profile category 265properties 259resource 2settings category 259subfamily 259templates category 269

object macro 339ObjectContainer 271ODBC category 28, 29OID 26open

resource file 5open related diagram 15OpenDatabase 97operator 308–311

* 309+ 309? 309

operator + 310operator ? 310options category 261OtherFunc 58outer scope 312output macro 323overlapping collections 21overload 317override 316

Pparameter passing 352ParameterTypes 116PdCommon 12Permission 68, 73, 105permission (object) 119physical option 135

adding to form 192composite 139default value 138extended attributes 136form 136, 192list of values 138profile 192repeat 141specified by a value 137storage 139tablespace 139

362

Page 369: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

variable 137without name 138

Physical Options (Common) tab 135Physical Options tab 135PkAutoIndex 86pkey 86PKeyComment 86platform-independent model 225platform-specific model 225polymorphism 304, 317post-transformation 229power evaluation operator 310PowerDesigner

resources 2pre-transformation 229privilege 118procedure 105ProcedureComment 105process language 273, 274

choreography category 276datahandling category 276enable trace mode 275family 275generation category 275implementation category 276modify 274properties 275resource 2settings category 276subfamily 275

profile 2, 161, 162add a metaclass 165add transformation 229calculated collection 184case study 231create generated file 222create template 222criteria 163, 173custom check 163, 204custom symbol 202custom symbol and tool 163event handler 211extended attribute 163, 175extended collection 181form 187generated file 222generated file & template 163

menu 219metaclass extension 163method 216physical options 192properties 229stereotype 163, 168template 222transformation 29, 225, 229, 296

profile category (DBMS) 28, 129profile category (object language) 265public name 13

Qqualifier 46, 111quote 53

default variable 68

Rreference 89Remove 100Rename 68, 73replace macro 340report language

resource 2report template

resource 2reports 184ReservedDefault 58ReservedWord 58resource

conversion table 2DBMS 2extended model definition 2object language 2process language 2profile 2report language 2report template 2XML language 2

resource editoradd category 7add entry 7add item 7category 4, 7copied resource 6create category 7create entry 7

363

Page 370: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

define 3drag & drop categories 7drag & drop entries 7edit menu 7entry 4, 7entry type 7generation commands category 261generation options category 261generation tasks category 261go to super-definition 7modify 6rename category 7search 7shared resource 6toolbar 4use 4

resource filebackup 3compare 6, 8import 6import DEF 6list 6merge 6, 9not certified 6open 5path 6properties 6save 6save all 6

result column 123reuse list of values 179reverse engineering 31

extended objects 48function based index 45physical options 43qualifiers 46script after 49script before 49

ReversedStatements 36, 63RevokeOption 118, 119role 114rule 103RuleComment 103

Sscope 312script category 28, 29

script error (VB) 209script reverse engineering 36ScriptExt 56select

resource file for comparison 8resource file for merge 9

sequence 111SequenceComment 111set_interactive_mode 341

external shortcut 341set_object macro 342set_value macro 343settings category (object language) 259settings category (process language) 276settings category (XML language) 281share template 348shared resource 6shortcut

open target model 341set_interactive_mode 341

shortcut translation in GTL 318simple macro 323sourceKind 211sourceStereotype 211SQL category 29, 53

block terminator 53BlockComment 53delimiter 53format 54identifierdelimiter 53LineComment 53quote 53SqlContinue 53terminator 53

SQL statementvariable format 158variables 155

SqlAkeyIndex 88SqlAttrQuery 63SqlChckQuery 68, 73SqlContinue 53SqlListChildrenQuery 89, 113, 114SqlListDefaultQuery 98SqlListQuery 63SqlListRefrTables 68SqlListSchema 68, 93SqlOptsQuery 63

364

Page 371: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

SqlPermQuery 68, 73, 93, 102, 105, 113, 114SqlStatistics 73SqlSupport 51SqlSysIndexQuery 82SqlXMLTable 68SqlXMLView 93StartCommand 56stereotype 168

attach icon 171attach tool 172create 168default name 169properties 169sub-classing 170use as metaclass 170

storage 96physical option 139

StorageComment 96sub-classing stereotype 170subfamily 259, 275, 281, 293synonym 112System 118

Ttable 68

Footer 68Header 68

TableComment 68TableExt 56tablespace 95tablespace physical option 139TablespaceComment 95tag 227tail string 349target type 182, 185tasks category 261template 163, 222, 305

browse tool 222create 222overload 317overriding 316recursive 348share 348sharing conditions 348translate shortcut 318translation scope 314

template for extended attribute 176

templates category (object language) 269terminator 53Time 107time format 55tips and techniques 348toolbar

resource editor 4transformation 225

add to profile 229create 226dependencies 226internal transformation object 226MDA 225post-generation 229pre-generation 229profile 29, 229, 296profile properties 229properties 226script 226script controls 226tag to identify origin 227VBS 226

translation scope 314TrgFooter 56TrgHeader 56TrgUsage1 56TrgUsage2 56trigger 107trigger template items 30trigger templates 30TriggerComment 107TriggerExt 56TypeList 68, 93typographic conventions v

UUddtComment 98UddtDefaultName 103UddtRuleName 103UML profile 162Unbind 73, 98, 113, 114, 120UniqConstAutoIndex 88UniqConstName 51UniqConstraintName 68UniqInTable 88UniqName 82unique macro 344

365

Page 372: Advanced User Documentation - infocenter-archive.sybase.cominfocenter-archive.sybase.com/help/topic/com...Sybase 365, Sybase Central, Sybase Client/Server Interfaces, Sybase Development

Index

unset macro 345uppercase macro 345UpperCaseOnly 54Usage1 56use as metaclass 170UseBlockTerm 53UseErrorMsgTable 107UseErrorMsgText 107user 102UserTypeName 98UseSpFornKey 89UseSpPrimKey 86

VValidate event handler 211variable 143, 155variable (DBMS)

abstract data type 149abstract data type attribute 150ASE & SQL Server 150column 149database security 145database synchronization 144domain 150domain and column checks 147format 158generation 143index 151index column 152join index 151key 154metadata 146physical options 137procedure 143, 155reference 152reference column 153reverse engineering 144rules 150sequence 151table 147trigger 143triggers 154views 154

variable (GTL) 306, 307block 307collection member 307, 310collection scope 312

environment 349format 313global 307, 311local 307, 311object member 307, 308object scope 307, 312outer scope 312

VBS 16vbscript macro 346view 93ViewCheck 93ViewComment 93ViewStyle 93volatile attribute 309

Wwarning macro 347web operation 121web parameter 122web service 121

XXML language 279, 280

data types 281enable trace mode 281family 281generation category 281modify 280properties 281resource 2settings category 281subfamily 281

XML markups 21

Z.Z formatting syntax 155

366


Recommended