Scenario I. FORWARD DATA MODELING: From class model through data model to DDL script
1. Create a Package
2. Add classes to Package (Logical View - New - Package) to form the class model
3. Mark each class as Persistent
4. Add new class diagram to package (Logical View - New - Class Diagram)
5. Drag or drop classes to class diagram to show them diagramatically
6. Add class relationships in diagram (for associations/aggregations don't forget supplier roles)
7. Add a new Schema (Logical View - Data Modeler - New - Schema)
8. Optionally create a new database (Componenent View - Data Modeler - New - Database). Select database target (defaulted to ANSI SQL92)
9. Optionally associate the Schema with the database. Database Target cannot be changed when associated.
10. Create data model: Package - Data Modeler - Transform to Data Model, tables appear in Schema
11. Create new data model diagram: Schema - New - Data Modeler - New Data Model Diagram
12. Drag or drop tables in data model diagram
13. Create DDL Script: Schema - Data Modeler - Forward Engineer ... the DDL script is created.
Scenario II. REVERSE DATA MODELING: From DDL script (database) through data model to class model
Note: You may need to edit the DDL Script to get rid of comment lines.
1. Open Rose with new model
2. Click on Main class diagram to display toolbar
3. Reverse engineer DDL Script: Tools - Data Modeler - Reverse Engineer ... - follow Wizard
4. New Schema, new component package, within it a a new database appear - rename if necessary.
5. Create new Data Model Diagram: Schema - Data Modeler - New - Data Model Diagram
6. Drag or drop tables in data model diagram
7. Transform to class model: Schema - Data Modeler - Transform to Object Model ... Rename package and remove prefix if necessary
8. Create new class diagram (Package - New - Class Diagram)
9. Drag or drop classes in class diagram.
Scenario III. FORWARD ENGINEERING: From class model to code
1. In Component View add new component package. Add new component: Component View - select Package - New - Component
2. Optionally add a new component diagram: Component View - Package - New - Component Diagram Drag or drop component and database in component diagram
3. Select component - Open Specifications ... - General Tab - Set Language (ANSI C++)
4. Realizes Tab - select individual classes - Right Click - Assign - OK when done
5. Select component - ANSI C++ - Open ANSI C++ Specification, set the following:
Style - set Model IDs: Code generation and reverse engineering
Comments : Always synchronize
Add copyrights and includes, e.g.: #include < string > #include < vector > #include < iostream > #include < conio >
6. Select individual classes - ANSI C++ - Class customization ... Standard Operations / Set-Get Operations select needed Note: you may need to individually change attribute data types, and set access to "private"
7. Select Component - Generate code ... OK.
Scenario IV. REVERSE ENGINEERING: From code to class model
1. In Component View add new component package. Add new component: Component View - select Package - New - Component
2. Optionally add a new component diagram: Component View - Package - New - Component Diagram drag or drop component in component diagram
3. Select component - Open Specifications ... - General Tab - Set Language (ANSI C++)
4. Select component - ANSI C++ - Open ANSI C++ Specification - General Tab - select root directory Press Add files - click Ellipe (...) - select all files - Open
5. Select component - ANSI C++ - Reverse engineer ... OK
6. Logical View - new package C++ Reverse Engineered appears - open to view classes
7. Add new class diagram: Select package - New - Class Diagram
8. Drag or drop all classes to class diagram.