69
E E N04 N04 Object-Or Object-Or i i en en t t ed Modeling with ed Modeling with PowerDesigner PowerDesigner 9.5 9.5 Xiao Wang PowerDesigner Chief Architect, EBD [email protected]

EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD [email protected]

Embed Size (px)

Citation preview

Page 1: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

EEN04N04Object-OrObject-Oriienentted Modeling with ed Modeling with PowerDesigner PowerDesigner 9.59.5

Xiao WangPowerDesigner Chief Architect, [email protected]

Page 2: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

AgendaAgenda

Introduction to modeling Brief Overview of Object-Oriented Modeling and UMLPowerDesigner 9.5 overview Designing an Object Model for a Java application Creating J2EE components Creating Web Service Components Creating .NET applications Reporting and Repository Conclusion

Page 3: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Why Modeling?Why Modeling?Would you build a house without a blueprint?Would you build a house without a blueprint?

The Architect will do the firsthigh level drawings to validatethe concept with its clientHe will then make a detailed plan for the Builders

The Builders will take thisblueprint and optimise it basedon technical constraints

Page 4: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

History of Modeling & DesignHistory of Modeling & Design

Modeling techniques has been created a while ago under the name CASE (Computer Aided Software Engineering)

What is recognized has effective modeling and design today? Database Modeling (Data Modeling), using E/R

(Entity/Relationship) techniques (standard), for IT users Application Modeling using UML (Unified Modeling

Language) techniques (standard), for IT users Business Process Modeling using emerging techniques, for

non IT users

Page 5: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Problem StatementProblem Statement

How to effectively model business-driven application? Different techniques (E/R, UML, BP Modeling) have

forced corporations to buy different tools, raising communication and co-ordination issues between business analysts, IT analysts & designers and application developers

Lack of common framework to store and manage models and design induce inconsistencies across applications and reduces ability to re-use existing software

Heritage from CASE and complexity of techniques and tools generate high costs in learning curve

Page 6: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Our VisionOur Vision

An Enterprise Modeling and Design solution That will empowers our customers to model

software that meets the needs of end users Fits the description of the business processes Enable IT users to perform analysis and design,

and application development

Page 7: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Brief Overview of Brief Overview of Object-Oriented ModelingObject-Oriented Modeling

Why Use Object-Oriented Modeling? Visually define and communicate the structure and

behavior of an application Represent systems using OO concepts

Abstraction: Describe using relevant characteristics Encapsulation: Combine Data and Methods Inheritance: Supertype/Subtype Polymorphism: Overloading and Overriding

Link concepts to executable code

Page 8: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Brief Overview of UMLBrief Overview of UML

UML is defined by OMG.UML consists of 9 diagrams:

StaticClass and Object diagrams

DynamicUse Case, Sequence, Statechart, Collaboration

and Activity diagrams

ImplementationComponent and Deployment diagrams

Page 9: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Use Case DiagramUse Case Diagram

A Use Case Diagram describes the Actors, the Use Cases and the interaction between the Actors and the Use Cases.

<<includes>>

<<includes>>

Logon

Logoff

CustomerShip To Address

Purchase

Display Catalog

List Orders

List Cart

News

Purchase Products Main Use Case

Shipping

Page 10: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Activity DiagramActivity Diagram

An Activity Diagram describes the logic of a Use Case, a function or another Activity.

[No]

[Yes]

Main Page

Login

Display Catalog

Purchase

Select Product

OK?Login Error

Purchase Products Action Steps

Check Out

Page 11: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Collaboration DiagramCollaboration Diagram

A Collaboration Diagram describes the interaction between objects by exchanging messages.

2.2: OK

1: Login

Customer<<JSP>>

Main page

<<Servlet>>

Validate Login<<Servlet>>

Display Catalog

4: Purchase

2.2: OK

3: Product List

2.1: Error

1: Login

Customer

<<JSP>>

Main page

<<Servlet>>

Validate Login

Display Error

<<Servlet>>

Display Catalog

Add in Shopping Cart

Page 12: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Sequence DiagramSequence Diagram

A Sequence Diagram describes the interaction between objects and how the messages are exchanged over time.

open

4: Purchase

2.2: OK

3: Product List

