OBJECT ORIENTED MODEL User’s Guide POWERDESIGNER 7.
Copyright (c) 1988–2000 Sybase, Inc. All rights reserved. Information in this manual may change without notice and does not represent a commitment on the part of Sybase, Inc. and its subsidiaries. The software described in this manual is provided by Sybase, Inc. under a Sybase License agreement. The software may be used only in accordance with the terms of the agreement.
Contents About This Book ............................................................................................ix 1 Object-Oriented Model Basics ..........................................1 Functional overview .................................................................. 2 UML and object-oriented modeling ........................................... 3 What is an OOM? ..................................................................... 4 Objects in an OOM .......................................
Preview the code of an interface ...................................... 45 Displaying text in interface symbols ................................. 46 Defining attributes ................................................................... 48 Attribute properties ........................................................... 49 Analyzing attribute properties ........................................... 50 Creating an attribute.........................................................
Creating a dependency .................................................. 109 Modifying dependency properties................................... 111 Displaying text in dependency symbols.......................... 112 Defining realizations.............................................................. 114 Realization properties..................................................... 114 Creating a realization...................................................... 115 Modifying realization properties ..............
Reverse engineering PowerBuilder options ................... 166 Loading a PowerBuilder library model in the workspace ................................................................ 168 Reverse engineering objects from a PowerBuilder application ................................................ 169 Reverse engineering objects from SRU files ................. 171 Reverse engineering XML .................................................... 174 Reverse engineering XML options .................................
Translating OOM data types for a PDM................................ 217 Translating Java data types for a PDM .......................... 217 Generating a PDM from an OOM ......................................... 218 Generating and updating a PDM .................................... 218 Defining PDM generation options................................... 220 Object selection parameters........................................... 220 Generating a new PDM ..................................................
viii
About This Book Subject This book describes the PowerDesigner Object-Oriented Model environment.
About This Book To help you do your work more easily, this book is divided into chapters that focus on particular goals.
C H A P T E R 1 Object-Oriented Model Basics About this chapter Contents This chapter presents the PowerDesigner Object-Oriented Model. It provides you with an introduction to the basic notions of object-oriented modeling and the Unified Modeling Language (UML).
Functional overview Functional overview PowerDesigner Object-Oriented Model is a powerful design tool for objectoriented modeling. It gives you all the advantages of a graphical object design implementation. With this product, you can: 2 ♦ Build an Object-Oriented Model (OOM) ♦ Generate Java class source files (.java) ♦ Generate PowerBuilder objects ♦ Reverse engineer Java files (.class, .java, or .
Chapter 1 Object-Oriented Model Basics UML and object-oriented modeling What is UML? UML (The Unified Modeling Language) is a modeling language aimed at defining standards for object-oriented modeling. UML has become a standardized language largely through the work of the OMG (Object Management Group), a group composed of individuals and representatives of companies involved in object-oriented projects. However, its original conception drew much of its inspiration from the work of G. Booch, J.
What is an OOM? What is an OOM? An OOM contains a set of packages, classes, interfaces, and their relationships. These objects together form a class structure that is the logical design view of all (or part of) a software system. An OOM is essentially a static conceptual model of a software system. You use PowerDesigner Object-Oriented Model to build object-oriented models (OOM).
Chapter 1 Object-Oriented Model Basics Objects in an OOM An OOM represents the interaction of the following objects: Object Selection Tool Description Package General purpose sub-set used to organize objects into groups Class Set of objects that share the same attributes, operations, methods, and relationships Interface Collection of operations used to specify the externally visible behavior of a class, object, or other entity Attribute — Named property of a class Operation — Service that ca
Creating a new OOM Creating a new OOM Creating an OOM requires that you do the following: ♦ Open a new file ♦ Give the OOM a name and a code After you create an OOM, you can enrich its definition by entering properties and associating objects. v To create an OOM: 1 Select File➤New. or Click the New button in the toolbar. The New window appears. 2 Select Object-Oriented Model and click OK. The Choose Object Language window appears.
Chapter 1 4 Object-Oriented Model Basics Click OK. If you were working on an existing workspace, PowerDesigner opens an new OOM. If there was no workspace open, PowerDesigner opens a new workspace and a new OOM. 5 Select Model➤Model Properties. or Right-click any empty space in the diagram and select Model Properties from the contextual menu. The model property sheet appears. 6 Type a model name and model code. 7 Click OK.
Opening an existing OOM Opening an existing OOM An OOM has the file extension .OOM. v To open an existing OOM: 1 Select File➤Open. or Click the Open tool. A standard Windows file selection dialog box appears. 2 Select a file with the .OOM extension. 3 Click OK. The model window displays the selected model.
Chapter 1 Object-Oriented Model Basics Defining OOM model options You can set model options and naming conventions that apply to all objects in the model. You can also set naming conventions for each type of object in your model. You define OOM model options from the model options dialog box.
Defining OOM model options Your choice of whether or not to enforce domain and attribute nondivergence has the following results: Non-divergence Result Not enforced Attributes that are divergent from the domain definition can remain attached to the domain Enforced Attributes that are divergent from the domain (for certain attribute properties) must be detached from the domain If you modify domain non-divergence options, these changes apply only to the current OOM.
Chapter 1 Object-Oriented Model Basics Defining OOM properties The Model property sheet displays the definition of the current model. From this property sheet you can modify the model definition. A OOM has the following model properties: Property Description Length Name Name for the model 254 Code Code for the model. This code is generated in database scripts 254 Comment Descriptive label for the model — Object language Current object language for the model.
Defining OOM properties 12
C H A P T E R 2 Building an Object-Oriented Model About this chapter Contents This chapter describes how to build an Object-Oriented Model (OOM). It explains the role of each object in an OOM and how to create and modify objects.
Defining packages Defining packages A package is a general purpose mechanism for organizing elements into groups. When you are working with large models, you can split any model into smaller subdivisions in order to avoid manipulating the entire set of data of the model. Packages can be useful to assign portions of a model, representing different tasks and subject areas, to different development teams. You can create as many packages as you need in a model.
Chapter 2 Building an Object-Oriented Model Displaying text in package symbols You can define the following display preferences for a package: Preference Description Show stereotypes When selected, displays the stereotype of the package Show constraints When selected, displays the constraints (types of business rule) that are attached to the package You modify the display preferences for a package in the Display Preferences dialog box.
Defining packages The package display preferences page appears. 16 4 Modify the package display preferences. 5 Click OK.
Chapter 2 Building an Object-Oriented Model Defining classes A class is a description of a set of objects that have a similar structure and behavior, and share the same attributes, operations, relationships, and semantics. A class usually implements one or more interfaces. Classes are the main building blocks of an OOM. Classes, and the relationships that you create between them, form the basic structure of an OOM.
Defining classes Class properties A class has the following general properties: Property Description Maximum length Name Name of the class 254 Code Reference name for the class 254 Comment Descriptive comment for the class — Stereotype Subclassification of a class derived from an existing one.
Chapter 2 Building an Object-Oriented Model Analyzing class properties The following class properties each have several default values from which you can select from: ♦ Stereotype ♦ Type ♦ Visibility ♦ Cardinality Stereotype Stereotypes are classes that are derived from existing classes but that are specific to a particular problem. They enable you to extend the semantics of a class without changing its structure.
Defining classes Default stereotypes You can declare a class to be one of the following stereotypes: Stereotype Description actor Coherent set of roles that users of use cases play when interacting with the use cases enumeration List of named values used as the range of a particular attribute type exception Exception class.
Chapter 2 Building an Object-Oriented Model Visibility The visibility of a class refers to the way in which it can be seen by other objects. A class that is visible to another object may influence the structure or behavior of the object, or similarly, its own properties may be affected by the other object.
Defining classes Creating a class from the Browser v To create a class from the Browser: 1 Right-click the Classes category in the Browser. 2 Select New from the contextual menu. The property sheet of the class appears. 3 Type a class name and a class code. 4 Click OK. A new class is created in the Classes category. Creating a class from the list of classes v To create a class by inserting it in the list: 1 Select Model➤Classes. The list of classes appears.
Chapter 2 Building an Object-Oriented Model Creating a class from a diagram v To create a class in a diagram: 1 Click the Class tool in the palette toolbar. 2 Click anywhere in the diagram. The following symbol appears at the click position: At creation, a class is named Classn, where n is a number assigned in the order of the creation of objects. 3 Click the Pointer tool in the palette toolbar. 4 Double-click the new class symbol in the diagram. The class property sheet appears.
Defining classes Attaching an inner class to a class You attach an inner class to a class (or interface) from the Inner Classes page of the class (or interface) property sheet. v To declare an inner class within a class: 1 Double-click a class in the model. The class property sheet opens to the General page. Opening property sheets at last accessed page Property sheets open to the General page by default.
Chapter 2 Building an Object-Oriented Model The classes appear in the list of inner classes for the current class, and the definition of the classes are added to the current class definition. 6 Click the Code Preview tab to visualize the inner class definitions within the current class: 7 Click OK.
Defining classes Detaching an inner class from a class Once you have attached an inner class to a class, to remove its declaration from the class you must use detach it. v To detach an inner class from a class: 1 Double-click a class in the model. The class property sheet opens to the General page. Opening property sheets at last accessed page Property sheets open to the General page by default.
Chapter 2 Building an Object-Oriented Model Classifiers A classifier, in UML terminology, is a mechanism that has structural (attributes) and behavioral (operations) features. A class is the most important classifier, but all objects that can have instances, such as interfaces or associations, are classifiers.
Defining classes The class property sheet appears. 2 Type or select class properties. or Click on a page tab. Type or select class properties as required. 3 Click OK. Modifying class properties from the list of classes The list of classes includes all classes attached to the current model or package. You can modify the class properties from the list. v To modify class properties from the list of classes: 1 Select Model➤Classes. The list of classes appears.
Chapter 2 Building an Object-Oriented Model An arrow appears at the beginning of the line. 3 Modify any of the properties of the class directly in the list. 4 Click OK. Adding objects to a class You can add an object to a class, that already exists in the model, but which belongs to another class.
Defining classes Adding an attribute to a class An attribute is a named property of an object that defines the characteristics of the object. You can add attributes that already exist in the model and which belong to other objects. v To add an attribute to a class: 1 Double-click a class in the model. The class property sheet appears. 2 Click the Attributes tab. The Attributes page appears. 3 30 Click the Add Attributes tool.
Chapter 2 Building an Object-Oriented Model The Selection window appears. It contains a list of all the attributes that exist in the model, with the exception of those that already belong to the class. 4 Select the attributes that you want to add to the class. or Use the Select All tool to add all the attributes in the list to the class. 5 Click OK. The attributes are added to the class and appear at the end of the list. 6 Click OK.
Defining classes The Operations page appears. 3 Click the Add Operations tool. The Selection window appears. It contains a list of all the operations that exist in the model, with the exception of those that already belong to the class. 32 4 Select the operations that you want to add to the class. 5 Click OK.
Chapter 2 Building an Object-Oriented Model The operations are added to the class and appear in the list of operations for the class. 6 Click OK. Preview the code of a class or an interface You can preview the code of a class or an interface in the Code Preview page of the Property sheet of a class or an interface. You cannot edit the code in this window. v To preview the code of a class: 1 Double-click a class in the model. The class property sheet appears. 2 Click the Code Preview tab.
Defining classes Displaying text in class symbols You can define the following display preferences for a class: Preference Description Show attributes Displays all the attributes of the class, or limits the number displayed to a maximum that you specify in the Limit box Show operations Displays all the operations of the class, or limits the number displayed to a maximum that you specify in the Limit box Show stereotypes When selected, displays the stereotype of the class Show constraints When sele
Chapter 2 Building an Object-Oriented Model The class display preferences page appears. 4 Modify the class display preferences. 5 Click OK.
Defining interfaces Defining interfaces An interface is a type of class that is similar to a class but which is used to implement the specification of an abstraction of a class. An interface is a collection of operations used to specify the externally visible behavior of a class. It has no implementation of its own. A class that implements all the operations in an interface is said to realize the interface. A class that requires one or more operations in an interface is said to use the interface.
Chapter 2 Building an Object-Oriented Model An interface definition also includes the following properties, which are defined on associated property sheets: Property Description Attribute Defines the characteristics of an interface Operations Carries out a service that effects behavior Business rules A rule that your business follows.
Defining interfaces The property sheet of the interface appears. 3 Type an interface name and an interface code. 4 Click OK. A new interface is created in the Interfaces category. Creating an interface from the list of interfaces v To create an interface by inserting it in the list: 1 Select Model➤Interfaces. The list of interfaces appears. Accessing the list of interfaces The list of interfaces is accessible only from a diagram.
Chapter 2 Building an Object-Oriented Model The following symbol appears at the click position: At creation, an interface is named Intfn, where n is a number assigned in the order of the creation of objects. 3 Click the Pointer tool in the palette toolbar. 4 Double-click the new interface symbol in the diagram. The interface property sheet appears. 5 Type an interface name and an interface code. 6 Click OK. The newly created interface is visible in the Browser.
Defining interfaces The interface property sheet opens to the General page. Opening property sheets at last accessed page Property sheets open to the General page by default. However, you can choose to open property sheets at the last page accessed by selecting Tools➤Options➤Dialog, and selecting the option Keep Last Tab in the Property Sheets groupbox. 2 Type or select interface properties. or Click on a page tab. Type or select interface properties as required. 3 Click OK.
Chapter 2 Building an Object-Oriented Model The list of interfaces appears. 2 Click the interface that you want to modify. An arrow appears at the beginning of the line. 3 Modify any of the properties of the interface directly in the list. 4 Click OK. Adding inner classes to an interface An inner class is a class definition that is defined within another (outer) class definition. Inner classes are commonly used in Java.
Defining interfaces You can add the following objects to an interface: Object Description Attribute Named property of an interface that defines the characteristics of an interface Operation Implementation of a service that can be requested from any object of the interface in order to affect behavior Business rule Written statement specifying what the information system must do or how it must be structured to support business needs You add an object to an interface from the list in the page correspon
Chapter 2 Building an Object-Oriented Model The Attributes page appears. 3 Click the Add Attributes tool. The Selection window appears. It contains a list of all the attributes that exist in the model, with the exception of those that already belong to the interface. 4 Select the attributes that you want to add to the interface. 5 Click OK. The attributes are added to the interface and appear in the list of attributes for the interface.
Defining interfaces 6 Click OK. Adding an operation to an interface An operation is the implementation of a service that can be requested from any object of the class in order to affect behavior. You can add operations that already exist in the model and which belong to other objects. v To add an operation to an interface: 1 Double-click an interface in the model. The interface property sheet appears. 2 Click the Operations tab. The Operations page appears. 3 44 Click the Add Operations tool.
Chapter 2 Building an Object-Oriented Model The Selection window appears. It contains a list of all the operations that exist in the model, with the exception of those that already belong to the interface. 4 Select the operations that you want to add to the interface. 5 Click OK. The operations are added to the interface and appear in the list of operations for the interface. 6 Click OK.
Defining interfaces The Code Preview page appears. 3 Click OK.
Chapter 2 Building an Object-Oriented Model v To modify the interface display preferences: 1 Select Tools➤Display Preferences. or Right-click the diagram background and select Display Preferences from the contextual menu. The Display Preferences dialog box appears. 2 Expand the Object View node in the Category list. 3 Select Interface. 4 Modify the interface display preferences. 5 Click OK.
Defining attributes Defining attributes Attributes define the characteristics of a class. A class may have none or several attributes. An attribute is a named property of a class that describes the range of values that instances of the property may hold. Each object in a class has the same attributes, but the values of the attributes may be different. Attribute names within a class must be unique. You can give identical names to two or more attributes only if they exist in different classes.
Chapter 2 Building an Object-Oriented Model Attribute properties An attribute has the following properties: Property Description Maximum length Parent Object to which the attribute belongs to 254 Name Name of the attribute 254 Code Reference name for the attribute 254 Comment Descriptive comment for the attribute — Stereotype Subclassification of an attribute derived from an existing one.
Defining attributes An attribute definition also includes business rules, which are defined on associated property sheets.
Chapter 2 Building an Object-Oriented Model Multiplicity The cardinality of each of an attribute is called the multiplicity. Cardinality Number of instances in relation 0..0 None 0..1 None or one 0..* None to infinity 1..1 One to one 1..* One to infinity * Infinity You can change the default format of cardinalities from the registry: HKEY_CURRENT_USER\Software\Sybase\PowerDesigner 7\ModelOptions\Cld MultiplicityNotation = 1 (0..
Defining attributes The property sheet of the attribute appears. 3 Type an attribute name and an attribute code. 4 Click OK. A new attribute is created in the Attributes category. Creating an attribute from the list of attributes v To create an attribute by inserting it in the list: 1 Select Model➤Attributes. The list of attributes appears. Accessing the list of attributes The list of attributes is accessible only from a diagram.
Chapter 2 Building an Object-Oriented Model 3 Type an attribute name and an attribute code. 4 Click the Stereotype column. 5 Select a stereotype from the Stereotype dropdown listbox. or Type a stereotype in the Stereotype column. 6 Click the Data Type column. 7 Select a data type from the Data Type dropdown listbox. or Type a data type in the Data Type column. 8 Click the Visibility column. 9 Select a value from the Visibility dropdown listbox. 10 Click the Multiplicity column.
Defining attributes The Attributes page appears. It lists attributes defined for the class. 3 Click a blank line in the list. or Click the Add a Row tool. An arrow appears at the beginning of the line. 4 Type an attribute name and an attribute code. 5 Click OK. The attribute is created for the class and appears in the list of attributes for the class. 6 Click OK.
Chapter 2 Building an Object-Oriented Model Modifying attribute properties from its property sheet The attribute property sheet displays the definition of the attribute, which you can modify. v To modify attribute properties from its property sheet: 1 Double-click the attribute in the model. The attribute property sheet appears. Opening property sheets at last accessed page Property sheets open to the General page by default.
Defining attributes The general properties of the attribute, in addition to those on the general page, appear. 4 Type or select attribute properties as required. 5 Click OK. Modifying attribute properties from the list of attributes The list of attributes includes all attributes attached to the current model. You can modify the attribute properties from the list. v To modify attribute properties from the list of attributes: 1 56 Select Model➤Attributes.
Chapter 2 Building an Object-Oriented Model The list of attributes appears. 2 Click the attribute that you want to modify. An arrow appears at the beginning of the line. 3 Modify any of the properties of the attribute directly in the list. 4 Click OK. Attaching an attribute to a domain If you attach an attribute to a domain, the domain supplies the data type and related data characteristics. It may also indicate check parameters, and business rules.
Defining attributes The attribute property sheet opens to the General page. Opening property sheets at last accessed page Property sheets open to the General page by default. However, you can choose to open property sheets at the last page accessed by selecting Tools➤Options➤Dialog, and selecting the option Keep Last Tab in the Property Sheets groupbox. 5 Click the Detail tab. 6 Select a domain from the Domain dropdown listbox at the bottom of the dialog box. 7 Click OK.
Chapter 2 Building an Object-Oriented Model Copying an attribute to another class You can copy an attribute from one class and add it to another class. If the class already contains an attribute with the same name or code as the copied attribute, the copied attribute is renamed. For example the attribute PERIPHLD is renamed PERIPHLD2 when it is copied to a class which already contains an attribute PERIPHLD. v To copy an attribute to another class: 1 Double-click a class in the model.
Defining attributes Displaying text in attribute symbols An attribute has the following display preferences: Preference Description Show visibility Displays the attribute as an icon, with markers, or using keywords Show datatype When selected, displays the datatype of the attribute in the attribute symbol Show initial value When selected, displays the initial value of the attribute in the attribute symbol The visibility of an attribute in a class or an interface can be displayed in one of the follo
Chapter 2 Building an Object-Oriented Model 3 Select Attribute. 4 Modify the attribute display preferences. 5 Click OK.
Defining identifiers Defining identifiers An identifier is a class attribute, or a combination of class attributes, whose values uniquely identify each occurrence of the class. An identifier is the OOM equivalent of a CDM identifier or a primary key or an alternate key in a PDM. Each class must have at least one identifier. If a class has only one identifier, than it is designated by default as the primary identifier for the class. A primary identifier is the main identifier for a class.
Chapter 2 Building an Object-Oriented Model Creating an identifier You can create an identifier from a class. v To create an identifier: 1 Double-click a class in the model. The class property sheet opens to the General page. 2 Click the Identifier tab. The Identifier page appears. 3 Click a blank line in the list. or Click the Add a Row tool. An arrow appears at the beginning of the line. 4 Type a name and code for the identifier. 5 Click OK.
Defining identifiers Adding attributes to an identifier You can add attributes to an identifier. v To add attributes to an identifier: 1 From the identifier property sheet, click the Attributes tab. The Attributes page appears. It lists the attributes currently defined for the identifier. 2 Click the Add Attributes tool. A list of attributes defined for the class appears.
Chapter 2 Building an Object-Oriented Model 3 Select checkboxes for one or more class attributes that you want to designate as an identifier. 4 Click OK in each of the dialog boxes.
Defining identifiers Opening property sheets at last accessed page Property sheets open to the General page by default. However, you can choose to open property sheets at the last page accessed by selecting Tools➤Options➤Dialog, and selecting the option Keep Last Tab in the Property Sheets groupbox. 2 Type or select identifier properties as required. 3 Click OK. Modifying identifier properties from the list of identifiers The list of identifiers includes all identifiers attached to the current model.
Chapter 2 Building an Object-Oriented Model Defining operations An operation is a service that can be requested from an object to effect behavior. It has a name and a list of parameters. An operation is a specification of a transformation or query that an object may be called to execute. Operation names within a class must be unique. You can give identical names to two or more operations only if they exist in different classes.
Defining operations Analyzing operation properties The following operation properties each have several default values from which you can select from: ♦ Visibility ♦ Stereotype Visibility Property Visible Private Only to the operation itself Protected Only to the operation and its inherited objects Package To all objects contained within the same package Public To all objects Stereotype Stereotype Description constructor Operation that creates and initializes an instance of a class Creati
Chapter 2 Building an Object-Oriented Model 3 Type an operation name and an operation code. 4 Click OK. A new operation is created in the Operations category. Creating an operation from the list of operations v To create an operation by inserting it in the list: 1 Select Model➤Operations. The list of operations appears. Accessing the list of operations The list of operations is accessible only from a diagram.
Defining operations Creating an operation from a class in a diagram You can create an operation from a class or an interface in a diagram in the same way. v To create an operation from a class in a diagram: 1 Double-click a class in the model. The class property sheet appears. 2 Click the Operations tab. The Operations page appears. It lists operations defined for the class. 3 Click a blank line in the list. or Click the Add a Row tool. An arrow appears at the beginning of the line.
Chapter 2 Building an Object-Oriented Model Modifying operation properties There are two approaches to modifying operation properties: ♦ Modify the property sheet of an operation ♦ Modify an entry in the list of operations Modifying operation properties from its property sheet The operation property sheet displays the definition of the operation that you can modify. v To modify operation properties from its property sheet: 1 Double-click a class in the model. The class property sheet appears.
Defining operations The operation property sheet opens to the General page. Opening property sheets at last accessed page Property sheets open to the General page by default. However, you can choose to open property sheets at the last page accessed by selecting Tools➤Options➤Dialog, and selecting the option Keep Last Tab in the Property Sheets groupbox. 5 Type or select operation properties. or Click on a page tab. Type or select operation properties as required. 6 Click OK.
Chapter 2 Building an Object-Oriented Model The list of operations appears. 2 Click the operation that you want to modify. An arrow appears at the beginning of the line. 3 Modify any of the properties of the operation directly in the list. 4 Click OK. Adding constructors and destructors to a class A constructor is a special type of operation that creates and initializes an instance of a class.
Defining operations You can create two types of constructor for a given class: Default Copy A Default constructor has no parameters. Adding a Default constructor and destructor to a class You can define only one Default constructor and one Default destructor (PowerBuilder only) for any given class. If the current object language of the OOM is Analysis or Java, you can create only one Default constructor and no Default destructor for a class.
Chapter 2 Building an Object-Oriented Model If the current object language of the OOM is Analysis or Java, a Default constructor is created at the end of the list of operations for the class. It has the same name as the class to which it belongs: If the current object language of the OOM is PowerBuilder, a Default constructor and a Default destructor is created at the end of the list of operations for the class.
Defining operations Adding a Copy constructor to a class The body of a Copy constructor contains a copy of the attributes of the class that exist at the moment of the creation of the constructor. When you create a Copy constructor, it has the same as that of the class, prefixed by the keyword new. It has a default parameter that you can modify, or you can add other parameters.
Chapter 2 Building an Object-Oriented Model Adding operations to a class You can add an operation to a class in one of the following two ways: ♦ Add a duplicate operation ♦ Add an operation from a parent class Adding a duplicate operation to a class A duplicate operation is an operation that creates and initializes an instance of a class within the class. When you create a duplicate operation, it has the name Duplicate, which you can modify.
Defining operations Adding an operation from a parent class You can add to a class an operation that belongs to a parent class. The new operation has the same signature (name and parameters) as the original operation, but does not have its other properties. Once you add an operation to a class in this way, you can modify only the code implementation of the operation. You cannot modify the signature of the operation.
Chapter 2 Building an Object-Oriented Model A copy of the operation is added to the list operations for the class. Adding Getter and Setter operations to a class Getter or a Setter operations are special types of operations that you create for an attribute. You create a Getter or a Setter operation type from the list of attributes of a class. For each attribute, you can create one Getter, one Setter operation, or both a Getter and a Setter operation.
Defining operations 4 Click the Add button. 5 Select Get/Set Operations from the dropdown listbox. The operations are created for the attributes. You can visualize them in the list of operations of the class. 6 80 Select the Operations tab.
Chapter 2 Building an Object-Oriented Model The newly created operations appear at the bottom of the list of operations for the class. They are grayed indicating that their names can not be modified. 7 Click OK. Creating an implementation operation When you create a realization link between a class and an interface in which the class implements the interface, you create an operation in the class that implements the interface.
Defining operations v To create an implementation operation: 1 Double-click a class that is linked to an interface by a realization link. 2 Click the Operations tab. 3 Click the To be implemented button. The To Be Implemented Operations window appears. It contains a list of all the operations of the interface that can be implemented from the class. 4 Select an operation from the list. 5 Click the Implement button. A copy of the operation is created in the class.
Chapter 2 Building an Object-Oriented Model 6 Click Close. The newly created operation is added to the end of the list of operations for the class. It is grayed, indicating that its name cannot be modified. 7 Click OK. Modifying the code of an implementation operation You can modify the code of an implementation operation from the Implementation page of the operation property sheet. $ For information on how to create an implementation operation, see the section Creating an implementation operation.
Defining operations The Implementation page appears. 3 Type or modify code directly in the window. or Click a tab at the bottom of the edit window and type or modify code. 4 Click OK. Copying an operation to another class You can copy an operation from one class and add it to another class. If the class already contains an operation with the same name or code as the copied operation, the copied operation is renamed.
Chapter 2 Building an Object-Oriented Model A selection box appears. It lists operations attached to all other classes in the model. 4 Select one or more operations in the list. 5 Click OK. The copied operations appear in the list of operations for the current class. 6 Click OK.
Defining operations The visibility of an operation in a class or an interface can be displayed in one of the following ways: Visibility When selected Icon Displays the operation as an icon Markers Displays the visibility of the operation as a marker: - (private), # (protected), + (public), or * (package) Keywords Displays the visibility of the operation as a word: private, protected, public, or package You modify the display preferences for an operation in the Display Preferences dialog box.
Chapter 2 Building an Object-Oriented Model 4 Modify the operation display preferences. 5 Click OK.
Defining parameters Defining parameters A parameter is a specification of a variable that can be changed, passed, or returned. Parameters are used only for operations. A parameter always has a direction, which indicates the flow of information.
Chapter 2 Building an Object-Oriented Model Creating a parameter You can create parameters only from an operation. You create parameters from the Parameters page in the operation property sheet. v To create a parameter: 1 Double-click an operation in the model. 2 Click the Parameters tab. The Parameters page appears. 3 Click the Add a Row tool or Click the first row. A parameter is created. 4 Double-click the arrow at the beginning of the line.
Defining parameters The parameter property sheet opens to the General page. Opening property sheets at last accessed page Property sheets open to the General page by default. However, you can choose to open property sheets at the last page accessed by selecting Tools➤Options➤Dialog, and selecting the option Keep Last Tab in the Property Sheets groupbox. 6 Type a name and code. 7 Select a value from the Direction dropdown listbox. In/Out is the default direction value.
Chapter 2 Building an Object-Oriented Model Defining generalizations A generalization relationship between classes shows that the subclass shares the structure or behavior defined in one or more superclasses. You use a generalize to show a "is-a" relationship between classes. You can create a generalization only from one class to another class, or from one interface to another interface.
Defining generalizations Analyzing generalization properties The following generalization properties each have several default values from which you can select from: ♦ Visibility ♦ Stereotype Visibility Property Visible Private Only to the generalization itself Protected Only to the generalization and its inherited objects Package To all objects contained within the same package Public To all objects Stereotype Stereotype Description implementation Specifies that the child object inherits
Chapter 2 Building an Object-Oriented Model The link appears between the two objects. Dragging a generalization to a different class You can change the class or interface at either end of a generalization by clicking the generalization to select it, pressing down CTRL, and dragging one of the attach points to a different class or interface. 3 Click the Pointer tool in the palette toolbar. or Click the right mouse button. You release the Generalization tool.
Defining generalizations Modifying generalization properties There are two approaches to modifying generalization properties: ♦ Modify the property sheet of the generalization ♦ Modify an entry in the list of generalizations Modifying generalization properties from its property sheet The generalization property sheet displays the definition of the generalization, which you can modify. v To modify generalization properties from its property sheet: 1 Double-click the generalization in the model.
Chapter 2 Building an Object-Oriented Model Modifying generalization properties from the list of generalizations The list of generalizations includes all generalizations attached to the current model. You can modify the generalization properties from the list. v To modify generalization properties from the list of generalizations: 1 Select Model➤Generalizations. The list of generalizations appears. 2 Click the generalization that you want to modify. An arrow appears at the beginning of the line.
Defining generalizations You modify the display preferences for a generalization in the Display Preferences dialog box. v To modify the display preferences: 1 Select Tools➤Display Preferences. or Right-click the diagram background and select Display Preferences from the contextual menu. The Display Preferences dialog box appears. 2 Expand the Object View node in the Category list. 3 Select Generalization. The Generalization display preferences appears.
Chapter 2 Building an Object-Oriented Model Defining associations An association represents a structural relationship between objects of different classes. An association is drawn as a solid line between pairs of classes. You can define an association between two classes, or between a class and an interface. An association may have a name to clarify the nature of the relationship between the associated classes. The name of the association is usually omitted when end names are used.
Defining associations Association properties An association has the following properties: 98 Property Description Maximum length Name Name of the association 254 Code Reference name for the association 254 Comment Descriptive comment for the association — Stereotype Subclassification of an association derived from an existing one.
Chapter 2 Building an Object-Oriented Model Creating an association You can create an association between two classes or between a class and an interface: ♦ in a diagram ♦ from the list of associations ♦ from the Browser Creating an association outside of a diagram When you create an association from the list of associations or from the Browser, you must select the two classes that are linked by the association.
Defining associations The association property sheet opens to the General page. Opening property sheets at last accessed page Property sheets open to the General page by default. However, you can choose to open property sheets at the last page accessed by selecting Tools➤Options➤Dialog, and selecting the option Keep Last Tab in the Property Sheets groupbox. 5 Type an association name and an association code. 6 Type a name and code for Role A. 7 Type a name and code for Role B. 8 Click OK.
Chapter 2 Building an Object-Oriented Model Association role properties You can define the following properties for each of the two roles of an association: ♦ Multiplicity ♦ Ordering ♦ Visibility Multiplicity The cardinality of each of the two roles of an association is called the multiplicity. The multiplicity indicates the maximum and minimum number of values each role can have. Cardinality Number of instances 0..0 None 0..1 None or one 0..* None to infinity 1..1 One to one 1..
Defining associations Visibility The visibility of an association refers to the way in which it can be seen by other objects. An association that is visible to another object may influence the structure or behavior of the object, or similarly, its own properties may be affected by the other object.
Chapter 2 Building an Object-Oriented Model The association context menu appears. 2 Select Change to Class from the context menu. An associative class with two associations replaces the association. The associative class takes the name of the original association.
Defining associations 3 Click OK. Modifying association properties from the list of associations The list of associations includes all associations attached to the current model. You can modify the association properties from the list. v To modify association properties from the list of associations: 1 Select Model➤Associations. The list of associations appears. 2 Click the association that you want to modify. An arrow appears at the beginning of the line.
Chapter 2 Building an Object-Oriented Model The association property sheet appears. 2 Click the Cardinality tab. The Cardinality page appears. 3 Select properties for role A and for Role B. 4 Select the Aggregation/Composition checkbox. 5 Select Aggregation/Composition group box options. 6 Click OK.
Defining associations Displaying text in association symbols You can define the following display preferences for an association: Preference Description Show name When selected, displays the name of the association Show constraints When selected, displays the constraints (business rules) of the association Show role names When selected, displays the name of the association roles Name attached to its symbol When selected, the name of the role remains attached to it when it is moved.
Chapter 2 Building an Object-Oriented Model The Association display preferences appears. 4 Modify the association display preferences. 5 Click OK.
Defining dependencies Defining dependencies A dependency is a relationship between two modeling elements, in which a change to one modeling element (the independent element) will affect the other modeling element (the dependent element). The dependency relationship indicates that one class or interface in a component diagram uses the services or facilities of another class or interface.
Chapter 2 Building an Object-Oriented Model Analyzing dependency properties Stereotype You can select a stereotype for a dependency from the following several default values: Stereotype Description access Public contents of the target package that can by accessed by the source package bind Source object that instantiates the target template using the given actual parameters call Source operation that invokes the target operation derive Source object that can be computed from the target friend S
Defining dependencies The link appears between the two objects. Dragging a dependency to a different class You can change the class at either end of a dependency by clicking the dependency to select it, pressing down CTRL, and dragging one of the attach points to a different class. 3 Click the Pointer tool in the palette toolbar. or Click the right mouse button. You release the Dependency tool. 4 Double-click the new dependency in the model. The dependency property sheet opens to the General page.
Chapter 2 Building an Object-Oriented Model Modifying dependency properties There are two approaches to modifying dependency properties: ♦ Modify the property sheet of a dependency ♦ Modify an entry in the list of dependencies Modifying dependency properties from its property sheet The dependency property sheet displays the definition of the dependency, which you can modify. v To modify dependency properties from its property sheet: 1 Double-click the dependency in the model.
Defining dependencies 3 Click OK. Modifying dependency properties from the list of dependencies The list of dependencies includes all dependencies attached to the current model. You can modify the dependency properties from the list. v To modify dependency properties from the list of dependencies: 1 Select Model➤Dependencies. The list of dependencies appears. 2 Click the dependency that you want to modify. An arrow appears at the beginning of the line.
Chapter 2 Building an Object-Oriented Model You modify the display preferences for a dependency in the Display Preferences dialog box. v To modify the display preferences: 1 Select Tools➤Display Preferences. or Right-click the diagram background and select Display Preferences from the contextual menu. The Display Preferences dialog box appears. 2 Expand the Object View node in the Category list. 3 Select Dependency. The Dependency display preferences appears.
Defining realizations Defining realizations A realization is a relationship between a class and an interface. It shows that the class realizes the operations offered by the interface. In this kind of relationship, the interface is called the specification element and the class is called the implementation element. The class implements the specification of the interface. You can also create a realization between a shortcut of an interface and a class, or between a shortcut of a class and a interface.
Chapter 2 Building an Object-Oriented Model Creating a realization You can create a realization only from a class to an interface. v To create a realization: 1 Click the Realization tool in the palette toolbar. 2 Drag the realization from the class to the interface. The link appears between the two objects.
Defining realizations Opening property sheets at last accessed page Property sheets open to the General page by default. However, you can choose to open property sheets at the last page accessed by selecting Tools➤Options➤Dialog, and selecting the option Keep Last Tab in the Property Sheets groupbox. 5 Type a realization name and a realization code. 6 Select a stereotype from the dropdown listbox. 7 Click OK.
Chapter 2 Building an Object-Oriented Model v To modify realization properties from its property sheet: 1 Double-click the realization in the model. The realization property sheet appears. 2 Type or select realization properties. or Click on a page tab. Type or select realization properties as required. 3 Click OK.
Defining realizations Modifying a realization from the list of realizations The list of realizations includes all realizations attached to the current model. You can modify the realization properties from the list. v To modify realization properties from the list of realizations: 1 Select Model➤Realizations. The list of realizations appears. 2 Click the realization that you want to modify. An arrow appears at the beginning of the line.
Chapter 2 Building an Object-Oriented Model You modify the display preferences for a realization in the Display Preferences dialog box. v To modify the display preferences: 1 Select Tools➤Display Preferences. or Right-click the diagram background and select Display Preferences from the contextual menu. The Display Preferences dialog box appears. 2 Expand the Object View node in the Category list. 3 Select Realization. The Realization display preferences appears.
Defining domains Defining domains Domains help you identify the types of information in your project. They define the set of values for which an attribute is valid. Applying domains to attributes makes it easier to standardize data characteristics for attributes in different classes.
Chapter 2 Building an Object-Oriented Model Creating a domain You create a domain from the list of domains. Accessing the List of Domains You can access the List of Domains from the current model, or by right clicking the appropriate model node in the Browser, and selecting New➤Domain from the contextual menu. v To create a domain: 1 Select Model➤Domains. The list of available domains appears. 2 Click a blank line in the list. or Click the Add a Row tool. An arrow appears at the beginning of the line.
Defining domains The property sheet for the new domain appears. 7 Select a data type. Specify length and precision as required. $ For information on data types and selecting a data type for a domain see the following sections Indicating data type, length, and precision and Selecting a data type for a domain from the list. 8 Click on a page tab. Type or select domain properties as required. 9 Click OK You return to the List of Domains. 10 Click OK. or Click another domain line.
Chapter 2 Building an Object-Oriented Model In the list of available data types, a variable indicates where you have to type a length or precision, as follows: Undefined data type Variable Replace with %n Length %s Length with precision %p Decimal precision All object languages allow you to select the data type. The data type indicates which domains remain without data types.
Defining domains 4 Select a data type from the dropdown listbox. Undefined data type If you do not want to select a data type immediately, you can choose the data type. When you generate Java or PowerBuilder objects, this data type is replaced by the default data type for your target object language. 5 Click OK. Selecting a data type for a domain from its property sheet v To select a data type for a domain from its property sheet: 1 Select Model➤Domains. The List of Domains appears.
Chapter 2 Building an Object-Oriented Model The change of data type appears in the list of domains. Undefined data type If you do not want to select a data type immediately, you can choose the data type. When you generate the database, this data type is replaced by the default data type for your target object language. Selecting a data type from a list of standard data types You can select a data type from a list of standard data types.
Defining domains Numeric data types Character data types 126 Conceptual data type What it stores Length? Precision? Integer 32-bit integer — — Short Integer 16-bit integer — — Long Integer 32-bit integer — — Byte 256 values — — Number Numbers with a fixed decimal point Fixed á Decimal Numbers with a fixed decimal point Fixed á Float 32-bit floating decimal numbers Fixed — Short Float Less than 32-bit floating decimal number — — Long Float 64-bit floating decimal numb
Chapter 2 Building an Object-Oriented Model Time data types Other data types Conceptual data type What it stores Date Day, month, year Time Hour, minute, and second Date & Time Date and time Timestamp System date and time Conceptual data type What it stores Length? Binary Binary strings Maximum Long Binary Binary strings Maximum Image Images Maximum Bitmap Images in bitmap format (BMP) Maximum OLE OLE links Maximum Other User-defined data type — Undefined Not yet defined d
Defining domains A list of standard data types appears. 5 Click the radio button corresponding to the data type you want to apply. The code for the data type appears in the Code box. Undefined data type If you do not want to select a data type immediately, you can choose the Undefined data type. 6 Type the maximum number of characters for the data type in the Length box.
Chapter 2 Building an Object-Oriented Model Modifying domain properties You can modify domain properties from its property sheet. When you modify a domain, you can choose to automatically update the following properties for attributes using the domain: ♦ Data type ♦ Check parameters ♦ Business rules v To modify domain properties: 1 Select Model➤Domains. The List of Domains appears. 2 Click a domain from the list. An arrow appears at the start of the line. 3 Click the Properties tool.
Defining check parameters Defining check parameters Check parameters are set of conditions which data must satisfy to remain valid. They are used principally in for use in a CDM or a PDM. There are two types of check parameters: Can be attached to Parameter type Description Standard parameters Common data constraints which define a data range.
Chapter 2 Building an Object-Oriented Model v To set standard parameters: 1 Click the Standard Checks tab in the property sheet of a domain or an attribute. The Standard Checks page appears. 2 Type your choice of Standard Parameters. 3 Click OK.
Defining check parameters You define additional check parameters for data constraints where standard check parameters are not sufficient. v To define additional check parameters: 1 Click the Additional Checks tab in the property sheet of an attribute or domain. The Additional Checks page appears. 2 Type SQL expression using the variables %MINMAX%, %LISTVAL%, and %RULES%. 3 Click OK.
Chapter 2 Building an Object-Oriented Model At generation, validation rule variables are instantiated with the following values: Variable Value %ATTRIBUTE% Code of the attribute to which the business rule applies %DOMAIN% Code of the domain to which the business rule applies %CLASS% Code of the class to which the business rule applies %MINMAX% Minimum and maximum values for the attribute or domain %LISTVAL% List values for the entity attribute or domain %RULES% Server validation rules for the e
Defining check parameters 134
C H A P T E R 3 Managing Object-Oriented Models About this chapter Contents This chapter describes how to compare and merge Object-Oriented Models as well as how to check the validity of a Object-Oriented Model (OOM).
Checking an OOM Checking an OOM The procedure that generates .java Java source files or PowerBuilder objects starts by checking the validity of the OOM. If an error is found, the files are not generated.
Chapter 3 Managing Object-Oriented Models OOM check options When you check an OOM, if a parameter is found to be invalid, it can be displayed with one of two types of messages: Message Description Error Major problem that impedes Java or PowerBuilder generation Warning Minor problem or recommendation These messages represent two different levels of problem severity. You can modify the level of problem severity for each object parameter that is verified by the Check model.
Checking an OOM Object selection in the Check Model You select objects to check from the Selection page. You can list all objects in the current model, or package, by selecting the Include Sub-packages tool.
Chapter 3 Managing Object-Oriented Models The object parameters which are verified by the Check Model are displayed with the symbols indicating a degree of problem severity. 3 If you want to change a degree of problem severity, select the object parameter and then select either the Error or Warning tool. The symbol changes to the appropriate severity level. 4 If you want PowerDesigner to automatically correct a problem, select the object parameter and then select the Automatic Correction tool.
Checking an OOM The Selection page appears. 6 Select a model from the dropdown list at the top of the dialog box. 7 Click an object tab. The corresponding object page displays all the objects in the current OOM. 8 Select checkboxes for objects that you want to be checked. 9 Clear checkboxes for objects that you do not want to be checked. Selecting all or clearing all checkboxes You can select all object checkboxes by clicking the Select All tool.
Chapter 3 Managing Object-Oriented Models The Check Model Result List displays errors and warnings based on the check options you have defined. Dockable result window When you right click an object parameter, a menu appears listing correction options. Among these, you can also select options to clear, dock or hide the result window. Making corrections based on OOM check results You can use the Check Model to locate and correct problems in the OOM.
Checking an OOM Navigating in the error list The Check tool bar also contains navigation tools that you can use to move to the first, previous, next, or last errors that are listed. You can also navigate in the list of errors by right-clicking an object parameter and selecting Go To First error, Previous error, Next error, or Last error from the context menu.
Chapter 3 6 Managing Object-Oriented Models Right-click the object parameter and select Re-check from the contextual menu. Verify that the problem has been corrected.
Merging two OOM Merging two OOM You can merge two OOM. The merge makes it possible to form a single model that combines design efforts performed independently by several team members. When the merge process finds two objects that have the same code, you can indicate whether or not the definition of the object in the source model should replace the definition in the target model. $ For more information on merging models, see the PowerDesigner General Features Guide.
Chapter 3 Managing Object-Oriented Models Opening a Rose model in an OOM You can import a .mdl models built with Rational Rose in PowerDesigner. A new OOM is created for the Rose model, and the objects of the Rose model are translated into OOM objects. This functionality provides you with greater scope and flexibility. You can create an OOM from a Rose model, from which you can generate Java files or objects for PowerBuilder to create applications.
Opening a Rose model in an OOM Objects imported The following Rose objects are imported directly into the new OOM: Package Diagram Class Interface Attribute Operation Generalization Association Dependency Realization Note Note Link Text The import process translates some properties of imported objects into OOM properties as follows: All objects Class Generalization Association 146 Property in an Rose model Imported property in a OOM Documentation Comment Export Control - Implementation Visibility
Chapter 3 Managing Object-Oriented Models Objects not imported When you open a Rose model, the following properties are not imported into the new OOM: Package Global Class Rose Property Rose Sub-property Type Parameterized Class Instanciated Class Parameterized Class Utility Instanciated Class Utility MetaClass Formal arguments — Nested Class — Concurrency — Files — Rose Property Rose Sub-property Type Class Class Utility Parameterized Class Instanciated Class Parameterized Class Utility
Opening a Rose model in an OOM Operation Default Values of Arguments Protocol Qualification (language-specific) Exceptions Size (amount of storage) Time (to complete operation) Concurrency (sequential, guarded, synchronous) Preconditions Postconditions Generalization Friendship required (yes/No) Association Keys/qualifiers Constraints Stereotype Derived Static Friend Dependency Export control Friendship required Cardinality from Cardinality to 148
C H A P T E R 4 Reverse Engineering About this chapter Contents This chapter describes Java, PowerBuilder, and XML reverse engineering functions for an Object-Oriented Model (OOM). It also shows you how to create a new OOM by reverse engineering from a database.
What is reverse engineering? What is reverse engineering? Reverse engineering is the process of examining and recovering data or source code from a file that is then used to build or update an OOM. You reverse engineer objects to an OOM via a diagram. You can reverse engineer objects to a new model, or to an existing model.
Chapter 4 Reverse Engineering Reverse engineering Java You can reverse engineer files that contain Java classes into an OOM. For each existing class in a Java file, a corresponding class is created in the model, with the same name and containing the same information. When you reverse engineer a Java class that already exists in a model, you can choose in the Merge Model window either to replace the existing class, or to keep the existing class definition in the model.
Reverse engineering Java Java code comments When you reverse engineer Java files, some comments may change form or position within the code.
Chapter 4 Reverse Engineering The Options page appears. 3 Select or clear options. 4 Click Apply. 5 Click Cancel. Loading a JDK library model in the workspace When you reverse engineer Java files, you can, at the same time, load one of the JDK models that contains the class libraries of a particular version of JDK. You can select to reverse a JDK library model from the Options page of the Reverse Java dialog box. The Setup program installs these models in the PowerDesigner LIBRARY folder.
Reverse engineering Java The available library files are listed. Each JDK file corresponds to a particular version of JDK. 3 Select the file JDK-1_1_8.OOM. This file contains all the library class files of version 1_1_8 of JDK. 4 Click Open. The OOM opens in the workspace. Reverse engineering Java source files without code body You can reverse engineer .java class source files without the body of the code.
Chapter 4 Reverse Engineering 3 Click the Add button. A standard Open dialog box appears. 4 Select the files that you want to reverse and click Open. You return to the Reverse Java dialog box. It displays the files you selected. 5 Click the Options tab. The Options page appears.
Reverse engineering Java 6 Select the Ignore operation body checkbox. 7 Click OK. The classes reversed without the body of the code. The classes are automatically added to your model and are visible in the diagram. Reverse engineering Java source files Each .java source file contains information on one or several class definitions. When you reverse engineer a .java file, PowerDesigner creates a class in the model corresponding to each class definition in the .java file.
Chapter 4 Reverse Engineering 2 Select the .java radio button. Reversing without the body of the code You can choose reverse .java source files without the body of the code of the class by selecting the Ignore operation body checkbox in the Options page. 3 Click the Add button. A standard Open dialog box appears.
Reverse engineering Java 4 Select the files that you want to reverse and click Open. Multi-selection You can select several files simultaneously by using the CTRL or SHIFT keys. 5 Click OK. A Progress box appears and the classes are added to your model. The classes are visible in the diagram and in the Browser. The reversed classes are listed in the Reverse page of the Output window, situated in the bottom part of the PowerDesigner main window. Reverse engineering compiled Java files A compiled .
Chapter 4 Reverse Engineering 2 Select the .class radio button. 3 Click the Add button. A standard Open dialog box appears. 4 Select the files that you want to reverse and click Open. Multi-selection You can select several files simultaneously by using the CTRL or SHIFT keys.
Reverse engineering Java You return to the Reverse Java dialog box. It displays the files you selected. 5 Click OK. A Progress box appears and the classes are added to your model. The classes are visible in the diagram and in the Browser. The reversed classes are listed in the Reverse page of the Output window, situated in the bottom part of the PowerDesigner main window.
Chapter 4 Reverse Engineering Reverse engineering Java files from a source directory Reverse engineering .java source files from a source directory requires that you follow the same procedure as when you reverse engineer independent .java files, the only difference being that you select a directory in which several .java files are located and not individual files. This gives you the advantage of reversing groups of files that belong to the same model or package.
Reverse engineering Java Reversing without the body of the code You can choose reverse .java source files without the body of the code of the class by deselecting the Ignore operation body checkbox. 3 Click the Add button. The Browse for Folder dialog box appears. 4 Select the directory that contains the Java files you want to reverse and click OK. You return to the Reverse Java dialog box. It displays the files you selected.
Chapter 4 Reverse Engineering 5 Click OK. A Progress box appears and the classes are added to your model. The classes are visible in the diagram and in the Browser. The reversed classes are listed in the Reverse page of the Output window, situated in the bottom part of the PowerDesigner main window. Reverse engineering archived .jar or .zip files Each .jar or .zip file contains definitions of one or several classes. These files can often contain large numbers of class definitions. A .
Reverse engineering Java 2 Select the Archive radio button. 3 Click the Add button. A standard Open dialog box appears. 4 Select the files that you want to reverse and click Open. Multi-selection You can select several files simultaneously by using the CTRL or SHIFT keys.
Chapter 4 Reverse Engineering The Reverse Java dialog box displays the files you selected. 5 Click OK. A Progress box appears and the classes are added to your model. The classes are visible in the diagram and in the Browser. The reversed classes are listed in the Reverse page of the Output window, situated in the bottom part of the PowerDesigner main window.
Reverse engineering PowerBuilder Reverse engineering PowerBuilder You can reverse engineer PowerBuilder NVO (non-visual objects) into an OOM from either of the following sources: ♦ PowerBuilder applications ♦ SRU files For each reversed PowerBuilder object, a class is created in the model, with the same name and containing the same information.
Chapter 4 Reverse Engineering You can define the following PowerBuilder reverse engineering options: Option Result of selection Ignore operation body Reverses PowerBuilder objects without including the body of the code Ignore Comments Reverses PowerBuilder objects without including code comments Create Symbols Creates a symbol for each object in the diagram.
Reverse engineering PowerBuilder The Options page appears. 3 Select PowerBuilder reverse options. 4 Click Apply. 5 Click Cancel. Loading a PowerBuilder library model in the workspace When you reverse engineer PowerBuilder files, you can, at the same time, load one of the PowerBuilder models that contains the class libraries of a particular version of PowerBuilder. You can select to reverse a PowerBuilder library model from the options page of the Reverse PowerBuilder dialog box.
Chapter 4 Reverse Engineering The available library files are listed. Each PB file corresponds to a particular version of PowerBuilder. 3 Select the file PB7.OOM. This file contains all the library class files of PowerBuilder version 7. 4 Click Open. The OOM opens in the workspace. Reverse engineering objects from a PowerBuilder application When you reverse engineer objects from a PowerBuilder application, you can select only one PowerBuilder application from the PB application dropdown listbox.
Reverse engineering PowerBuilder 2 Select the PBL radio button. 3 Select a PowerBuilder application from the PB Application dropdown listbox. 4 Click the Add button. A standard Open dialog box appears. 5 Select the file that you want to reverse and click Open. Multi-selection You can select several files simultaneously by using the CTRL or SHIFT keys.
Chapter 4 Reverse Engineering You return to the Reverse PowerBuilder dialog box. It displays the files you selected. 6 Click OK. A Progress box appears and the classes are added to your model. The classes are visible in the diagram and in the Browser. The reversed classes are listed in the Reverse page of the Output window, situated in the bottom part of the PowerDesigner main window.
Reverse engineering PowerBuilder 2 Select the SRU radio button. 3 Click the Add button. A standard Open dialog box appears. 4 Select the SRU files that you want to reverse and click Open. Multi-selection You can select several files simultaneously by using the CTRL or SHIFT keys.
Chapter 4 Reverse Engineering You return to the Reverse PowerBuilder dialog box. It displays the files you selected. 5 Click OK. A Progress box appears and the classes are added to your model. The classes are visible in the diagram and in the Browser. The reversed classes are listed in the Reverse page of the Output window, situated in the bottom part of the PowerDesigner main window.
Reverse engineering XML Reverse engineering XML You can reverse engineer one of the following types of XML file to an OOM: ♦ XML - DTD format. ♦ XML - Schema Provides an overall structure for an XML file in Schema format. ♦ XML - Data Provides an overall structure for an XML file in DTD All other XML documents describing data or schemas. When you reverse a DTD file into an OOM, you get more readable view of the DTD.
Chapter 4 Reverse Engineering v To define XML reverse engineering options: 1 Select Language➤Reverse Engineer XML. The Reverse XML dialog box opens. 2 Click the Options tab. The Options page appears. 3 Select XML reverse options. 4 Click Apply. 5 Click Cancel. Reverse engineering XML files XML files can be reversed into an OOM.
Reverse engineering XML v To reverse engineer an XML file: 1 Select Language➤Reverse Engineer XML. The Reverse XML dialog box opens to the Selection page. 2 Click the Add button. A standard Open dialog box appears. 3 Select the files that you want to reverse and click Open. Multi-selection You can select several files simultaneously by using the CTRL or SHIFT keys. You return to the Reverse XML dialog box. It displays the files you selected. 4 Click OK.
Chapter 4 Reverse Engineering Reverse engineering into a new OOM You can reverse engineer object language files (Java, PowerBuilder, XML) into a new OOM. v To reverse engineer object language files into a new OOM: 1 Select File➤Reverse Engineering➤Object Language. The Choose Object Language dialog box appears. 2 Click the Link radio button. 3 Select an object language in the dropdown list box. 4 Click OK.
Reverse engineering into a new OOM This product includes XML4C 3.0.1 software developed by the Apache Software Foundation (http://www.apache.org/) Copyright (c) 1999 The Apache Software Foundation. All rights reserved. THE XML4C 3.0.1 SOFTWARE ("SOFTWARE") IS PROVIDED ‘‘AS IS’’ AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
C H A P T E R 5 Generating Objects from an OOM About this chapter Contents This chapter describes how to generate objects from an OOM.
Generating objects Generating objects You can generate the following types of objects from an OOM: Object type What is generated Java source files .
Chapter 5 Generating Objects from an OOM You have the following selection options: Parent object Include SubPackages Model Selected All objects in model including all objects contained in packages and sub-packages Model Not selected All objects in model except objects contained in packages and sub-packages Package Selected All objects contained in package including all objects contained in sub-packages Package Not selected All objects in package except objects contained in sub-packages Displ
Generating Java source files Generating Java source files You generate Java source files from the classes and interfaces of a model. A separate file, with the file extension .java, is generated for each class or interface that you select from the model. You can only generate Java files from one model at a time. You can compile the .java class files that you generate from an OOM in any Java compiler tool. You can also run Java in a database server such as Sybase Adaptive Server Anywhere.
Chapter 5 Type sort Generating Objects from an OOM You can sort the order that attributes and operations are arranged in the code of the classes of the model. Option Result of selection Attributes - Operations Displays the class attributes before the operations in the generated class definition Operations - Attributes Displays the class operations before the attributes in the generated class definition You define Java generation options from the Java Generation dialog box.
Generating Java source files Generating Java class definition files PowerDesigner generates a Java class definition file for each of the classes you select to generate in the Java Generation dialog box. You can select any of the classes from the model, including those that are contained within packages or sub-packages. The generated files contain the definition of each class and have the file extension .java. v To generate .java files: 1 Select Language➤Generate Java Code.
Chapter 5 4 Generating Objects from an OOM Select the classes that you want to generate from the list. Select Tools All the classes and interfaces of the model, including those that are grouped into packages, are selected and displayed by default. You can use the Select tools to the right of the Folder Selection dropdown listbox to modify the selection. The Include Sub-Packages tool, enables you to include in your selection all the classes and interfaces that are situated within packages.
Generating Java source files The Options page appears. 7 Select the Select Java generation options. Navigating between pages Use CTRL+PAGEDOWN or CTRL+PAGEUP to move to the next or to the previous tab and display the corresponding page. 8 Click OK. A Java class definition file is generated with the file extension .java for each of the classes that you selected. Creating Java BeanInfo classes A Java Bean is a reusable software component that can be visually manipulated in a software development tool.
Chapter 5 Generating Objects from an OOM A BeanInfo class can only be created from a class if its type is Java Bean. You can define the type of a class from its property sheet: v To create Java BeanInfo classes: 1 Select Language➤Create BeanInfo Classes. A selection window appears. It contains a list of all the classes in the model of type Java Bean. 2 Select the classes for which you want to generate Java BeanInfo classes.
Generating Java source files 3 Click OK. A BeanInfo class is created in the model for each of the classes you selected.
Chapter 5 Generating Objects from an OOM Generating objects for PowerBuilder You can generate PowerBuilder NVO (non-visual objects) from the classes of an OOM to either of the following: ♦ A PowerBuilder application ♦ SRU files You can create PowerBuilder user objects only from the classes of the diagram and not from interfaces. pbl application You can generate PowerBuilder NVOs from an OOM that you can use directly in PowerBuilder.
Generating objects for PowerBuilder PBL When generating objects for a PowerBuilder application, you must make a selection in both the PB library and PB application fields. If PowerBuilder is not installed on your machine, you cannot generate objects for a PowerBuilder application. Option Result of selection PB library Directory into which PowerDesigner generates PowerBuilder library files PB application PowerBuilder application into which you generate PowerBuilder non-visual objects.
Chapter 5 4 Click Apply. 5 Click Cancel. Generating Objects from an OOM Generating objects for a PowerBuilder application When you generate PowerBuilder objects, you must specify both the PowerBuilder library and the application that will use the objects, otherwise you will not be able to use them in PowerBuilder. If PowerBuilder is not installed on your machine, you cannot generate objects for a PowerBuilder application.
Generating objects for PowerBuilder Select Tools All the classes of the model, including those that are grouped into packages, are selected and displayed by default. You can use the Select tools to the right of the Folder Selection dropdown listbox to modify the selection. The Include Sub-Packages tool, enables you to include in your selection all the classes that are situated within packages. 4 Click the Options tab. The Options page appears.
Chapter 5 Generating Objects from an OOM Generating PowerBuilder objects in sru files When you generate PowerBuilder objects in sru files, a separate file is created for each of the classes that you select in the OOM. You do not have to have PowerBuilder installed on your machine to generate sru files. v To generate PowerBuilder user objects in sru files: 1 Select Language➤Generate PowerBuilder. The PowerBuilder User Object Generation dialog box opens.
Generating objects for PowerBuilder The Options page appears. 5 Select the SRU option. 6 Select a directory in which you want to generate the .sru files. 7 Click OK. A PowerBuilder User Object is generated with the file extension .sru for each of the classes that you selected.
Chapter 5 Generating Objects from an OOM Generating for XML You can generate an XML DTD file from an OOM. A DTD file provides an overall structure for an XML file. The DTD file can be used as a standard for validating data in XML files or for exchanging data in XML format. You can generate an XML DTD in one of the following format types: XML file format Description XML - DTD Used for standard DTD specification. Each class is generated as an ELEMENT, with its attributes as subelements.
Generating for XML The Options page appears. 3 Select XML generation options. 4 Click Apply. 5 Click Cancel. Generating XML objects When you generate XML from an OOM, PowerDesigner creates an XML file containing the definition of each of the classes you select to generate in the XML Generation dialog box. You can select any of the classes from the model, including those that are contained within packages or sub-packages.
Chapter 5 Generating Objects from an OOM v To generate XML files: 1 Select Language➤Generate XML. The XML Generation dialog box opens. 2 Type a destination directory for generated XML file in the Directory box. or Click the Browse to Folder button to the right of the Directory box and browse to select a directory path. 3 Type a name for generated XML file in the File name box. 4 Select a model or package from the Folder Selection dropdown listbox.
Generating for XML 6 Click OK. An XML file is generated with the file extension .xml.
Chapter 5 Generating Objects from an OOM Customizing scripts You can customize scripts as follows: ♦ Insert scripts at the beginning and end of a script ♦ Insert scripts before and after a class or interface creation command Customizing a creation script allows you to add descriptive information about a generated script, or manipulate the script in such a way that is not provided by PowerDesigner.
Customizing scripts 200
C H A P T E R 6 Generating a Conceptual Data Model from an Object-Oriented Model About this chapter Contents This chapter describes how to generate a Conceptual Data Model (CDM) from an Object-Oriented Model (OOM).
Generating OOM objects to a CDM Generating OOM objects to a CDM When you generate a Conceptual Data Model (CDM) from an ObjectOriented Model (OOM), PowerDesigner translates OOM objects and data types to CDM objects and data types. The current object language of an OOM has no effect on the generation to a CDM. Translating OOM objects into CDM objects CDM generation translates OOM objects into conceptual objects.
Chapter 6 Generating a Conceptual Data Model from an Object-Oriented Model Translating OOM data types for a CDM PowerDesigner supports both Java and conceptual data types. When you generate objects from an OOM to a CDM, Java data types are translated by PowerDesigner into conceptual data types. PowerDesigner conceptual data types cannot be modified.
Generating a CDM from an OOM Generating a CDM from an OOM You can generate a CDM from a global OOM or from a package within the model. Limiting CDM generation to a single package is useful when different designers own packages of the same OOM. Designers can generate their packages independently from others. Generating a package results in an independent CDM. You generate a CDM from a diagram in the model.
Chapter 6 Update existing Conceptual Data Model Generating a Conceptual Data Model from an Object-Oriented Model You must indicate the following parameters when you update an existing CDM: Parameter Description Select Model Target Conceptual Data Model.
Generating a CDM from an OOM Check model before generation If you select the Check Model option, the procedure to generate a CDM starts by checking the validity of the OOM or package. A CDM results when no errors are found. You can set check options by selecting Tools➤Check Model. Object selection parameters You select objects for CDM generation from the Selection page.
Chapter 6 Generating a Conceptual Data Model from an Object-Oriented Model Generating a new CDM When you generate from an OOM to a new CDM, PowerDesigner creates a new CDM containing all the objects that you selected to generate in the OOM. The newly created CDM appears in the browser and the corresponding diagram opens in the main diagram window. You can only generate a CDM from the active OOM diagram window. v To generate to a new CDM from an OOM: 1 Select Tools➤Generate Conceptual Data Model.
Generating a CDM from an OOM The Detail page appears. 5 Select or clear CDM generation options. 6 Click the Selection tab. The Selection page appears. 7 208 Select the name of an OOM from the Select Location dropdown list.
Chapter 6 Generating a Conceptual Data Model from an Object-Oriented Model Generating a CDM from a package To generate a CDM from a package, select the package name from the Select Location dropdown listbox at the top of the page. To generate CDM from a sub-package, select the Sub-Packages Included tool next to the Selection Location dropdown listbox, and then select a sub-package from the dropdown listbox. 8 Select checkboxes corresponding to each entity that you want to generate.
Generating a CDM from an OOM Updating an existing CDM There are two ways to update an existing CDM depending on whether the Preserve Modifications options is selected or not selected: Preserve Modifications Result Selected You can manually compare and merge existing CDM (target model) with the newly generated CDM ( source model) Not selected The existing CDM is automatically replaced by the newly generated CDM When Preserve Modifications is selected, the Merge Models window appears after the new CDM
Chapter 6 Generating a Conceptual Data Model from an Object-Oriented Model 3 Select a target model from the Select Model dropdown listbox. This is the existing model that you want to update. Preserve modifications If you want to preserve the existing objects in the CDM, then the Preserve modifications checkbox must be selected. If you clear this checkbox, all existing objects in the CDM will be removed from the model, leaving only the objects generated from the OOM. 4 Click the Detail tab.
Generating a CDM from an OOM The Detail page appears. 5 Select or clear CDM generation options. 6 Click the Selection tab. The Selection page appears. 7 212 Select the name of an OOM from the Select Location dropdown list. The default CDM is generated from this OOM.
Chapter 6 Generating a Conceptual Data Model from an Object-Oriented Model Generating a CDM from a package To generate a CDM from a package, select the package name from the Select Location dropdown listbox at the top of the page. To generate CDM from a sub-package, select the Sub-Packages Included icon next to the Selection Location dropdown listbox, and then select a sub-package from the dropdown listbox. 8 Select class checkboxes for each entity that you want to generate.
Generating a CDM from an OOM 214
C H A P T E R 7 Generating a Physical Data Model from an Object-Oriented Model About this chapter Contents This chapter describes how to generate a Physical Data Model (PDM) from an Object-Oriented Model (OOM).
Generating OOM objects to a PDM Generating OOM objects to a PDM When you generate a Physical Data Model (PDM) from an Object-Oriented Model (OOM), PowerDesigner translates OOM objects and data types to PDM objects and data types supported by the current DBMS. The current object language of an OOM has no effect on the generation to a PDM. Translating OOM objects into PDM objects PDM generation translates OOM objects into physical objects.
Chapter 7 Generating a Physical Data Model from an Object-Oriented Model Translating OOM data types for a PDM PowerDesigner supports both Java and physical data types. Data types that you select in the OOM are not always supported by the current DBMS. In this case, the data type is translated to a data type supported by the DBMS when you generate the PDM.
Generating a PDM from an OOM Generating a PDM from an OOM You can generate a PDM from a global OOM or from a package within the model. Limiting PDM generation to a single package is useful when different designers own packages of the same OOM. Designers can generate their packages independently from others. Generating a package results in an independent PDM . You generate a PDM from a diagram in the model.
Chapter 7 Update existing Physical Data Model Generating a Physical Data Model from an Object-Oriented Model You must indicate the following parameters when you update an existing PDM: Parameter Description Select Model Target Physical Data Model.
Generating a PDM from an OOM Defining PDM generation options You can set the following general generation options: Option Description Check model Checks the model before generating the PDM, and stops generation if an error is found Save generation dependencies When selected, PowerDesigner keeps a record of which model was generated from Table prefix Helps you identify a table more easily in the model Update Rule Update referential integrity defined for references Delete Rule Delete referential i
Chapter 7 Generating a Physical Data Model from an Object-Oriented Model You have the following selection options: Parent object Include Subpackages Model Selected All objects in model including all objects contained in packages and sub-packages Model Not selected All objects in model except objects contained in packages and sub-packages Package Selected All objects contained in package including all objects contained in sub-packages Package Not selected All objects in package except objects
Generating a PDM from an OOM The PDM Generation Options dialog box appears. 2 Click the Generate new Physical Data Model radio button. 3 Select the DBMS you want to be associated to your model from the DBMS dropdown listbox. 4 Type a new name and code, otherwise, the PDM will have the same name and code as the OOM. 5 Click the Detail tab. The Detail page appears.
Chapter 7 Generating a Physical Data Model from an Object-Oriented Model 6 Select or clear PDM generation options. 7 Click the Selection tab. The Selection page appears. 8 Select the name of an OOM from the Select Location dropdown list. Generating a PDM from a package To generate a PDM from a package, select the package name from the Select Location dropdown listbox at the top of the page.
Generating a PDM from an OOM The Output window shows the progress of the generation process. The new PDM appears in the diagram window.
Chapter 7 Generating a Physical Data Model from an Object-Oriented Model The PDM Generation Options dialog box appears. If you do not have a PDM in the current Workspace, the Update existing Physical Data Model option is not available. 2 Select the Update existing Physical Data Model radio button. 3 Select a target model from the Select Model dropdown listbox. This is the existing model that you want to update. The DBMS that is attached to the model appears in the DBMS box.
Generating a PDM from an OOM The Detail page appears. 5 Select or clear PDM generation options. 6 Click the Selection tab. The Selection page appears. 7 226 Select the name of an OOM from the Select Location dropdown list. The default PDM is generated from this OOM.
Chapter 7 Generating a Physical Data Model from an Object-Oriented Model Generating a CDM from a package To generate a CDM from a package, select the package name from the Select Location dropdown listbox at the top of the page. To generate CDM from a sub-package, select the Sub-Packages Included icon next to the Selection Location dropdown listbox, and then select a sub-package from the dropdown listbox. 8 Select class checkboxes for each table that you want to generate.
Generating a PDM from an OOM 228
C H A P T E R 8 Using Object Languages About this chapter Contents This chapter explains how to use an object language in an OOM.
Object languages Object languages An object language contains specifications for a particular language. It provides PowerDesigner with the syntax and guidelines for implementing stereotypes, data types, scripts and constants for an object language. Every OOM is attached by default to an object language. When you create a new OOM, you choose an object language.
Chapter 8 Using Object Languages Accessing object language properties There are two different ways of accessing and modifying an object language properties: Object language Menu item Description Linked (to all models) Tools➤Resources➤Object Languages Used to define object languages for all models that are linked to this object language Local to the model Language➤Edit Current Object Language Used to define the object language that is local to the current OOM Modifying the current object language Y
Object languages The Object Languages Properties dialog box appears. In the left pane is a list of categories and sub-categories in which are contained the values that you can modify. 3 Expand a category node (and its sub-category if it has one), and select a value. The name, associated comment, and value of the field appear in the zone to the right of the explorer window. 232 4 Modify the comment or value as required. 5 Click OK.
Chapter 8 Using Object Languages The next time you open an OOM, the modifications that you made in the object language editor will remain the same for the newly opened model. Modifying linked object language properties You can change any of the parameters of existing linked object languages. The changes you make apply to all models that are linked to the object language. v To modify the parameters of a linked object language: 1 Open an OOM. 2 Select Tools➤Resources➤Object Languages.
Object languages The Object Languages Properties dialog box appears. In the left pane is a list of categories and sub-categories in which are contained the values that you can modify. 4 Expand a category node (and its sub-category if it has one), and select a value. The name, associated comment, and value of the field appear in the zone to the right of the explorer window. 234 5 Modify the comment or value as required. 6 Click OK.
Chapter 8 Using Object Languages Changing the object language of an OOM You can change the object language for an OOM, defining the new object language as being local to the model or as being linked to the model. v To change the object language of an OOM: 1 Open an OOM. 2 Select Language➤Change Current Object Language. The Change Object Language window appears. 3 Select a new object language from the Object Language dropdown listbox in the New groupbox.
Object languages The Object Languages window appears. 3 Click the New tool. The New Object Language window appears. 236 4 Type a name for the new object language in the Name box. 5 Select an existing object language from the Copy from dropdown listbox if you want the new object language to be based on an existing one. 6 Click OK.
Chapter 8 Using Object Languages The Object Languages Properties dialog box appears. 7 Expand the category nodes as appropriate and modify comments or values as required. 8 Click OK. A standard Windows Save As box appears. 9 Type the filename and click Save. The object language is saved in a file with the XOL extension. You return to the Object Languages window with the new object language selected.
Object languages 10 Click Close. $ For information on how to associate an object language to an OOM, see the section Changing the object language of an OOM.
Chapter 8 Using Object Languages Using the object language editor You use the object language editor to consult or modify parameters that appear in categories or sub-categories of an Object-Oriented Model. Categories The object language editor is made up of a number of categories, subcategories, that contain parameters. When you select a category or a parameter, its comment and values are displayed in fields in the right-hand side of the of the dialog box.
Using the object language editor Modifying values in the object language editor You have to use the object language editor from an Object-Oriented Model. The modifications that you make to values in the object language editor will apply to the current model, as well as to all new Object-Oriented Models.
Chapter 8 Using Object Languages Object language editor categories The values you define as parameters fall into three categories: Category Description General Object language identification UML Object stereotypes as defined in UML Script Generation characteristics, command definition, and data type translations Extended Attributes Extended attributes for the OOM objects that will be used in the generation process General category The values that you define in the General category are used when y
Object language editor categories Default stereotypes The following objects have existing default stereotypes that you can modify: ♦ Class ♦ Operation ♦ Generalization ♦ Dependency ♦ Realization ♦ Package Class stereotypes A class has the following default stereotypes: 242 Stereotype Description actor Coherent set of roles enumeration List of named values used as the range of a particular attribute type exception Exception class.
Chapter 8 Using Object Languages Operation stereotypes An operation has the following default stereotype: Stereotype Description constructor Operation that creates and initializes an instance of a class Generalization stereotypes A generalization has the following default stereotype: Stereotype Description implementation Specifies that the child object inherits the implementation of the parent object but that it does not make public its interfaces, nor support them, thus violating its substitutabili
Object language editor categories Dependency stereotypes A dependency has the following default stereotypes: 244 Stereotype Description access Public contents of the target package that can by accessed by the source package bind Source object that instantiates the target template using the given actual parameters call Source operation that invokes the target operation derive Source object that can be computed from the target friend Source object that has special visibility towards the target
Chapter 8 Using Object Languages Package stereotypes A package has the following default stereotypes: Stereotype Description Facade Package that is a view of another package Framework Package that consists mostly of patterns Model Specifies a semantically closed abstraction of a system Stub Package that serves as a proxy for the public contents of another package Subsystem Grouping of elements, some of which constitute a specification of the behavior offered by the other contained elements Syst
Object language editor categories Default constants The following constant values are defined by default: Constant Default value Null 0 True TRUE False FALSE Void void Bool boolean Object scripts Depending on the object language family (Java, XML, …) some pieces of generated code can be parameterized in this section. Each object concerned by the generation process has a sub-category where its definition and other topics can be defined.
Chapter 8 Using Object Languages The following table lists all the objects that can be customized, with an example for each object specification.
Object language editor categories XML Mapping The reverse engineering of XML Data documents needs a mapping table to identify which element or attribute becomes a class, attribute or association in the reversed OOM. The XML Mapping sub-category, defined under Object scripts, contains three maps: ClassMapping, AttributeMapping and AssociationMapping. In each map, the ‘ID’ item specifies the name of the element that will become an object.
Chapter 8 Using Object Languages Namings You can modify the following default names for Getter and Setter operations: Getter operation Setter operation Name Default value * set%Code% Name Default value boolean is%Code% * get%Code% Event You can use this sub-category to define events on operations. The default exisiting events are constructor and destructor. Extended Attributes category The Extended Attributes category allows he user to define extended attributes for the OOM objects.
Object language editor categories 250
C H A P T E R 9 Using Business Rules About this chapter Contents This chapter describes how business rules help you model information.
What is a business rule? What is a business rule? A business rule is a written statement specifying what the information system must do or how it must be structured to support business needs. A business rule is a rule that your business follows. A business rule could be a government-imposed law, a customer requirement, or an internal guideline. Starts as an observation Business rules often start as simple observations, for example "customers call toll-free numbers to place orders.
Chapter 9 Using Business Rules Defining business rules in an OOM You can define a business rule which can be attached to the following objects in an OOM: Domains Classes Interfaces Attributes Identifiers Operations Associations Generalizations Realizations Dependencies Types of business rule In PowerDesigner, you can define several different types of business rules.
Defining business rules in an OOM Business rule properties A business rule definition includes the following properties: Property Description Maximum length Name Name for the rule 254 Code Reference name for the rule 254 Comment Descriptive label for the rule — Type Indicates whether the rule is a definition, a fact, a formula, or a validation — Expression Presence of associated expression — Notes Presence of associated notes — Creating a business rule Before you create business rules,
Chapter 9 Using Business Rules v To create a business rule: 1 Select Model➤Business Rules. The List of Rules appears. It displays the business rules defined for the model. 2 Click a blank line in the list. or Click the Add a Row tool. An arrow appears at the beginning of the line. 3 Type a name and a code for the business rule. 4 Click Apply. The creation of the new business rule is committed. 5 Click the new business rule line. An arrow appears at the beginning of the line.
Applying business rules to objects Applying business rules to objects From the list of business rules, you can apply a business rule to existing objects. You can also apply a business rule to objects from their property sheets or lists. Applying a business rule to an object You can add business rules that already exist in the model, and which belong to other objects. v To apply a business rule to an object: 1 Double-click an object in the model. The object property sheet appears.
Chapter 9 Using Business Rules The Selection window appears. It contains a list of all the business rules that exist in the model, with the exception of those that already belong to the object. 4 Select the business rules that you want to add to the object. 5 Click OK. The business rules are added to the object and appear in the list of business rules for the object. 6 Click OK. Attaching an expression to a business rule A business rule typically starts out as a description.
Applying business rules to objects 258
Glossary abstract class A class that cannot have any direct instances aggregation An form of association that specifies a part-whole relationship between a component class and an aggregate class association A structural relationship that describes a set of links between objects association role The endpoint of an association, a role specifies the multiplicity and visibility between the association and the class to which it is connected attribute A named property of an object that defines the chara
Glossary class diagram A class diagram is a view of a model that shows a set of packages, classes, interfaces, and their relationships that together represent the logical static design view of a system. A class diagram may contain all or part of the class structure of a system classifier A classifier is a mechanism that has structural (attributes) and behavioral (operations) features.
Glossary multiplicity A specification of the range of allowable cardinalities that a set may assume Object-oriented model (OOM) Class structure that is the logical design view of a software system. An OOM is essentially a static conceptual model of a software system object language Contains the specifications for a particular language.
Glossary stereotype An extension of the vocabulary of the UML, which allows you to create new kinds of building blocks that are derived from existing ones but that are specific to your problem transient object An object that ceases to exist when the process that created it ceases to exist visibility Denotes how an object can be seen and used by other objects 262
Index A abstract class 18 operation 67 abstract class 259 access dependency 109 actor class 20 add attribute 59 constructor 73 operation 84 add object class 29 interface 41 add operation attribute 79 additional check parameter 131 additional checks domain 120 aggregation 259 association 98, 102 role 102 application PowerBuilder 191 apply business rule 132, 256 validation rule 132 archived Java files reverse engineering 151 association 259 aggregation 98, 102 associative class 102 cardinality 101, 104 chang
attribute (continued) detail 58 diagram 53 display 60 domain 49, 57 duplicate 59 enforce coherence 9 icon 60 identifier 49 initial value 49 interface 42 keywords 60 length 49 list 52, 56 markers 60 model option 9 modify 54, 55, 56 multiplicity 49, 51 name 49 operation 79 precision 49 property 49, 54, 55 Rose import 147 show 60 static 49 stereotype 49 symbol 60 validation rule 132 variable 132 visibility 49, 50, 60 automatic correct 142 automatic correction check 137 check option 141 B BeanInfo 259 check 13
changeability (continued) attribute 49 check association 136 attribute 136 automatic correction 137 BeanInfo 136 class 136 correct 141, 142 error list 142 generalization 136 interface 136 manual correction 137 model 138 OOM 136, 141, 142 operation 136 option 137, 138 realization 136 view 136 check option automatic correction 141 detail 141 manual correction 141 recheck 141 check parameter additional 131 attribute 130, 132 business rule 252 define 130 domain 130, 132 property 130 standard 130, 131 type 130 v
class (continued) operation 67 package 14 parameter 88 preview from class 33 preview from interface 45 realization 114 comment association 98 attribute 49 class 18 dependency 108 domain 120 generalization 91 identifier 62 interface 36 Java code 152 OOM 11 operation 67 package 14 parameter 88 realization 114 compile reverse engineering Java 158 composition 260 association 98, 102 role 102 conceptual data type 203 constant object language 246 script 246 constraint business rule 252 constructor 260 add 73 Copy
data type (continued) script 248 select 123 serial 126, 217 short 203 time 127 translate 203, 217 txt 203 undefined 123 datatypes options 9 date data type 127 decimal data type 126, 217 Default constructor 74 default stereotype class 20 define association 97, 102 attribute 48 business rule 252 check parameter 130 class 17 classifier 27 dependency 108 domain 120 generalization 91 identifier 62 interface 36 OOM 4 operation 67 package 14 parameter 88 realization 114 reverse engineering 150 role 100 UML 3 valid
display (continued) realization 118 diverge from domain 9 documentation Rose import 146 domain 260 access list 121 attribute 49, 57 check 120 check parameter 130, 132 code 120 comment 120 create 121 create from Browser 121 data type 120, 123, 125 define 120 diverge from 9 enforce coherence 9 length 120, 122 model option 9 modify 129 name 120 OOM 120 precision 120, 122 property 120 validation rule 132 variable 132 duplicate attribute 59 operation 77, 84 E edit object language 231 editor language 239 object
generalization (continued) display 95 implementation 92 list 95 modify 94, 95 name 91 parent 91 property 91, 94 Rose import 146, 148 stereotype 91, 92, 243 symbol 95 tool 5 virtual 91 visibility 91, 92 generate BeanInfo 186 CDM 202, 204 class 18 definition file 184 interface 36 Java 182 Java Bean 186 new CDM 204, 207 new PDM 218, 221 PDM 216, 218 PowerBuilder 189 PowerBuilder application 191 PowerBuilder options 189 select object 180 sru 193 update CDM 205, 210 update PDM 219, 224 updated CDM 204 updated PD
initial value attribute 49 inner class 23, 260 attach 24 detach 26 interface 41 reverse engineering Java In\Out parameter direction 88 instantiate dependency 109 integer data type 126, 217 interface 260 add object 41 attribute 42 Browser 37 check 136 code 36 comment 36 create 37 define 36 diagram 38 display 46 generate 36 inner class 41 list 38, 40 modify 39, 40 name 36 operation 44 preview code 45 property 36, 39 realization 114 Rose import 147 stereotype 36 symbol 46 tool 5 visibility 36, 37 introduction
linked object language 231 list association 104 attribute 52, 56 class 22, 28 dependency 112 generalization 95 identifier 66 interface 38, 40 operation 69, 72 realization 118 load JDK 153 PowerBuilder 168 local object language 231 M manual correct 142 manual correction check 137, 141 mark classifiers reverse Java 152 reverse PowerBuilder 166 reverse XML 174 markers attribute 60 operation 86 merge model 144 OOM 144 merise notation 205 model check 138 create 6 import 145 JDK 153 merge 144 new 6 object select
new model 6 object language 235 OOM 6 new CDM generate 207 new PDM generate 221 notation Entity/Relationship 205 merise 205 number data type 126, 217 O object business rule 256 generate 180 language 230 script 246 xml mapping 248 object language 261 category 239, 241 constant 246 create 235 current 231, 235 customize 240 data type 248 define 230 edit 231 editor 239 event 249 extended attributes 249 field 239 general 241 linked 231 local 231 modify 240 naming 249 OOM 11 parameter 233 script 245, 246 type 23
open (continued) OOM 8 PowerBuilder 168 Rose model 145 operation 261 abstract 67 add 84 attribute 79 Browser 68 check 136 class 31, 77 code 67 comment 67 constructor 68, 73 create 68, 84 define 67 diagram 70 display 85 duplicate 77, 84 event 67 final 67 Getter 79 icon 86 implementation 83 interface 44 keywords 86 list 69, 72 markers 86 modify 71, 72 name 67 parent 67 parent class 78 property 67, 71 return type 67 Rose import 148 Setter 79 show 85 static 67 stereotype 67, 68, 243 symbol 85 visibility 67, 68,
parent dependency 108 generalization 91 operation 67 parameter 88 parent class operation 78 PDM data type 217 generate 216, 218 generate from association 216 generate from class 216 generate options 220 generate package 227 generation options 218 new 221 preserve modifications 225 select generation objects 220 update 224 persistence 261 class 18 persistent object 261 PK index names PDM generation option 220 PowerBuilder application 191 generate 189 library 168 load 168 model 168 objects 166 open 168 options
R realization 261 check 136 class 114 code 114 comment 114 create 115 define 114 display 118 interface 114 link 114 list 118 modify 116, 118 name 114 property 114, 116 stereotype 114 symbol 118 tool 5 recheck check option 141 refine dependency 109 return type 261 operation 67 reverse engineering .
severity error 137 show attribute preference 60 operation 85 signal class 20 signature 261 sorted association 101 source file reverse engineering Java 156 sru generate 193 PowerBuilder 193 standard check parameter 131 standard checks domain 120 static attribute 49 operation 67 stereotype 262 association 98 class 18, 19, 20, 242 dependency 109, 244 generalization 91, 92, 243 interface 36 operation 67, 68, 243 package 245 realization 114 sub-package hierarchy 14 include 138 Sybase SQL Anywhere data type 217 s
V Z validate OOM 136 validation rule 130 apply 132 attribute 132 business rule 132 check parameter 132 define 132 domain 132 generate 132 value object language 239 variable attribute 132 domain 132 view check 136 virtual generalization 91 visibility 262 association 98, 102 attribute 49, 50, 60 class 21 generalization 91, 92 interface 36, 37 keywords 60, 86 operation 67, 68, 86 zip reverse engineering Java 163 W warning OOM 137, 141, 142 without body code reverse Java 154 X XML generate 195, 196 object
278