Object-Oriented Modeling PowerDesigner...

758
Object-Oriented Modeling PowerDesigner ® 15.2 Windows

Transcript of Object-Oriented Modeling PowerDesigner...

  • Object-Oriented Modeling

    PowerDesigner® 15.2

    Windows

  • DOCUMENT ID: DC38086-01-1520-01LAST REVISED: February 2010Copyright © 2010 by Sybase, Inc. All rights reserved.This publication pertains to Sybase software and to any subsequent release until otherwise indicated in new editions ortechnical notes. Information in this document is subject to change without notice. The software described herein is furnishedunder a license agreement, and it may be used or copied only in accordance with the terms of that agreement.To order additional documents, U.S. and Canadian customers should call Customer Fulfillment at (800) 685-8225, fax (617)229-9845.Customers in other countries with a U.S. license agreement may contact Customer Fulfillment via the above fax number. Allother international customers should contact their Sybase subsidiary or local distributor. Upgrades are provided only atregularly scheduled software release dates. No part of this publication may be reproduced, transmitted, or translated in anyform or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of Sybase,Inc.Sybase trademarks can be viewed at the Sybase trademarks page at http://www.sybase.com/detail?id=1011207. Sybase andthe marks listed are trademarks of Sybase, Inc. A ® indicates registration in the United States of America.Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and othercountries.Unicode and the Unicode Logo are registered trademarks of Unicode, Inc.All other company and product names used herein may be trademarks or registered trademarks of the respective companieswith which they are associated.Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.Sybase, Inc., One Sybase Drive, Dublin, CA 94568

    http://www.sybase.com/detail?id=1011207

  • Contents

    PART I: Building OOMs ........................................1

    CHAPTER 1: Getting Started with Object-OrientedModeling ......................................................3

    Creating an OOM ....................................................5OOM Properties ................................................7

    CHAPTER 2: Building Use Case Diagrams ..................9Use Case Diagram Objects ........................................9Creating a Use Case Diagram ...................................10Use Cases (OOM) ..................................................10

    Creating a Use Case .........................................11Use Case Properties .........................................11

    Use Case Property Sheet Specification Tab .......12Use Case Property Sheet Implementation

    Classes Tab .........................................12Use Case Property Sheet Related Diagrams Tab

    .......................................................13Actors (OOM) .......................................................13

    Creating an Actor ............................................15Actor Properties .............................................15

    Actor Property Sheet Implementation ClassesTab ...................................................16

    Actor Property Sheet Related Diagrams Tab ......18Reusing Actors ...............................................18

    Use Case Associations (OOM) ...................................18Creating a Use Case Association ..........................19Use Case Association Properties ..........................19

    Object-Oriented Modeling iii

  • CHAPTER 3: Building Structural Diagrams ...............21Class Diagram Basics ..............................................21

    Class Diagram Objects ......................................22Creating a Class Diagram ...................................23

    Composite Structure Diagram Basics ..........................24Composite Structure Diagram Objects ...................24Creating a Composite Structure Diagram ................26

    Object Diagram Basics ...........................................26Object Diagram Objects ....................................27Creating an Object Diagram ...............................28

    Package Diagram Basics ..........................................28Package Diagram Objects ..................................28Creating a Package Diagram ...............................29

    Classes (OOM) ......................................................29Creating a Class ..............................................30Class Properties ..............................................30

    Class Property Sheet Detail Tab ....................33Class Property Sheet Generic Tab ..................33Class Property Sheet Script Tab ....................34Class Property Sheet Preview Tab ..................35

    Creating Java BeanInfo Classes ...........................37Creating a Java BeanInfo Class from the

    Language Menu ....................................39Creating a Java BeanInfo Class from the Class

    Contextual Menu ..................................39Generic Types and Methods ................................40

    Creating Generic Types ..............................40Creating Generic Methods ...........................40Creating a Specialized Classifier ...................41Creating a Bound Classifier .........................42Generic Type Example ...............................42

    Composite and Inner Classifiers ...........................43Creating Inner Classifiers ............................44

    Contents

    iv PowerDesigner

  • Creating a Composite Classifier Diagram .........44Attaching a Classifier to a Data Type or a Return Type

    ..............................................................45Attaching a Classifier ................................46

    Viewing the Migrated Attributes of a Class ..............46Packages (OOM) ................................................... 48

    OOM Package Properties ...................................50Previewing the Code of a Package in an OOM ...........51Defining the Diagram Type of a New Package ...........51

    Interfaces (OOM) ..................................................52Creating an Interface .......................................52Interface Properties .........................................53

    Interface Property Sheet Generic Tab .............54Objects (OOM) .....................................................55

    Creating an Object ..........................................56Object Properties ...........................................57

    Object Property Sheet Attribute Values Tab .....57Linking a Classifier to an Object ..........................59

    Parts (OOM) ........................................................ 60Creating a Part ...............................................61Part Properties ...............................................61

    Ports (OOM) ........................................................62Creating a Port ...............................................63Port Properties ...............................................63Redefining Parent Ports ....................................65

    Attributes (OOM) ..................................................65Creating an Attribute .......................................66Attribute Properties .........................................66

    Attribute Property Sheet Detail Tab ...............68Adding Getter and Setter Operations to a Classifier ...69Copying an Attribute to a Class, Interface, or

    Identifier ..................................................70Overriding an Attribute in PowerBuilder .................72

    Adding an Inherited Attribute to a Class ..........72Identifiers (OOM) ..................................................73

    Contents

    Object-Oriented Modeling v

  • Creating an Identifier .......................................73Creating a primary identifier when you create

    the class attributes ...............................74Defining the Primary Identifier from the List of

    Identifiers ..........................................74Identifier Properties ........................................75Adding Attributes to an Identifier ........................75

    Operations (OOM) .................................................76Creating an Operation ......................................76

    Creating a User-Defined Operation ................77Creating a Standard Operation .....................77Inheriting and Overriding Operations from

    Parent Classifiers ..................................79Creating an Implementation Operation ...........79Copying an Operation to Another Class ...........80

    Operation Properties ........................................81Operation Property Sheet Implementation Tab

    .......................................................83Operation Property Sheet Parameters Tab ........84Operation Property Sheet Generic Tab ............86

    Associations (OOM) ...............................................86Creating an Association ....................................88Associations Properties .....................................88

    Associations Property Sheet Detail Tab ...........89Association Implementation ...............................91

    Understanding the Generated Code ...............93Creating an Association Class ..............................94Migrating Association Roles in a Class Diagram .........95

    Migrating Navigable Roles ...........................95Rebuilding Data Type Links ................................96Linking an Association to an Instance Link ..............96

    Generalizations (OOM) ...........................................97Creating a Generalization ..................................98Generalization Properties ..................................99

    Dependencies (OOM) ...........................................100

    Contents

    vi PowerDesigner

  • Creating a Dependency ...................................102Dependency Properties ...................................102

    Realizations (OOM) ..............................................103Creating a Realization .....................................104Realization Properties .....................................104

    Require Links (OOM) ............................................105Creating a Require Link ...................................105Require Link Properties ...................................105

    Assembly Connectors (OOM) ..................................106Creating an Assembly Connector ........................107Assembly Connector Properties ..........................107

    Delegation Connectors (OOM) ................................ 108Creating a Delegation Connector ........................109Delegation Connector Properties ........................109

    Annotations (OOM) ..............................................109Attaching an Annotation to a Model Object ...........110Creating a New Annotation Type ........................111Using the Annotation Editor ..............................114

    Instance Links (OOM) ...........................................114Creating an Instance Link .................................117Instance Link Properties ..................................117

    Domains (OOM) .................................................. 118Creating a Domain .........................................119Domain Properties .........................................119

    Domain Property Sheet Detail Tab ................121Domain Property Sheet Other Tabs ...............122

    Updating Attributes Using a Domain in an OOM .......122Check Parameters (OOM) ......................................122

    Setting Standard Check Parameters for Objects in anOOM .......................................................123

    Defining Additional Check Parameters for Objects inan OOM ...................................................123

    CHAPTER 4: Building Dynamic Diagrams ...............125

    Contents

    Object-Oriented Modeling vii

  • Communication Diagram Basics ...............................125Communication Diagram Objects ........................127Creating a Communication Diagram ....................127Creating a Communication Diagram from a Sequence

    Diagram ..................................................127Sequence Diagram Basics ......................................128

    Creating a Sequence Diagram ............................130Creating a Sequence Diagram from a Communication

    Diagram ..................................................130Sequence Diagram Objects ...............................130

    Activity Diagram Basics ........................................131Activity Diagram Objects .................................133Creating an Activity Diagram ............................133

    Statechart Diagram Basics .....................................134Defining a Default Classifier in the Statechart

    Diagram ..................................................135Statechart Diagram Objects ..............................136Creating a Statechart Diagram ...........................136

    Interaction Overview Diagram Basics .......................137Interaction Overview Diagram Objects .................137Creating an Interaction Overview Diagram ............138

    Messages (OOM) ..................................................138Creating a Message ........................................140Message Properties ........................................140

    Message Property Sheet Detail Tab ...............141Creating Create and Destroy Messages in a Sequence

    Diagram ..................................................143Creating Create Messages ..........................144Creating Destroy Messages .........................144

    Creating a Recursive Message in a Sequence Diagram.............................................................146

    Creating a Recursive Message WithoutActivation .........................................147

    Creating a Recursive Message with Activation......................................................147

    Contents

    viii PowerDesigner

  • Messages and Gates ........................................147Sequence Numbers ........................................ 149

    Moving Sequence Numbers ........................ 150Inserting Sequence Numbers ...................... 151Increasing Sequence Numbers in a

    Communication Diagram ........................151Decreasing Sequence Numbers in a

    Communication Diagram ........................152Activations (OOM) ...............................................152

    Creating an Activation .................................... 152Creating an Activation at Creation of the

    Message ............................................152Creating an Activation from a Diagram: .........153

    Attaching a Message to an Activation ...................153Detaching a Message from an Activation ...............154Overlapping Activations ...................................154Moving an Activation ...................................... 154Resizing an Activation .....................................155

    Interaction References and Interaction Activities (OOM)...................................................................155

    Creating an Interaction Reference ...................... 156Creating an Interaction Activity ......................... 156Interaction Reference and Interaction Activity

    Properties ................................................157Manipulating Interaction References ................... 157

    Interaction Fragments (OOM) .................................158Creating an Interaction Fragment .......................158Interaction Fragment Properties ........................ 158

    Interaction Fragment Property Sheet Sub-Regions Tab ....................................... 159

    Manipulating Interaction Fragments .................... 160Activities (OOM) .................................................161

    Creating an Activity ....................................... 162Activity Properties ......................................... 162

    Activity Property Sheet Action Tab ............... 163

    Contents

    Object-Oriented Modeling ix

  • Activity Property Sheet Input Parameters andOutput Parameters Tabs ........................ 164

    Activity Property Sheet Sub-Activities Tab ......164Specifying Activity Parameters ..........................164Specifying Action Types ...................................165

    Example: Using the Call Action Type .............166Example: Reading and Writing Variables ........169

    Decomposed Activities and Sub-Activities .............171Converting an Activity Diagram to a

    Decomposed Activity ............................173Organization Units (OOM ) .....................................174

    Creating an Organization Unit ...........................174Creating Organization Units with the Swimlane

    Tool ................................................174Organization Unit Properties .............................175Attaching Activities to Organization Units .............176Displaying a Committee Activity ........................176Managing Swimlanes and Pools ..........................177

    Moving, Copying and Pasting Swimlanes .........177Grouping and Ungrouping Swimlanes ............178Creating Links Between Pools of Swimlanes ....180Changing the Orientation of Swimlanes .........181Resizing Swimlanes .................................182Changing the Format of a Swimlane .............182

    Starts ( OOM) .....................................................182Creating a Start ............................................183Start Properties ............................................183

    Ends ( OOM) ......................................................183Creating an End ............................................184End Properties ..............................................184

    Decisions ( OOM) .................................................185Creating a Decision ........................................186Decision Properties ........................................186

    Synchronizations ( OOM) .......................................187Creating a Synchronization ...............................188

    Contents

    x PowerDesigner

  • Synchronization Properties ...............................189Flows ( OOM) .....................................................189

    Creating a Flow ............................................ 190Flow Properties .............................................190

    Object Nodes (OOM) ............................................192Creating an Object Node ................................. 193Object Node Properties ................................... 193

    States (OOM) .....................................................194Creating a State ............................................195State Properties ............................................ 195

    State Property Sheet Actions Tab .................195State Property Sheet Deferred Events Tab ...... 196State Property Sheet Sub-States Tab .............196

    Decomposed States and Sub-states ..................... 196Converting a Statechart Diagram to a

    Decomposed State ............................... 198Transitions (OOM) ...............................................199

    Creating a Transition ...................................... 199Transition Properties ...................................... 200

    Transition Property Sheet Condition Tab ........ 200Transition Property Sheet Trigger Tab ............201

    Events (OOM) .....................................................201Creating an Event ..........................................202Event Properties ........................................... 202

    Event Property Sheet Dependencies Tab ........ 203Event Property Sheet Parameters Tab ........... 203

    Defining Event Arguments ................................ 204Actions (OOM) ....................................................204

    Creating an Action ......................................... 205Action Properties ...........................................205

    Action Property Sheet Condition Tab .............206Junction Points (OOM) ..........................................207

    Creating a Junction Point .................................207Junction Point Properties .................................207

    Contents

    Object-Oriented Modeling xi

  • CHAPTER 5: Building Implementation Diagrams ......209Component Diagram Basics ....................................209

    Component Diagram Objects .............................210Creating a Component Diagram .........................211

    Deployment Diagram Basics ...................................211Deployment Diagram Objects ............................212Creating a Deployment Diagram .........................212

    Components (OOM) ............................................. 212Creating a Component ....................................213

    Using the Standard Component Wizard ..........214Component Properties ....................................214

    Component Property Sheet Interfaces Tab ......216Component Property Sheet Classes Tab .........218Component Property Sheet Files Tab .............219Component Property Sheet Operations Tab .....220

    Creating a Class Diagram for a Component ............221Deploying a Component to a Node ......................221

    Nodes (OOM) ..................................................... 222Creating a Node ............................................223Node Properties ............................................223

    Node Property Sheet Component Instances Tab......................................................224

    Node Diagrams .............................................224Creating a Node Diagram ..........................224Opening a Node Diagram ...........................225Closing a Node Diagram ............................225

    Component Instances (OOM) ..................................225Creating a Component Instance .........................226Component Instance Properties .........................226

    Files (OOM) .......................................................227Creating a File Object .....................................228File Object Properties .....................................228

    Node Associations (OOM) ......................................229

    Contents

    xii PowerDesigner

  • Creating a Node Association .............................229Node Association Properties ..............................230

    CHAPTER 6: Working with Web Services ..............233Defining Web Services Tools ..................................234Defining Web Services Targets ................................236Defining Web Service Components ..........................236

    Web Service Component Properties .....................237Web Service Tab of the Component ..............237WSDL Tab of the Component ......................238WSDL Schema Tab of the Component ............238Preview Tab of the Component ...................238Extended Attributes Tab of the Component ....239

    Creating a Web Service with the Wizard ...............240Creating a Web Service from the Component Diagram

    .............................................................242Defining Data Types for WSDL ............................242

    WSDL Data Type Mappings .........................242Selecting WSDL Data Types ........................243Declaring Data Types in the WSDL ................243

    Web Service Implementation Class ......................243Detail Tab of the Class .............................243Preview Tab of the Class ...........................244

    Managing Web Service Methods ..............................244Creating a Web Service Method ..........................244Web Service Method Properties ..........................245Implementing a Web Service Method in Java ..........246

    Defining the Return Type of an Operation ......246Defining the Parameters of an Operation .......247Implementing the Operation ......................249

    Implementing a Web Service Method in .NET .........251Defining Web Service Method Extended Attributes ...251Defining SOAP Data Types of the WSDL Schema .......252

    Defining Web Service Component Instances ...............253

    Contents

    Object-Oriented Modeling xiii

  • Web Service Tab of the Component Instance ..........254WSDL Tab of the Component Instance ..................255Using Node Properties .....................................255

    Generating Web Services for Java ...........................255Generating JAXM Web Services ..........................256Generating JAX-RPC Web Services ......................257Generating Stateless Session Bean Web Services .....258Generating AXIS RPC Web Services ......................259Generating AXIS EJB Web Services ......................260Generating Java Web Services (JWS) ...................261Testing Web Services for Java ............................261

    Generating Web Services for .NET ...........................261Defining Web Services Generation Options in .NET ...262Defining Web Service Generation Tasks in .NET .......262Generating Web Services in .NET ........................263Generating a .NET Proxy Class for a Web Service .....263

    Define the WSDL Variable ..........................263Generate the Client Proxy Classes ...............263

    Deploying Web Services in .NET .........................264Testing Web Services for .NET ...........................264

    Generating Web Services for Sybase WorkSpace .........265Creating a Java or EJB Web Service for Sybase

    WorkSpace ...............................................265Defining the Java Class Package .........................266Generating the Java or EJB Web Service for Sybase

    WorkSpace ...............................................267Understanding the .svc_java or .svc_ejb File .........267

    Importing WSDL Files ...........................................268Browsing WSDL Files from UDDI .........................270

    PART II: Working with OOMs .............................273

    CHAPTER 7: Generating and Reverse Engineering OOSource Files ...............................................275

    Contents

    xiv PowerDesigner

  • Generating OO Source Files from an OOM ..................275Generating Source Files ...................................275Working with Generation Targets ........................278Defining the Source Code Package ......................278Enabling Trace Mode in Preview Tabs ...................279

    Reverse Engineering OO Source Files into an OOM .......279Reverse Engineering OO Files into a New OOM ........280

    Reverse Engineering Encoding Format ...........281Reverse Engineering into an Existing OOM .............282

    Synchronizing a Model with Generated Files ..............282

    CHAPTER 8: Generating Other Models from an OOM...............................................................285

    Mapping OOM Objects to other Model Objects ............286Managing Object Persistence During OOM to CDM

    Generation .................................................... 287Defining Object Persistence in the OOM ...............287Managing Complex Data Type Persistence .............288Managing Multiplicity for Complex Persistent Data

    Types ......................................................289Managing Object Persistence During OOM to PDM

    Generation .................................................... 292Defining Object Persistence in the OOM ...............292Managing Complex Data Type Persistence .............294Managing Multiplicity for Complex Persistent Data

    Types ......................................................297

    CHAPTER 9: Customizing the OOM Environment .....301Working with Object Language ...............................301

    Previewing the Code of an OOM .........................302Modifying the Code Using Preview ......................303Changing the Object Language of an OOM .............303

    Setting OOM Model Options ................................... 305Setting OOM Display Preferences ............................307

    Contents

    Object-Oriented Modeling xv

  • Extending Your Modeling Environment with ExtendedModel Definitions ............................................ 310

    Creating Links with Extended Dependencies ..............311

    CHAPTER 10: Checking an OOM.........................313Domain Checks ...................................................313Data Source Checks .............................................314Package Checks ..................................................314Actor/Use Case Checks .........................................315Class Checks ......................................................315Identifier Checks ................................................322Interface Checks .................................................322Class/Interface Attribute Checks .............................324Class/Interface Operation Checks ............................325Realization Checks ..............................................327Generalization Checks .........................................327Object Checks ....................................................328Instance Link Checks ...........................................329Message Checks ..................................................329State Checks ......................................................329State Action Checks .............................................330Event Checks .....................................................331Junction Point Checks ..........................................331Activity Checks ..................................................332Decision Checks .................................................332Object Node Checks ............................................333Organization Unit Checks ......................................333Start/End Checks ................................................334Synchronization Checks ........................................334Transition and Flow Checks ...................................335Component Checks ..............................................335Node Checks ......................................................336Component Instance Checks ..................................337Interaction Reference Checks ................................337

    Contents

    xvi PowerDesigner

  • Class Part Checks ................................................338Class/Component Port Checks ................................339Class/component Assembly Connector Checks ............339Association Checks ..............................................340Activity Input and Output Parameter Checks ..............340

    CHAPTER 11: Importing a Rational Rose Model into anOOM........................................................341

    Importing Rational Rose General Objects ..................341Importing Rational Rose Use Case Diagrams ...............342Importing Rational Rose Class Diagrams ....................343Importing Rational Rose Collaboration Diagrams ..........344Importing Rational Rose Sequence Diagrams ..............345Importing Rational Rose Statechart Diagrams .............345Importing Rational Rose Activity Diagrams .................346Importing Rational Rose Component Diagrams ............347Importing Rational Rose Deployment Diagrams ...........348

    CHAPTER 12: Importing and Exporting an OOM in XMIFormat .....................................................349

    Importing XMI Files ..............................................349Exporting XMI Files ..............................................349

    PART III: OOM Target Reference .......................351

    CHAPTER 13: Working with Java ........................353Java Public Classes ..............................................353Java Enumerated Types (Enums) .............................353JavaDoc Comments .............................................358

    Defining Values for Javadoc Tags ........................361Javadoc Comments Generation and Reverse

    Engineering ..............................................364Java 5.0 Annotations ...........................................364

    Contents

    Object-Oriented Modeling xvii

  • Java Strictfp Keyword ..........................................365Enterprise Java Beans (EJBs) V2 .............................365

    Using EJB Types ............................................367EJB Properties ..............................................368Creating an EJB with the Wizard ........................370Defining Interfaces and Classes for EJBs ...............373

    Defining an Interface or a Class for an EJB .....375Defining Operations for EJBs .............................375

    Adding an Operation to the Bean Class ..........376Adding an Operation to an EJB Interface ........377Understanding Operation Synchronization ......378

    Understanding EJB Support in an OOM .................379Understanding EJB Initialization ..................380Understanding EJB Synchronization ..............380Understanding EJB Code Generation .............380

    Previewing the EJB Deployment Descriptor ............383Generating EJBs ............................................385

    What Kind of Generation to Use? .................386Understanding EJB Source and Persistence .....388Generating EJB Source Code and the

    Deployment Descriptor .........................389Generating JARs ............................................390Reverse Engineering EJB Components ..................391

    Enterprise Java Beans (EJBs) V3 .............................392Creating an EJB 3.0 with the Enterprise JavaBean

    Wizard ....................................................392EJB 3.0 BeanClass Properties ............................396EJB 3.0 Component Properties ...........................397

    Adding Further Interfaces and Classes to theEJB .................................................397

    EJB 3.0 Operation Properties ............................398Java Servlets .....................................................399

    Servlet Page of the Component ..........................399Defining Servlet Classes ...................................399Creating a Servlet with the Wizard .....................400

    Contents

    xviii PowerDesigner

  • Understanding Servlet Initialization andSynchronization .........................................401

    Generating Servlets ........................................402Generating Servlet Web Deployment Descriptor

    ......................................................405Generating WARs ...........................................405Reverse Engineering Servlets .............................406

    Java Server Pages (JSPs) .......................................408JSP Page of the Component ..............................408Defining File Objects for JSPs ............................408Creating a JSP with the Wizard ..........................409

    Creating a JSP with the Wizard ...................409Generating JSPs ............................................410

    Generating JSP Web Deployment Descriptor . . .410Reverse Engineering JSPs .................................414

    Generating Java Code ..........................................415Defining Java Environment Variables ...................416Selecting Java Generation Options ......................416Selecting Java Generation Tasks .........................418Generating Java Files .....................................420

    Reverse Engineering Java Code ..............................421Reverse Engineer Java Options Tab .....................423

    Reverse Engineering Java Code Comments .....425

    CHAPTER 14: Working with the Eclipse ModelingFramework (EMF) ........................................427

    EMF Objects ......................................................427EPackages ..................................................427Eclasses, EEnums, and EDataTypes ......................427EAnnotations ...............................................428Eattributes and EEnumLiterals ...........................428EReferences ................................................428EOperations and EParameters ............................429

    Generating EMF Files ...........................................429

    Contents

    Object-Oriented Modeling xix

  • Reverse Engineering EMF Files ...............................430

    CHAPTER 15: Working with IDL ..........................431IDL Objects .......................................................431Generating for IDL ...............................................440Reverse Engineering IDL Files ................................441

    CHAPTER 16: Working with PowerBuilder .............443Full-featured Mapping ..........................................443

    Application .................................................443Structure ...................................................444Function ....................................................444User Object .................................................444Proxy ........................................................444Window .....................................................444

    Minimal Mapping .................................................445Selecting a PowerBuilder Version ............................445

    Selecting a PowerBuilder Version During Generation.............................................................446

    Selecting a PowerBuilder Version During ReverseEngineering ..............................................447

    Generating for PowerBuilder ................................. 448Generated Objects ........................................ 448

    Operation Generated Header .....................448Generating Events ..................................449

    Selecting PowerBuilder Generation Options ...........449Generating Objects for PowerBuilder ............450

    Reverse Engineering PowerBuilder ..........................451Reverse Engineered Objects ............................. 451

    Operation Reversed Header .......................452Overriding Attributes ...............................452

    Selecting PowerBuilder Reverse Engineering Options.............................................................453

    Contents

    xx PowerDesigner

  • Defining PowerBuilder reverse engineeringoptions .............................................454

    PowerBuilder Reverse Engineering Process ............455Reverse Engineering PowerBuilder Objects .....456

    Loading a PowerBuilder Library Model in theWorkspace ...............................................457

    CHAPTER 17: Working with VB .NET ....................459What Is Automatically Generated ............................459Supported VB .NET Objects ...................................460

    Inheritance & Implementation ...........................460Namespace ..................................................460Project .......................................................460Accessibility ................................................461Class .........................................................462Structure ...................................................462Interface ....................................................463Nested Types ................................................463Module ......................................................463Enumeration ...............................................463Custom Attributes .........................................464Shadows ....................................................465Variables ....................................................465Property ....................................................466Method ......................................................467Constructor & Destructor .................................469Delegate ....................................................469Event ........................................................470Event Handler ..............................................471External Method ............................................471

    Generating for VB.NET .........................................471Defining VB .NET Environment Variables ...............471Selecting VB .NET Generation Options .................472Selecting VB .NET Generation Tasks ....................472

    Contents

    Object-Oriented Modeling xxi

  • Generating VB.NET Files ..................................473Reverse Engineering VB .NET .................................473

    Selecting VB .NET Reverse Engineering Options ......474Defining VB .NET Reverse Engineering Options

    ......................................................475VB .NET Reverse Engineering Preprocessing ...........475

    VB .NET Supported Preprocessing Directives . . .476Defining a VB .NET Preprocessing Symbol .......476VB .NET Reverse Engineering with

    Preprocessing .....................................477Reverse Engineering VB .NET Files ......................478

    Working with ASP.NET ..........................................479ASP Tab of the Component ...............................479Defining File Objects for ASP.NET .......................480Creating an ASP.NET with the Wizard ...................480Generating ASP.NET ........................................482

    CHAPTER 18: Working with Visual Basic 2005 ........485Custom Visual Basic 2005 Tools ..............................485Visual Basic 2005 Assemblies .................................485

    Creating an Assembly .....................................486Converting a Single-assembly Model to a Multi-

    assembly Model ..................................486Assembly Properties .......................................487

    Assembly Property Sheet Application Tab .......487Assembly Property Sheet Assembly Tab ..........487

    Visual Basic 2005 Compilation Units ........................488Creating a Compilation Unit ..............................488

    Creating an Empty Compilation Unit from theBrowser ............................................488

    Creating and Populating a Compilation Unitfrom the Property Sheet of a Type ............488

    Adding Types to Compilation Units ......................489

    Contents

    xxii PowerDesigner

  • Adding a Type to a Compilation Unit from theCompilation Unit Property Sheet ..............489

    Adding a Type to a Compilation Unit from theType Property Sheet .............................490

    Creating a Generation Folder Structure ................490Adding Compilation Units to Folders .............490

    Previewing the Code to Be Generated for aCompilation Unit ........................................491

    Visual Basic 2005 Namespaces ................................491Visual Basic 2005 Classes ......................................491

    Visual Basic 2005 Class Properties .......................492Partial Types ................................................492

    Specifying the Compilation Unit to Which anInner Type Belongs: ..............................493

    Visual Basic 2005 Interfaces ..................................493Visual Basic 2005 Interface Properties ..................493

    Visual Basic 2005 Structs ......................................493Creating a Struct ...........................................494Struct Properties ...........................................494

    Visual Basic 2005 Delegates ...................................494Creating a Delegate .......................................495Delegate Properties .......................................496

    Visual Basic 2005 Enums .......................................496Creating an Enum ..........................................497Enum Properties ............................................497

    Visual Basic 2005 Fields, Events, and Properties .........497To Create a Field, Event, or Property: ..................497Field, Event, and Property Properties ..................498Working with Properties ..................................498Working with Events .......................................499

    Visual Basic 2005 Methods ....................................500Method Properties .........................................500

    Constructor & Destructor ..........................502Visual Basic 2005 Inheritance and Implementation ......502Visual Basic 2005 Custom Attributes ........................502

    Contents

    Object-Oriented Modeling xxiii

  • Generating Visual Basic 2005 Code ..........................502Visual Basic 2005 Generation Dialog Options Tab .....504Visual Basic 2005 Generation Dialog Tasks Tab ........505Defining Visual Basic 2005 Environment Variables ....505

    Reverse Engineering Visual Basic 2005 Code ..............505Visual Basic Reverse Engineer Dialog Options Tab ....506Visual Basic Reverse Engineering Preprocessing

    Directives ................................................507Visual Basic Supported Preprocessing Directives

    ......................................................508Defining a Visual Basic Preprocessing Symbol

    ......................................................508

    CHAPTER 19: Working with C# ..........................511What Is Automatically Generated ............................511Supported C# Objects ..........................................512

    Inheritance & Implementation ...........................512Namespace ..................................................512Project .......................................................512Accessibility ................................................513Class .........................................................513Struct ........................................................515Enumeration ...............................................515Interface ....................................................516Nested Types ................................................516Custom Attributes .........................................516Fields ........................................................516Property ....................................................517Indexer ......................................................519Method ......................................................520Constructor & Destructor .................................522Delegate ....................................................522Event ........................................................523Operator Method ...........................................523

    Contents

    xxiv PowerDesigner

  • Conversion Operator Method .............................523Documentation Tags .......................................524

    Generating for C# ...............................................525Defining C# Environment Variables ......................525Selecting C# Generation Options ........................526Selecting C# Generation Tasks ...........................526Generating C# Files ........................................526

    Reverse Engineering C# ........................................527Selecting C# Reverse Engineering Options .............528

    Defining C# Reverse Engineering Options .......529C# Reverse Engineering Preprocessing ..................529

    C# Supported Preprocessing Directives ..........530Defining a C# Preprocessing Symbol ..............530C# Reverse Engineering with Preprocessing .....531

    Reverse Engineering C# Files .............................532

    CHAPTER 20: Working with C# 2.0 .....................535Custom C# 2.0 Tools ............................................535C# 2.0 Assemblies ...............................................535

    Creating an Assembly .....................................536Converting a Single-assembly Model to a Multi-

    assembly Model ..................................536Assembly Properties .......................................536

    Assembly Property Sheet Application Tab .......537Assembly Property Sheet Assembly Information

    Tab .................................................537C# 2.0 Compilation Units ......................................538

    Creating a Compilation Unit ..............................538Creating an Empty Compilation Unit from the

    Browser ............................................538Creating and Populating a Compilation Unit

    from the Property Sheet of a Type: ...........538Adding Types to Compilation Units ......................539

    Contents

    Object-Oriented Modeling xxv

  • Adding a Type to a Compilation Unit from theCompilation Unit Property Sheet ..............539

    Adding a Type to a Compilation Unit from theType Property Sheet .............................540

    Creating a Generation Folder Structure ................540Adding Compilation Units to Folders .............540

    Previewing the Code to Be Generated for aCompilation Unit ........................................541

    C# 2.0 Namespaces .............................................541C# 2.0 Classes ....................................................541

    C# Class Properties ........................................543Partial Types ................................................543

    Specifying the Compilation Unit to Which anInner Type Belongs ...............................543

    C# 2.0 Interfaces ................................................543C# Interface Properties ...................................544

    C# 2.0 Structs ....................................................544Creating a Struct ...........................................544Struct Properties ...........................................545

    C# 2.0 Delegates ................................................545Creating a Delegate .......................................545Delegate Properties .......................................546

    C# 2.0 Enums ....................................................546Creating an Enum ..........................................546Enum Properties ............................................547

    C# 2.0 Fields .....................................................547Field Properties ............................................547

    C# 2.0 Methods ..................................................547Method Properties .........................................548Overriding Methods Using New ...........................549Constructors and Destructors ............................549Method Implementation ..................................549Operator Method ...........................................549Conversion Operator Method .............................550

    C# 2.0 Events, Indexers, and Properties ...................550

    Contents

    xxvi PowerDesigner

  • Creating an Event, Indexer, or Property ................552Event, Indexer, and Property Properties ...............553

    C# 2.0 Inheritance and Implementation ....................553C# 2.0 Custom Attributes ......................................553Generating C# 2.0 Code ........................................554

    C# Generation Dialog Options Tab .......................555C# Generation Dialog Tasks Tab ..........................556Defining C# Environment Variables ......................556

    Reverse Engineering C# 2.0 Code ............................556C# Reverse Engineer Dialog Options Tab ...............557C# Reverse Engineering Preprocessing Directives .....558

    C# Supported Preprocessing Directives ..........559Defining a C# Preprocessing Symbol ..............559

    CHAPTER 21: Working with XML.........................561Designing for XML ...............................................561Generating for XML .............................................565Reverse-Engineering XML ......................................566

    CHAPTER 22: Working with C++ .........................569Designing for C++ ................................................569Generating for C++ ..............................................570

    CHAPTER 23: Object/Relational (O/R) Mapping ......573Top-Down: Mapping Classes to Tables .......................573

    Entity Class Transformation ..............................575Attribute Transformation .................................576Value Type Transformation ...............................577Association Transformation ...............................578

    Association Class Transformation .................580Inheritance Transformation ..............................581

    Bottom-Up: Mapping Tables to Classes ......................584

    Contents

    Object-Oriented Modeling xxvii

  • Meet in the Middle: Manually Mapping Classes to Tables...................................................................585

    Entity Class Mapping .......................................586Attribute Mapping ..........................................589Primary Identifier Mapping ...............................590Association Mapping .......................................593

    One-to-One Association Mapping Strategy ......594One-to-Many Association Mapping Strategy

    ......................................................595Many-to-Many Association Mapping Strategy

    ......................................................597Defining Inheritance Mapping ............................598

    Table Per Class Hierarchy Inheritance MappingStrategy ...........................................598

    Joined Subclass Inheritance Mapping Strategy......................................................601

    Table Per Class Inheritance Mapping Strategy......................................................602

    CHAPTER 24: Generating Persistent Objects for Javaand JSF Pages ............................................605

    Generating Hibernate Persistent Objects ..................605Adding Hibernate Support ................................605

    Defining the Hibernate Default Options .........606Defining the Hibernate Database Configuration

    Parameters ........................................606Defining Hibernate Basic O/R Mappings ................608

    Defining Hibernate Class Mapping Options ......608Defining Primary Identifier Mappings ............611Defining Attribute Mappings .......................615

    Hibernate Association Mappings .........................616Defining Hibernate Association Mapping

    Options ............................................616Collection Management Options ..................618

    Contents

    xxviii PowerDesigner

  • Persistence Options .................................619Mapping Collections of Value Types ..............620

    Defining Hibernate Inheritance Mappings ..............621Generating Code for Hibernate ..........................621

    Checking the Model .................................622Defining Generation Options ......................622Generating Code for Hibernate ...................623

    Using the Generated Hibernate Code ...................624Importing the Generated Project into Eclipse

    ......................................................624Performing the Unit Tests ..........................624Running Unit Tests in Eclipse ......................625Running Unit Tests with Ant .......................627

    Generating EJB 3 Persistent Objects ........................628Generating Entities for EJB 3.0 ..........................629Adding EJB 3 Persistence Support .......................629Defining EJB 3 Basic O/R Mapping .......................629

    Defining Entity Mappings ...........................630Defining Embeddable Class Mapping .............633

    Defining EJB 3 Association Mappings ....................633Mapping One-to-one Associations .................633Mapping One-to-many Associations ..............634Mapping Many-to-many Associations .............635Defining EJB 3 Association Mapping Options ....635

    Defining EJB 3 Inheritance Mappings ...................636Mapped Superclasses ...............................636Table Per Class Hierarchy Strategy ...............636Joined Subclass Strategy ...........................637Applying Table Per Class Strategy ................637

    Defining EJB 3 Persistence Default Options ............638Defining EJB 3 Persistence Configuration ..............638Checking the Model ........................................640Generating Code for EJB 3 Persistence .................640

    Defining the Environment Variable ...............640Generate Code ......................................641

    Contents

    Object-Oriented Modeling xxix

  • Authoring in Dali Tools .............................644Run Unit Tests .......................................644Generated File List .................................647

    Generating JavaServer Faces (JSF) for Hibernate ........648Adding JSF Support ........................................648Defining Global Options ...................................649Defining Attribute Options ...............................651

    Derived Attributes ..................................653Attribute Validation Rules and Default Values

    ......................................................653Defining Master-Detail Pages .............................654Generating PageFlow Diagrams ..........................656

    Generating a class level PageFlow diagram .....656Generating a Package Level PageFlow Diagram:

    ......................................................657Generating a Model Level PageFlow Diagram

    ......................................................657Modifing Default High Level PageFlow Diagram

    ......................................................658Installing JSF Runtime Jar Files ..........................662

    Installing the JSF Reference Implementation......................................................662

    Installing Apache My Faces ........................662Configuring for JSF Generation ..........................663Generating JSF Pages ......................................663Testing JSF Pages ...........................................664

    Testing JSF Pages with Eclipse WTP ..............664Testing JSF Pages with Apache Tomcat ..........664

    CHAPTER 25: Generating .NET 2.0 Persistent Objectsand Windows Applications .............................667

    Generating ADO.NET and ADO.NET CF Persistent Objects...................................................................669

    Adding ADO.NET or ADO.NET CF Support ..............669

    Contents

    xxx PowerDesigner

  • ADO.NET and ADO.NET CF Options ...............669Class Mappings ..............................................670

    Primary Identifier Mappings .......................672Attribute Mappings ..................................673

    Defining Association Mappings ...........................674Defining Inheritance Mappings ...........................676Generating Code for ADO.NET or ADO.NET CF ........676

    Generating NHibernate Persistent Objects .................677Adding NHibernate Support ..............................678

    NHibernate Options .................................678Defining Class Mappings ...................................679

    Primary Identifier Mappings .......................682Attribute Mappings ..................................685

    Defining Association Mappings ...........................687Defining NHibernate Collection Options .........689Defining NHibernate Persistence Options .......690Defining NHibernate Collection Container Type

    ......................................................691Defining Inheritance Mappings ...........................691Generating Code for NHibernate ........................692

    Configuring Connection Strings ...............................693Configuring a Connection String from the ADO.NET or

    ADO.NET CF Tab ........................................694Configuring a Connection String from the NHibernate

    Tab ........................................................694OLEDB Connection String Parameters ...................694ODBC Connection String Parameters ....................695Microsoft SQL Server and Microsoft SQL Server Mobile

    Edition Connection String Parameters ...............695Oracle Connection String Parameters ...................695

    Generating Unit Tests ...........................................696Add Unit Test Support .....................................696Generating Code for Unit Testing .......................696Differences Between NUnit and Visual Studio Team

    Test (VSTS) ...............................................698

    Contents

    Object-Oriented Modeling xxxi

  • Running NUnit Unit Tests .................................699Running Visual Studio Test System Unit Tests ..........700

    Running Tests in Visual Studio.NET 2005 IDE......................................................700

    Running Tests from the Command Line ..........701Generating Windows or Smart Device Applications ......701

    Adding Windows or Smart Device Application Support.............................................................701

    Adding Windows Application Support ............701Adding Smart Device Application Support .......702

    Specifying an Image Library ..............................702Controlling the Data Grid View ..........................702Defining Attributes Display Options .....................702Defining Attribute Validation Rules and Default

    Values .....................................................703Generating Code for a Windows Application ..........703Generating Code for a Smart Device Application .....704

    Generating Code ....................................704Deploying Code to a Smart Device ...............705Testing the Application on the Device ...........705

    Index ....................................................................707

    Contents

    xxxii PowerDesigner

  • PART I

    Building OOMs

    The chapters in this part explain how to model your information systems in PowerDesigner.

    Object-Oriented Modeling 1

  • 2 PowerDesigner

  • CHAPTER 1 Getting Started with Object-Oriented Modeling

    An object-oriented model (OOM) helps you analyze an information system through use cases,structural and behavioral analyses, and in terms of deployment, using the Unified ModelingLanguage (UML). You can model, reverse-engineer, and generate for Java, .NET and otherlanguages.

    The Unified Modeling Language (UML) is the standard language for object-orientedmodeling. It was originally devised by Grady Booch, James Rumbaugh, and Ivar Jacobson,and is now controlled by the OMG (Object Management Group).

    PowerDesigner® supports the following UML diagrams:

    • Use case diagram ( )

    • Structural Diagrams:• Class diagram ( )• Composite structure diagram ( )• Object diagram ( )• Package diagram ( )

    • Dynamic Diagrams:• Communication diagram ( )• Sequence diagram ( )• Statechart diagram ( )• Activity diagram ( )• Interaction overview diagram ( )

    • Implementation Diagrams:• Component diagram ( )• Deployment diagram ( )

    For detailed information on these diagrams, see:

    • Chapter 3, Building Structural Diagrams on page 21• Chapter 2, Building Use Case Diagrams on page 9• Chapter 4, Building Dynamic Diagrams on page 125• Chapter 5, Building Implementation Diagrams on page 209

    In the picture below, you can see how the various UML diagrams can interact within yourmodel:

    Object-Oriented Modeling 3

  • PowerDesigner

    The PowerDesigner Object-Oriented Model is a powerful design tool for graphical object-oriented design implementation.

    With this product, you can:

    4 PowerDesigner

  • • Build an Object-Oriented Model (OOM) using the standard UML diagrams• Generate and reverse engineer Java, C#, VB.NET, and PowerBuilder files• Generate code for C++, Visual Basic, IDL-CORBA, etc.• Generate EJB, servlets, and JSP components• Generate Conceptual Data Models (CDMs), Physical Data Models (PDMs), XML Models

    (XSMs), and other Object-Oriented Models (OOMs) from your OOM• Generate an OOM from a CDM, PDM, XML, or other OOM• Import a Rose model• Import/export XMI• Customize the OOM to suit physical and performance considerations• Customize and print model reports

    Suggested Bibliography

    • James Rumbaugh, Ivar Jacobson, Grady Booch – The Unified Modeling LanguageReference Manual – Addison Wesley, 1999

    • Grady Booch, James Rumbaugh, Ivar Jacobson – The Unified Modeling Language UserGuide – Addison Wesley, 1999

    • Ivar Jacobson, Grady Booch, James Rumbaugh – The Unified Software DevelopmentProcess – Addison Wesley, 1999

    • Doug Rosenberg, Kendall Scott – Use Case Driven Object Modeling With UML APractical Approach – Addison Wesley, 1999

    • Michael Blaha, William Premerlani – Object-Oriented Modeling and Design for DatabaseApplications – Prentice Hall, 1998

    • Geri Schneider, Jason P. Winters, Ivar Jacobson – Applying Use Cases: A Practical Guide– Addison Wesley, 1998

    • Pierre-Alain Muller – Instant UML – Wrox Press Inc, 1997• Bertrand Meyer – Object-Oriented Software Construction – Prentice Hall, 2nd Edition,

    1997• Martin Fowler, Kendall Scott – UML Distilled Applying The Standard Object Modeling

    Language – Addison Wesley, 1997

    Creating an OOMYou create a new object-oriented model by selecting File > New Model.

    Note: In addition to creating an OOM from scratch with the following procedure, you can alsoreverse-engineer a model from existing OO code (see Reverse Engineering OO Source Filesinto an OOM on page 279).

    The New Model dialog is highly configurable, and your administrator may have hiddenoptions that are not relevant for your work or provided templates or predefined models to

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    Object-Oriented Modeling 5

  • guide you through model creation. When you open the dialog, one or more of the followingbuttons will be available on the left hand side:

    • Categories - which provides a set of predefined models and diagrams sorted in aconfigurable category structure.

    • Model types - which provides the classic list of PowerDesigner model types anddiagrams.

    • Template files - which provides a set of model templates sorted by model type.

    1. Select File > New Model to open the New Model dialog.

    2. Click a button, and then select a category or model type ( Object-Oriented Model ) in theleft-hand pane.

    3. Select an item in the right-hand pane. Depending on how your New Model dialog isconfigured, these items may be first diagrams or templates on which to base the creation ofyour model.

    Use the Views tool on the upper right hand side of the dialog to control the display of theitems.

    4. Enter a model name.

    6 PowerDesigner

  • The code of the model, which is used for script or code generation, is derived from thisname according to the model naming conventions.

    5. [when available] Select an object language , and specify whether to:

    • Share the object language definition – creates a link to the file in the ResourceFiles\ Object Languages directory. Changes made to the target affect allmodels that share it.

    • Copy the object language definition in model – makes a copy of the resource fileand saves it with the model. Changes made to the target affect only the current model.

    For more information about PowerDesigner resource files, and how to add extensions tothem, see the Customizing and Extending PowerDesigner manual.

    6. [optional] Click the Select Extensions button and attach one or more extensions to yourmodel.

    7. Click OK to create and open the object-oriented model .

    Note: Sample OOMs are available in the Example Directory.

    OOM PropertiesThe Model property sheet displays the definition of the current model.

    An OOM has the following model properties:

    Property Description

    Name Name for the model

    Code Code for the model. This code is used in scripts

    Comment Descriptive label for the model

    Filename Location of the model file. This box is empty if the model has never beensaved

    Author Author of the model. You can insert a name, a space, or nothing.

    If you insert a space, the Author field in the title box remains empty.

    If you intentionally leave the box empty, the Author field in the title boxdisplays the user name from the Version Info tab of the model property sheet

    Version Version of the model. You can use this box to display the repository version ora user defined version of the model. This parameter is defined in the displaypreferences of the Title node

    Object language Current object language for the model

    Default diagram Diagram displayed by default when opening the model

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    Object-Oriented Modeling 7

  • 8 PowerDesigner

  • CHAPTER 2 Building Use Case Diagrams

    A use case diagram is a UML diagram that provides a graphical view of the requirements ofyour system, and helps you identify how users interact with it.

    With a use case diagram, you immediately see a snapshot of the system functionality. Furtherdetails can later be added to the diagram if you need to elucidate interesting points in thesystem behavior.

    A use case diagram is well suited to the task of describing all of the things that can be done witha database system by all the people who might use it. However, it would be poorly suited todescribing the TCP/IP network protocol because there are many exception cases, branchingbehaviors, and conditional functionality (what happens when the connection dies, whathappens when a packet is lost?)

    In the following example, the actor "photographer" does two things with the camera: takepictures and change the film. When he takes a picture, he has to switch the flash on, open theshutter, and then close the shutter but these activities are not of a high enough level to berepresented in a use case.

    Use Case Diagram ObjectsPowerDesigner supports all the objects necessary to build use case diagrams.

    Object Tool Symbol Description

    Actor Used to represent an external person, process orsomething interacting with a system, sub-system orclass. See Actors (OOM) on page 13.

    Object-Oriented Modeling 9

  • Object Tool Symbol Description

    Use case Defines a piece of coherent behavior in a system,without revealing its internal structure. See UseCases (OOM) on page 10.

    Association Communication path between an actor and a usecase that it participates in. See Use Case Associa-tions (OOM) on page 18.

    Generalization A link between a general use case and a more spe-cific use case that inherits from it and add featuresto it. See Generalizations (OOM) on page 97.

    Dependency Relationship between two modeling elements, inwhich a change to one element will affect the otherelement. See Dependencies (OOM) on page 100.

    Creating a Use Case DiagramYou can create a use case diagram in an existing OOM in any of the following ways:

    • Right-click the model in the Browser and select New > Use Case Diagram.• Right-click the background of any diagram and select Diagram > New Diagram > Use

    Case Diagram.

    To create a new OOM with a use case diagram, select File > New Model, choose to create anobject-oriented model from the Model type list, choose Use Case Diagram as the firstdiagram, and click OK.

    Use Cases (OOM)A use case is an interaction between a user and a system (or part of a system). It defines adiscrete goal that a user wants to achieve with the system, without revealing the system'sinternal structure.

    A use case can be created in the following diagrams:

    • Use Case Diagram

    Example

    In this example, "buy tickets" and "buy subscriptions" are use cases.

    10 PowerDesigner

  • Creating a Use CaseYou can create a use case in any of the following ways:

    • Use the Use Case tool in the diagram Palette• Select Model > Use Cases to access the List of Use Cases, and click the Add a Row tool• Right-click the model or package in the Browser, and select New > Use Case

    For general information about creating objects, see the Objects chapter in the Core FeaturesGuide.

    Use Case PropertiesYou can modify an object's properties from its property sheet. To open a use case propertysheet, double-click its diagram symbol or its Browser entry in the Use Cases folder.

    The General Tab contains the following properties:

    Property Description

    Name Specifies the name of the item, which should be clear and meaningful, and shouldconvey the item's purpose to non-technical users.

    Code Specifies the technical name of the object, which is used for generating code orscripts

    Comment Descriptive comment for the object.

    Stereotype Extends the semantics of an object derived from existing objects but specific toyour needs.

    CHAPTER 2: Building Use Case Diagrams

    Object-Oriented Modeling 11

  • Use Case Property Sheet Specification TabThe Specification tab contains the following properties, available via sub-tabs at the bottom ofthe dialog box:

    Property Description

    Action Steps Provides a textual description of the normal sequence of actions associated with ause case.

    For example, the action steps for a use case called 'register patient' in a hospitalmight be as follows: "Open a file, give a new registration number, write downmedical treatment".

    Extension Points Provides a textual description of actions that extend the normal sequence of ac-tions. Extensions are usually introduced with an "if ....then" statement.

    For example, an extension to the action steps above might be: "If the patientalready has a registration number, then retrieve his personal file".

    Exceptions Specifies signals raised in response to errors during system execution.

    Pre-Conditions Specifies constraints that must be true for an operation to be invoked.

    Post-Conditions Specifies constraints that must be true for an operation to exit correctly.

    Each of these sub-tabs contains a text box (RTF or TXT format) which lets you give a moredetailed definition of a use case.

    Use Case Property Sheet Implementation Classes TabThe Implementation Classes tab in the use case property sheet shows the list of classes, orinterfaces used to implement a use case. A use case is generally a task or service, representedas a verb. When analyzing what a use case must do, you can identify the classes and interfacesthat need to be created to fulfill the task, and attach them to a use case.

    Creating a Class or an Interface

    To add a class or interface to the list, use one of the following tools:

    Tool Action

    Add Objects – Opens a dialog box from which you can select any class or interface currentlyexisting in the model to implement the use case.

    Create a New Class – Creates a new class to implement the use case. The new class isavailable in the Classes folder of the current model or package in the Browser for use inother diagrams.

    12 PowerDesigner

  • Tool Action

    Create a New Interface - Creates a new interface to implement the use case. The newinterface is available in the Interfaces folder of the current model or package in the Browserfor use in other diagrams.

    For example, a use case ship product by express mail needs the classes Shipping, Product, andBilling to perform its task:

    You can display the names of the use cases associated with a class on the Dependencies tab ofits property sheet.

    Use Case Property Sheet Related Diagrams TabThe Related Diagrams tab lists other diagrams in the present model that relate to the use case.Click the Add Objects tool to add diagrams to the list.

    For more information see "Defining related diagrams" in the Diagrams and Symbols chapterof the Core Features Guide.

    Actors (OOM)An actor is an outside user or set of users that interact with a system. Actors can be humans orother external systems. For example, actors in a computer network system may include asystem administrator, a database administrator and users. Actors are typically those entities

    CHAPTER 2: Building Use Case Diagrams

    Object-Oriented Modeling 13

  • whose behavior you cannot control or change, because they are not part of the system that youare describing.

    An actor can be created in the following diagrams:

    • Communication Diagram• Sequence Diagram• Use Case Diagram

    A single actor object may be used in a use case, a sequence, and a communication diagram if itplays the same role in each. Each actor object is available to all the diagrams in your OOM.They can either be created in the diagram type you need, or dragged from a diagram type anddropped into another diagram type.

    Actors in a Use Case Diagram

    In the use case diagram, an actor is a primary actor for a use case if he asks for and/or triggersthe actions performed by a use case. Primary actors are located to the left of the use case, andthe association linking them should be drawn from the actor to the use case.

    An actor is a secondary actor for a use case if it does not trigger the actions, but rather assiststhe use case to complete the actions. After performing an action, the use case may give results,documents, or information to the outside and, if so, the secondary actor may receive them.Secondary actors are located to the right of the use case, and the association linking themshould be drawn from the use case to the actor.

    On a global scale, a secondary actor for one use case may be a primary actor for another usecase, either in the same or another diagram.

    Actors in a Communication Diagram

    In a communication diagram, an actor may be connected to an object by an instance link, ormay send or receive messages.

    14 PowerDesigner

  • Actors in a Sequence Diagram

    In the sequence diagram, an actor has a lifeline representing the duration of its life. You cannotseparate an actor and its lifeline.

    If an actor is the invoker of the interaction, it is usually represented by the first (farthest left)lifeline in the sequence diagram. If you have several actors in the diagram, you should try toposition them to the farthest left or to the farthest right lifelines because actors are, bydefinition, external to the system.

    Creating an ActorTo create an actor:

    • Use the Actor tool in the diagram Palette• Select Model > Actors to access the List of Actors, and click the Add a Row tool• Right-click the model or package in the Browser, and select New > Actor

    For general information about creating objects, see the Objects chapter in the Core FeaturesGuide.

    Actor PropertiesYou can modify an object's properties from its property sheet. To open an actor property sheet,double-click its diagram symbol or its Browser entry in the Actors folder.

    The General Tab contains the following properties:

    CHAPTER 2: Building Use Case Diagrams

    Object-Oriented Modeling 15

  • Property Description

    Name Specifies the name of the item, which should be clear and meaningful, andshould convey the item's purpose to non-technical users.

    Code Specifies the technical name of the object, which is used for generating code orscripts

    Comment Descriptive comment for the object.

    Stereotype Extends the semantics of an object derived from existing objects but specific toyour needs.

    Actor Property Sheet Implementation Classes TabThe Implementation Classes tab shows the list of classes and interfaces used to implement anactor. An actor can be a human being (person, partner) or a machine, or process (automatedsystem). When analyzing what an actor must do, you can identify the classes and interfacesthat need to be created for the actor to perform his task, and attach them to the actor.

    Creating a Class or an Interface

    To add a class or interface to the list, use one of the following tools:

    Tool Action

    Add Objects – Opens a dialog box from which you can select any class or interface currentlyexisting in the model to implement the actor.

    Create a New Class – Creates a new class to implement the actor. The new class is availablein the Classes folder of the current model or package in the Browser for use in otherdiagrams.

    Create a New Interface - Creates a new interface to implement the actor. The new interface isavailable in the Interfaces folder of the current model or package in the Browser for use inother diagrams.

    For example, an actor Car needs the classes Engine and Motorway to perform its task. They areshown as related to the actor in the following figure:

    16 PowerDesigner

  • You can display the names of the actors associated with a class on the Dependencies tab of itsproperty sheet.

    Example

    Conceptually, you may link elements even deeper.

    For example, a clerk working in an insurance company is represented as an actor in a use casediagram, dealing with customers who declare a car accident.

    The clerk actor becomes an object in a communication or sequence diagram; those diagramsrepresenting the actions between the objects, the clerk as an object receives messages fromcustomers and sends messages to his manager.

    The clerk as an object is also an instance of a class Clerk that can be found in a class diagramwith its attributes and operations.

    CHAPTER 2: Building Use Case Diagrams

    Object-Oriented Modeling 17

  • Actor Property Sheet Related Diagrams TabThe Related Diagrams tab lists other diagrams in the present model that relate to the actor.Click the Add Objects tool to add diagrams to the list.

    For more information see "Defining related diagrams" in the Diagrams and Symbols chapterof the Core Features Guide.

    Reusing ActorsThe same actor can be used in a Use Case Diagram, Communication Diagram, and SequenceDiagram. To reuse an actor created in one diagram in another diagram:

    • Select the actor you need in the Browser, and drag it and drop it into the new diagram.• Select Symbols > Show Symbols in the new diagram to open the Show Symbols dialog

    box, select the actor to display, and click OK.

    Use Case Associations (OOM)An association is a unidirectional relationship that describes a link between objects.

    A use case association can be created in the following diagrams:

    • Use Case Diagram

    You can create an association between:

    • An actor and a use case• A use case and an actor

    Associations in a use case diagram are very similar to those in class diagrams. However, it isnot possible to specify roles, cardinalities and navigability for associations.

    18 PowerDesigner

  • The orientation of the association is defined by the way it is created graphically. Anassociation leading from an actor to a use case is an input association. An association leadingfrom a use case to an actor is an output association.

    If the orientation of the association is not displayed, you can modify the association displaypreferences.

    Example

    Creating a Use Case AssociationYou can create a use case association in any of the following ways:

    • Use the Use Case Association tool in the diagram Palette• Select Model > Associations to access the List of Associations, and click the Add a Row

    tool• Right-click the model or package in the Browser, and select New > Association

    For general information about creating objects, see the Objects chapter in the Core FeaturesGuide.

    Use Case Association PropertiesYou can modify an object's properties from its property sheet. To open an association propertysheet, double-click its diagram symbol or its Browser entry in the Associations folder.

    The General Tab contains the following properties:

    Property Description

    Name Specifies the name of the item, which should be clear and meaningful, andshould convey the item's purpose to non-technical users.

    Code Specifies the technical name of the object, which is used for generating code orscripts.

    Comment Descriptive comment for the object.

    CHAPTER 2: Building Use Case Diagrams

    Object-Oriented Modeling 19

  • Property Description

    Stereotype Extends the semantics of an object derived from existing objects but specific toyour needs.

    Orientation Defines the direction of the association. You can choose between:

    • Primary Actor – the association leads from the actor to the use case• Secondary Actor – the association leads from the use case to the actor

    Source Specifies the object that the association leads from. You can use the tools to theright of the list to create an object, browse the complete tree of available objectsor view the properties of the currently selected object.

    Destination Specifies the object that the association leads to You can use the tools to theright of the list to create an object, browse the complete tree of available objectsor view the properties of the currently selected object.

    20 PowerDesigner

  • CHAPTER 3 Building Structural Diagrams

    The diagrams in this chapter allow you to model the static structure of your system.PowerDesigner provides three types of diagrams for modeling your system in this way, eachof which offers a different view of your objects and their relationships:

    • A class diagram shows the static structure of the classes that make up the system. You use aclass diagram to identify the kinds of objects that will compose your system, and to definethe ways in which they will be associated. For more information, see Class Diagram Basicson page 21.

    • A composite structure diagram allows you to define in greater detail the internal structureof your classes and the ways that they are associated with one another. You use a compositestructure diagram in particular to model complex forms of composition that would be verycumbersome to model in a class diagram. For more information, see Composite StructureDiagram Basics on page 24.

    • An object diagram is like a class diagram, except that it shows specific object instances ofthe classes. You use an object diagram to represent a snapshot of the relationships betweenactual instances of classes. For more information, see Object Diagram Basics on page26.

    • A package diagram shows the structure of the packages that make up your application, andthe relationships between them. For more information, see Package Diagram Basics onpage 28.

    Class Diagram BasicsA class diagram is a UML diagram that provides a graphical view of the classes, interfaces,and packages that compose a system, and the relationships between them.

    You build a class diagram to simplify the interaction of objects in the system you are modeling.Class diagrams express the static structure of a system in terms of classes and relationshipsbetween those classes. A class describes a set of objects, and an association describes a set oflinks; objects are class instances, and links are association instances.

    A class diagram does not express anything specific about the links of a given object, but itdescribes, in an abstract way, the potential link from an object to other objects.

    The following example shows the process of product order and shipment in a class diagram.

    Object-Oriented Modeling 21

  • Class Diagram ObjectsPowerDesigner supports all the objects necessary to build clas