2.1: Error

1: Login

<<JSP>>

Main page

<<Servlet>>

Validate Login Display Error<<Servlet>>

Display Catalog Add in Shopping Cart

Customer

Page 13: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Class DiagramClass Diagram

A Class Diagram defines the Classes, Interfaces, Attributes, Operations, Relationships, Inheritances, …

A Class Diagram can be used to define persistent objects, control objects and user-interface objects.

A Class Diagram can be used to generate the Physical Data Model and the implementation code.

Page 14: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Example of a Class Diagram in Example of a Class Diagram in PowerDesignerPowerDesigner

0..*peripheral

0..1personalcomputers <<Persistent>>

parallelPeripheral

+++

periphIdperiphCodeNamevendorName

: String: String: String

++++

registerPeriph ()testPort ()testPwSupply ()testMotherBd ()

: void: void: void: void

printer

++

laserprintSpeed

: boolean: int

+ printPage () : void

scanner

++

flatBedresolution

: boolean: int

+++++

preview ()registerPeriph ()testPort ()testPwSupply ()testMotherBd ()

: void: void: void: void: void

Peripheral

++++

registerPeriph ()testPort ()testPwSupply ()testMotherBd ()

: void: void: void: void

peripheral tester

+++

test #testNametestDate

: int: String: java.util.Date

+ printReport () : void

Computer

++

serial #ownerName

: String: String

Page 15: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Component DiagramComponent Diagram

A Component Diagram can be used to define the components we need to create for an appliacation

A Component can be using Classes, Interfaces, Operations

EJBs, Servlets, JSPs and Web Services can be represented as Components

Product

EntityBean_CMP

GetProductList

Servlet

GetProductPageJSP

Page 16: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Object-Oriented Modeling Best PracticesObject-Oriented Modeling Best Practices

> Create an Analysis Object-Oriented Model (OOM) first

> Create Use Cases

> Create Collaboration Diagrams (identify classes)

> Create Sequence Diagrams (identify classes, operations)

> Create Architecture Diagram using Collaboration Diagram or the Free Model

> Create Class Diagram

> Generate an Implementation OOM or refine the analysis OOM

> Create implementation components (EJBs, Servlets, Web Services)

> Generate the code

> Complete the code with an IDE

> Reverse engineer the code to synchronize the model

Page 17: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Re

po

sito

ry

Source Sybase

Rep

osito

ryBusiness

centric

ITcentric

PowerDesigner 9.5 OverviewPowerDesigner 9.5 OverviewArchitecture and Summary of FeaturesArchitecture and Summary of Features

Development

Analysis&

Design

BusinessAnalysis

Business-centric Control Flow diagram

Entity/Relationship modeling (and DW extensions)

UML modeling (all diagrams)

RDBMS structuresObject Relational mappingJava, .Net, XML, PB... supportIDEs & App Server support

Tem

plates, G

eneric G

enerato

rs,U

ML

pro

files, mo

del-to

-mo

del g

eneratio

n…

Page 18: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

PowerDesignerPowerDesignerWhat’s new in 9.5 (1/3)What’s new in 9.5 (1/3)

Data Modeling Database denormalization (table split or merge, copy columns)

UML/Object modeling Full UML support (all 9 diagrams)

Openness/Flexibility UML profile (sophisticated stereotypes): extension of meta classes,

customs symbols, custom checks, extended attributes, templates… Model to model generation (logical model, several level of abstraction) ‘Free Model’ – graphical model customizable

BP Modeling Custom symbols, data (entity & items), swimlanes,

CRUD matrix, CDM generation from BP Model

Page 19: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

PowerDesignerPowerDesignerWhat’s new in 9.5 (2/3)What’s new in 9.5 (2/3)

Enhanced Web Services support Design and reverse-engineer (UDDI browser for meta

data extraction) Web Services Deploy for Java and .NET

Enhanced J2EE support Servlet & JSP

General improvements VBScript (repository, reports) Repository (logs and better property sheets) Custom symbols (shape, gradient, bitmap) Improved HTML report generator

Page 20: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

PowerDesignerPowerDesignerWhat’s new in 9.5.1 (3/3)What’s new in 9.5.1 (3/3)

