sybase - object oriented modeling

Upload: manuel-david-alcantara

Post on 03-Jun-2018

236 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Sybase - Object Oriented Modeling

    1/688

    Object-Oriented Modeling

    PowerDesigner16.1

    Windows

  • 8/12/2019 Sybase - Object Oriented Modeling

    2/688

    DOCUMENT ID: DC38086-01-1610-01

    LAST REVISED: November 2011

    Copyright 2011 by Sybase, Inc. All rights reserved.

    This publication pertains to Sybase software and to any subsequent release until otherwise indicated in new editions or

    technical 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.

    Upgrades are provided only at regularly scheduled software release dates. No part of this publication may be reproduced,

    transmitted, or translated in any form 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 and

    the marks listed are trademarks of Sybase, Inc. A indicates registration in the United States of America.

    SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered

    trademarks of SAP AG in Germany and in several other countries all over the world.

    Java and all Java-based marks are trademarks or registered trademarks of Oracle and/or its affiliates in the U.S. and other

    countries.

    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 companies

    with which they are associated.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 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
  • 8/12/2019 Sybase - Object Oriented Modeling

    3/688

    Contents

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

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

    Creating an OOM ...................................................................5

    OOM Properties ..............................................................7

    Previewing Object Code ........................................................8

    CustomizingObject Creation Scripts ................................10

    Customizingyour Modeling Environment .........................11

    Setting OOM Model Options .........................................11

    Setting OOM Display Preferences ................................13

    Viewing and Editing the Object Language Definition

    File ............................................................................13

    Changing theObject Language ..........................13

    Extending your Modeling Environment .........................14

    Linking Objects with Traceability Links .........................15

    CHAPTER 2: Use Case Diagrams................................17

    Use Case Diagram Objects .................................................18

    Use Cases (OOM) .................................................................18

    Creating a Use Case....................................................19

    Use Case Properties ....................................................19

    Actors (OOM) .......................................................................20

    Creating an Actor ..........................................................22Actor Properties ............................................................22

    Reusing Actors .............................................................24

    Use Case Associations (OOM) ...........................................24

    Creating a Use Case Association .................................25

    Use Case Association Properties .................................25

    Object-Oriented Modeling iii

  • 8/12/2019 Sybase - Object Oriented Modeling

    4/688

    CHAPTER 3: Structural Diagrams...............................27

    Class Diagrams....................................................................27

    Class Diagram Objects .................................................28Composite Structure Diagrams..........................................29

    Composite Structure Diagram Objects .........................30

    Package Diagrams ...............................................................31

    Package Diagram Objects ............................................32

    Object Diagrams..................................................................32

    Object Diagram Objects ................................................33

    Classes (OOM) .....................................................................34

    Creating a Class ...........................................................34

    Class Properties ...........................................................35Creating JavaBeanInfo Classes ...................................39

    Creating a Java BeanInfo Class from the

    Language Menu..............................................41

    Creating a Java BeanInfo Class from the Class

    ContextualMenu.............................................42

    Generic Types andMethods .........................................42

    Creating Generic Types .......................................42

    Creating Generic Methods ...................................43Creating a Specialized Classifier .........................43

    Creating a Bound Classifier .................................45

    Generic TypeExample .........................................45

    Composite and Inner Classifiers ...................................46

    Creating Inner Classifiers ....................................46

    Creating a Composite Classifier Diagram ............47

    Specifying a Classifier as a Data Type or Return Type

    ..................................................................................47

    Viewingthe Migrated Attributes of a Class ...................48

    Packages (OOM) ..................................................................49

    OOM Package Properties .............................................50

    Defining the Diagram Type of a New Package ..............51

    Interfaces (OOM) ..................................................................51

    Contents

    iv PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    5/688

    Creating an Interface....................................................51

    Interface Properties ...................................................... 52

    Objects (OOM) ......................................................................54

    Creating an Object ........................................................56

    Object Properties ..........................................................56Linking a Classifier to an Object ...................................57

    Parts (OOM) ..........................................................................58

    Creating a Part ..............................................................59

    Part Properties ..............................................................59

    Ports (OOM) ..........................................................................60

    Creating a Port ..............................................................61

    Port Properties ..............................................................61

    Redefining Parent Ports ................................................63

    Attributes (OOM)..................................................................63

    Creating an Attribute .....................................................64

    Copying an Attribute to a Class, Interface, or

    Identifier ...........................................................65

    Overriding an Attribute in PowerBuilder ...............66

    Adding Getter and Setter Operations to a

    Classifier ..........................................................66

    Attribute Properties .......................................................67

    Setting Data Profiling Constraints .................................70Creating Data Formats For Reuse.......................71

    Specifying Advanced Constraints ........................72

    Identifiers (OOM) ..................................................................72

    Creating an Identifier .................................................... 73

    Creating a primary identifier when you create the

    classattributes ................................................ 73

    Defining the Primary Identifier from the List of

    Identifiers .........................................................74Identifier Properties ...................................................... 74

    Adding Attributes to an Identifier ...................................75

    Operations (OOM) ................................................................76

    Creating an Operation .................................................. 76

    Copyingan Operation From Another Classifier . . .77

    Contents

    Object-Oriented Modeling v

  • 8/12/2019 Sybase - Object Oriented Modeling

    6/688

    Inheriting and Overriding Operations from

    Parent Classifiers ............................................ 77

    Creating a Standard Operation ............................77

    Implementing Operations from an Interface .........78

    Operation Properties ....................................................79Parameters (OOM).......................................................83

    Associations (OOM) ............................................................84

    Creating an Association ................................................86

    Association Properties ..................................................86

    Association Implementation ..........................................89

    Understanding the Generated Code ....................91

    Creating an Association Class ......................................92

    Migrating Association Roles in a Class Diagram..........93

    Migrating Navigable Roles ...................................93

    Rebuilding Data Type Links ..........................................94

    Linking an Association to an Instance Link ...................94

    Generalizations (OOM) ........................................................95

    Creating a Generalization .............................................96

    Generalization Properties .............................................96

    Dependencies (OOM) ..........................................................98

    Creating a Dependency ................................................99

    Dependency Properties ..............................................100Realizations(OOM) ............................................................102

    Creating a Realization ................................................102

    Realization Properties................................................103

    Require Links (OOM) .........................................................103

    Creating a Require Link ..............................................104

    Require Link Properties ..............................................104

    Assembly Connectors (OOM) ...........................................105

    Creating an Assembly Connector ...............................105Assembly Connector Properties .................................106

    Delegation Connectors (OOM) .........................................106

    Creating a Delegation Connector ...............................107

    Delegation Connector Properties ...............................107

    Annotations (OOM) ............................................................108

    Contents

    vi PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    7/688

  • 8/12/2019 Sybase - Object Oriented Modeling

    8/688

    Creating a Recursive Message Without

    Activation .......................................................144

    Creating a Recursive Message with Activation

    .......................................................................145

    Messages and Gates ..................................................145Sequence Numbers ....................................................147

    Moving Sequence Numbers ..............................147

    Inserting Sequence Numbers ............................149

    Increasing Sequence Numbers in a

    Communication Diagram...............................149

    Decreasing Sequence Numbers in a

    Communication Diagram...............................149

    Activations (OOM) .............................................................149

    Creating an Activation .................................................150

    Creating Activations with Procedure Call

    Messages ......................................................150

    Creating an Activation from a Diagram..............150

    Attaching a Message to an Activation .........................150

    Detaching a Message from an Activation ...................151

    Overlapping Activations ..............................................151

    Moving an Activation ...................................................152

    Resizing an Activation................................................152Interaction References and Interaction Activities (OOM)

    .........................................................................................153

    Creating an Interaction Reference ..............................153

    Creating an Interaction Activity ...................................154

    Interaction Reference and Interaction Activity

    Properties ...............................................................154

    Manipulating Interaction References ..........................154

    Interaction Fragments (OOM) ...........................................155Creating an Interaction Fragment ...............................155

    Interaction Fragment Properties .................................155

    Manipulating Interaction Fragments ............................157

    Activities (OOM) .................................................................158

    Creating an Activity .....................................................159

    Contents

    viii PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    9/688

    Activity Properties .......................................................160

    Specifying Activity Parameters ...................................162

    Specifying Action Types ..............................................163

    Example: Using the Call Action Type .................164

    Example: Reading and Writing Variables ..........167DecomposedActivities and Sub-Activities ..................168

    Converting an Activity Diagram to a

    Decomposed Activity .....................................170

    Organization Units (OOM ) ................................................171

    Creating an Organization Unit ....................................171

    Creating Organization Units with the Swimlane

    Tool ................................................................172

    Organization Unit Properties ......................................172

    Attaching Activities to Organization Units ...................173

    Displaying a Committee Activity ................................173

    Managing Swimlanes and Pools .................................174

    Moving, Copying and Pasting Swimlanes..........175

    Grouping andUngrouping Swimlanes ...............176

    Creating Links Between Pools of Swimlanes .....178

    Changing theOrientation of Swimlanes ............178

    Resizing Swimlanes ...........................................179

    Changing theFormat of a Swimlane.................179Starts ( OOM).....................................................................179

    Creating a Start ..........................................................180

    Start Properties ..........................................................180

    Ends ( OOM) .......................................................................180

    Creating an End ..........................................................181

    End Properties ............................................................181

    Decisions ( OOM) ...............................................................182

    Creating a Decision ....................................................184Decision Properties ....................................................184

    Synchronizations ( OOM) ..................................................185

    Creating a Synchronization .........................................186

    Synchronization Properties .........................................186

    Flows ( OOM) ......................................................................187

    Contents

    Object-Oriented Modeling ix

  • 8/12/2019 Sybase - Object Oriented Modeling

    10/688

    Creating a Flow ...........................................................188

    Flow Properties ...........................................................188

    Object Nodes (OOM) ..........................................................189

    Creating an Object Node ............................................190

    Object Node Properties ..............................................190States (OOM)......................................................................191

    Creating a State ..........................................................192

    State Properties ..........................................................192

    Decomposed States and Sub-states ..........................194

    Converting a Statechart Diagram to a

    Decomposed State ........................................196

    Transitions (OOM) ..............................................................197

    Creating a Transition ...................................................197

    Transition Properties ...................................................198

    Events(OOM) .....................................................................199

    Creating an Event .......................................................200

    Event Properties .........................................................200

    Defining Event Arguments ..........................................201

    Actions (OOM) ....................................................................201

    Creating an Action ......................................................203

    Action Properties ........................................................203

    Junction Points (OOM) ......................................................204Creating a Junction Point ............................................205

    Junction Point Properties ............................................205

    CHAPTER 5: Implementation Diagrams....................207

    Component Diagrams.......................................................207

    Component Diagram Objects .....................................208

    Deployment Diagrams.......................................................209

    Deployment Diagram Objects .....................................210

    Components (OOM) ...........................................................210

    Creating a Component ................................................211

    Using the Standard Component Wizard ............211

    Component Properties ................................................212

    Contents

    x PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    11/688

    Creating a Class Diagram for a Component ...............215

    Deploying a Component to a Node.............................216

    Nodes (OOM) ......................................................................216

    Creating a Node ..........................................................217

    Node Properties ..........................................................217Node Diagrams ...........................................................218

    Component Instances (OOM) ...........................................218

    Creating a Component Instance .................................219

    Component Instance Properties .................................220

    Files (OOM) .........................................................................220

    Creating a File Object .................................................221

    File Object Properties .................................................222

    Node Associations (OOM) ................................................223

    Creating a Node Association ......................................223

    Node Association Properties ......................................223

    CHAPTER 6: Web Services ........................................225

    Defining Web Services Tools ............................................225

    Defining Web Services Targets ........................................228

    Defining Web Service Components .................................228

    Web Service Component Properties ..........................228Creating a Web Service with the Wizard ....................231

    Creating a Web Service from the Component Diagram

    ................................................................................233

    Defining DataTypes for WSDL...................................234

    WSDL Data Type Mappings ...............................234

    Selecting WSDL Data Types ..............................234

    Declaring Data Types in the WSDL...................234

    Web Service Implementation Class Properties ..........234

    Managing Web Service Methods ......................................235

    Creating a Web Service Method .................................235

    Web Service Method Properties .................................237

    Implementing a Web Service Method in Java .............237

    Defining the Return Type of an Operation.........237

    Contents

    Object-Oriented Modeling xi

  • 8/12/2019 Sybase - Object Oriented Modeling

    12/688

    Defining the Parameters of an Operation..........238

    Implementing the Operation ..............................240

    Implementing a Web Service Method in .NET ............242

    Defining Web Service Method Extended Attributes ....242

    Defining SOAP Data Types of the WSDL Schema..... 243Defining Web Service Component Instances .................244

    Web Service Tab of the Component Instance............ 245

    WSDL Tab ofthe Component Instance ......................246

    Using Node Properties ...............................................246

    Generating Web Services for Java...................................246

    Generating JAXM Web Services................................247

    Generating JAX-RPC Web Services ..........................248

    Generating Stateless Session Bean Web Services ....249

    Generating AXIS RPC Web Services.........................250

    Generating AXIS EJB Web Services ..........................251

    Generating Java Web Services (JWS) .......................252

    Testing Web Services for Java....................................252

    Generating Web Services for .NET...................................252

    Defining WebServices Generation Options in .NET ..252

    Defining WebService Generation Tasks in .NET ....... 253

    Generating Web Services in .NET ..............................253

    Generating a .NET Proxy Class for a Web Service ....254Define the WSDL Variable .................................254

    Generate the Client Proxy Classes ....................254

    Deploying Web Services in .NET ................................255

    Testing Web Services for .NET ...................................255

    Generating Web Services for Sybase WorkSpace ..........256

    Creating a Java or EJB Web Service for Sybase

    WorkSpace .............................................................256

    Defining the Java Class Package ............................... 257Generating the Java or EJB Web Service for Sybase

    WorkSpace .............................................................258

    Understanding the .svc_java or .svc_ejb File .............258

    Importing WSDL Files .......................................................259

    Browsing WSDL Files from UDDI ...............................261

    Contents

    xii PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    13/688

    PART II: Working with OOMs .....................................263

    CHAPTER 7: Generating and Reverse EngineeringOO Source Files .......................................................265

    Generating OO Source Files from an OOM.....................265

    Working with Generation Targets ................................268

    Defining the Source Code Package ............................268

    Reverse Engineering OO Source Files into an OOM ......269

    Reverse Engineering OO Files into a New OOM ........269

    Reverse Engineering Encoding Format .............270

    Reverse Engineering into an Existing OOM ...............271

    Synchronizing a Model with Generated Files .................272

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

    Managing Object Persistence During Generation of

    Data Models ...................................................................277

    Managing Persistence for Generalizations.....................277

    Managing Persistence for Complex Data Types .............279

    CHAPTER 9: Checking an OOM ................................283

    DomainChecks ..................................................................283

    Data SourceChecks..........................................................284

    Package Checks .................................................................285

    Actor/Use Case Checks ....................................................286

    Class Checks .....................................................................287

    Identifier Checks ................................................................293Interface Checks................................................................293

    Class/Interface Attribute Checks .....................................296

    Class/Interface Operation Checks ...................................297

    Realization Checks ............................................................299

    Generalization Checks ......................................................299

    Contents

    Object-Oriented Modeling xiii

  • 8/12/2019 Sybase - Object Oriented Modeling

    14/688

    Object Checks ....................................................................300

    Instance Link Checks ........................................................301

    Message Checks................................................................301

    State Checks......................................................................302

    State ActionChecks..........................................................303Event Checks .....................................................................304

    Junction Point Checks......................................................305

    Activity Checks ..................................................................305

    Decision Checks ................................................................306

    Object NodeChecks..........................................................307

    OrganizationUnit Checks .................................................308

    Start/End Checks ...............................................................309

    Synchronization Checks ...................................................309

    Transition and Flow Checks .............................................310

    Component Checks...........................................................311

    Node Checks ......................................................................312

    Data FormatChecks .........................................................313

    Component Instance Checks ...........................................313

    Interaction Reference Checks ..........................................314

    Class Part Checks .............................................................315

    Class/Component Port Checks........................................316

    Class/component Assembly Connector Checks............317Association Checks...........................................................318

    Activity Input and Output Parameter Checks ..................318

    CHAPTER 10: Importing a Rational Rose Model intoan OOM.....................................................................319

    Importing Rational Rose Use Case Diagrams .................320

    Importing Rational Rose Class Diagrams .......................321

    Importing Rational Rose Collaboration Diagrams ..........322

    Importing Rational Rose Sequence Diagrams ................323

    Importing Rational Rose Statechart Diagrams...............323

    Importing Rational Rose Activity Diagrams ....................324

    Importing Rational Rose Component Diagrams .............325

    Contents

    xiv PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    15/688

    Importing Rational Rose Deployment Diagrams ............326

    CHAPTER 11: Importing and Exporting an OOM inXMI Format ...............................................................327

    Importing XMI Files ...........................................................327

    Exporting XMI Files ...........................................................327

    PART III: Object Language Definition Reference......329

    CHAPTER 12: Working with Java..............................331

    Java Public Classes ..........................................................331

    Java Enumerated Types (Enums) .....................................331JavaDoc Comments ..........................................................334

    Defining Values for Javadoc Tags ...............................337

    Javadoc Comments Generation and Reverse

    Engineering ............................................................ 339

    Java 5.0 Annotations .........................................................339

    Java StrictfpKeyword .......................................................340

    Enterprise Java Beans (EJBs) V2 ....................................341

    Using EJB Types .........................................................342EJB Properties ............................................................343

    Creating an EJB with the Wizard ................................344

    Defining Interfaces and Classes for EJBs ...................347

    Defining Operations for EJBs ..................................... 349

    Adding an Operation to the Bean Class ............ 350

    Adding an Operation to an EJB Interface ..........350

    Understanding Operation Synchronization ........351

    Understanding EJB Support in an OOM .....................351

    Previewing the EJB Deployment Descriptor ............... 354

    Generating EJBs .........................................................356

    What Kind of Generation to Use? ......................357

    Understanding EJB Source and Persistence .....359

    Contents

    Object-Oriented Modeling xv

  • 8/12/2019 Sybase - Object Oriented Modeling

    16/688

    Generating EJB Source Code and the

    Deployment Descriptor ..................................360

    Generating JARs ........................................................361

    Reverse Engineering EJB Components .....................362

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

    Wizard ....................................................................363

    EJB 3.0BeanClass Properties ...................................367

    EJB 3.0Component Properties ..................................368

    Adding Further Interfaces and Classes to the

    EJB ................................................................368

    EJB 3.0 Operation Properties .....................................369

    Java Servlets ......................................................................370

    Servlet Page of the Component ..................................370

    Defining Servlet Classes ............................................371

    Creating a Servlet with the Wizard .............................371

    Understanding Servlet Initialization and

    Synchronization ......................................................372

    Generating Servlets ....................................................373

    Generating Servlet Web Deployment Descriptor

    .......................................................................376

    Generating WARs .......................................................376Reverse Engineering Servlets ....................................377

    Java Server Pages (JSPs) .................................................379

    JSP Page of the Component ......................................379

    Defining File Objects for JSPs ....................................379

    Creating a JSP with the Wizard ..................................380

    Generating JSPs .........................................................381

    Generating JSP Web Deployment Descriptor ....381

    Reverse Engineering JSPs .........................................384Generating Java Files ........................................................385

    Reverse Engineering Java Code ......................................389

    Reverse Engineer Java Options Tab ...........................391

    Reverse Engineering Java Code Comments .....393

    Contents

    xvi PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    17/688

    CHAPTER 13: Working with the Eclipse ModelingFramework (EMF) .....................................................395

    EMF Objects .......................................................................395EPackages .................................................................395

    Eclasses, EEnums, and EDataTypes ..........................395

    EAnnotations .............................................................396

    Eattributes and EEnumLiterals ...................................396

    EReferences ..............................................................396

    EOperations and EParameters ...................................397

    Generating EMF Files ........................................................397

    Reverse Engineering EMF Files.......................................398

    CHAPTER 14: Working with IDL.................................399

    IDL Objects .........................................................................399

    Generating for IDL .............................................................408

    Reverse Engineering IDL Files .........................................409

    CHAPTER 15: Working with PowerBuilder ...............411

    PowerBuilder Objects ........................................................411Generating PowerBuilder Objects ....................................414

    Reverse Engineering PowerBuilder .................................415

    Reverse Engineered Objects ......................................415

    Operation Reversed Header ..............................416

    Overriding Attributes ..........................................417

    PowerBuilder Reverse Engineering Process ..............417

    Reverse Engineering PowerBuilder Objects ......418

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

    CHAPTER 16: Working with VB .NET........................421

    Inheritance & Implementation ..........................................421

    Contents

    Object-Oriented Modeling xvii

  • 8/12/2019 Sybase - Object Oriented Modeling

    18/688

    Namespace .........................................................................421

    Project .................................................................................421

    Accessibility .......................................................................422

    Classes, Interfaces, Structs, and Enumerations ............423

    Module ...............................................................................424CustomAttributes .............................................................425

    Shadows ............................................................................425

    Variables ............................................................................426

    Property .............................................................................427

    Method ...............................................................................428

    Constructor & Destructor .................................................430

    Delegate .............................................................................430

    Event ..................................................................................431

    Event Handler .....................................................................432

    External Method .................................................................432

    Generating VB.NET Files ..................................................433

    Reverse Engineering VB .NET ..........................................435

    Selecting VB .NETReverse Engineering Options ......435

    Defining VB .NET Reverse Engineering Options

    .......................................................................436

    VB .NET Reverse Engineering Preprocessing ...........437

    VB .NET Supported Preprocessing Directives.......................................................................438

    Defining a VB .NET Preprocessing Symbol .......438

    VB .NET Reverse Engineering with

    Preprocessing ...............................................439

    Reverse Engineering VB .NET Files ...........................440

    Working with ASP.NET ......................................................441

    ASP Tab of the Component ........................................441

    Defining File Objects for ASP.NET ..............................442Creating an ASP.NET with the Wizard ........................442

    Generating ASP.NET ..................................................444

    CHAPTER 17: Working with Visual Basic 2005........447

    Contents

    xviii PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    19/688

    Visual Basic 2005 Assemblies..........................................447

    Visual Basic 2005 Compilation Units ...............................449

    Partial Types ...............................................................451

    Visual Basic 2005 Namespaces........................................451

    Visual Basic2005 Classes ................................................452Visual Basic2005 Interfaces .............................................453

    Visual Basic2005 Structs .................................................453

    Visual Basic2005 Delegates .............................................454

    Visual Basic2005 Enums ..................................................455

    Visual Basic2005 Fields, Events, and Properties ..........456

    Visual Basic2005 Methods ...............................................459

    Visual Basic2005 Inheritance and Implementation.......460

    Visual Basic2005 Custom Attributes ..............................460

    Generating Visual Basic 2005 Files .................................460

    Reverse Engineering Visual Basic 2005 Code ................462

    Visual Basic Reverse Engineer Dialog Options Tab ...463

    Visual Basic Reverse Engineering Preprocessing

    Directives ................................................................464

    Visual Basic Supported Preprocessing

    Directives .......................................................465

    Defining a Visual Basic Preprocessing Symbol

    .......................................................................465

    CHAPTER 18: Working with C# ..................................467

    Inheritance & Implementation..........................................467

    Namespace.........................................................................467

    Project .................................................................................467

    Accessibility .......................................................................468

    Classes, Interfaces, Structs, and Enumerations............469

    Custom Attributes .............................................................471

    Fields .................................................................................471

    Property .............................................................................472

    Indexer ...............................................................................473

    Method ...............................................................................475

    Contents

    Object-Oriented Modeling xix

  • 8/12/2019 Sybase - Object Oriented Modeling

    20/688

    Constructor & Destructor .................................................477

    Delegate .............................................................................477

    Event ..................................................................................478

    Operator Method ................................................................478

    Conversion Operator Method ...........................................478Documentation Tags .........................................................479

    Generating C# Files ...........................................................480

    Reverse Engineering C# ...................................................482

    Selecting C# Reverse Engineering Options ................483

    Defining C# Reverse Engineering Options ........ 484

    C# Reverse Engineering Preprocessing .....................484

    C# Supported Preprocessing Directives............485

    Defining a C# Preprocessing Symbol ................486

    C# Reverse Engineering with Preprocessing.... 487

    Reverse Engineering C# Files ....................................487

    CHAPTER 19: Working with C# 2.0 ............................489

    C# 2.0 Assemblies .............................................................489

    C# 2.0 Compilation Units ..................................................491

    Partial Types ............................................................... 492

    C# 2.0 Namespaces ...........................................................493C# 2.0 Classes ....................................................................494

    C# 2.0 Interfaces ................................................................495

    C# 2.0 Structs .....................................................................495

    C# 2.0 Delegates ................................................................496

    C# 2.0 Enums.....................................................................497

    C# 2.0 Fields .......................................................................498

    C# 2.0 Methods ..................................................................498

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

    C# 2.0 Inheritanceand Implementation...........................504

    C# 2.0 Custom Attributes ..................................................504

    Generating C# 2.0 Files .....................................................504

    Reverse Engineering C# 2.0 Code ...................................506

    C# Reverse Engineer Dialog Options Tab .................. 507

    Contents

    xx PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    21/688

    C# Reverse Engineering Preprocessing Directives ....508

    C# Supported Preprocessing Directives............508

    Defining a C# Preprocessing Symbol ................509

    CHAPTER 20: Working with XML...............................511

    Designing for XML .............................................................511

    Generating for XML ...........................................................515

    Reverse-Engineering XML ................................................516

    CHAPTER 21: Working with C++ ................................519

    Designing for C++ ..............................................................519

    Generating for C++ ............................................................520

    CHAPTER 22: Object/Relational (O/R) Mapping.......523

    Top-Down: Mapping Classes to Tables ...........................523

    Entity Class Transformation ........................................525

    Attribute Transformation ..............................................526

    Value Type Transformation ..........................................527

    Association Transformation .........................................528

    Association Class Transformation ......................530Inheritance Transformation .........................................530

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

    Meet inthe Middle: Manually Mapping Classes to Tables

    .........................................................................................534

    Entity Class Mapping ..................................................535

    Attribute Mapping ........................................................538

    Primary Identifier Mapping ..........................................539

    Association Mapping ...................................................542One-to-One Association Mapping Strategy .......543

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

    Many-to-Many Association Mapping Strategy . . .547

    Defining Inheritance Mapping .....................................547

    Contents

    Object-Oriented Modeling xxi

  • 8/12/2019 Sybase - Object Oriented Modeling

    22/688

    Table Per Class Hierarchy Inheritance Mapping

    Strategy .........................................................547

    Joined Subclass Inheritance Mapping Strategy

    .......................................................................550

    Table Per Class Inheritance Mapping Strategy.......................................................................551

    CHAPTER 23: Generating Persistent Objects forJava and JSF Pages................................................553

    Generating Hibernate Persistent Objects ........................553

    Defining the Hibernate Default Options ......................553

    Defining the Hibernate Database Configuration

    Parameters .............................................................554Defining Hibernate Basic O/R Mappings ....................555

    Defining Hibernate Class Mapping Options .......555

    Defining Primary Identifier Mappings .................558

    Defining Attribute Mappings ...............................562

    Hibernate Association Mappings ................................563

    Defining Hibernate Association Mapping

    Options ..........................................................563

    Collection Management Options ........................565Persistence Options ...........................................566

    Mapping Collections of Value Types ..................567

    Defining HibernateInheritance Mappings ..................568

    Generating Code for Hibernate ...................................568

    Checking the Model ...........................................569

    Defining Generation Options .............................569

    Generating Code for Hibernate ..........................570

    Using the Generated Hibernate Code ........................571

    Importing the Generated Project into Eclipse ....571

    Performing the Unit Tests ...................................571

    Running Unit Tests in Eclipse ............................572

    Running Unit Tests with Ant ...............................574

    Generating EJB 3 Persistent Objects ..............................575

    Contents

    xxii PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    23/688

    Generating Entities for EJB 3.0 ..................................576

    Defining EJB 3 Basic O/R Mapping ............................576

    Defining Entity Mappings ...................................576

    Defining Embeddable Class Mapping................579

    Defining EJB 3 Association Mappings ........................580Mapping One-to-one Associations .....................580

    Mapping One-to-many Associations ..................580

    Mapping Many-to-many Associations ................581

    Defining EJB 3 Association Mapping Options

    .......................................................................582

    Defining EJB 3 Inheritance Mappings ........................582

    Mapped Superclasses .......................................583

    Table Per Class Hierarchy Strategy ...................583

    Joined Subclass Strategy ..................................583

    Applying Table Per Class Strategy .....................584

    Defining EJB 3 Persistence Default Options ...............584

    Defining EJB 3 Persistence Configuration ..................584

    Checking the Model ....................................................586

    Generating Code for EJB 3 Persistence.....................587

    Defining the Environment Variable .....................587

    Generate Code ..................................................588

    Authoring in Dali Tools .......................................590Run Unit Tests ...................................................590

    Generated File List ............................................593

    Generating JavaServerFaces (JSF) for Hibernate .........594

    Defining Global Options ..............................................594

    Defining Attribute Options ...........................................597

    Derived Attributes ..............................................599

    Attribute Validation Rules and Default Values

    .......................................................................599Defining Master-Detail Pages .....................................600

    Generating PageFlow Diagrams.................................602

    Generating aclass level PageFlow diagram ......602

    Generating aPackage Level PageFlow

    Diagram: ........................................................603

    Contents

    Object-Oriented Modeling xxiii

  • 8/12/2019 Sybase - Object Oriented Modeling

    24/688

    Generating a Model Level PageFlow Diagram

    .......................................................................603

    Modifing Default High Level PageFlow Diagram

    .......................................................................604

    Installing JSF Runtime Jar Files .................................606Installing the JSF Reference Implementation

    .......................................................................606

    Installing Apache My Faces ...............................607

    Configuring for JSF Generation ..................................607

    Generating JSF Pages ................................................608

    Testing JSF Pages ......................................................608

    Testing JSF Pages with Eclipse WTP................609

    Testing JSF Pages with Apache Tomcat ............609

    CHAPTER 24: Generating .NET 2.0 PersistentObjects and Windows Applications.......................611

    Generating ADO.NET and ADO.NET CF Persistent

    Objects ...........................................................................613

    ADO.NET and ADO.NET CF Options .........................613

    Class Mappings ..........................................................614

    Primary Identifier Mappings ...............................616Attribute Mappings .............................................617

    Defining Association Mappings ...................................618

    Defining Inheritance Mappings ...................................620

    Generating Code for ADO.NET or ADO.NET CF ........620

    Generating NHibernate Persistent Objects .....................621

    NHibernate Options ....................................................622

    Defining Class Mappings ............................................623

    PrimaryIdentifier Mappings ...............................626

    Attribute Mappings .............................................629

    Defining Association Mappings ...................................631

    Defining NHibernate Collection Options ............632

    Defining NHibernate Persistence Options .........633

    Contents

    xxiv PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    25/688

    Defining NHibernate Collection Container Type

    .......................................................................634

    Defining Inheritance Mappings ...................................634

    Generating Code for NHibernate ................................635

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

    ADO.NET CF Tab ...................................................637

    Configuring a Connection String from the NHibernate

    Tab ..........................................................................637

    OLEDB Connection String Parameters ......................637

    ODBC Connection String Parameters ........................638

    Microsoft SQL Server and Microsoft SQL Server

    Mobile Edition Connection String Parameters ........638

    Oracle Connection String Parameters ........................638

    Generating Code for Unit Testing ....................................639

    Running NUnit Unit Tests ............................................641

    Running Visual Studio Test System Unit Tests ...........642

    Running Tests in Visual Studio.NET 2005 IDE

    .......................................................................643

    Running Tests from the Command Line ............643

    Generating Windows or Smart Device Applications ......644

    Specifying an Image Library .......................................644Controlling the Data Grid View ...................................644

    Defining Attributes Display Options ............................644

    Defining Attribute Validation Rules and Default Values

    ................................................................................645

    Generating Code for a Windows Application ..............645

    Generating Code for a Smart Device Application .......646

    Deploying Code to a Smart Device ....................647

    Testing the Application on the Device ................647

    Index .........................................................................................649

    Contents

    Object-Oriented Modeling xxv

  • 8/12/2019 Sybase - Object Oriented Modeling

    26/688

    Contents

    xxvi PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    27/688

    PART I

    Building OOMs

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

    PowerDesigner.

    Object-Oriented Modeling 1

  • 8/12/2019 Sybase - Object Oriented Modeling

    28/688

    2 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    29/688

    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 Modeling

    Language (UML). You can model, reverse-engineer, and generate for Java, .NET and other

    languages.

    PowerDesignersupports the following UML diagrams:

    Use case diagram ( ) - see Chapter 2, Use Case Diagramson page 17

    Structural Diagrams:

    Class diagram ( ) - see Class Diagramson page 27 Composite structure diagram ( ) - see Composite Structure Diagramson page 29

    Object diagram ( ) - see Object Diagramson page 32

    Package diagram ( ) - see Package Diagramson page 31

    Dynamic Diagrams:

    Communication diagram ( ) - see Communication Diagramson page 123

    Sequence diagram ( ) - see Sequence Diagramson page 125

    Activity diagram ( ) - see Activity Diagramson page 129

    Statechart diagram ( ) - see Statechart Diagramson page 131

    Interaction overview diagram ( ) - see Interaction Overview Diagramson page134

    Implementation Diagrams:

    Component diagram ( ) - see Component Diagramson page 207

    Deployment diagram ( ) - see Deployment Diagramson page 209

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

    model:

    Object-Oriented Modeling 3

  • 8/12/2019 Sybase - Object Oriented Modeling

    30/688

    Suggested Bibliography

    James Rumbaugh, Ivar Jacobson, Grady Booch The Unified Modeling Language

    Reference Manual Addison Wesley, 1999

    Grady Booch, James Rumbaugh, Ivar Jacobson The Unified Modeling Language User

    Guide Addison Wesley, 1999

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    4 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    31/688

    Ivar Jacobson, Grady Booch, James Rumbaugh The Unified Software Development

    Process Addison Wesley, 1999

    Doug Rosenberg, Kendall Scott Use Case Driven Object Modeling With UML A

    Practical Approach Addison Wesley, 1999

    Michael Blaha, William Premerlani Object-Oriented Modeling and Design for Database

    Applications 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 also

    reverse-engineer a model from existing OO code (see Reverse Engineering OO Source Files

    into an OOMon page 269).

    The New Model dialog is highly configurable, and your administrator may hide options that

    are not relevant for your work or provide templates or predefined models to guide you through

    model creation. When you open the dialog, one or more of the following buttons will be

    available on the left hand side: Categories- which provides a set of predefined models and diagrams sorted in a

    configurable category structure.

    Model types- which provides the classic list of PowerDesigner model types and

    diagrams.

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

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    Object-Oriented Modeling 5

  • 8/12/2019 Sybase - Object Oriented Modeling

    32/688

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

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

    left-hand pane.

    3. Select an item in the right-hand pane. Depending on how your New Model dialog is

    configured, these items may be first diagrams or templates on which to base the creation of

    your model.

    Use the Viewstool on the upper right hand side of the dialog to control the display of the

    items.

    4. Enter a model name.

    The code of the model, which is used for script or code generation, is derived from this

    name using the model naming conventions.5. Select a target object language , which customizes PowerDesigner's default modifying

    environment with target-specific properties, objects, and generation templates.

    By default, PowerDesigner creates a link in the model to the specified file. To copy the

    contents of the resource and save it in your model file, click the Embed Resource in

    Modelbutton to the right of this field. Embedding a file in this way enables you to make

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    6 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    33/688

    changes specific to your model without affecting any other models that reference the

    shared resource.

    6. [optional] Click the Select Extensionsbutton and attach one or more extensions to your

    model.

    7. Click OKto create and open the object-oriented model .

    Note:Sample OOMs are available in the Example Directory.

    OOM PropertiesYou open the model property sheet by right-clicking the model in the Browser and selecting

    Properties.

    Each object-oriented model has the following model properties:

    Property Description

    Name/Code/Comment Identify the model. The name should clearly convey the model's purpose to

    non-technical users, while the code, which is used for generating code or

    scripts, may be abbreviated, and should not normally include spaces. You

    can optionally add a comment to provide more detailed information about

    the model. By default the code is auto-generated from the name by applying

    the naming conventions specified in the model options. To decouple name-

    code synchronization, click to release the = button to the right of the Code

    field.

    Filename Specifies the location of the model file. This box is empty if the model has

    never been saved.

    Author Specifies the author of the model. If you enter nothing, the Author field in

    diagram title boxes displays the user name from the model property sheet

    Version Info tab. If you enter a space, the Author field displays nothing.

    Version Specifies the version of the model. You can use this box to display the

    repository version or a user defined version of the model. This parameter is

    defined in the display preferences of the Title node.

    Object language Specifies the model target.

    Default diagram Specifies the diagram displayed by default when you open the model.

    Keywords Provide a way of loosely grouping objects through tagging. To enter mul-tiple keywords, separate them with commas.

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    Object-Oriented Modeling 7

  • 8/12/2019 Sybase - Object Oriented Modeling

    34/688

    Previewing Object Code

    Click the Previewtab in the property sheet of the model, packages, classes, and various other

    model objects in order to view the code that will be generated for it.For example, if you have created EJB or servlet components in Java, the Preview tab displays

    the EJB or Web deployment descriptor files. If you have selected an XML family language, the

    Preview tab displays the Schema file that corresponds to the XML file to be generated.

    If you have selected the Preview Editableoption (available from Tools > Model Options),

    you can modify the code of a classifier directly from its Previewtab. The modified code must

    be valid and apply only to the present classifier or your modifications will be ignored. You can

    create generalization and realization links if their classifiers already exist in the model, but you

    cannot rename the classifier or modify the package declaration to move it to another package.

    You should avoid renaming attributes and operations, as any other properties that are notgenerated (such as description, annotation or extended attributes) will be lost. Valid changes

    are applied when you leave the Previewtab or click the Applybutton.

    In a model targeting PowerBuilder, this feature can be used to provide a global vision of the

    code of an object and its functions which is not available in PowerBuilder. You can use the

    Previewtab to check where instance variables are used in the code. You can also modify the

    body of a function or create a new function from an existing function using copy/paste.

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    8 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    35/688

    The following tools are available on the Previewtab toolbar:

    Tools Description

    Editor Menu [Shift+F11]- Contains the following commands:

    New [Ctrl+N]- Reinitializes the field by removing all the existing content.

    Open... [Ctrl+O]- Replaces the content of the field with the content of the se-

    lected file.

    Insert... [Ctrl+I]- Inserts the content of the selected file at the cursor.

    Save [Ctrl+S]- Saves the content of the field to the specified file.

    Save As...- Saves the content of the field to a new file.

    Select All [Ctrl+A]- Selects all the content of the field.

    Find... [Ctrl+F]- Opens a dialog to search for text in the field.

    Find Next... [F3]- Finds the next occurence of the searched for text.

    Find Previous... [Shift+F3]- Finds the previous occurence of the searched fortext.

    Replace... [Ctrl+H]- Opens a dialog to replace text in the field. Go To Line... [Ctrl+G]- Opens a dialog to go to the specified line.

    Toggle Bookmark [Ctrl+F2]Inserts or removes a bookmark (a blue box) at thecursor position. Note that bookmarks are not printable and are lost if you refresh

    the tab, or use the Show Generation Optionstool

    Next Bookmark [F2]- Jumps to the next bookmark.

    Previous Bookmark [Shift+F2]- Jumps to the previous bookmark.

    Edit With [Ctrl+E]- Opens the previewed code in an external editor. Click the down

    arrow to select a particular editor or Choose Programto specify a new editor. Editors

    specified here are added to the list of editors available at Tools > General Options >

    Editors.

    Save [Ctrl+S]- Saves the content of the field to the specified file.

    Print [Ctrl+P]- Prints the content of the field.

    Find [Ctrl+F]- Opens a dialog to search for text.

    Cut [Ctrl+X], Copy [Ctrl+C], and Paste [Ctrl+V]- Perform the standard clipboardactions.

    Undo [Ctrl+Z]and Redo [Ctrl+Y]- Move backward or forward through edits.

    Refresh [F5]- Refreshes the Preview tab.

    You can debug the GTL templates that generate the code shown in the Preview tab. To

    do so, open the target or extension resource file, select the Enable Trace Modeoption,

    and click OKto return to your model. You may need to click the Refreshtool to

    display the templates.

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    Object-Oriented Modeling 9

  • 8/12/2019 Sybase - Object Oriented Modeling

    36/688

    Tools Description

    Select Generation Targets [Ctrl+F6]- Lets you select additional generation targets(defined in extensions), and adds a sub-tab for each selected target. For information

    about generation targets, see Customizing and Extending PowerDesigner > Extension

    Files > Extending Generation and Creating Separate Generation Targets.

    Show Generation Options [Ctrl+W]- Opens the Generation Options dialog, allow-

    ing you to modify the generation options and to see the impact on the code. This feature

    is especially useful when you are working with Java. For other object languages,generation options do not influence the code.

    Customizing Object Creation Scripts

    The Script tab allows you to customize the object's creation script by, for example, adding

    descriptive information about the script.

    ExamplesFor example, if a project archives all generated creation scripts, a header can be inserted before

    each creation script, indicating the date, time, and any other appropriate information or, if

    generated scripts must be filed using a naming system other than the script name, a header

    could direct a generated script to be filed under a different name.

    You can insert scripts at the beginning (Header subtab) and the end (Footer subtab) of a script

    or insert scripts before and after a class or interface creation command (Imports subtab)

    The following tools and shortcut keys are available on the Script tab:

    Tool Description

    [Shift+F11] Open Editor Contextual menu

    [Ctrl+E] Edit With - Opens your default editor.

    Import Folder - [Imports sub-tab] Opens a selection window to select packages to

    import to the cursor position, prefixed by the keyword 'import'.

    Import Classifier - [Imports sub-tab] Opens a selection window to select classifiers to

    import to the cursor position, prefixed by the keyword 'import'.

    You can use the following formatting syntax with variables:

    Format code Format of variable value in script

    .L Lowercase characters

    .T Removes blank spaces

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    10 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    37/688

    Format code Format of variable value in script

    .U Uppercase characters

    .c Upper-case first letter and lower-case next letters

    .n Maximum length where n is the number of characters

    .nJ Justifies to fixed length where n is the number of characters

    You embed formatting options in variable syntax as follows:

    %.format:variable%

    Customizing your Modeling Environment

    The PowerDesigner object-oriented model provides various means for customizing and

    controlling your modeling environment.

    Setting OOM Model OptionsYou can set OOM model options by selecting Tools > Model Optionsor right-clicking the

    diagram background and selecting Model Options. These options affect all the objects in the

    model, including those already created.

    You can set the following options:

    Option Definition

    Name/Code casesensitive Specifies that the names and codes for all objects are case sensitive, allowing youto have two objects with identical names or codes but different cases in the same

    model. If you change case sensitivity during the design process, we recommend

    that you check your model to verify that your model does not contain any du-plicate objects.

    Enable links to re-quirements

    Displays a Requirements tab in the property sheet of every object in the model,which allows you to attach requirements to objects (see Requirements Model-

    ing).

    Show classes as

    data types

    Includes classes of the model in the list of data types defined for attributes or

    parameters, and return types defined for operations.

    Preview editable Applies to reverse engineering. You can edit your code from the Preview page ofa class or an interface by selecting the Preview Editable check box. This allowsyou to reverse engineer changes applied to your code directly from the Preview

    page.

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    Object-Oriented Modeling 11

  • 8/12/2019 Sybase - Object Oriented Modeling

    38/688

    Option Definition

    External Shortcut

    Properties

    Specifies the properties that are stored for external shortcuts to objects in other

    models for display in property sheets and on symbols. By default, Allproperties

    appear, but you can select to display only Name/Codeto reduce the size of yourmodel.

    Note:This option only controls properties of external shortcuts to models of thesame type (PDM to PDM, EAM to EAM, etc). External shortcuts to objects in

    other types of model can show only the basic shortcut properties.

    Default DataTypes

    Specifies default data types for attributes, operations, and parameters.

    If you type a data type value that does not exist in the BasicDataTypes andAdditionalDataTypes lists of the object language, then the value of the Default-

    DataType entry is used. For more information on data types in the object lan-guage, see Customizing and Extending PowerDesigner > Object, Process, andXML Language Definition Files > Settings Category: Object Language.

    Domain/Attrib-

    ute: Enforce non-

    divergence

    Specifies that attributes attached to a domain must remain synchronized with the

    properties of that domain. You can specify any or all of:

    Data type data type, length, and precision

    Check check parameters, such as minimum and maximum values

    Rules business rules

    Domain/Attrib-ute: Use data type

    full name

    Specifies that the full data type name is used for attribute data types instead of itsabbreviated from. Provides a clear persistent data type list for attributes.

    Default Associa-

    tion Container

    Specifies a default container for associations that have a role with a multiplicity

    greater than one.

    Message: Support

    delay

    Specifies that messages may have duration (slanted arrow message). If this op-

    tion is deselected, messages are treated as instantaneous, or fast (horizontalmessage).

    Interface/Class:Auto-implement

    realized interfa-ces

    Adds to the realizing class any methods of a realized interface and its parents thatare not already implemented by the class. The stereotype is

    applied to the methods.

    Interface/Class:

    Class attribute de-fault visibility

    Specifies the default visibility of class attributes.

    Note:For information about specifying naming conventions for your model objects, see Core

    Features Guide > The PowerDesigner Interface > Objects > Object Properties > Naming

    Conventions.

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    12 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    39/688

    Setting OOM Display PreferencesPowerDesigner display preferences allow you to customize the format of object symbols, and

    the information that is displayed on them. To set object-oriented model display preferences,

    select Tools > Display Preferencesor right-click the diagram background and select Display

    Preferencesfrom the contextual menu.

    For detailed information about customizing and controlling the attributes and collections

    displayed on object symbols, see Core Features Guide > The PowerDesigner Interface >

    Diagrams, Matrices, and Symbols > Display Preferences.

    Viewing and Editing the Object Language Definition FileEach OOM is linked to a definition file that extends the standard PowerDesigner metamodel to

    provide objects, properties, data types, and generation parameters and templates specific to

    the language being modeled. Definition files and other resource files are XML files located in

    the Resource Filesdirectory inside your installation directory, and can be opened and

    edited in the PowerDesigner Resource Editor.

    Warning!We strongly recommend that you make a back up of the resource files delivered

    with PowerDesigner before editing them.

    To open your model's definition file and review its extensions, select Language > Edit

    Current Object Language.

    For detailed information about the format of these files, see Customizing and Extending

    PowerDesigner > Object, Process, and XML Language Definition Files.

    Note:Some resource files are delivered with "Not Certified" in their names. Sybasewill

    perform all possible validation checks, however Sybase does not maintain specific

    environments to fully certify these resource files. Sybase will support the definition by

    accepting bug reports and will provide fixes as per standard policy, with the exception that

    there will be no final environmental validation of the fix. Users are invited to assist Sybase by

    testing fixes of the definition provided by Sybase and report any continuing inconsistencies.

    Changing the Object LanguageYou can change the object languagebeing modeled in your OOM at any time.

    Note:You may be required to change the object language if you open a model and the

    associated definition file is unavailable. Language definition files are frequently updated ineach version of PowerDesigner and it is highly recommended to accept this change, or

    otherwise you may be unable to generate for the selected language.

    1. Select Language > Change Current Object Language:

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    Object-Oriented Modeling 13

  • 8/12/2019 Sybase - Object Oriented Modeling

    40/688

    2. Select a object languagefrom the list.

    By default, PowerDesigner creates a link in the model to the specified file. To copy the

    contents of the resource and save it in your model file, click the Embed Resource in

    Modelbutton to the right of this field. Embedding a file in this way enables you to make

    changes specific to your model without affecting any other models that reference the

    shared resource.

    3. Click OK.

    A message box opens to tell you that the object language has been changed.

    4. Click OKto return to the model.

    Extending your Modeling EnvironmentYou can customize and extend PowerDesigner metaclasses, parameters, and file generation

    with extensions, which can be stored as part of your model or in separate extension files

    (*.xem) for reuse with other models.

    To access extension defined in a *.xemfile, simply attach the file to your model. You can do

    this when creating a new model by clicking the Select Extensionsbutton at the bottom of the

    New Model dialog, or at any time by selecting Model > Extensionsto open the List of

    Extensions and clicking the Attach an Extensiontool.

    In each case, you arrive at the Select Extensions dialog, which lists the extensions available,

    sorted on sub-tabs appropriate to the type of model you are working with:

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    14 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    41/688

    To get started extending objects, see Core Features Guide > The PowerDesigner Interface >

    Objects > Extending Objects. For detailed information about working with extensions, seeCustomizing and Extending PowerDesigner > Extension Files.

    Linking Objects with Traceability LinksYou can create traceability links to show any kind of relationship between two model objects

    (including between objects in different models) via the Traceability Linkstab of the object's

    property sheet. These links are used for documentation purposes only, and are not interpreted

    or checked by PowerDesigner.

    For more information about traceability links, see Core Features Guide > Linking and

    Synchronizing Models > Getting Started with Linking and Syncing > Creating TraceabilityLinks.

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    Object-Oriented Modeling 15

  • 8/12/2019 Sybase - Object Oriented Modeling

    42/688

    CHAPTER 1: Getting Started with Object-Oriented Modeling

    16 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    43/688

    CHAPTER 2 Use Case Diagrams

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

    Note:To create a use case diagram in an existing OOM, right-click the model in the Browser

    and select New > Use Case Diagram. To create a new model, select File > New Model,

    choose Object Oriented Model as the model type and Use Case Diagramas the first diagram,

    and then click OK.

    With a use case diagram, you immediately see a snapshot of the system functionality. Further

    details can later be added to the diagram if you need to elucidate interesting points in the

    system 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 to

    describing the TCP/IP network protocol because there are many exception cases, branching

    behaviors, and conditional functionality (what happens when the connection dies, what

    happens when a packet is lost?)

    In the following example, the actor "photographer" does two things with the camera: take

    pictures and change the film. When he takes a picture, he has to switch the flash on, open the

    shutter, and then close the shutter but these activities are not of a high enough level to be

    represented in a use case.

    Object-Oriented Modeling 17

  • 8/12/2019 Sybase - Object Oriented Modeling

    44/688

    Use Case Diagram Objects

    PowerDesigner supports all the objects necessary to build use case diagrams.

    Object Tool Symbol Description

    Actor Used to represent an external person, process or

    something interacting with a system, sub-system or

    class. See Actors (OOM)on page 20.

    Use case Defines a piece of coherent behavior in a system,

    without revealing its internal structure. See Use

    Cases (OOM)on page 18.

    Association Communication path between an actor and a use

    case that it participates in. See Use Case Associa-

    tions (OOM)on page 24.

    Generalization A link between a general use case and a more spe-cific use case that inherits from it and add features

    to it. See Generalizations (OOM)on page 95.

    Dependency Relationship between two modeling elements, in

    which a change to one element will affect the otherelement. See Dependencies (OOM)on page 98.

    Use Cases (OOM)A use caseis an interaction between a user and a system (or part of a system). It defines a

    discrete goal that a user wants to achieve with the system, without revealing the system's

    internal structure.

    A use case can be created in the following diagrams:

    Use Case Diagram

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

    CHAPTER 2: Use Case Diagrams

    18 PowerDesigner

  • 8/12/2019 Sybase - Object Oriented Modeling

    45/688

    Creating a Use CaseYou can create a use case from the Toolbox, Browser, or Modelmenu.

    Use the Use Casetool in the Toolbox.

    Select Model > Use Casesto access the List of Use Cases, and click the Add a Rowtool. Right-click the model (or a package) in the Browser, and select New > Use Case.

    For general information about creating objects, see Core Features Guide > The

    PowerDesigner Interface > Objects.

    Use Case PropertiesTo view or edit a use case's properties, double-click its diagram symbol or Browser or list

    entry. The property sheet tabs and fields listed here are those available by default, before any

    customization of the interface by you or an administrator.

    The Generaltab contains the following properties:

    Property Description

    Name/Code/

    Comment

    Identify the object. The name should clearly convey the object's purpose to non-

    technical users, while the code, which is used for generating code or scripts, may

    be abbreviated, and should not normally include spaces. You can optionally add a

    comment to provide more detailed information about the object. By default the

    code is generated from the name by applying the naming conventions specified in

    the model options. To decouple name-code synchronization, click to release the

    = button to the right of the Codefield.

    Stereotype Extends the semantics of the object beyond the core UML definition. You can

    enter a stereotype directly in this field, or add stereotypes to the list by specifying

    them in an extension file.

    Keywords Provide a way of loosely grouping objects through tagging. To enter multiple

    keywords, separate them with commas.

    Specification TabThe Specification tab contains the following properties, available on sub-tabs at the bottom of

    the dialog:

    Property Description

    Action Steps Specifies a textual description of the normal sequence of actions associated with a

    use case.

    For example, the action steps for a use case called 'register patient' in a hospital

    might be as follows: "Open a file, give a new registration number, write down

    medical treatment".

    CHAPTER 2: Use Case Diagrams

    Object-Oriented Modeling 19

  • 8/12/2019 Sybase - Object Oriented Modeling

    46/688

    Property Description

    Extension Points Specifies a textual description of actions that extend the normal sequence of

    actions. Extensions are usually introduced with an "if ....then" statement.

    For example, an extension to the action steps above might be: "If the patient

    already 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.

    Implementation Classes TabA use case is generally a task or service, represented as a verb. When analyzing what a use case

    must do, you can identify the classes and interfaces that need to be created to fulfill the task,

    and attach them to the use case. The Implementation Classes tab lists the classes and interfacesused to implement a use case. The following tools are available:

    Tool Action

    Add Objects Opens a dialog box to select any class or interface in the model to implement

    the use case.

    Create a New Class Creates a new class to implement the use case.

    Create a New Interface - Creates a new interface to implement the use case.

    For example, a use case Ship product by express mailcould be implemented by the classesShipping, Product, and Billing.

    Related Diagrams TabThe Related Diagrams tab lists diagrams that help you to further understand the use case. Click

    the Add Objectstool to add diagrams to the list from any model open in the workspace. For

    more information, Core Features Guide > The PowerDesigner Interface > Diagrams,

    Matrices, and Symbols > Diagrams > Specifying Diagrams as Related Diagrams.

    Actors (OOM)An actoris an outside user or set of users that interact with a system. Actor