Improve Web Services support (Web Services deployment for J2EE (JSR109 specification))

Support new application servers (IBM WebSphere 5.0, BEA WebLogic 7, Apache Tomcat 4)

Integration with IDEs (JBuilder 7, Ant) Support PowerBuilder 9.0

Page 21: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

The PowerDesigner Object-Oriented ModelThe PowerDesigner Object-Oriented Model

The PowerDesigner 9.5 OOM supports: All the 9 UML diagrams. Java, C#, VB .NET, C++, PowerBuilder, IDL, VB6, XML

and WSDL Round-trip Java generation/reverse engineering EJB including O/R mapping, Servlet, JSP Web Services for Java and .NET Data Model generation O/R mapping

Page 22: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

DesignDesigning an OOM for Javaing an OOM for Java

Create a Class Diagram Design packages, classes, interfaces,

attributes, operations, … Preview the Java code Implement the Java methods using an IDE Generate the Java code Reverse engineer Java classes Iterative round-trip engineering

Page 23: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining PackagesDefining Packages

Packages in UML: A logical container for objects that belong together Provides a way to partition and manage work Provides namespace scope for objects

Packages in Java: Directory structure containing objects

Classes are known by their Package (path) and class name

Packages in PowerDesigner: Add model management capabilities Ideally a container for related objects

Product Management

Page 24: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining ClassesDefining Classes Generated Code:

/************************************************* * Module: Item.java * Author: xwang * Modified: Friday, June 28, 2002 11:39:00 AM * Purpose: Defines the Class Item *************************************************/

package Product;

import java.util.*;

public class Item{ public int itemNumber; public java.lang.String itemName; public double itemPrice; public int getItemNumber() { return itemNumber; } public java.lang.String getItemName() { return itemName; } public double getItemPrice() { return itemPrice; }}

Item

+++

itemNumberitemNameitemPrice

: int: java.lang.String: double

+++

getItemNumber ()getItemName ()getItemPrice ()

: int: java.lang.String: double

The Item Class

Page 25: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining GeneralizationsDefining Generalizations

Item

+++

itemNumberitemNameitemPrice

: int: java.lang.String: double

+++

getItemNumber ()getItemName ()getItemPrice ()

: int: java.lang.String: double

Product

+ category : java.lang.String

++

getCategory ()setCategory (java.lang.String newCategory)

: java.lang.String: void

> Generated Code:/************************************************* * Module: Product.java * Author: xwang * Modified: Friday, June 28, 2002 11:39:00 AM * Purpose: Defines the Class Product *************************************************/

package Product;

import java.util.*;

public class Product extends Item{ public java.lang.String category; public java.lang.String getCategory() { return category; } /** @param newCategory */ public void setCategory(java.lang.String newCategory) { category = newCategory; }

}

Generalization (Inheritance)

Page 26: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining AttributesDefining Attributes

Page 27: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining OperationsDefining Operations

Create operations Generate default constructor, static initializer Generate default getters and setters Add operations defined in a parent classes or

interfaces

Page 28: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Implementing an OperationImplementing an Operation

Page 29: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining AssociationsDefining Associations

Associations are the relationships between classes

Implementation depends on the definition of: Multiplicity: Is this a single reference or array? Navigability: Is there a reference variable? Visibility: Visibility of the reference variable Role Names: Name given to the reference

variable0..*

0..1shippingAddress

0..*0..1

billingAddress

Customer

++++

customerIDcustomerNamephoneNumberemail

: int: java.lang.String: java.lang.String: java.lang.String

Address

++++

addressIDstreetzipCodeAttribute_4

: int: java.lang.String: int: java.lang.String

Page 30: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining InterfacesDefining Interfaces

Item

+++

itemNumberitemNameitemPrice

: int: java.lang.String: double

+++

getItemNumber ()getItemName ()getItemPrice ()

: int: java.lang.String: double

IItem

+++

getItemNumber ()getItemName ()getItemPrice ()

: int: java.lang.String: double

> Generated Code:package Product;

import java.util.*;

public interface IItem{ int getItemNumber(); java.lang.String getItemName(); double getItemPrice();

}

package Product;

import java.util.*;

public class Item implements IItem{ public int itemNumber; public java.lang.String itemName; public double itemPrice; public int getItemNumber() { return itemNumber; } …}

The IItem Interface

The Item Class

Page 31: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Object Reuse in PowerDesignerObject Reuse in PowerDesigner

Shortcuts PowerDesigner allows classes defined in one

package or model to be reused in other packages and models via Shortcuts.

Shortcuts define an object that is outside the model or package in question. It acts like a pointer to the original object.

Replication Objects (new in V9.5) It is a copy of the original object. Users can

modify the original objects and the replicated objects.

Page 32: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Preview the Java Code of a ClassPreview the Java Code of a Class

Page 33: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Editing the Java Code in an IDEEditing the Java Code in an IDE

PowerDesigner does not generate complete code for all your methods. You have to implement them.

Users need to implement the methods using PowerDesigner or an IDE (JBuilder, …)

You can use the Edit With feature to launch an IDE. PowerDesigner will automatically copy the modified Java code back in the model and synchronize the model with the code.

Page 34: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Generating the Java CodeGenerating the Java Code

You can select the objects you want to generate, the location and the generation options.

Page 35: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Generating the Java CodeGenerating the Java Code

You could compile the Java code, generate Java doc and deploy components in an Application Server.

Page 36: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Develop, Deploy and Debug Using an IDEDevelop, Deploy and Debug Using an IDE

You can use an IDE or a text editor to implement the generated methods, compile the code, deploy the application and debug the application.

PowerDesigner 9.5.1 generates a JBuilder 7 project file and an Ant build script that allow you to compile and deploy you application outside PowerDesigner.

Page 37: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Reverse Engineering Java CodeReverse Engineering Java Code

Recover Java code Reverse engineer from a .java or .class file Select from individual files, a directory or an

archivePowerDesigner can create a new OOM or

extend an existing one Understand existing Java applications Capture a library for reference in other models Synchronize a model with externally edited

code

Page 38: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Iterative Round-Trip EngineeringIterative Round-Trip Engineering

Build and test as the Design matures: Create an OOM Generate Java code and edit in an IDE Reverse engineer the edited code to synchronize

the Model Modify the Model Generate new code from the updated Model

Page 39: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating J2EE ComponentsCreating J2EE Components

Creating Servlets Use Component and Class to represent a Servlet

Creating JSPs Use Component and File object to represent a JSP

Creating EJBs Use Component, Classes and Interfaces to represent an

EJB

Page 40: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating ServletsCreating Servlets

Use the Create Servlet wizard to create a Servlet Implement the Servlet code Compile and deploy

GetProductList

Servlet

<<ServletClass>>GetProductListServlet

+++++

init (..)destroy ()doGet (..)doPut (..)doPost (..)

: void: void: void: void: void

Servlet component

Servlet class

Page 41: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating ServletsCreating Servlets

Implementing the Servlet methods

Page 42: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating ServletsCreating Servlets

Generate Servlet code and Web Deployment Descriptor Compile and create the .WAR file Deploy the .WAR file

Page 43: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating JSPsCreating JSPs

Use the Create JSP wizard to create a JSPImplement the JSP codeGenerate and deploy the .WAR file

GetProductPageJSP

Page 44: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating JSPsCreating JSPs

Implementing the JSP code using the internal editor or an external editor (DreamWaver, …)

GetProductPageJSP

Page 45: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining O/R Mapping and Creating EJBsDefining O/R Mapping and Creating EJBs

Designing the objects Designing the database for objects persistence Defining the O/R mapping Creating EJBs (Enterprise Java Beans) Generating EJBs and O/R mapping descriptor Deploy EJBs

Page 46: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Designing the DatabaseDesigning the Database

PowerDesigner is also a very powerful Database Design tool

Bi-level Database Design Conceptual Data Model (CDM)

Normalized, Implementation (RDBMS) independent

Physical Data Model (PDM) Database Specific: Generates DDL to a script or to database

live via an ODBC connection

Page 47: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Example of a PDM for Sybase SQL Example of a PDM for Sybase SQL AnywhereAnywhere

id = cust_id

customer

idfnamelnameaddresscitystatezipphonecompany_name

integerchar(15)char(20)char(35)char(20)char(2)char(10)char(12)char(35)

<pk>

sales_order

idcust_idorder_datefin_code_idregionsales_rep

integerintegerdatechar(2)char(7)integer

<pk><fk>

/*======================================================*/

/* Table: customer */

/*======================================================*/

create table DBA.customer

(

id integer not null default autoincrement,

fname char(15) not null,

lname char(20) not null,

address char(35) not null,

city char(20) not null,

state char(2) not null,

zip char(10) not null,

phone char(12) not null,

company_name char(35),

primary key (id)

);

/*======================================================*/

/* Index: ix_cust_name */

/*======================================================*/

create index ix_cust_name on DBA.customer (

lname ASC,

fname ASC

)

with hash size 10;

Page 48: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Generating and Reverse Engineering Generating and Reverse Engineering DatabaseDatabase

PowerDesigner captures existing database structures and translates them to Java: Reverse engineer the Database to a PDM Generate an OOM (Java) from the PDM

Gives Object Designers a view of existing database objects Jump-start to building Business Logic Generate the O/R mapping

PowerDesigner can translate a class diagram into a PDM: Generate a PDM (tables, columns, indexes, references,

O/R mapping, …) Optimize the database (triggers, tablespace,

denormalization) Generate the database

Page 49: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Defining the Object/Relational MappingDefining the Object/Relational Mapping

Generate O/R mapping when generating a PDM from an OOM

Generate O/R mapping when generating an OOM from a PDM

Customize the O/R mapping to support complex mappings

Customize the O/R mapping syntax for each application server

Support EJB-QL and stored-procedures

Page 50: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Example of the O/R MappingExample of the O/R Mapping

O/R mapping syntax for Sybase EAServer:

Page 51: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Java in the Database (RDBMS)Java in the Database (RDBMS)

Use PowerDesigner to model Java in the Database: Create OOM for Java Stored Procedures and Java Data

Types Create a PDM for the Database (Target your RDBMS) Reuse objects from the OOM in the PDM as Data Types Generate .java from the OOM to “import” to server to

support Data Types and add Stored Procedures

Page 52: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating Enterprise Java Beans (EJBs)Creating Enterprise Java Beans (EJBs)

PowerDesigner supports CMP Entity Beans, BMP Entity Beans, Stateless Session Beans, Statefull Session Beans and Message Driven Beans.

PowerDesigner generates the source code, the deployment descriptor and the O/R mapping descriptor.

PowerDesigner could compile the code, create the JAR file, run J2EE verifier and deploy the JAR file.

PowerDesigner supports Sybase EAServer, BEA WebLogic and Cocobase today. Support of other servers could be added by creating a profile.

Page 53: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating a Container Managed Persistence Creating a Container Managed Persistence (CMP) EJB(CMP) EJB

Create a package Create a class inside the package Generate or define the O/R mapping Use the Create Enterprise JavaBean wizard to create

a CMP EJB Set properties (transaction, …) Implement additional business methods Verify the source code and the deployment descriptor Generate the code, compile, verify and deploy

Page 54: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Example of a CMP EJBExample of a CMP EJB

Example of the EJB wizard:

<<EJBEntity>>

customerBean{abstract}

+++++++++-

idfnamelnameaddresscitystatezipphonecompany_nameejbContext

: java.lang.Integer: java.lang.String: java.lang.String: java.lang.String: java.lang.String: java.lang.String: java.lang.String: java.lang.String: java.lang.String: EntityContext

++++++++

customerBean ()ejbActivate ()ejbLoad ()ejbPassivate ()ejbRemove ()ejbStore ()setEntityContext (EntityContext ctx)unsetEntityContext ()

: void: void: void: void: void: void: void

customerEntityBean_CMP

The EJB component

The Bean class

Page 55: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Generating EJBsGenerating EJBs

Use Tools>Generate Java Code to generate EJBs Select the tasks to perform after the code generation

Page 56: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating Web ServicesCreating Web Services

PowerDesigner V9.5 supports: Creating Web Services components for Java and .NET Generating server side code for Java and .NET Generating client proxy code for Java and .NET Browsing UDDI to find Web Services (WSDL) Importig and generating WSDL

Page 57: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating Web Services for JavaCreating Web Services for Java

For Java, PowerDesigner V9.5 supports: Java Web Service using JAXRPC Servlet Web Service using JAXM Generating server side code and client proxy using

JAXRPC tool Deploying EJBs as Web Services when the « Web

Services for J2EE » (JSR109) specification will be finalized

Page 58: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating a Servlet Web ServiceCreating a Servlet Web Service Use the Create Web Service wizard to create a Servlet

Web Service Select Java Servlet as the Component type Implement the onMessage() method Compile and deploy

<<ServletClass>>

SalesOrderServlet

+++

init (..)destroy ()onMessage (..)

: void: void: javax.xml.soap.SOAPMessage

<<Web Service>>

SalesOrderImplementation

Page 59: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Create a Web Service Component Using Create a Web Service Component Using JAX-RPCJAX-RPC

Use the Create Web Service wizard to create a Web Service

Select Standard as the Component type In the Java class, create one or several methods Indicate these methods as Web Method Implement these methods Generate the Java code:

In the generation window, select the XRPCC commands to generate server side and/or client side code

Page 60: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Example of the Generated WSDLExample of the Generated WSDL

Page 61: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Deploy EJBs as Web Service ComponentsDeploy EJBs as Web Service Components

PowerDesigner 9.5.1 uses the «J2EE for Web Services» (JSR109) specification to generate deployment descriptor and .EAR file to deploy Stateless Session Beans as Web Services.

EAServer 5.0 will support JSR109.

Page 62: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Browse UDDI to Search Web ServicesBrowse UDDI to Search Web Services

PowerDesigner V9.5 provides a UDDI browser to allow users to search Web Services (search WSDL)

Page 63: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Import WSDLImport WSDL

PowerDesigner V9.5 imports WSDL files or URLs (found in UDDI) PowerDesigner creates Web Service component from the WSDL

Page 64: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Creating .NET ApplicationsCreating .NET Applications

With PowerDesigner 9.5, you can: Create .NET applications for C# or VB .NET Generate C#, VB .NET code Compile C#, VB .NET code Create Web Services for .NET Create ASP .NET (ASPX) components Use the .NET Framework library model Future version will support reverse engineering for C#

and VB .NET

Page 65: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Extending PowerDesigner’s FeaturesExtending PowerDesigner’s Features

Users could extend PowerDesigner’s features: Use the template based generic generator (GTL) to

generate other Java components (JDO, Ant build script, unit test programs, …)

Use VB Script or VBA to work directly with the PowerDesigner models (import, export, generate more complex code, …)

Use XMI import/export to integrate with other code generators

Page 66: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

Documentation and ReportingDocumentation and Reporting

PowerDesigner provides comprehensive reporting capabilities Print Graphics to see model diagrams Create Report to include objects metadata Multi-model report to span all models in a workspace Report Print Preview Generate HTML or RTF reports Multi-language support (English, Chinese, …)

Page 67: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

RepositoryRepository

PowerDesigner has an enterprise repository for model sharing and management Consolidation/Extraction of Models and other non-

PowerDesigner files Object level versioning Branching, Configurations Security Open Database: (RDBMS vs. flat-file system)

Write your own reports using SQL or other reporting tools (InfoMaker, Crystal Reports, etc…)

Page 68: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

ConclusionConclusion

With PowerDesigner 9.5, you can: Create all UML diagrams Analyse, design and develop Java or .NET applications Generate the database and O/R mapping from your OO

design Support full Round-Trip Iterative development of

Applications Produce documents and reports for your OO design Use the enterprise repository for team work and versioning

PowerDesigner 9.5 is a complete enterprise modeling tool

Page 69: EN04 Object-Oriented Modeling with PowerDesigner 9.5 Xiao Wang PowerDesigner Chief Architect, EBD xwang@sybase.com

More informationMore information

Sybase China web site for PowerDesigner: http://www.sybase.com.cn/cn/content/goto.jsp?resID=87

Sybase US web site for PowerDesigner: http://www.sybase.com/powerdesigner/ Whitepapers, knowledgebase, tech support, and

evaluation copies

News group: powersoft.public.powerdesigner.general

SDN: http://www.sybase.com/developer