Home

code engineering sets

image

Contents

1. CREATE TABLE PKColumnExample col2 INTEGER col3 INTEGER 2005 No Magic Inc 2 43 MagicDraw Code Engineering Database Engineering CONSTRAINT pkCombination PRIMARY KEY col2 col3 Representation using UML concepts lt lt gt gt PKColumnExample col2 integer col3 integer lt lt PK gt gt pkCombination columns col2 col3 Figure 27 Primary key constraint examples FOREIGN KEY A Foreign Key constraint represents a relationship to another table Foreign Key constraint is represented as a dependency with the lt lt FK gt gt stereotype to the target table CONSTRAINT lt tkname gt FOREIGN KEY lt linkCols gt REFERENCES lt targetlable gt lt targetCols gt UML concept FK element Example Dependency name lt fkname gt tk Dependency source lt linkTable gt FKLink class FK columns tagged lt linkCols gt 1 12 value on the dependency Dependency target class lt targetlable gt FKTarget PK columns tagged lt targetCols gt 11 12 value on the dependency Example of a DDL script CREATE TABLE FKTargetl t INTEGER PRIMARY KEY CREATE TABLE FKLinkl r INTEGER CONSTRAINT fk1 REFERENCES FKTargetl t CREATE TABLE FKTarget tl INTEGER t2 INTEGER PRIMARY KEY tl t2 CREATE TABLE FKLink rl INTEGER
2. CODE AND DATABASE ENGINEERING version 10 0 user s guide No Magic Inc October 2005 _ TABLE OF CONTENTS Table of Contents 0 1 INTRODUCTION 1 5 Overview 1 5 Code Engineering Sets 1 6 Generate Code 1 9 Code Generation for Set 1 10 Code Generation for Model Element 1 11 Reverse 1 11 Java Reverse to Sequence Diagram 1 13 Sequence Diagram from Java Source Wizard 1 14 Global options for Code Engineering 1 18 Code engineering options for all sets in your project 1 18 Java Documentation Properties dialog box 1 23 Round Trip 1 24 Type Mapping Table 1 25 Files of Properties 1 25 2 DATABASE ENGINEERING 2 27 Retrieve DB Info dialog box 2 27 Forward engineering to DDL script 2 30 Packages 2 30 Classes 2 31 Attributes 2 33 Operations 2 33 Relationship cardinalities 2 35 Inheritance 2 37 Not supported UML constructs 2 38 Reverse engineering for DDL script 2 39 Database 2 39 Schema 2 40 Table 2 40 Column 2 41 Constraint 2 41 Unnamed constraint representation as a stereotype of an attribute 2 46 Index 2 46 Trigger 2 47 View 2 48 DDL dialects 2 49 2005 No Magic Inc MagicDraw Code Engineering User s Guide Contents Standard SQL2 2 50 Cloudscape 2 50 Oracle Oracle8 2 50 Stereotypes for MagicDraw constructs 2 5 Properties of code engineering set for DDL 2 52 Properties for DDL script reverse engineering and generation 2 52 Supported SQL statements 2 55 T
3. In the Select Classes for Diagram step all referenced classes are displayed Select the desired classes and instances of those classes will be added into diagram with call messages to them e Select the Analyze and split long expressions in diagram check box if expression contains calls and cannot be displayed as call message Then every call will be shown as separate call message with temporary variable initialization e Select the Create return message check box if you want to display return message for every call message e Select the Wrap message text check box and specify the maximum message text length in pixels to wrap longer message 1 16 2005 No Magic Inc MagicDraw Code Engineering Introduction STEP 4 SPECIFY SYMBOLS PROPERTIES ence Diagram from Java Source Wizard RGB 200 250 200 FR true Wine 66 66 66 W RGS 0 0 0 SansSerif 12 fake F7 fake F true WRG 0 0 0 SansSerif 12 Figure 8 Sequence Diagram trom Sequence Wizard Specity Symbols Properties In this step define symbols properties for lifelines and messages 2005 No Magic Inc 1 17 MagicDraw Code Engineering Introduction GLOBAL OPTIONS FOR CODE ENGINEERING Code engineering options for all sets in your project From the Options menu choose Project The Project Options dialog box appears gProject Options 2 E v General project options Diagram Info 1 44 Symbols
4. button and enter header text in the Header screen You may also define DATE AUTHOR and TIME in the header CORBA IDL 3 0 Generate Includes the documentation of an element in the Language documentation comment Options Generate Opens a bracket in the new line generating opening bracket in new line Generate spaces Spaces inside an assignment and other operators are generated Generate empty Comment brackets are placed in your code documentation unless class in the model has no documentation Generate Generation of import statements for classes imports that are referenced in the generated class Generate Generates pre processors directives preprocessor directives Documentation Three styles are available for documentation Style Header Add the specific header to all your code files Click the button and enter header text in the Header screen You may also define DATE AUTHOR and TIME in the header Set Include Path Specify the path for the includes Click the button to open the Select Folder dialog box DDLLanguage Generate Opens a bracket in the new line generating Options opening bracket in new line Generate spaces Spaces inside an assignment and other operators are generated Generate Comment brackets are placed in your code 2005 No Magic Inc documentation unless class in the model has no documentation Header Add the specific header to all your code files Click the button
5. EJBRefName Dependency The name of the EJB Enterprise EJBReference or Bean referenced EJBLocalReference EJBReflype Dependency The type of referenced EJB EJBReference or EJBLocalReference Enterprise Bean one of the strings Entity or Session EJBRelationshipRoleDescription AssociationEnd EJBRelationshipRole A String specitying a description an EJB relationship role EJBRelationshipRoleName AssociationEnd EJBRelationshipRole The name of an EJB relationship role EJBResources Class EJBEnterpriseBean A string of XML tags designating the resource factories used by the EJB Enterprise Bean EJBResourcesEnv Class EJBEnterpriseBean A string of XML tags designating the environment entries used by the EJB Enterprise Bean EJBResultTypeMapping Operation EJBFindem or EJBSelect The allowed values are the literal strings Local or Remote If the optional corresponding lt result type mapping gt tag is not to be used in the deployment descriptor then the value is empty EJBSessionType EJBSessionBean Stateful or Stateless Indicates whether or not the EJB Session Bean maintains state EJBTranslype Class EJBSessionBean or Class EJBMessageDrivenBean An enumeration with values Bean or Container Indicates whether the transactions of the EJB Session Bean or EJB Message Driven Bean are managed by the bean or by its c
6. Example lt xs schema xmlns xs http www w3 org 2001 XMLSchema targetNamespace http www example com example gt lt xs schema gt The XML representation of the skeleton of a schema 2003 No Magic Inc 5 133 SE MagicDraw Code and Database Engineering XML Schema schema UML Model example nm lt lt xoDnamespace gt gt exmlns exmlns 7 lt lt xsDnamespace gt gt http www w3 0rg 2001 XMLS chema http nomagic com xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema xmlns http nomagic com attributeFormDefault qualified blockDefault extension elementFormDefault unqualified finalDefault extension targetNamespace http nomagic com version 1 2 xml lang EN notation Maps to UML Attribute with stereotype XSDnotation This attribute must be added into UML class with stereotype XSDschema e name maps to UML Attribute name e annotation maps to UML Attribute documentation 5 134 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema XML Representation Summary notation Element Information Item notation id ID name NCName public anyURI System anyURI any attributes with non schema namespace Content annotation notation Example xs notation name jpeg public image jpeg system viewer exe The XML representation of a notation
7. 2005 No Magic Inc 3 60 MagicDraw Code Engineering CORBA DL Mapping to UML lt lt binding gt gt lt lt binding gt gt MagicDraw presents a CORBA IDL diagram which simplifies the creation of standard CORB IDL elements The loffowing elements are available in the CORBA IDL diagram Button Shortcut key Model Element M CORBA IDL Module CORBA IDL Interface V CORBA IDL Value oe SHIFT P Class by Pattern 1 BP 3 61 2005 No Magic Inc Button Shortcut key MagicDraw Code Engineering CORBA IDL Mapping to UML Model Element E G Generalization EM Truncatable Generalization a Value Support Generalization she 152 A CORBA IDL Association Pa S Association F A Aggregation F Composition P Package L3 B C Class Interface D Dependenc 2005 No Magic Inc km MagicDraw Code Engineering CORBA IDL Mapping to UML Button Shortcut key Model Element B Binding Dependency SHIFT C Containment W Separator 3 63 2005 No Magic Inc EJB 2 0 UML 4 In MagicDraw EJB UML mapping is based on UML Profiles for EJB The UML Profiles for EJB is a mapping from Unified Modeling Language UML to the Enterprise JavaBeans EJB architecture The mapping specities the standard representation for elements of the EJB architecture in UML models UML Profiles for EJB consist of Java EJB
8. Generate index for True default false unique If the DBMS you use requires explicit indexes for primary key or unique columns may enable explicit index creation using this flag See also GeneratelndexForPK Generate not Null True default false constraint If true generates NOT NULL constraint for column attribute with 1 multiplicity If you set GenerateNullConstraint you may wish to do not generate NOT NULL constrain See also GenerateNullConstraint AttributeDefaultMultiplicity Generate qualified True default false names If value of Generate Qualified Names check box is true package name is generated before the table or view name For example database gt package MQOnline includes lt lt table gt gt class libraries Then check box Generate Qualified Names is selected as true in generated source would be written DROP TABLE MQOnline libraries Then check box Generate Qualified Names is selected as false in generated source would be written DROP TABLE libraries Generate quoted True false default identifiers Specifies whether DDL code generator should generate quoted names of identifiers 2005 No Magic Inc MagicDraw Code Engineering Database Engineering Object creation mode MSUPPORTED SQL STATEMENTS This section lists SQL statements that MagicDraw UML supports that are parsed and mapped into UML constructs The Object Creation Mode combo bo
9. lt xs schema xmlns xs http www w3 org 2001 XMLSchema gt lt xs simpleType name my_number_list2 gt lt xs list gt lt xs simpleType gt xs restriction base xs string xs simpleType lt xs list gt lt xs simpleType gt lt xs simpleType name my_number_list gt xs annotation gt lt xs documentation gt my list documentation lt xs documentation gt lt xs annotation gt xs list itemType xs boolean gt lt xs simpleType gt lt xs schema gt 5 96 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema union example lt lt kKSDrestriction gt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt xs simpleType name my simple union gt xs union id unionID memberTypes xs string xs number xs simpleType xs simpleType name my simple union2 gt xs annotation xs documentation very important documentation lt xs documentation gt lt xs annotation gt xs union id unionID memberTypes xs number gt lt xs simpleType gt xs restriction base xs number gt lt xs simpleType gt lt xs union gt lt xs simpleType gt lt xs schema gt minExclusive Maps to UML Attribute with stereotype XSDminExclusive Name and type of such attribute does not make sence e value to Attribute initial value 2005 No Ma
10. Use spaces in place of tabs Number of spaces OK Help Figure 5 Code Generation Options dialog box The Code Generation Options dialog box allows you to specify the way your code will be generated Once generating options are specified for the set code can be generated Box name Function Output Directory Type the directory where the generated files will be saved The Set Output Directory dialog box appears Select the directory for the generated files Set as Working The output directory is set as a working directory and files are Directory saved to the working directory Reverse before Changes your model according to changes in the existing code generation WARNING Exercise caution when selecting the Reverse before generation check box If the model differs from the code all differences in the model will be discarded In such cases you will lose some your work 1 10 2005 No Magic Inc MagicDraw Code Engineering Introduction Box name Function If element To influence the structure of generated code click one of the deleted from following option buttons model e Delete code The representation of deleted entities will be deleted from the code file e Comment code Deleted entities will be commented in the code file Use spaces in When selected spaces instead of tabs will be written to the code place of tabs file Number of Specity the number of spaces to be
11. e Supported attribute multiplicity can be not specified 0 1 and 1 All other attribute multiplicities are not supported B REVERSE ENGINEERING FOR DDL SCRIPT Information about a specific database structure acquired reversing DDL script or from JDBC is mapped to the MagicDraw UML constructs as described bellow Database A Database is a system for a data storage and controlled access to the stored data It is the biggest construct that a data model supports A package which is used with the lt lt database gt gt stereotype represents a database in the MagicDraw UML model The database that is modeled as a package must have a name Example of a DDL script CREATE DATABASE BankDB Representation using UML concepts lt lt database gt BankDB Figure 22 Database example 2005 No Magic Inc 2 39 MagicDraw Code Engineering Database Engineering See also CurrentDatabaseName property Schema A package with the lt lt schema gt gt stereotype within the package with the lt lt database gt gt stereotype represents a database schema Example of a DDL script CREATE SCHEMA Public Example rewritten using a qualified schema name BankDB Public CREATE SCHEMA BankDB Public Representation using UML concepts lt lt schema gt gt Public BankDB Figure 22 Schema example NOTE There can be more than one schema associated to a database
12. restriction To specify restriction generalization must be used between this class and super class This generalization has or do not have XSDrestriction stereotype Restriction id and annotation maps to Generalization properties In order to have inner simpleType element parent of this Generalization must be inner Class of outer UML Class list UML Class must have additional stereotype XSDlist Binding between this class and XSD list must be provided itemsType maps to UML TemplateArgument from Binding union UML Class must have additional stereotype XSDunion memberTypes and inner simpleTypes maps to several UML Generalizations between this simple type and members types In order to have inner simpleType element parent of this Generalization must be inner Class of outer UML Class 5 92 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema simpleType UML Model example restriction example lt lt XSDrestriction gt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt lt xs simpleType name farenheitWaterTemp gt lt xs annotation gt lt xs documentation gt documentation of simple type lt xs documentation gt xs annotation xs restriction base xs number xs annotation xs documentation documentation of restriction lt xs documentation gt lt xs annotation gt xs patt
13. 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema length UML Model example For an example Section simpleType UML Model example on page 5 107 minLength Maps to UML Attribute with stereotype XSDminLength Name and type of such attribute does not make sence e value to Attribute initial value XML Representation Summary minLength Element Information Item lt minLength fixed boolean false id ID value nonNegativeInteger fany attributes with non schema namespace Content annotation lt minLength gt Example The following is the definition of a user derived datatype which requires strings to have at least one character i e the empty string is not in the value space of this datatype lt simpleType name non empty string restriction base string minLength value 1 lt restriction gt lt simpleType gt minLength UML Model example For an example see Section simpleType UML Model example maxLength Maps to UML Attribute with stereotype XSDmaxLength Name and type of such attribute does not make sence e value to Attribute initial value 2005 No Magic Inc 5 103 SE MagicDraw Code and Database Engineering XML Schema XML Representation Summary maxLength Element Information Item lt maxLength fixed boolean false id ID value nonNegativeInteger attributes with non schema namespace Content
14. lt lt kSDcom plexType gt lt lt XSD sequence gt gt XSDsequence XSD sequence rootType personType stateType XSD elem ent stateR ef re fe state amp XSD elem ent car carType s XSDelem ent code twoLetterC ode XSDelem ent 7 personRef trefzpersonj XSDelem ent vehicleRef trefz vechicle y XSDcomplexTypes lt lt XSDcomplexType XSDall lt lt XSD sequences vec hicleType carType eT lt lt XSDattribute gt gt plateN umber integer regP late integer lt lt XSDattribute gt gt state twoLetterC ode twoLetterCode XSDattribute regState twoLetterC ode lt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt lt xs element name vechicle gt lt xs complexType gt lt xs all gt xs attribute name plateNumber type xs integer gt xs attribute name state type nm twoLetterCode gt lt xs complexType gt lt xs element gt lt xs element name state gt lt xs complexType gt lt xs sequence gt lt xs element name code type nm twoLetterCode gt 5 122 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema lt xs element ref nm vechicle maxOccurs unbounded gt lt xs element ref nm person maxOccurs unbounded
15. lt xs field xpath state gt lt xs keyref gt lt xs key name regKey gt lt vehicles are keyed by a pair of state and xs selector xpath vehicle xs field xpath state gt xs field xpath plateNumber gt lt xs key gt lt xs keyref name carRef refer regKey people s cars are a reference gt xs selector xpath car xs field xpath regState gt xs field xpath regPlate gt lt xs keyref gt lt xs element gt 2003 No Magic Inc 5 125 EE MagicDraw Code and Database Engineering XML Schema lt xs element name person gt lt xs complexType gt lt 5 Sequence gt lt xs element name car gt lt xs complexType gt xs attribute name regState type twoLetterCode xs attribute name regPlate type xs integer lt xs complexType gt lt xs element gt lt xs sequence gt lt xs complexType gt lt xs element gt A state element is defined which contains a code child and some vehicle and person children A vehicle in turn has a plateNumber attribute which is an integer anda state attribute State s codes are a key for them within the document Vehicle s plateNumbers are a key for them within states and state and plateNumber is asserted to be a key for vehicle within the document as a whole Furthermore a person element has an empty car child with regState and regPlate attributes which are t
16. xs string gt lt xs extension gt lt xs simpleContent gt lt xs complexType gt lt xs complexType name my_Type abstract true block extension final extension id myTypeID mixed true gt lt xs annotation gt lt xs documentation gt my_type documentation lt xs documentation gt lt xs annotation gt xs attribute name name type xs string gt xs attributeGroup ref nm attr group gt xs anyAttribute gt lt xs complexType gt xs attributeGroup name attr group gt lt xs schema gt attributeGroup attributeGroup maps to simple UML Class with stereotype XSDattributeGroup e name to UML Class name e annotation to UML Class documentation e attribute to inner UML Attribute or AssociationEnd with XSDattribute stereotype 2005 No Magic Inc EE MagicDraw Code and Database Engineering XML Schema e attributeGroup inner attributeGroup always must be just reference Such reference maps to Attribute or AssociationEnd with type of referenced attributeGroup The opposite Association End kind must be aggregated and it must be navigable e anyAttribute to inner UML Attribute with stereotype XSDanyAttribute If reference is generated name is not generated XML Representation Summary attributeGroup Element Information ltem attributeGroup id ID name NCName ref QName any attributes with non schema namespace gt Content anno
17. Database Engineering View element UML concept Script example Referenced table alias Dependency name P Referenced column list columns tagged value on ld firstName lastName the dependency DDL script for view example CREATE TABLE Person id INTEGER NOT NULL socialId NUMBER 10 NOT NULL lastName VARCHAR 20 NOT NULL firstName VARCHAR 10 NOT NULL sex CHAR 1 REATE TABLE Account accountNo INTEGER NOT NULL balance FLOAT 5 DEFAULT 0 0 NOT NULL personalld INTEGER NOT NULL CREATE VIEW ImportantClient AS SELECT P Account balance as total FROM Person as P id firstName lastName Account WHERE balance gt 1000000 00 AND personId P id Representation using UML concepts references references Figure 34 View example MDDL DIALECTS This section reviews DDL implementations from different vendors Specitic implementation usually states compliance to some level of SQL standard and provides some extensions 2005 No Magic Inc MagicDraw Code Engineering Database Engineering Standard SQL2 For SQL2 statements supported by MagicDraw UML see Section Supported SQL statements Supported SQL statements on page 55 MagicDraw UML schema package is located within a database package Database definition statement
18. EJBMethod to specify a complete deployment descriptor method tag for a method or set of methods using Style 1 2 or 3 syntax as defined by the EJB 2 0 Specification EJBUnchecked Actor A Boolean that when true indicates EJBMethodPermission that permission to invoke the specified methods should not be checked before invocation Default is false EJBUseCallerldentity Component A Boolean indicating whether or not to EJBEnterpriseBean use the caller s identity when invoking the bean methods 2005 No Magic Inc 4 75 7E MagicDraw Code Engineering EJB 2 0 UML USING MAGICDRAW EJB 2 0 Reverse engineering 1 Create EJB 2 0 code engineering set NOTE If the project does not contain profiles required for EJB code engineering you will be asked whether you would like to import the EJB 2 0 template It is recommended to select Yes 2 Add java files and EJB deployment descriptor file that are part of concrete EJB EJB deployment descriptor file ejb jar xml must be in META INF directory 3 Reverse those files Atter the reverse you will get the following result Model elements representing the code will be created Stereotypes and tagged values representing EJB tags will be applied to appropriate model elements Code generation We will create a simple example and we will go step by step from the beginning to the generated code As an example we will take a reservation system for a theater tick
19. r2 INTEGER CONSTRAINT fk2 FOREIGN KEY r1 r2 REFERENCES FKTarget t1 t2 E 2 44 2005 No Magic Inc MagicDraw Code Engineering W Database Engineering Representation using UML concepts lt lt FK gt gt columns r PK columns t lt lt FKe gt Figure 28 Foreign key constraint example CHECK The Check constraint checks the value of data according to a given expression The Check constraint is represented as an operation with the lt lt check gt gt stereotype Operation s name is equal to the name of the check constraint or if the constraint name is not specified the name unnamed is generated There are a column check constraint and table check constraint For column check constraint operation s parameter list contains one parameter with the name that equals to the name of the attribute for witch check constraint is assigned Example Table check constraint operation has no parameters CREATE TABLE CheckExample balance INTEGER CONSTRAINT checkBalance CHECK balance gt 0 start INTEGER period start balance income INTEGER CHECK income gt 0 unnamed check constraint outcome INTEGER CONSTRAINT checkInOut CHECK start income outcome balance Representation using UML concepts Figure 29 Check con
20. EJBRealizeRemote Abstraction Indicates that the supplier of the Abstraction represents an EJB Remote Interface for the EJB Enterprise Bean Class represented by the client 2005 No Magic Inc MagicDraw Code Engineering EJB 2 0 UML EJBReference Dependency A stereotyped Dependency representing an EJB Remote Reference where the client is an EJB JAR and the supplier is an EJB Enterprise Bean EJBRelationship Association Indicates that the EJB Entity Bean at the supplier Association End represents a container managed relationship field for the client EJB Entity Bean EJB 2 0 EJBRelationshipRole AssociationEnd Indicates the Association End of an EJBRelationship EJBRemoteMethod Operation Indicates that the Operation represents a method that is exposed on e ther the remote or remote home interface The former case is assumed if the EJB Business stereotype is also present EJBRoleNameRef Actor The name of security role reference used programmatically in a bean s source code and mapped to an EJB Role Name in the Deployment Model EJBRoleLink Dependency Indicates a Dependency between a client EJB Role Name Reference Design Model and a supplier EJB Role Name Deployment Model EJBSessionBean Class Indicates that the Class represents an EJB Session Bean Specializes EJBEnterpriseBean EJBSelect Operation An Operation that is a se
21. MN ree Figure 10 Set classpath dialog box Click the Get from System button to get CLASSPATH variable defined by operating system or click the Add button and select the classpath directory in the Add Classpath dialog box Java Source Available choises 1 4 or 5 0 Header Add the specific header to all your code files Click the button and enter header text in the Header screen You may also define DATE AUTHOR and TIME in the header Generate Opens a bracket in the newly generated line opening bracket in new line Generate spaces Spaces inside an assignment and other operators are generated Generate empty documentation Comment brackets are placed in your code unless class in the model has no documentation Generate methods body into class Select check box to generate methods body into class Documentation Style Two styles are available for documentation Use include path Select check box The button is activated Click the button and then specify the path for the includes in the Set Include Path dialog box 2005 No Magic Inc MagicDraw Code Engineering Introduction Tab name Element name Function Use explicit Select check box The button is activated macros click it and in the C Macros dialog box use a set of predefined macros Header Add the specific header to all your code files Click the
22. gt 2003 No Magic Inc 5 129 SE MagicDraw Code and Database Engineering XML Schema lt xs documentation gt ref documentation lt xs documentation gt lt xs annotation gt lt xs group gt lt xs group ref nm myGroup2 minOccurs 0 maxOccurs unbounded gt xs annotation gt lt xs documentation gt another ref documentation lt xs documentation gt lt xs annotation gt lt xs group gt lt xs element name name type xs string gt lt xs element name name2 type xs string gt lt xs element name namel type xs string gt xs any anyID namespace value minOccurs 0 maxOccurs 1 gt lt xs sequence gt lt xs group gt xs group name myGroup3 gt lt xs choice gt lt xs element name lt xs choice gt lt xs group gt xs group name myGroup2 gt lt xs all gt lt xs element name lt xs all gt lt xs group gt lt xs schema gt address type xs string gt surname type xs string gt group Maps to UML Class with stereotype XSDgroup This class also may have stereotype XSDall XSDsequence or XSDchoice If group has ref attribute such group definition maps to UML Attribute or UML Association End UML Attribute must have XSDgroupRef stereotype This stereotype may be omitted for AssociationEnd XML Representation Summary group Element Information Item lt group name NCName gt Content annotation
23. gt lt xs sequence gt lt xs complexType gt xs unique name reg gt xs annotation gt lt xs documentation gt unique documentation lt xs documentation gt xs annotation xs selector xpath vehicle xs field xpath plateNumber gt lt xs unique gt lt xs element gt lt xs element name person gt lt xs complexType gt lt xs sequence gt lt xs element name car gt lt xs complexType gt lt xs sequence gt lt xs attribute name regPlate type xs integer gt lt xs attribute name regState type nm twoLetterCode gt lt xs complexType gt lt xs element gt xs sequence xs complexType lt xs element gt lt xs element name root gt lt xs complexType gt lt xs sequence gt lt xs element ref nm state maxOccurs unbounded gt xs sequence xs complexType lt xs key name state gt xs selector xpath state xs field xpath code xs key xs keyref name vehicleState refer nm state xs selector xpath vehicle xs field xpath state gt lt xs keyref gt xs key name regKey gt lt xs annotation gt lt xs documentation gt key documentation lt xs documentation gt lt xs annotation gt lt xs selector xpath vehicle gt lt xs field xpath state gt lt xs field xpath plateNumber gt lt xs key gt lt xs keyref name carRef refe
24. xs annotation gt xs attribute xs attribute name address fixed fixed value form qualified use optional gt xs annotation xs documentation surname attribute documentation lt xs documentation gt lt xs annotation gt lt xs simpleType gt lt xs restriction base xs string gt lt xs simpleType gt lt xs attribute gt lt xs attribute name Surname type xs string gt xs attributeGroup name attr group gt lt xs attribute ref nm name gt xs annotation gt lt xs documentation gt reference documentation lt xs documentation gt lt xs annotation gt lt xs attribute gt xs attribute ref nm surname gt lt xs attributeGroup gt lt xs schema gt element Maps to UML Attribute or UML AssociationEnd with stereotype XSDelement e annotation to UML Attribute or UML AssociationEnd documentation e default to initial UML Attribute or UML AssociationEnd value e maxOccurs to multiplicity upper range Value unbounded maps to asterisk in UML e minOccurs to multiplicity lower range e name to UML Attribute or UML AssociationEnd e type or content simpleType complexType to UML Attribute or UML AssociationEnd type Other properties maps to corresponding tagged values 5 82 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema XML Representation Summary element Element Information
25. SELECT OPERATION By Sequence Diagram from Java Source Wizard n Select operation C 1 Specify name and package EI fz Data 2 Select Operation 8 25 File View lt lt fileView gt gt C 3 Select classes for diagram AO 8 29 javax C 4 Specify symbols properties A org ERE apache Select operation which implementation AO xalan you want to visualize IF source file cannot B client aS XSLTProcessorApplet H E TrustedAgent destroy void be found automatically you must select Java source file manually escapeString s javaclang String t0 freeCachel void 1 v get ppletlnfo ja a lang String lt v b Select Java source file Ic temporg apache xalan client lt SLT Processor4pplet java em Back Next gt Finish Help In this step select an operation for which you want to create a sequence diagram If the Java source file is not shown you must select it manually IMPORTANT To specify implementation files we suggest before reversing to specify Java Default working directory in the Project Options dialog box specify root folder where all source files can be found 2005 No Magic Inc 1 15 MagicDraw Code Engineering Introduction STEP 3 SELECT CLASSES FOR DIAGRAM A Sequence Diagram from Java Source Wizard B Data b 7 java E IV lang java F Thread
26. See also CurrentSchemaName property Table A table is the basic modeling structure of a relational database It represents a set of records of the same structure also called rows Each of these records contains data Information about the structure of a table is stored in the database itself A class with the lt lt table gt gt stereotype represents a relational table in a schema of a database Example of a DDL script for table CREATE TABLE Account accountNo INTEGER NOT NULL personlId INTEGER NOT NULL balance FLOAT 5 DEFAULT 0 0 NOT NULL This example may be rewritten instead of Account using qualified table name BankDB Public Account Representation using UML concepts 2 40 2005 No Magic Inc MagicDraw Code Engineering Database Engineering Figure 23 Table example Hosting the table in the schema package creates an association of a table to a schema Column A table contains columns A column must have a defined name and data type a default value and several constraints are optional Example balance FLOAT 5 DEFAULT 0 0 A column is represented as an attribute A name data type and initial value of an attribute are set according to the name data type and default value of the column The stereotype of an attribute is set according to column constraints Stereotype can be not specified lt lt unique gt gt or lt lt PK gt gt
27. annotation lt maxLength gt Example The following is the definition of a user derived datatype which might be used to accept form input with an upper limit to the number of characters that are acceptable lt simpleType name form input gt lt restriction base string gt lt maxLength value 50 gt lt restriction gt lt simpleType gt maxLength UML Model example For an example see Section simpleType UML Model example whiteSpace Maps to UML Attribute with stereotype XSDwhiteSpace Name and type of such attribute does not make sence e value to Attribute initial value XML Representation Summary whiteSpace Element Information ltem lt whiteSpace fixed boolean false id ID value collapse preserve replace fany attributes with non schema namespace Content annotation lt whiteSpace gt Example The following example is the datatype definition for the token built in derived datatype simpleType name token gt restriction base normalizedString gt whiteSpace value collapse gt lt restriction gt lt simpleType gt 5 104 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema whiteSpace UML Model example For an example see Section simpleType UML Model example on page 5 107 pattern Maps to UML Attribute with stereotype XSDpattern Name and type of such attribute does not make sence e value to Attribu
28. any attributes with non schema namespace gt Content annotation lt any gt lt anyAttribute id ID namespace any other List of anyURI targetNamespace local any processContents lax skip strict strict any attributes with non schema namespace gt Content annotation lt anyAttribute gt 2003 No Magic Inc 5 131 EE MagicDraw Code and Database Engineering XML Schema Example xs any processContents skip xs any namespace other processContents lax gt xs any namespace http www w3 org 1999 XSL Transform gt xs any namespace targetNamespace gt xs anyAttribute namespace http www w3 org XML 1998 namespace XML representations of the four basic types of wildcard plus one attribute wildcard any and anyAttribute UML Model example lt xml version 1 0 encoding Cp1252 xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt xs group name my type gt lt xs choice gt xs any id anyID namespace http bla processContents strict minOccurs 0 maxOccurs 1 gt xs annotation gt lt xs documentation gt any documentation lt xs documentation gt lt xs annotation gt xs any xs choice xs group xs attributeGroup name attr group xs anyAttribute id anyID n
29. declaration notation UML Model example xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com xs notation name jpeg public image jpeg system viewer exe gt lt xs schema gt redefine Maps to UML Class with stereotype XSDredefine This class has inner UML Classes as redefined elements Every redefined element must be derived from other UML class with stereotype XSDsimpleType XSDcomplexType XSDgroup XSDattributeGroup The name of this class shall match schemaLocation value If two redefine with the same schema location appears they shall be merged to the one and the same class with a name schemaLocation Redefine Class must be inner class of XSDschema Class e annotation to XSDredefine UML Class documentation e schemaLocation to XSDredefine UML Class name 2003 No Magic Inc 5 135 SE MagicDraw Code and Database Engineering XML Schema XML Representation Summary redefine Element Information Item lt redefine id ID schemaLocation anyURI any attributes with non schema namespace Content annotation simpleType complexType group attributeGroup redefine Example 59 lt xs complexType name personName gt xs sequence lt xs element name title minOccurs 0 gt lt xs element name forename minOccurs 0 maxOccurs unbounded gt xs sequenc
30. lt KSDany gt gt any D 1 namespacezvalue id anylD sequenceNumber 7 lt lt KSD groupRef gt gt group3Ref http vinomagic com myGroup3 D 1 sequenceNumberz2 lt lt KSDelement gt gt name httpviwww w3 org 2001 KMLSchema string sequenceOrder sequenceNumber 4 lt lt xSDelement gt gt name1 http wwwew3 org 2001 KMLSchema string se quenceN umber 6 lt lt KSDelement gt gt name 2 http veww w3 org 2001 XMLS chema string se quenceNumber 5 sequenceNumber 3 xSDgroups lt lt SDall gt myGroup2 lt lt XS Delement gt gt surname http Pwww w3 org 2001 XMLSchema string lt lt KSDchoice compositor se quenceNumber 1 lt lt SDelement gt gt number http Jiveww w3 org 2001 XML8 chema string lt lt S Dgroup gt lt XSDchoice gt gt myGroup3 xSDelement address http www ow3 org 2001 KMLSchema string lt xml version 1 0 encoding Cp1252 lt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt xs group name myGroup gt xs annotation gt lt xs documentation gt my group documentation lt xs documentation gt lt xs annotation gt lt xs sequence minOccurs 2 maxOccurs 1 gt lt xs choice gt lt xs element name number type xs string gt lt xs choice gt lt xs group ref nm myGroup3 minOccurs 0 maxOccurs 1 xs annotation
31. operation in the Reservation interface press Ctrl button and drag the operation to bean s class Create an interface ReservationHome that extends javax ejb EJBHome interface and has operation public Reservation create throws CreateException RemoteException Create abstraction links from the bean s class to the Reservation and Reservation Home interfaces On the abstraction between ReservationBean and Reservation add stereotype EJBRealizeHome On the abstraction between ReservationBean and ReservationHome interface add stereotype EJBRealizeRemote Create a new EJB 2 0 code engineering set In the containment tree select ReservationBean Reservation and ReservationHome and drag them to the set In the ComponentView select ReservationBean java component open specification for it and add stereotype EJBSessionBeanDeployment In the Component View package create new component ejb jar jar Open specitication and add stereotype EJB JAR to it Create a new Implementation Diagram Drag ReservationBean java and ejb jar jar components to the diagram Create dependency link from the ReservationBean java component to ejb jar jar component and add stereotype implement to the dependency Drag ejb jar jar component from the in the Containment Tree from Component View to the EJB 2 0 code engineering set Generate the code 2005 No Magic Inc 4 77 XML SCHEMA 5 Reference http www w3 org TR xmlschema 2 XML SCHEMA MAPPIN
32. to UML Permission with stereotype XSDimport Permission client must be schema class stereotypes lt lt XSDschema gt gt Component supplier namespace Package XSDnamespace e namespace maps to supplier name 2003 No Magic Inc 5 137 SE MagicDraw Code and Database Engineering XML Schema e annotation maps to UML Attribute documentation e schemaLocation maps to TaggedValue XML Representation Summary import Element Information ltem import id ID namespace anyURI schemaLocation anyURI any attributes with non schema namespace Content annotation lt import gt Example The same namespace may be used both for real work and in the course of defining schema components in terms of foreign components lt schema xmlns http www w3 org 2001 XMLSchema xmlns html http www w3 0rg 1999 xhtml targetNamespace uri mywork xmlns my uri mywork gt import namespace http www w3 org 1999 xhtml annotation documentation lt html p gt Some documentation for my schema lt html p gt documentation lt annotation gt lt complexType name myType gt lt sequence gt lt element ref html p minOccurs 0 gt lt sequence gt lt complexType gt lt element name myElt type my myType gt lt schema gt The treatment of references as QNames implies that since with the exception of the schema for schemas the target namespace and the XML Schema namespace differ wit
33. written spaces OK The Messages Window appears displaying how code files are being generated The Messages Window informs you of problems and errors mainly file access and syntax errors found in the code generation process and generation summary You are also prompted to confirm that you wish to overwrite the file if the output directory already contains one with the same name Cancel Closes the dialog box without saving changes Help Displays MagicDraw Help Code Generation for Model Element All the classes contained in the component will be written to one file However code for the class can be generated in a different way Select the class you wish to generate in the browser Data package and click Generate in the class shortcut menu For packages and components you may also select Generate but you will not be able to specify the generation options All the options related to that task will be set according to the default values If you have chosen framework generation for a single class or for packages the Code Generation Options dialog box does not appear The code is generated according to the default values If no errors occurred you may view the results with your favorite file viewer or programming environment Look for the files in the directory that you specitied as your Working directory in the Round trip set dialog box or in the Project Options dialog box Additional sub directories could be created MREVERSE A rever
34. 05 No Magic Inc MagicDraw Code Engineering Database Engineering MSTEREOTYPES FOR MAGICDRAW CONSTRUCTS The following table lists stereotypes that are used with MagicDraw UML constructs to represent a database structure Model Item Package Class Attribute Operation Dependency 2005 No Magic Inc Stereotype lt lt database gt gt lt lt schema gt gt lt lt table gt gt lt lt view gt gt lt lt PK gt gt lt lt unique gt gt lt lt PK gt gt lt lt unique gt gt lt lt check gt gt lt lt gt gt lt lt trigger gt gt lt FK gt gt lt lt reference gt gt Description See Section Database on page 2 39 See Section Schema on page 2 40 See Section Table on page 2 40 See Section View on page 2 48 See Section Primary Key on page 2 43 See Section Uniqueness on page 2 43 See Section Primary Key on page 2 43 See Section Operations on page 2 33 See Section Check on page 2 45 See Section Index on page 2 46 See Section Trigger on page 2 47 See Section Relationship cardinalities on page 2 35 See Section Relationship cardinalities on page 2 35 Default item stereotype for forward engineering If EnableDefaultStereotypes property is true lt database gt stereotype is used for first level packages and lt schema gt stereotyp
35. 1 FOREIGN KEY c id REFERENCES Company id ONE TO ONE 1 1 RELATIONSHIP One to one 1 1 relationship is handled as a special case of one to many relationships where end B allowed cardinalities are O 1 and end A allowed cardinalities are O 1 see Cardinalities of 1 N relationshipl Cardinalities of 1 N association 1 1 relationship is mapped to a dependency with lt FK stereotypey The 1 1 cardinality must be forced through constraints lt lt FKe gt FK columns c_id PK columns id Figure 19 1 1 relationship and mapped representation A script that creates a 1 1 relationship CREATE TABLE Company id INTEGER NOT NULL PRIMARY KEY CREATE TABLE Director c id INTEGER NOT NULL UNIQUE CONSTRAINT FK 1 FOREIGN KEY c id REFERENCES Company id 2 36 2005 No Magic Inc MagicDraw Code Engineering Database Engineering Nevertheless this DDL script with these constrains does not ensure a strict 1 1 relationship Company table may have rows that do not have their counterpart rows within Director table MANY TO MANY N M RELATIONSHIP Many to many N M associations are not handled by MagicDraw UML The N M relationship can be achieved by using two 1 N relationships with intermediate table Inheritance SINGLE INHERITANCE l
36. Attribute Group Definition pe is anamed component and has two additional L is an unnamed component properties name and target namespace XML Schema Component Data Model 5 142 2003 No Magic Inc
37. Code and Database Engineering XML Schema For an example see Section simpleType UML Model example on page 5 107 maxlnclusive Maps to UML Attribute with stereotype XSDmaxlnclusive Name and type of such attribute does not make sence e value to Attribute initial value XML Representation Summary maxInclusive Element Information ltem lt maxInclusive fixed boolean false id ID value anySimpleType any attributes with non schema namespace Content annotation lt maxInclusive gt value must be in the value space of base type definition Example The following is the definition of a user derived datatype which limits values to integers less than or equal to 100 using maxlnclusive simpleType name one hundred or less restriction base integer gt maxlInclusive value 100 gt lt i SE ic iL ee dL Om lt simpleType gt maxinclusive UML Model example For an example Section simpleType UML Model example totalDigits Maps to UML Attribute with stereotype XSDtotalDigits Name and type of such attribute does not make sence e value to Attribute initial value 5 100 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema XML Representation Summary totalDigits Element Information ltem totalDigits fixed boolean false id ID value positiveInteger fany attributes with non schema namespace Con
38. Constraint A constraint is a rule applied to the structure of a database This rule extends the structure of a database and can be applied to a column or a table In general a constraint may be represented as an operation with an appropriate stereotype and parameter list containing the list of column names that constraint concerns An operation name is equal to the name of a constraint but when a constraint has no name specified operation is unnamed All listed constraints null not null uniqueness primary key foreign key and check are implemented in the following example CREATE TABLE Person id INTEGER NOT NULL PRIMARY KEY socialId NUMBER 10 NOT NULL UNIQUE CONSTRAINT checkSociallId CHECK sociallId gt 0 lastName VARCHAR 20 NOT NULL firstName VARCHAR 10 NOT NULL sex CHAR 1 NULL CREATE TABLE Account accountNo INTEGER NOT NULL balance FLOAT 5 DEFAULT 0 0 NOT NULL CONSTRAINT checkBalance CHECK balance gt 0 2005 No Magic Inc 2 41 MagicDraw Code Engineering Database Engineering personalld INTEGER NOT NULL CONSTRAINT PK AccountO0 PRIMARY KEY accountNo personalId CONSTRAINT FK Accountl FOREIGN KEY personalld REFERENCES Person Representation using UML concepts lt lt table gt Person lt stable gt gt Account firstName varch
39. Design and EJB Deployment profiles The Java Profile detines the subset of Java constructs that are needed to support the EJB Profiles EJB Design Profile detines how to model EJB applications using the interfaces and the implementation classes of an enterprise bean The EJB Deployment Profile defines mapping of EJB components contained in EJB JAR archives and deployment on Application Servers to UML Java Profile This section describes stereotypes and tagged values introduced in the Java Profile STEREOTYPES Stereotype Applies To Definition JAR Artifact Specializes the standard UML Stereotype file Indicates Component that the Artifact or Component represents a JAR JARInclude Dependency Indicates that the supplier of the Dependency a JAR Java class file or other file is included by value e copied into the JAR that is the client of the Dependency JARReference Usage Indicates that the supplier is a model element that is not contained in the archive but is referenced by it in the META INF MANIFEST MF file JavaSourceFile file Specializes the standard UML Stereotype file Indicates that the Artifact describes a Java Source File NOTE The compiled class file is not modeled by this profile TAGGED VALUES Tagged Values of the Java Profile are included in current implementation of MagicDraw but are not used in EJB 2 0 code engineering Tagged Value Applies To Definition Jav
40. Figure 12 Retrieve DB Info dialog box Box name Function Recently Used Contains the list of the recently used reverse templates Choose the one you need and click Apply DB The connection URL for the selected profile Connection URL Driver Files Contains jar and zip files or directories with JDBC driver s classes To choose the files or directories you want to add or remove click the button The Select Files and or Directories dialog box appears NOTE If the driver file is empty Driver Class is searched from the classpath 2005 No Magic Inc 2 29 MagicDraw Code Engineering Database Engineering Box name Function Driver Class Contains the connection driver class Click the button and the list of available driver classes that are available in the selected driver files is displayed NOTE Only in the files that are selected in the Driver Files list the system searches for driver classes Username Type the username to connect to the database Password Type the password to connect to the database Catalog Contains a name of the selected Catalog To retrieve the list of available Catalogs from the database click the button and select the catalog The catalog name appears in the Catalog text box NOTE Only when all other properties in this dialog box are correctly defined the list of catalogs can be retrieved Schema Contains a name of the selected Schema To re
41. G TO UML ELEMENTS Defined stereotypes Stereotype name Base Stereotype Applies to Defined TagDefinitions Details XSDcomponent Class id string The base and Attribute abstract AssociationEnd stereotype for Binding all XML Generalization stereotypes used UML P profile XSDattribute XSDcomponent Attribute fixed some fixed element value form qualified unqualified refString string representation of reference to other attribute ref actual reference to other attribute use optional prohibited required optional 2005 No Magic Inc 5 77 MagicDraw Code and Database Engineering XML Schema XSDelement XSDcomponent Attribute AssociationEnd abstract true false block extension restriction substitution final extension restriction fixed some fixed element value form qualified unqualified nillable true false refString string representation of reference to other attribute ref actual reference to other attribute substitutionGroup actual reference to UML ModelElement substitutionGroupStrin g string representation of substitution group key unique keyRef a list of referenced UML Attributes sequenceOrder a number in sequence order XSDcomplexType XSDcomponent Class block extension restriction final extension restriction mixed true false XSDsimp
42. ICDRAW New XML Schema code engineering language is added into MagicDraw engine in order to generate reverse XSD files Code Engineering Project of this language has such Language Properties e Default Target XSD File Name the name of default xsd file This CE set has one RT Component by default Selected by user classes will be added into this component Component is mapped to xsd file RT Component does not have inner RT Components TODO in Magicdraw add encoding property to project 2003 No Magic Inc 5 141 S MagicDraw Code and Database Engineering XML Schema Schema Components Diagram non normative Notation Declaration notation declarations attribute declarations system identifier Public identifier type definitions Big attribute group definitions element declarations model group defintions Identity constraint Definition identity constraint category substitution group afffliation substitution group exclusions K gt disallowed substitutions P rel abstract definition c o lt e Ez m a Ll E Simple Type Definition s Pe derivation method facets Afinal final abstract AT min occurs varie prohibited substitutions nax attribute wildcard ode Group base type definition attribute uses base type definiti come Ositor Attribute Use required Value constraint attribute declaration Attribute Declaration xo attribute uses
43. LE NullableExample dontcare INTEGER optional INTEGER NULL required INTEGER NOT NULL Representation using UML concepts 2 42 2005 No Magic Inc MagicDraw Code Engineering Database Engineering Figure 25 Not null null constraints example UNIQUENESS Uniqueness constraint indicates that the value of a column must be unique within the table Uniqueness constraint is modeled as the lt lt unique gt gt stereotype applied to an attribute and or operation with the lt lt unique gt gt stereotype and a parameter list Example of a DDL script CREATE TABLE UniqueExample coll INTEGER CONSTRAINT uniqueColumn UNIQUE col2 INTEGER col3 INTEGER CONSTRAINT uniqueCombination UNIQUE col2 col3 Representation using UML concepts Figure 26 Unique constraint example PRIMARY KEY Primary Keys uniquely identify a row in a table They mark an attribute as the Primary Key or the part of the Primary Key The attribute must be of a scalar type If more than one Primary Key attribute is identified a concatenated primary key is generated A Primary Key is represented as the lt lt gt gt stereotype on an attribute and or operation with the lt lt PK gt gt stereotype and the parameter list Example of a DDL script CREATE TABLE PKColumnExample coll INTEGER Constraint pkColumn PRIMARY KEY
44. SDrestriction gt z XSDrestrictions lt xml version 1 0 encoding 2 Cp1252 lt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com xs complexType name my Type2 block extension final extension mixed true gt xs annotation xs documentation my type2 documentation lt xs documentation gt lt xs annotation gt 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema xs complexContent id contentID mixed false gt xs extension base nm my Type gt xs attribute name surname type xs string lt xs extension gt lt xs complexContent gt lt xs complexType gt lt xs complexType name my_Type3 gt lt xs complexContent gt lt xs restriction base nm my_Type gt lt xs all gt lt xs element name order type xs string gt lt xs element name orderl type xs string gt lt xs all gt lt xs restriction gt lt xs complexContent gt lt xs complexType gt lt xs complexType name my_Type4 gt lt xs simpleContent gt lt xs restriction base xs string gt lt xs minLength value 2 gt lt xs restriction gt lt xs simpleContent gt lt xs complexType gt lt xs complexType name my_Type5 gt lt xs simpleContent gt lt xs extension base xs string gt lt xs attribute name attri type
45. The file name pattern is lang prop where lang stands for the name of the programming language Supported File of Properties language JAVA java prop C C prop CORBA IDL idl prop JAVABytecode javabytecode prop DDL ddl prop CIL cil prop CIL Disassembler cil disassembler prop C c prop EJB ejb prop EJB 2 0 ejb20 prop IDL idl prop 2005 No Magic Inc 1 25 MagicDraw Code Engineering Introduction Supported File of Properties language XML Schema xmlschema prop WSDL wsdl prop Files of language properties are separated into sections where all related elements are grouped You may edit existing entities add new ones and change the default values We strongly recommend that you edit default values only In general all the sections have the list of possible and default values for the element 2005 No Magic Inc DATABASE ENGINEERING 2 MagicDraw UML has the tools that forward engineer UML constructs to DDL script The resulting DDL script depends on the selected DDL language dialect Retrieve DB Info dialog box IMPORTANT Since MagicDraw version 9 0 Retrieve DB Info dialog box has been moved to the Round Trip Set dialog box The Retrieve DB info function allows you to retrieve the information from the existing database or ODBC source Database structure is retrieved as UML model using class diagram elements The mapping of the DB to UML is the same as in DDL reverse engineering NOTE As the retrieve DB in
46. a Edit Source Java Bytecode C Cs Show Full Types in Browser CIL Show Stereotypes in Browser CIL Disassembler Show Code Engineering Sets CORBA IDL Reverse DDL Refresh EJB 2 0 XML Schema WSDL 5 Zoom Control E Documentation Ez Properties Figure 1 Code engineering language options 1 6 2005 No Magic Inc Introduction MagicDraw Code Engineering Edit sets in the Round Trip Set dialog box To open this dialog box e Choose Edit from the set shortcut menu If you are performing round trip for the first time the tip message box appears Figure 2 Code Engineering Sets tip message box Disable the tip message box by deselecting the Show this tip next time check box 2005 No Magic Inc 1 7 MagicDraw Code Engineering Introduction The Round Trip Set dialog box allows you to manage entities to be added removed to your set I xi Working Directory CNi2sdk1 4 2_03 demo Working Package Data P Add Files Add Data from Model All Files Set U A applets H E Animator H E ArcTest E 3 BarChart B a Blink CardTest Add All E 3 Clock H E DitherT est Add Recursively H E DrawTest H 6 Fractal Remove H GraphicsT est a GraphLayout Remove All 29 23 ImageMap 5 Blink java 09 425 JumpingBox E n tiana 2 Files of type Java source files java Y Figure 3 Round Trip Set dialog box Add ti
47. a programming languages in the Default language field found on the right side of the Project Options dialog box 2005 No Magic Inc other operators Generate empty documentation Comment brackets are placed in your code unless class in the model has no documentation Automatic generation Class count to generate import on demand Automatic generation of import sentences according to classes that are referenced in the generated class Specity number of classes imported from a single package until all statements importing a single class are substituted with a statement importing an entire package MagicDraw Code Engineering Introduction Tab name Element name Function C Language Options Set the generated code style for C programming languages Documentation n After selecting Java Doc processor click the Processor button to open the Documentation Properties dialog box Style Two styles are available for documentation Use CLASSPATH The button is activated Search a classpath for importing sentences generation in the Set classpath dialog box FT x Ib xalan jar C Program Files Java jck 1 5 ONreMb ut jar I ain FEES ETT Sn jar C Program Files ava ick 1 5 0 Wre ib suntsas C Program Files ava Nik 7 5 0NreMbNisse jar C Program Files Java jck1 5 0 jre ib cejar g iiaiai E Get from System
48. a method that is exposed on e herthe local or local home interface The former case is assumed if the EJB Business stereotype is also present EJB 2 0 only EJBLocalReference Dependency A stereotyped Dependency representing an EJB Local Reference where the client is an EJB JAR and the supplier is an EJB Enterprise Bean EJB 2 0 only EJBMessageDrivenBean Class Indicates that the Class represents an EJB Message Driven Bean Specializes EJBEnterpriseBean EJB 2 0 only EJBPrimaryKey Usage Indicates that the supplier of the Usage represents the EJB Primary Key Class for the EJB Enterprise Bean represented by the client EJBPrimaryKeyField Attribute Specializes EJBCmpField Indicates that the AssociationEnd Attribute or Association End is the primary key field for an EJB Entity Bean with container managed persistence EJBRealizeHome Abstraction Indicates that the supplier of the Abstraction represents an EJB Remote Home Interface for the EJB Enterprise Bean Class represented by the client EJBRealizeLocal Abstraction Indicates that the supplier of the Abstraction represents an EJB Local Interface for the EJB Enterprise Bean Class represented by the client EJB 2 0 only EJBRealizeLocalHome Abstraction Indicates that the supplier of the Abstraction represents an EJB Local Home Interface for the EJB Enterprise Bean Class represented by the client EJB 2 0 only
49. a person s body temperature on the Celsius scale This definition would appe in a schema authored by an end user and shows how to define a datatype by specifying facet values which constrain the range of the base type simpleType name celsiusBodyTemp restriction base decimal gt totalDigits value 4 fractionDigits value 1 gt lt mai bne sine walwe 36 4 gt lt maxInclusive value 40 5 gt lt restriction gt lt simpleType gt fractionDigits UML Model example For an example see Section simpleType UML Model example on page 5 107 length Maps to UML Attribute with stereotype XSDlength Name and type of such attribute does not make sence e value to Attribute initial value XML Representation Summary Length Element Information ltem length fixed boolean false id ID value nonNegativeInteger any attributes with non schema namespace Content annotation lt length gt Example The following is the definition of a user derived datatype to represent product codes which must be exactly 8 characters in length By fixing the value of the length facet we ensure that type derived from productCode can change or set the values of other facets such as pattern but cannot change the length lt simpleType name productCode lt restriction base string gt length value 8 fixed true lt restriction gt lt simpleType gt 5 102
50. a xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt lt xs element name name type xs string default minde id elementID abstract true block extension final restriction fixed fixedValue form qualified nillable true substitutionGroup nm count gt lt xs annotation gt lt xs documentation gt element name documentation lt xs documentation gt lt xs annotation gt lt xs element gt lt xs element name count gt lt xs annotation gt lt xs documentation gt element count documenation lt xs documentation gt lt xs annotation gt lt xs simpleType gt lt xs restriction base xs number gt lt xs simpleType gt lt xs element gt lt xs element name hour type xs integer gt lt xs element name minute type xs integer substitutionGroup nm count gt lt xs element name Surname type xs string minOccurs 1 maxOccurs unbounded gt lt xs complexType name some_type gt lt xs all gt lt xs element ref nm hour minOccurs 0 maxOccurs 1 gt xs annotation gt lt xs documentation gt hour ref documentatuion lt xs documentation gt lt xs annotation gt lt xs element gt lt xs element ref nm minute minOccurs 0 maxOccurs 1 gt lt xs all gt lt xs complexType gt 5 84 2005 No Magic Inc MagicDraw Code and Database Engineeri
51. aStrictfp Class A Boolean value indicating whether or not the Java Class is FP strict 2005 No Magic Inc 4 67 MagicDraw Code Engineering EJB 2 0 UML JavaStatic Class A Boolean value indicating whether or not the Java Class is static JavaVolatile Attribute or A Boolean value indicating whether or not the Java AssociationEnd Field is volatile JavaDimensions Attribute AssociationEnd or Parameter An Integer indicating the number of array dimensions declared by the Java Field or Parameter JavaCollection Attribute or AssociationEnd A String containing the name of the Java Collection Type used to implement an Attribute or Association End with complex multiplicity JavaNative Operation or Boolean value indicating whether or not the Method Operation or Method is native JavaThrows Operation or comma delimited list of names of Java Exception Method Classes JavaFinal Parameter A Boolean value indicating whether or not the EJB Design Profile Parameter is final This section describes stereotypes and tagged values introduced in the EJB Design Profile STEREOTYPES Stereotype Applies To Definition EJBBusiness Operation Indicates that the Operation represents an instance level business method a method that supports the business logic of the EJB Contrast with c ass eve business methods on home interfaces which are stereotyped EJBHome EJBCmpF
52. all choic sequence lt group gt lt group ref QName maxOccurs nonNegativelInteger unbounded minOccurs nonNegativeInteger 1 Content annotation lt group gt 5 130 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema Example xs group name myModelGroup gt lt xS Sequence gt lt xs element ref someThing gt lt xs sequence gt lt xs group gt lt xs complexType name trivial gt lt xs group ref myModelGroup gt GS noo lt xs complexType gt lt xs complexType name moreSo gt S CNOLCE gt lt xs element ref anotherThing gt lt xs group ref myModelGroup gt lt xs choice gt lt xs complexType gt group UML Model example For an example see Section compositors UML Model example on page 5 129 any and anyAttribute Maps to UML Attribute with stereotype XSDany or XSDanyAttribute maxOccurs to multiplicity upper range Value unbounded maps to asterisk in UML minOccurs to multiplicity lower range annotation maps to Attribute documentation Other properties to TaggedValues XML Representation Summary any Element Information ltem any ig ID maxOccurs nonNegativelnteger unbounded minOccurs nonNegativeInteger 1 namespace fany other List of anyURI targetNamespace local processContents lax skip strict strict
53. amespace http bla bla bla processContents skip xs annotation 5 132 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema lt xs documentation any attribute documentation lt xs documentation gt lt xs annotation gt lt xs anyAttribute gt lt xs attributeGroup gt lt xs schema gt schema Maps to UML Class with stereotype XSDschema All schema global attributes and elements are mapped to UML Attributes of this class Name of this class should match file name or must be assigned to the component which represents file xmlns xml tags maps to an permission link with stereotype lt lt xmlns gt gt and name representing given prefix Permission client is schema class and supplier package with name equal to the xmlns value XML Representation Summary schema Element Information schema attributeFormDefault qualified unqualified unqualified blockDefault all List of extension restriction substitution TY elementFormDefault qualified unqualified unqualified finalDefault fall List of extension restriction f Hem id ID targetNamespace anyURI version token xml lang language any attributes with non schema namespace gt Content include import redefine annotation simpleType complexType group attributeGroup element attribute notation annotation lt schema gt
54. and Database Engineering XML Schema Example The following is the definition of a user derived datatype which limits values to integers less than or equal to 100 using maxExclusive simpleType name less than one hundred and one restriction base integer gt maxExclusive value 101 gt lt restriction gt lt simpleType gt Note that the value space of this datatype is identical to the previous one named one hundred or less maxExclusive UML Model example For an example see Section simpleType UML Model example on page 5 107 minlnclusive Maps to UML Attribute with stereotype XSDminInclusive Name and type of such attribute does not make sence e value to Attribute initial value XML Representation Summary minInclusive Element Information Item lt minInclusive fixed boolean false id I value anySimpleType any attributes with non schema namespace gt Content annotation minInclusive value must be in the value space of base type definition Example The following is the definition of a user derived datatype which limits values to integers greater than or equal to 100 using minlnclusive simpleType name one hundred or more restriction base integer lt minInclusive value 100 lt restriction gt lt simpleType gt minlnclusive UML Model example 2005 No Magic Inc 5 99 SE MagicDraw
55. and enter header text in the Header screen You may also define DATE AUTHOR and TIME in the header MagicDraw Code Engineering Introduction Tab name Element name Function C Language Options Set the generated code style for C programming languages Generate opening bracket in new line Opens a bracket in the newly generated line Generate spaces Generates spaces inside an assignment and other operators Generate empty documentation Comment brackets are placed in your code unless class in the model has no documentation Generate Automatic generation of using directives This required using option facilitates the usage of namespaces and directives types defined in other namespaces Concatenate If not selected namespace names are separated namespace into several lines names e g namespace A namespace Documentation e Processor e Use C XMI processor then generates c xmi documentation for commenting the code e Style e Select one of the listed comment styles Header Adds the specific header to all your code files Click the button and type header text in the Header dialog box You may also define DATE AUTHOR and TIME in the header Conditional Add the conditional symbols which can not be Symbols recognized and should be skipped during reverse Click the button and add conditional symbols in the Define Conditional Symbols dial
56. ar 10 accountNo integer PK id integer personallD integer lt lt FKe gt lastName varchar 20 sex char 1 checkBalanced FK columns personallD sociallD number 10 PK Account accountNo personallD PK columns id checkSociallD sociallD Figure 24 Constraints example NOT NULL NULL NOTE A Null constraint is not defined in SQL 92 standard but some dialects use it Microsoft SQL Server allows setting a flag which indicates that all columns have Not Null constraint which is set by default A Null constraint that is assigned for a column overrides the default Not Null constraint and allows null values Not Null constraint indicates that the value for an attribute is required Null constraint indicates that the value is optional Example firstName VARCHAR 10 NOT NULL sex CHAR 1 NULL Not null constraint and null constraint are modeled as the multiplicity of an attribute Multiplicity may be indicated by placing a multiplicity indicator in brackets after the name of an attribute A multiplicity of O 1 provides a possibility of null values for an example sex 0 1 CHAR 1 In the absence of a multiplicity indicator an attribute holds exactly one value See also ColumnDefaultNullability AttributeDefaultMultiplicity GenerateNullConstraint GenerateNotNullConstraint properties Example of a DDL script CREATE TAB
57. ard Stereotype EJBEnterpriseBean Indicates that the Component represents an EJB Entity Bean EJBExcludeList Actor Indicates an Actor that represents an Exclude List An exclude list is specified using one or more dependencies stereotyped EJBMethod from an EJB Enterprise Bean client to an EJB Exclude List Actor supplier EJBMessageDrivenBeanDeployment Component Specializes the standard Stereotype EJBEnterpriseBean Indicates that the Component represents an EJB Message Driven Bean EJBMethod Dependency Indicates a Dependency between an EJB Component client and an EJB Method Permission or EJB Container Transaction or EJBExcludeList supplier that completes a Method Permission or Container Transaction or Exclude List specification It contains a method specification either style 1 2 or 3 according to the EJB 2 0 specification 2005 No Magic Inc 7E MagicDraw Code Engineering EJB 2 0 UML EJBMethodPermission Actor Indicates an Actor that represents a Method Permission It contains a tag value indicating whether or not the method is unchecked One or more method permissions are specitied using one or more dependencies stereotyped EJBMethod from an EJB Enterprise Bean to an EJB Method Permission Actor EJBOverrideHome reside Indicates a relationship that for the client EJB Enterprise Bean Component the supplier UML Interface overri
58. atabase Engineering This representation is valid but the primary key contains overhead info specifically column col2 Unique column alone may be used as a valid primary key CREATE TABLE PKWithoutOverheadExample coll INTEGER PRIMARY KEY col2 INTEGER 2005 No Magic Inc CORBA IDL MAPPING UML S CORBA IDL mapping to UML is based on UML Profile for CORBA Specification Version 1 0 April 2002 http www omg org technology documents formal profile corba htm Differences between UML Profile for CORBA specification and mapping in MagicDraw is listed below Most differences are present because MagicDraw does not fully support UML 1 4 CORBA IDL exception is mapped to Core Class instead of CommonBehavior Exception MagicDraw does not support CommonBehavior Exception Constraints defined in UML Profile for CORBA specification are not checked in MagicDraw For storing constants UML class instead of UtilityClass is used Use simplified 1 multiplicity instead of 1 1 Stereotype CORBAAnonymousFixed is introduced It is used to represent anonymous fixed types Fixed types without names are mapped to inner classes with stereotype CORBAAnonymousFixed These classes are binded with CORBA fixed classes IDL Code struct baz fixed lt 8 4 gt high_scale fixed lt 8 2 gt low_scale This code is mapped to the following diagram
59. ated index TriggerNamePrefix property specifies an optional naming standard that is added to the beginning of the name for each generated trigger table stables TableB Table b1 integer a1 integer 123 b2 integer ee _ _ gt gt integer lt lt FK gt gt fk1 1k lt lt FK gt gt lt lt index gt indexOnAl a1 FK columns fk lt lt check gt checkColumnt id s lt check checkTabled lt strigger gt triggerl 0 PK columns id lt lt pK gt pk1 id unique unique1 h1 b2 Figure 16 Operations mapping example An example of the DDL script for operations mapping 2 34 2005 No Magic Inc MagicDraw Code Engineering Database Engineering CREATE TABLE TableB id integer CONSTRAINT checkColumn CHECK lt check expression gt bl integer b2 integer CONSTRAINT pkl PRIMARY KEY id CONSTRAINT checkTable CHECK check expression CONSTRAINT uniquel UNIQUE b1 b2 CREATE TABLE TableA fk integer al integer DEFAULT 123 CONSTRAINT 1 FOREIGN KEY fk REFERENCES TableB CREATE INDEX indexOnAl ON TableA al CREATE TRIGGER triggerl ON TableA triggered SQL statement gt Relationship cardinalities ONE TO MANY 1 N RELATIONSHIP One to many 1 N relationship is mapped to dependency with lt FK
60. case such class maps to inner part of other group Elements order in sequence group is very important Such elements are ordered according values of TaggedValue sequenceOrder lt all qd ID maxOccurs Le 1 minOccurs sx any attributes with non schema namespace Content annotation element all choice id ID maxOccurs nonNegativeInteger unbounded 1 minOccurs nonNegativeInteger 1 any attributes with non schema namespace gt Content annotation element group choic sequence choice sequence id ID maxOccurs nonNegativeInteger unbounded 1 minOccurs nonNegativeInteger 1 any attributes with non schema namespace Content annotation element group choice sequence any sequence Example xs all xs element ref cats xs element ref dogs lt xs sequence gt lt xs choice gt lt xs element ref left gt lt xs element ref right gt lt xs choice gt lt xs element ref landmark gt lt xs sequence gt XML representations for the three kinds of model group the third nested inside the second 5 128 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema compositors UML Model example xXSD groups lt lt XSDs equence gt myGroup id group id minOccurs 2 maxOccurs 1 choiceld choiceid lt
61. cepts 2005 No Magic Inc 2 47 Figure 33 Trigger example View MagicDraw Code Engineering Database Engineering A View is a construct for creating a virtual table based on one or more existing tables or views A class with the lt lt view gt gt stereotype represents a view in a schema of a database The View column is modeled as an attribute Relationships between the View and its underlying tables clause are modeled as dependencies with lt lt reference gt gt stereotype Referenced table alias is modeled as the name of the dependency referenced column list as the columns tagged value on the dependency 2 48 View element View View name Column Column name Derived column lt expression gt AS lt name gt lt tablename gt lt columnname gt lt tablename gt lt columnna me lt expression gt Table reference UML concept Class with the lt lt view gt gt stereotype Class name Attribute Attribute name Attribute default value expression name lt name gt Attribute name Attribute name Attribute name Attribute name lt columnname gt and default value lt tablename gt lt columnna me gt Generated unique attribute name and default value lt expression gt Dependency Script example CREATE VIEW Account balance AS total p Balance Account balance 2005 No Magic Inc MagicDraw Code Engineering W
62. code written in those languages Also reverse from Java Bytecode and CIL is supported The Code Engineering Sets tool is MagicDraw tool managing center for all code engineering matters Code engineering is available only in Professional or Enterprise editions In the following table you ll find what languages are supported in different editions Language Professional Edition Enterprise Edition Java Java Java Bytecode Java C C CORBA IDL 4 DDL Database engineering CIL C 2005 No Magic Inc 1 5 Introduction MagicDraw Code Engineering Language Professional Edition Enterprise Edition CIL Disassembler C XML Schema WSDL C C EJB 2 0 T MCODE ENGINEERING SETS You may manage code engineering through the Code Engineering Sets in the Browser tree The Code Engineering Sets tree contains the list of all sets created in the project and instruments for managing those sets To add a new set 1 From the Code Engineering Sets shortcut menu choose New 2 Choose the language you want possible choices include Java Java Bytecode C C CIL CIL Disassembler CORBA IDL DDL Cloudscape DB2 Microsoft Access Microsoft SQL Server MySQL Oracle Pervasive Pointbase PostgreSQL Sybase EJB 2 0 XML Schema and WSDL The new set is created B Data 8 UML Standard Profile UML_Standard_Profile L Fs Code enaineerina sets Jav
63. d NULL NOT NULL Database Engineering Description If column has no NULL or NOT NULL constraint specified the value of this property is used Create catalog sets current catalog True default false Specifies whether create catalog statement changes current catalog name Create schema sets current schema True default false Specifies whether create schema statement changes current schema name Default catalog name DefaultCatalogNone default DefaultCatalogPack age any entered by the user Specifies current database name Used when DDL script does not specify database name explicitly Default schema name DefaultSchemaNone default DefaultSchemaPack age any entered by the user Specifies current schema name Used when DDL script does not specify schema name explicitly Drop statements Deferred default Immediate Ignored Specifies whether execution of drop statements may be deferred or must be executed or must be ignored Deferred drop may be enabled if elements are recreated later This will save existing views Attribute stereotypes multiplicity and default value always are not dropped immediately Map Null not Null constraints to Stereotypes default Multiplicity When parsing DDLs the null not null constraints are modeled as either stereotypes or multiplicity Map foreign keys True default false A dependency with lt lt FK gt g
64. datatype by enumerating the values in its value space The enumerated values must be type valid literals for the base lt simpleType name holidays lt annotation gt lt documentation gt some US holidays lt documentation gt lt annotation gt lt restriction base gMonthDay gt lt enumeration value 01 01 lt annotation gt lt documentation gt New Year s day lt documentation gt lt annotation gt lt enumeration gt enumeration value 07 04 gt lt annotation gt lt documentation gt 4th of July lt documentation gt lt annotation gt lt enumeration gt lt enumeration value 12 25 lt annotation gt lt documentation gt Christmas lt documentation gt lt annotation gt lt enumeration gt lt restriction gt lt simpleType gt enumeration UML Model example For an example see Section simpleType UML Model example on page 5 107 5 106 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema unique Maps to UML Attribute added into some UML Class unique id ID name NCName fany attributes with non schema namespace Content annotation selector field lt unique gt unique UML Model example For an example see Section keyref UML Model example on page 5 122 key Maps to UML Attribute added into some UML Class e name to Attribute name e id to TaggedValue lt key id ID name NCName attributes with
65. des the Home Interface that is defined by the EJB Enterprise Bean This is a technique for constructing new EJBs while reusing EJB Enterprise Bean Classes EJBOverrideLocal reside Indicates a relationship that for the client EJB Enterprise Bean Component the supplier UML Interface overrides the Local Intertace that is defined by the EJB Enterprise Bean This is a technique for constructing new EJBs while reusing EJB Enterprise Bean Classes EJBOverrideLocalHome reside Indicates a relationship that for the client EJB Enterprise Bean Component the supplier UML Interface overrides the Local Home Interface that is defined by the EJB Enterprise Bean This is a technique for constructing new EJBs while reusing EJB Enterprise Bean Classes EJBOverridePrimaryKey reside Indicates a relationship that for the client EJB Enterprise Bean Component the supplier Java Class overrides the EJB Primary Key Class that is defined by the EJB Enterprise Bean This is a technique for constructing new EJBs while reusing EJB Enterprise Bean Classes EJBOverrideRemote reside Indicates a relationship that for the client EJB Enterprise Bean Component the supplier UML Interface overrides the Remote Interface that is defined by the EJB Enterprise Bean This is a technique for constructing new EJBs while reusing EJB Enterprise Bean Classes EJBRoleName Actor Indicates the name of a security role used in th
66. e lt xs complexType gt lt xs element name addressee type personName gt S72 s 3868 xs redefine schemaLocation v1 xsd xs complexType name personName gt lt xs complexContent gt xs extension base personName gt lt xs sequence gt lt xs element name generation minOccurs 0 gt xs sequence lt xs extension gt lt xs complexContent gt lt xs complexType gt lt xs redefine gt lt xs element name author type personName gt The schema corresponding to v2 xsd has everything specified by v1 xsd with the personName type redefined as well as everything it specifies itself According to this schema elements constrained by the personName type may end with a generation element This includes not only the author element but also the addressee element 5 136 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema redefine UML Model example lt lt xSDregtriction gt lt xml version 1 0 encoding UTF 8 lt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com xs redefine schemaLocation http nomagic com gt xs simpleType name string gt xs annotation gt xs documentation my documentation lt xs documentation gt lt xs annotation gt xs restriction base xs string gt lt xs simpleType gt lt xs redefine gt lt xs schema gt import Maps
67. e is used for second level packages Otherwise none If EnableDefaultStereotypes property is true lt table gt stereotype is used Otherwise none None None yE MagicDraw Code Engineering Database Engineering MPROPERTIES OF CODE ENGINEERING SET FOR DDE There are two separate properties sets stored as properties of code engineering set for DDL e Properties for DDL script generation e Properties for DDL script reverse engineering Properties for DDL script reverse engineering and generation Acc Properties Editor xj script v Default Target DDL Script File Hame Target DDL Dialect Hame Enable Default Stereotypes Standard SQL x 7 Generate Extended Index Name true v Generate Extended Trigger Hame true v Generate Drop Statements true v Attribute Default Multiplicity Senoren consa tre Generate Hot Hull Constraint true v conmratendentr Pinay tue Generate Index for Unique true v porc Generate Qualified Hames true v Default Catalog Hame Hone Befeuit Scheme Herne Mone Figure 35 CG Properties Editor dialog box DDL properties Property name Reverse engineering features Values list Description 2 52 2005 No Magic Inc Column default nullability MagicDraw Code Engineering Values list Dialect default default not specifie
68. e definitions of Method Permissions erc 4 74 2005 No Magic Inc MagicDraw Code Engineering El EJB 2 0 UML EJBRunAsldentity Dependency Indicates a Dependency between an EJB Role Name supplier and an EJB Component client that completes a Run As specification which names a role under which methods of the EJB are to be executed EJBSecurityRole Association Indicates a Dependency between an EJB JAR client and an EJB Role Name supplier It defines the role as part of the archive EJBSessionBeanDeployment Component Specializes the standard Stereotype EJBEnterpriseBeanDeployment Indicates that the Component represents an EJB Session Bean The EJBContainerTransaction Actor model elements always receive a second stereotype which identifies the ype of transaction Transaction Type Description EJBMandatory Transactions are mandatory for this method EJBNever Transactions are never used for this method EJBNotSupported Transactions aren t supported for this method EJBRequired Transactions are required for this method EJBRequiresNew A new transaction is required for this method EJBSupports Transactions are supported for this method TAGGED VALUES Tagged Value Applies To Definition EJBDisplayName Artifact EJB JAR A String with the name for the Archive to be displayed by tools EJBMethodDescriptor Dependency A String with the subset of XML required
69. e name is equal to the package name A Schema if the package has the lt lt schema gt gt stereotype Elements CREATE SCHEMA lt database_name gt lt schema_name gt Schema name is equal to the package name Schema database name is the name of a package that contains schema package e Otherwise it is not mapped If a package has no stereotype and the EnableDefaultStereotypes property is true the lt database gt stereotype is used for the first level packages and the lt schema gt stereotype is used for the second level packages lt lt database gt gt Figure 13 Package mapping example DLL script generated for example showed in Package mapping example12 creates one Database and two Schemas CREATE DATABASI CREATE SCHEMA CREATE SCHEMA Classes E DBl DBl Schemal DBl Schema2 A class depending on class stereotype is mapped to one of the following DDL constructs 2005 No Magic Inc e Table if the class has the lt lt table gt gt stereotype Elements CREATE TABLE schema name table name column and constraint list Table name is equal to the class name Table schema name is the name of package that contains table class yE MagicDraw Code Engineering Database Engineering e View if the class has the lt lt view gt gt stereotype Elements CREATE VIEW lt schema_name gt lt view_name gt lt column_list gt AS SELECT der
70. e options dialog box Element name Function VIZUALIZATION 1 12 2005 No Magic Inc MagicDraw Code Engineering Introduction Element name Function Visualize reversed Classes that are created while reversing can be added to a model diagrams Launch Model After reversing the Model Visualizer dialog box appears It Visualizer will assist you in creating a class diagram or sequence diagram Java only for newly created entities Create new class After reversing the Create Diagram dialog box appears diagram Create a new diagram where the created entities will be added Add to active diagram After reversing all created entities will be added to the current opened diagram GENERAL Look for classes in Search for classes in the classpath while reversing is classpath executed CREATE CLASS FIELDS AS Attributes Class fields are represented in model as attributes Associations Class fields are represented in model as association ends Reset already created Select this option if you want to keep already created UML fields representation attribute or association for class fields MODEL REFRESH TYPE Merge model and The model elements are updated by code Elements that do code not exist in the code will not be removed from the model Change model Model will be created strictly by code Entities in the model according to code that do not match entities in the code will be discarded OK Saves chan
71. e output or code generation Model will be reversed or code generated from this specified package e Default Paths for References add specific profiles modules libraries to define where to search paths for references during revers code generation e Default Encoding a list of available encodings appears e Default language drop down box select the default generation language e Use Syntax Checker check box when selected the syntax checker runs while Code Engineering is executed e Directory for Temporal Files it can be Active Directory System or define other by clicking button Tab name Description Code Set code generation options using the fields listed in the right side generation of the Project options dialog box The Code generation area contains boxes that have the same functionality as in the Code generations options dialog box see Section Generate Code on page 1 9 Reverse Set reverse options for all reverse actions of the project using the options listed on the right side of the Project options dialog box The Reverse area contains boxes that have the same functionality as in the Reverse options dialog box see Section Reverse on page 1 11 Tab name Element name Function Java Language Generate Opens a bracket in the new line that is being Options opening bracket generated Set the in new line generated code Generate spaces Generates spaces inside an assignment and style for Jav
72. ehavior Drop view statement Delete class Elements table name drop Yes behavior Drop behavior Action property Modifiers CASCADE RESTRICT No i5 Short representation for primary key constraint When primary key is made out of several columns and columns order is not important short primary key representation may be used Columns that make up the primary key must be marked with lt lt PK gt gt stereotype Because a table can contain only one if any primary key these columns are concatenated into one primary key Short primary key representation using UML concepts and generated DDL script 2005 No Magic Inc yE MagicDraw Code Engineering Database Engineering CREATE TABLE ShortPKExample coll INTEGER col2 INTEGER PRIMARY KEY coll col2 If the order of columns within the primary key is important constraint representation as an operation with parameters must be used CREATE TABLE NoShortPKExample coll INTEGER col2 INTEGER PRIMARY KEY col2 coll Primary key constraint with overhead info Consider such primary key definition using UML concepts and generated DDL script CREATE TABLE PKWithOverheadExample coll INTEGER UNIQUE col2 INTEGER PRIMARY KEY coll col2 I 2 58 2005 No Magic Inc MagicDraw Code Engineering D
73. ent lt appinfo gt lt documentation source anyURI xml lang language Content fany lt documentation gt Example xs simpleType fn note special lt xs annotation gt lt xs documentation gt A type for experts only lt xs documentation gt lt xs appinfo gt lt fn specialHandling gt checkForPrimes lt fn specialHandling gt lt xs appinfo gt lt xs annotation gt XML representations of three kinds of annotation annotation UML Model example lt lt XSDan notation gt gt the documentation for this schema fapplnfoContent infoContent applnfoSource infoSource xm I lang EN source documentation source xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com xs annotation gt xs appinfo source infoSource gt infoContent lt xs appinfo gt 2003 No Magic Inc 5 127 EE MagicDraw Code and Database Engineering XML Schema lt xs documentation source documentation source xml lang EN gt the documentation for this schema lt xs documentation gt lt xs annotation gt lt xs schema gt compositors Complex type maps to UML Class with stereotype XSDcomplexType In order to have some group in complex type the same UML Class also must have XSDall XSDchoice or XSDsequence stereotype UML model can have ModelClass just with single stereotype XSDall XSDchoice or XSDsequence In this
74. ern id pattern id value 0 9 5 0 9 4 gt xs annotation gt lt xs documentation gt pattern doc lt xs documentation gt 2005 No Magic Inc 5 93 EE MagicDraw Code and Database Engineering XML Schema lt xs annotation gt lt xs pattern gt lt xs whiteSpace id white_spaceid fixed true value ll preserve gt xs annotation gt lt xs documentation gt white space doc lt xs documentation gt lt xs annotation gt lt xs whiteSpace gt lt xs whiteSpace id white_spaceid fixed true value ll preserve gt lt xs annotation gt lt xs documentation gt white space doc lt xs documentation gt lt xs annotation gt lt xs whiteSpace gt xs maxLength maxlengthID fixed false value 50 gt lt xs annotation gt lt xs documentation gt max length documentation lt xs documentation gt lt xs annotation gt lt xs maxLength gt xs minLength id minlengthID fixed true value omn gt xs annotation gt lt xs documentation gt min length documentation lt xs documentation gt lt xs annotation gt lt xs minLength gt lt xs length id lengthID fixed true value 10 gt xs annotation gt lt xs documentation gt length documentation lt xs documentation gt lt xs annotation gt lt xs length gt lt xs fractionDigits id fractionDigitsID fixed true value 1 gt lt xs annotation gt lt xs documentat
75. et reservation It will consist of single session enterprise bean ReservationBean You may find this example in the lt MagicDraw installation directory gt examples folder 1 Create a new MagicDraw project from EJB 2 0 template 2 Create a new class diagram Create an interface Reservation that extends javax ejb EJBObject interface in the class diagram 4 Create operation bookSeats playName java lang String userName java lang String quantity java lang String in the bean s class The operation should throw java rmi RemoteException To specify which exceptions the method throws open the Operation Specification dialog box click the Language Properties button and in the CG Properties Editor dialog box Java tab specify the Throws Exceptions property java rmi RemoteException 5 Create a class with name ReservationBean The class will be an enterprise session bean 6 Make the class realizes SessionBean interface from javax ejb package 7 Open the ReservationBean s specification and add EJBSessionBean stereotype to the class and EJBNamelnJAR tagged value ReservationEJB 4 76 2005 No Magic Inc 10 11 12 1 14 15 16 17 18 19 MagicDraw Code Engineering El EJB 2 0 UML Create operation bookSeats playName java lang String userName java lang String quantity java lang String in the bean s class You can copy the operation from the Reservation interface select the
76. finalDefault targetNamespace reference to some ModelPackage version xml lang XSDnotation XSDcomponent Attribute public system XSDredefine XSDcomponent Class 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema XSDimport XSDcomponent Permision schemaLocation lt lt import gt gt XSDinclude XSDcomponent Component XSDminExclusive XSDcomponent Attribute fixed boolean false XSDminlnclusive XSDcomponent Attribute fixed boolean false XSDmaxExclusive XSDcomponent Attribute fixed boolean false XSDmaxlnclusive XSDcomponent Attribute fixed boolean false XSDtotalDigits XSDcomponent Attribute fixed boolean false XSDfractionDigits XSDcomponent Attribute fixed boolean false XSDlength XSDcomponent Attribute fixed boolean false XSDminLength XSDcomponent Attribute fixed boolean false XSDmaxLength XSDcomponent Attribute fixed boolean false XSDwhiteSpace XSDcomponent Attribute fixed boolean false value XSDpattern XSDcomponent Attribute XSDenumeration XSDcomponent Attribute XSDunique Attribute selector field XSDkey Attribute selector field XSDkeyref Attribute selector field refer UML Attribute referString String XSDnamespace ModelPackage xmlns Permission attribute e XML schema attribute maps to UML Attribute with stereotype XSDattribute e default maps to initial UML Attribute or AssociationEnd val
77. fo function uses JDBC bridge you may need to have JDBC drivers All types of drivers are valid for making a connection The driver should be able to retrieve the database metadata information The same applies to the database it should be able to provide this information To open the Retrieve DB Info dialog box dialog box 1 From the Code Engineering Sets shortcut menu choose New 2 Choose DDL and then choose the database vendor you need possible choices include Cloudscape DB2 Microsoft Access 2005 No Magic Inc 2 27 y MagicDraw Code Engineering Database Engineering Microsoft SQL Server MySQL Oracle Pervasive Pointbase PostgreSQL Standard SQL and Sybase 3 The new set is created 4 From the created set shortcut menu choose Edit The Round Trip Set dialgo box appears Select the Reverse from DB option 2 28 2005 No Magic Inc MagicDraw Code Engineering Database Engineering e From the Tools menu choose Quick Reverse and then choose DDL and required database vendor The Round Trip Set dialgo box appears Select the Reverse from DB option ground Trip Set E 3 TER Detaut v Aw DB connection URL jdbc oracle thin lt host port lt sid gt sinstall root gt data DB_engineeringWrivers oj Driver files Driver class oracle jdbe driver OracleDriver Username Password Catalog Schema Debug JDBC driver J False Reload driver v True
78. from Java Source Wizard Sequence Diagram from Java Source Wizard is the primary tool for reversing s sequence diagram from Java method It contains four steps that are described below STEP 1 SPECIFY NAME AND PACKAGE Bj Sequence Diagram from Java Source Wizard Type Sequence Diagram name 1 Specify name and package Class Method implementation 2 Select Operation Select package For di i 3 Select classes for diagram eee ee C 4 Specify symbols properties 8 25 File View lt lt fileView gt gt AR java Type diagram name and choose or create E javax the package that will contain the created org diagram Eg UML Standard Profile UML_Standard_Profile xml Ep UML Profile for Java modelLibrary Java Profile xml Lig Untitled Create Back Next gt Finish Cancel Help emer Figure 7 Sequence Diagram from Java Source Wizard 1 14 2005 No Magic Inc MagicDraw Code Engineering Introduction In this step type the name of the newly created sequence diagram Be default class name and selected operation name with a word implementation will be included in the sequence diagram name Also choose the package that will contain created sequence diagram If you want to create a new package and place there a sequence diagram click the New button and define package parameters in the Package Specification dialog box STEP 2
79. ges in the code are treated as new items and added to the model If data in the model file is deleted it will be restored while refreshing even when the code has not been changed or the data itself is unimportant 2005 No Magic Inc Introduction MagicDraw Code Engineering Type Mapping Table Languages supported by MagicDraw UML have their own built in types One language s type might have no matches in another language or it might have multiple matches Additionally some names are interpreted differently in different languages When performing code generation therefore problems may occur when switching between different languages To avoid this MagicDraw UML uses type mapping tables to manage mapping between languages It describes the rules of how one language s built in types are converted to those of another language BFILES OF PROPERTIES The code can be generated out of prepared UML models The mapping between the identifiers used in the UML model and the language to which the model is being generated should be implemented This mapping includes the following sections e Build in types their default values e Generalization types e Possible class declarations Attributes and operations declaration and visibility modifiers e Code generation options The separate prop file is created for every language that is supported by MagicDraw Files are located in the lt MagicDraw installation directory gt data folder
80. ges and exits the dialog box Cancel Exits dialog box without saving changes Help Displays MagicDraw Help If you have a code set combined from several files you may see changes you wish to model without reversing all the code Only changed files should be reversed This type of reversing can be done by clicking the Refresh button on the set shortcut menu or by performing model refresh from the Code Engineering Sets dialog box JAVAREVERSE TO SEQUENCE DIAGRAM Java reverse to Sequence diagram functionality allows visualizing Java method implementation with UML Sequence diagram Created from method Sequence diagram cannot be updated every time new diagram should be generated 2005 No Magic Inc 1 13 Introduction MagicDraw Code Engineering To launch Sequence Diagram from Java Source Wizard and specify options needed for the reverse e You are able to reverse any operation from the Browser right click an operation choose Reverse Implementation and launch Sequence diagram from Java Source Wizard e From the Tools menu choose Model Vlsualizer and then choose Sequence Diagram from Java Source Wlzard e When reversing in the Reverse Options dialog box choose Launch Model Visualizer and then choose Sequence Diagram from Java Source Wizard The more detailed example of how this functionality works see MagicDraw Tutorials pdf which is locate in lt MagicDraw installation directory manual folder Sequence Diagram
81. gic Inc 5 97 EE MagicDraw Code and Database Engineering XML Schema XML Representation Summary minExclusive Element Information ltem minExclusive fixed boolean false id ID value anySimpleType any attributes with non schema namespace gt Content annotation lt minExclusive gt value must be in the value space of base type definition Example The following is the definition of a user derived datatype which limits values to integers greater than or equal to 100 using minExclusive simpleType name more than ninety nine gt lt restriction base integer gt lt minExclusive value 99 gt anol gt lt simpleType gt Note that the value space of this datatype is identical to the previous one named one hundred or more minExclusive UML Model example For an example see Section simpleType UML Model example on page 5 107 maxExclusive Maps to UML Attribute with stereotype XSDmaxExclusive Name and type of such attribute does not make sence e value to Attribute initial value XML Representation Summary maxExclusive Element Information Item lt maxExclusive fixed boolean false id ID value anySimpleType fany attributes with non schema namespace Content annotation lt maxExclusive gt value must be in the value space of base type definition 5 98 2005 No Magic Inc MagicDraw Code
82. gt httpJ nomagic com schem a xsd lt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt lt xs include schemaLocation http nomagic com schema xsd gt lt xs schema gt XML schema namespaces Maps to UML Package with stereotype XSDnamespace In order to define xmlns attribute in the schema file Permission between XSDnamespace package and XSDschema class must be added into the model e The Permission name maps to namespace shortcut Example lt xs schema xmlns xs http www w3 0rg 2001 XMLSchema xmlns http www w3 org 2001 XMLSchema targetNamespace http www example com example gt xs schema The XML representation of the skeleton of a schema In order to generate such namespaces UML model must have Package with name htto www w3 org 2001 XMLSchema e UML model must have Package with name http www example com example e Permission with name xs must be added into model between XMLSchema Class and Package http www w3 org 2001 XMLSchema e Permission without name must be added into model between XMLSchema Class and Package http www w3 org 2001 XMLSchema 5 140 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema XML schema namespaces UML Model example For an example see Section schema UML Model example on page 5 134 XSD FILE CREATION WITH MAG
83. gt stereotype cb ca table A table B id integer gt gt 1 integer lt lt FKe gt ssFK 2 FK 1 b id FK columns b id PK columns id Figure 17 Cardinalities of 1 N relationship For 1 N relationship allowed cardinalities for end A are 0 1 N For end allowed cardinalities are O 1 see Cardinalities of 1 N relationship16 Cardinalities of 1 N association Concrete cardinalities of A and B ends are mapped to different data model constraints if any 1 IfA end does not allow N cardinality the UNIQUE constraint is assigned to b id column When b id column has the UNIQUE constraint every instance of A class references a unique instance of B class if any Given B class instance is associated with the unique instance of A class if any This means that A end has no N cardinality 2005 No Magic Inc 2 35 yE MagicDraw Code Engineering Database Engineering 2 f B end does not allow cardinality NOT NULL constraint is assigned to b id column When b id column has NOT NULL constraint every A class references some B class This means that ca role does not allow O cardinality c id FK columns c id 1 PK columns id Figure 18 1 N relationship and mapped representation Script creating 1 N relationship CREATE TABLE Company id INTEGER NOT NULL PRIMARY KEY CREATE TABLE Employee c id INTEGER NOT NULL CONSTRAINT FK
84. hen asserted together to refer to vehicles via the carRef constraint The requirement that a vehicle s state match its containing state s code is not expressed here selector and field UML Model example For an example see Section keyref UML Model example on page 5 122 annotation Maps to UML Comment with or without stereotype XSDannotation Documentation s content maps to UML Comment body name documentation maps as UML comment e content value shall be comment name e xml lang value tag xml lang value e source value tag source value appinfo maps as tag value with name applnfoSource e source value will be tag value e content will be documentation for tagged value Appearing several annotation nodes on one element node mapping shall be done in following way e documentation text shall be merged into one UML comment with merged content but content and xml lang tag values shall represent only first matched values 5 126 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema e applnfo shall have content merged into one tag applnfoSource comment but tag value shall represent first matched appinfo XML Representation Summary annotation Element Information ltem annotation id ID any attributes with non schema namespace Content appinfo documentation lt annotation gt lt appinfo source anyURI gt Cont
85. hout massive redeclaration of the default namespace either internal references to the names being defined in a schema document or the schema declaration and definition elements themselves must be explicitly qualified This example takes the first option most other examples in this specification have taken the second 5 138 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema import UML Model example lt lt xXSDnamespace gt http Avww w3 org 1999 xhtml schem aLocati ondhttp Jews org 999 5dhtm lt lt kSDnam espace gt gt http Avww w3 0rg 2001 X ML Schema lt lt xmins gt lt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt xs import namespace http www w3 org 1999 xhtml schemaLocation http www w3 org 1999 xhtml gt lt xs schema gt include Maps to UML Component with stereotype XSDinclude Component must be added into xsd file component e annotation maps to UML Component documentation e schemaLocation maps to UML Component name XML Representation Summary include Element Information ltem include id ID schemaLocation anyURI attributes with non schema namespace Content annotation include 2003 No Magic Inc 5 139 EE MagicDraw Code and Database Engineering XML Schema include UML Model example lt lt xSDin clude gt
86. ield Attribute AssociationEnd Indicates that the Attribute or Association End represents a container managed field for an EJB Entity Bean with container managed persistence EJBCmrMethod Dependency A UML Dependency with the EJBRelationshipRole Association End as the client and the abstract get set Methods of the relationship as the suppliers This connects the EJB Relationship to the pair of container managed relationship methods and allows the decoupling of the role name to the name of the CMR fields EJB 2 0 only EJBCreate Operation Indicates that the Operation represents an EJB Create Method 2005 No Magic Inc MagicDraw Code Engineering EJB 2 0 UML EJBEnterpriseBean Class Specializes the standard UML Stereotype implementationClass An abstract Class that represents an EJB Enterprise Bean The stereotype is applied to the implementation class for the EJB EJBEntityBean Class Indicates that the Class represents an EJB Entity Bean Specializes EJBEnterpriseBean EJBFinder Operation Indicates that the Operation represents an EJB Finder Method EJBHome Operation Indicates that the Operation represents an EJB Home Method e herlocal or remote which is a class level business method as opposed to a create finder efc method Contrast with EJBBusiness EJBLocalMethod Operation Indicates that the Operation represents
87. ion gt fraction digits documentation lt xs documentation gt lt xs annotation gt lt xs fractionDigits gt lt xs totalDigits id totalDigitsID fixed false value 8 gt lt xs annotation gt lt xs documentation gt total digits id lt xs documentation gt lt xs annotation gt lt xs totalDigits gt lt xs imaxInclusive maxinclusiveid fixed true value 100 gt xs annotation gt lt xs documentation gt max inclusive documentation lt xs documentation gt lt xs annotation gt lt xs maxInclusive gt xs minlInclusive id mininclusiveid fixed true value 100 gt 5 94 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema xs annotation xs documentation min inclusive documentation lt xs documentation gt lt xs annotation gt lt xs miniInclusive gt xs maxExclusive id maxexclusiveid fixed true value 101 gt xs annotation gt lt xs documentation gt max exclusive documentation lt xs documentation gt lt xs annotation gt xs maxExclusive xs minExclusive id id fixed true value 99 gt xs annotation xs documentation min exclusive documentation lt xs documentation gt lt xs annotation gt xs minExclusive lt xs restriction gt lt xs simpleType gt lt xs simpleType name dayTime gt xs annotation gt lt xs documentation gt day time documentation lt
88. ips 2 57 Short representation for primary key constraint 2 57 Primary key constraint with overhead info 2 58 2005 No Magic Inc MagicDraw Code Engineering User s Guide Contents 2005 No Magic Inc MagicDraw Code Engineering User s Guide Contents 2005 No Magic Inc INTRODUCTION OVERVIEW MagicDraw code engineering provides a simple and intuitive graphical interface for merging code and UML models as well as preparing both code skeletons out of UML models and models from code MagicDraw code engineering implements several cases where code engineering may by very useful e You already have code that needs to be reversed to a model e You wish to have the implementation of the created model e You need to merge your models and code The tool may generate code from models and create models out of code reverse Changes in the existing code can be reflected in the model and model changes may also be seen in your code Independent changes to a model and code can be merged without destroying data in the code or model MagicDraw UML code engineering supports Java C CORBA IDL DDL XML Schema WSDL and C languages also EJB 2 0 UML notation is supported You may model EJB classes and generate descriptors for them You may also reverse descriptors and will get a model describing your Enterprise Java Beans Your models can be converted to any of those languages or UML models can be created from the source
89. is not the part of the SQL2 standard it is an analogue of a Database a Catalog NOTE A Catalog has no explicit definition statement If a database package for a Catalog does not exist it should be created when it is referred for the first time Cloudscape Informix Cloudscape v3 5 dialect has no database definitions statement A database package with the name specitied by CurrentDatabaseName property is used This dialect has CREATE INDEX and CREATE TRIGGER statements that are not the part of a SQL2 standard but that should be taken into account while reversing DDL script of this dialect This dialect has some syntax differences from SQL2 standard because of extensions e g some schema definition statements can have PROPERTIES clause These extensions are ignored while reversing Oracle Oracle8 Oracle Oracle8 dialect has CREATE DATABASE CREATE INDEX and CREATE TRIGGER statements that are not the part of SQL2 standard but that should be taken into account while reversing DDL script of this dialect This dialect has some syntax differences from SQL2 standard because of extensions e g some schema definition statements can have STORAGE clause These extensions are ignored while reversing Oracle Oracle8 has object oriented DDL statements CREATE TYPE and CREATE TYPE BODY Additional object oriented Oracle8 schema objects are Object Types Nested Object Types Nested Table VARRAY Object Tables and Object Views 2 50 20
90. ived bl id INTEGER NOT N b2 id INTEGER NOT N PRIMARY KEY bl id b2 id CONSTRAINT FK 1 FOREIGN KEY bl id REFERENCES Basel id CONSTRAINT FK 2 FOREIGN KEY b2 id REFERENCES Base2 id Not supported UML constructs Constructs that are not mapped into DDL script because this would lead to a generation of an illegal DDL code e Duplicated names are not allowed NOTE Uppercase and lowercase letters are equivalent e Database package cannot contain two schema packages with the same name e Schema package cannot contain two UML constructs that are mapped to the schema elements such as table classes view 2 38 2005 No Magic Inc MagicDraw Code Engineering Database Engineering classes index operations and trigger operations that have the same name e Table class cannot have two column attributes or constraint operations with the same name e View class cannot have two column attributes with the same name e Table class cannot have two operations with the lt lt PK gt gt stereotype because a table can have only one primary key if any e References to non existing columns are illegal e The parameter name of an operation with a DDL stereotype lt lt gt gt lt trigger gt lt lt PK gt gt lt lt unique gt gt lt lt gt gt must be the name of an existing column attribute
91. ived column list FROM table list View name is equal to the class name The view schema name is the name of a package that contains view class Table list within view FROM clause are derived from dependencies between the view class and tables classes e Otherwise it is not mapped NOTE If a class has no stereotype and the EnableDefaultStereotypes property is true the class is treated as a class with the lt lt table gt gt stereotype reference lt lt refefence gt Figure 14 Class mapping example DLL script generated for classes is showed in Class mapping example It has two Table definition statements CREATE TABLE and view definition statement CREATE VIEW CREATE TABLE Person id integer Socialld number 10 lastName varchar 20 firstName varchar 10 sex char 1 CREATE TABLE Account accountNo integer balance float 5 DEFAULT 0 0 personalld integer CREATE VIEW ImportantClient AS SELECT P Account balance as total FROM Person Account 2 32 2005 No Magic Inc MagicDraw Code Engineering Database Engineering Attributes An attribute of a class with the lt lt table gt gt or the lt lt view gt gt stereotype depending on an attribute stereotype is mapped to one of the following DDL constructs e A Column of a Table if the class that contains an attribute has the lt lt table gt gt stereotype A Co
92. leContent Class simpleContentld string XSDcomplexContent Class complexContentld string complexContentMixed XSDgroup XSDcomponent Class XSDgroupRef XSDcomponent Attribute sequenceOrder a AssociationEnd number in sequence order XSDall Class allld string maxOccurs minOccurs 5 78 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema XSDchoice Class choiceld string maxOccurs minOccurs sequenceOrder a number in sequence order XSDsequence Class sequenceld string maxOccurs minOccurs sequenceOrder a number in sequence order XSDrestriction XSDcomponent Generalization XSDextension XSDcomponent Generalization XSDattributeGroup Class XSDcomponent XSDsimpleType Class XSDcomponent final Zall list union restriction XSDlist Class XSDcomponent listld string XSDunion Class XSDcomponent unionld string XSDannotation XSDcomponent Comment applnfoSource applnfoContent source xml lang XSDany XSDcomponent Attribute namespace string processContents lax skip strict default strict sequenceOrder a number in sequence order XSDanyAttribute XSDcomponent Attribute namespace string processContents lax skip strict default strict XSDschema XSDcomponent Class attributeFormDefault blockDefault elementFormDefault
93. lect method in an EJB Entity Bean EJB 2 0 only EJBSecurityRoleRef Association Indicates a Dependency between an EJB client and an EJB Role Name Reference supplier TAGGED VALUES Tagged Value Applies To Definition EJBAbstractSchemaName Class EJBEntityBean A String representing the abstract name used for a schema associated with a CMP 2 0 entity bean EJBAcknowledgeMode Class EJBMessageDrivenBean An enumeration with values Auto Acknowledge or Dups OK Acknowledge indicating the type of message acknowledgment used for the onMessage message of a message driven bean that uses bean managed transaction demarcation EJBComponentInterface Dependency EJBReference or EJBLocalReference The name of the EJB Enterprise Bean s Component Interface local or remote 2005 No Magic Inc MagicDraw Code Engineering EJB 2 0 UML EJBCmpVersion Class EJBEntityBean An enumeration with values 1 x or 2 x Indicates the type of CMP used by the EJB Entity Bean EJBCmrFieldType AssociationEnd Type expression property of the EJBRelationshipRole supplier UML Association End EJBRelationshipRole EJBDisplayName Class EJBEnterpriseBean A String with the name for the EJB to be displayed by tools EJBEnvEntries Class EJBEnterpriseBean A string of XML tags designating the environment entries used by the EJB Enterprise Bean EJBHomelnterface Dependenc
94. les tab Specify Working Directory for displaying source files This option indicates files and required sub directories where a code generation output goes Type a path manually or by browsing in the directory tree by clicking the button The Working Package option allows to define any package for reverse output or code generation Model will be reversed or code generated from this specified package The Round Trip Set dialog box has two tabs Add Files and Add Data from Model The Add Files tab helps you manage the files of source code involved in your code engineering set Element name Function All files Helps you find directories with the source files for the set Files of type Contains possible file name extensions for the chosen language 1 8 2005 No Magic Inc MagicDraw Code Engineering Introduction The Add Data from Model tab helps you manage elements located in the UML model iM j x Working Directory C i2sdk1 4 2_03 demo T Working Package Data Add Files Add Data from Model All data Set B Data H E File View 8 5 java Blink java E Clock java B CLSFractaljava E CLSRule java E CLSTuttle java Add All Add Recursively Remove pE DrawControls pE DrawPanel Remove All if DrawTest i OK Help Figure 4 Round Trip Set dialog box Add data trom model tab The All Data list contains the hierarchy of UML model packages with model eleme
95. lobal attr group2 gt xs attribute name city type xs string xs attributeGroup lt xs schema gt simpleType Maps to UML Class with stereotype XSDsimpleType XML Representation Summary simpleType Element Information ltem lt simpleType final fall list union restriction any attributes with non schema namespace gt Content annotation restriction list union lt simpleType gt lt restriction base QName id ID any attributes with non schema namespace Content annotation simpleType minExclusive minInclusive maxi maxInclusive totalDigits fractionDigits length minLength maxLeng whiteSpace pattern lt restriction gt lt list id ID itemType QName fany attributes with non schema namespace Content annotation simpleType lt list gt lt union id ID memberTypes List of QName attributes with non schema namespace Content annotation simpleType lt union gt 2005 No Magic Inc 5 91 EE MagicDraw Code and Database Engineering XML Schema Example xs simpleType name farenheitWaterTemp gt lt xs restriction base xs number gt lt xs fractionDigits value 2 gt lt xs minExclusive value 0 00 gt lt xs maxExclusive value 100 00 gt lt xs restriction gt lt xs simpleType gt The XML representation of a simple type definition
96. ltem element abstract boolean false block all List of extension restriction substitution default string final fall List of extension restriction fixed string form qualified unqualified I maxOccurs nonNegativeInteger unbounded minOccurs nonNegativeInteger 1 name NCName nillable boolean false ref QName substitutionGroup QName type QName any attributes with non schema namespace gt Content annotation simpleType complexType unique key keyr lt element gt ref value is generated from ref or refString TaggedValue One of ref or name must be present but not both If ref is present then all of lt complexType gt lt simpleType gt lt key gt lt keyref gt lt unique gt nillable default fixed form block and type must be absent i e only minOccurs maxOccurs id are allowed in addition to ref along with lt annotation gt Example lt xs element name PurchaseOrder type PurchaseOrderType gt lt xs element name gift gt lt xs complexType gt lt xs sequence gt lt xs element name birthday type xs date gt lt xs element ref PurchaseOrder gt lt xs complexType gt lt xs element gt 2005 No Magic Inc 5 83 EE MagicDraw Code and Database Engineering XML Schema element UML Model example lt lt SDelement gt gt 1 sumam lt xs schem
97. lumn name is equal to the name of an attribute A Column type is equal to the type of an attribute Column default value is equal to the initial value of an attribute if any e A Column of a View if the class that contains an attribute has the lt view gt stereotype Elements column expression AS column name gt A Column name is equal to the name of an attribute Column expression is equal to the initial value of an attribute if any lt stable gt gt Table1 lt lt yieywr gt fa View1 011 integer 0 1 123 bansa Figure 15 Attributes mapping example Coll attribute of the Tablel class see Attributes mapping example 4 is mapped to the coll column of a Table table and coll attribute of the View class is mapped to the coll column of a View view There is DDL script for attributes mapping example CREATE TABLE Tablel coll integer DEFAULT 123 CREATE VIEW viewl AS SELECT Tablel coll AS vl FROM Tablel Operations An operation method of a class with the lt lt table gt gt stereotype depending on an operation s stereotype is mapped to one of the following DDL constructs e An Index for a Table if the operation has the lt lt index gt gt stereotype Elements CREATE INDEX lt schema_name gt lt index_name gt ON lt table name column list An Index name is equal to the name of an operation Names of comma delimited set of column f
98. ng XML Schema lt xs schema gt complexType Complex type maps to UML Class with stereotype XSDcomplexType e abstract to UML Class abstract value true false e annotation to UML Class documentation e attribute to inner UML Class Attribute or UML Association End e attributeGroup to UML AssociationEnd or UML Attribute with type XSDattributeGroup e name to UML Class name This class also can have stereotypes XSDsimpleContent XSDcomplexContent XSDall XSDchoice XSDsequence No stereotype the same as XSDsequence Generalization between complex type and other type has stereotype XSDrestriction or XSDextension We assume stereotype XSDextension if generalization do not have stereotype Some complex mapping e complexType with simpleContent to UML Class This class must be derived from other class and can must have stereotype XSDsimpleContent e complexType with complexContent to UML Class This class must be derived from other class and must have stereotype XSDcomplexContent e complexType with group all choice or sequence to UML class with appropriate stereotype complexType abstract boolean false block all List of extension restriction final all List of extension restriction id ID mixed boolean false name NCName any attributes with non schema namespace gt Content annotation simpleContent complexCon
99. non schema namespace Content annotation selector field lt key gt key UML Model example For an example see Section keyref UML Model example on page 5 122 keyref Maps to UML Attribute added into some UML Class e refer to value of refer or referString TaggedValue e name to Attribute name e id to TaggedValue lt keyref id ID name NCName refer QName fany attributes with non schema namespace Content annotation selector field lt keyref gt 2003 No Magic Inc 5 121 S MagicDraw Code and Database Engineering XML Schema keyref UML Model example lt lt XSDschem a2 schema ftargetNam espace http nomagic com xm Ins nm http nom agic com WA S Samen XSDelem ent person personType lt lt kKSD elem ent root rootTypetkey unique keyfRefsstate vehicleState regKey cari ef lt lt kSD elem ent state stateTypetkey unique key ef reg XSD elem ent vechicle vechicleType lt lt kSPke ye gt regkey selector vehide field state plateN umber lt lt kSDkey gt state field code selector J state WAR SF lt lt XS Dey ef 7 carR efiselectorz J car ield regState regP late refr regkey XSDkeyR ef gt gt vehicleState re fer state selector vehide feld state WOH A rique 5 4 gt umber selector vehicle XSDcom plexT ype gt lt lt XSDcomplexType
100. nts or other packages inside of them Your code engineering set can be combined out of model and code elements The following buttons are available in the Round Trip Set dialog box Add The selected file in the All Files or All Data list is added to the set Add All All files in the opened or selected directory are added to the set Add Recursively All files in the selected directory and its subdirectories are added to the set Remove Removes the selected entity from the set Remove All Removes all entities from the set MGENERATE CODE You may generate code for the selected and prepared set and directly for model elements 2005 No Magic Inc 1 9 MagicDraw Code Engineering Introduction Code Generation for Set Start code generation once the set or sets are prepared For more details about creating and editing sets see Section Code Engineering Sets on page 1 6 e Choose Generate from the Code Engineering Sets item shortcut menu It allows code generating for all created sets e Choose Generate from the selected set shortcut menu It allows code generating only for the selected set The Code Generation Options dialog box appears IP Generation Options Untitledt Output Directory C Program Files MaaicDraw UML Ss Set as working directory Reverse before generation r If element deleted from model Delete code Comment code
101. og box 2005 No Magic Inc MagicDraw Code Engineering Introduction Java Documentation Properties dialog box To open the Java Documentation Properties dialog box In the Project Options dialog box Java Language Options group select the Java Doc processor in the Documentation field and click the button to open the Documentation Properties dialog box Bj Documentation Properties Classifier Operation Attribute Description Value is taken From model up Dawn Add Figure 11 Documentation Properties dialog box Box Name Function Tag Name Type a tag name Value the value of the tag Generate The selected tag will be placed in the generated code as a comment before classifier class or interface operation or attribute Up Moves the selected item up the list Down Moves the selected item down the list Add Adds a new item in the list Remove Removes the selected item from the list OK Saves changes and closes the dialog box Cancel Closes the dialog box without saving changes Help Displays MagicDraw Help 2005 No Magic Inc 1 23 MagicDraw Code Engineering Introduction Round Trip MagicDraw round trip keeps your code and model synchronized and because Round trip traces all the model and code changes you may freely change entity specifications without discarding code changes made outside the tool For example R
102. ontainer respectively EJBVersion EJB Deployment Profile Class EJBEnterpriseBean An enumeration with values 1 1 or 2 0 Indicates the EJB version of the EJB Enterprise Bean STEREOTYPES Stereotype Applies To Definition EJB JAR Artifact Specializes the Stereotype JAR Indicates Component that the Artifact represents an EJB JAR 2005 No Magic Inc MagicDraw Code Engineering 4 EJB 2 0 UML g EJBClientJAR Usage Indicates that the client of the Usage represents an ejb client jar for the EJB JAR represented by the supplier of the Usage EJBContainerTransaction Actor Indicates the type of transaction used for associated Methods It is combined with a transaction type stereotype such as EJBRequired See the following Table Container transactions are specified using one or more dependencies stereotyped EJBMethod from an EJB Enterprise Bean client to an EJB Container Transaction Actor supplier EJBEnterpriseBeanDeployment Component Indicates that the Component represents an EJB Enterprise Bean It resides in an EJB JAR It has tagged values for overriding default settings in the corresponding EJB Enterprise Bean Class For example these tagged values can be used to create a new EJB by specifying different EJB Home and EJB Remote interfaces for a shared EJB Enterprise Bean Class EJBEntityBeanDeployment Component Specializes the stand
103. or the index are equal to the parameter names of an operation 2005 No Magic Inc MagicDraw Code Engineering Database Engineering e Tags with names trigger action time trigger event and triggered action has meaning in DDL CG have meaning in the DDL CG if are specitied for an operation with stereotype lt The implementation tag specified for operation with stereotype trigger has no meaning for the DDL code generation since MD 6 0 version The implementation tag was split to three tags trigger action time trigger event and triggered action Values of these tags will be used then generating definition of a trigger CREATE TRIGGER ON REFERENCING e Aconstraint if the Operation has the lt lt PK gt gt lt lt unique gt gt or lt lt check gt gt stereotype Elements ALTER TABLE lt table name gt ADD CONSTRAINT lt constraint_name gt Constraint name is equal to the name of an operation e PRIMARY KEY pk column list Primary key column list contains all attributes with the lt PK gt stereotype e UNIQUE unique column list Unique constraint element unique column list is generated from operation s parameter names e CHECK check expression Check constraint element check expression is generated from tag named Implementation Otherwise it is not mapped NOTES IndexNamePrefix property specifies an optional naming standard that is added to the beginning of the name for each gener
104. ound Trip prevents a job from being damaged by code additions or changes when these steps are followed Within the tool class Base is created 1 2 3 4 5 Operation getlnstance is added to class Code is generated With external tool programmer adds code to that operation With MagicDraw UML operations name is changed to Instance Code is generated If the tool rewrites the whole code these changes are made without corrupting the programmer s job The name of the operation is changed but the internals remain the same Round trip catches all changes in your project and controls the following actions If the source code is not changed it is not allowed to refresh UML model The Refresh command from the set shortcut menu is unavailable If the model is changed but the code remains the same new members were added or their headers were changed refresh is not allowed and the Refresh command from the set shortcut menu is unavailable When generating code according to changes all changes in the model are written to the signatures of class members leaving the old implementation in place If the code is changed but the model remains the same refresh can be executed code will be reversed to the UML models If the Code Generation Options dialog box appears when you are attempting to generate code you may select a code action that differs from the UML model If the code and model are changed while refreshing all chan
105. properties styles Default Working Directory Code Engineering amp If Default Default 8 9 Shapes lt install root gt 7 Paths Default Working Package i Diagram Stereotypes Engineering e venera dn Default Paths For References is 1 gP Reverse Default encoding J Java Language Options J Language Options efauk M tl Ctt Language Options CORBA IDL 3 0 language of ioe DDL Language Options Default language Java v Use syntax checker Directory For Temporal Files Active Directory US Reset to Defaults OK Help Figure 9 Project Options dialog box The Project Options dialog box has two main collections of customizable options which are represented by the hierarchy tree on the left side of the dialog box e Styles expands the tree hierarchy of all the styles defined within the project You may use as many of these styles as you wish See MagicDraw main User s Manual working with Projects Section e Code engineering these options are found on the right side of the Project options dialog box e Default Working Directory field type the name or browse by clicking the button in the working directory 1 18 2005 No Magic Inc MagicDraw Code Engineering Introduction e Default Working Package allows to define any package for revers
106. r nm regKey gt xs annotation gt lt xs documentation gt key ref documentation lt xs documentation gt ll 2003 No Magic Inc 5 123 EE MagicDraw Code and Database Engineering XML Schema lt xs annotation gt lt xs selector xpath car gt lt xs field xpath regState gt lt xs field xpath regPlate gt lt xs keyref gt lt xs element gt lt xs simpleType name twoLetterCode gt xs restriction base xs string lt xs simpleType gt lt xs schema gt ll selector and field Maps to UML TaggedValues named selector and field of UML Attribute representing key keyRef or unique selector tag has value representing xpath and field list of values representing field xpath ID values shall be skipped and annotation documentation will be applied to tagged value according to annotation rule see annotation For field values annotation documentation shall be merged in one lt selector id ID xpath a subset of XPath expression see below any attributes with non schema namespace gt Content annotation lt selector gt lt field id ID xpath a subset of XPath expression see below any attributes with non schema namespace gt Content annotation field Example lt xs key name fullName gt lt xs selector xpath person gt lt xs field xpath forename gt lt xs field xpa
107. ring IJ Database Engineering included and optionally the uniqueness of the index An index can include multiple columns or just a single column An index is represented as an operation with the lt index gt stereotype and parameter list The operation name is equal to the index name and the parameter list of the operation is a column names for the index The uniqueness of the index is ignored not mapped DDL script for an index example that creates the Person table and two indexes CREATE TABLE Person id INTEGER NOT NULL PRIMARY KEY socialId NUMBER 10 NOT NULL UNIQU lastName VARCHAR 20 NOT NULL firstName VARCHAR 10 NOT NULL sex CHAR 1 Gl CREATE UNIQUE INDEX bySocialId ON 1 1 CREATE INDEX byName ON Person lastName firstName Representation using UML concepts Figure 32 Index example Trigger A trigger is an activity executed by the DBMS as a side effect or instead of a modification of a table or view to ensure consistent system behavior on data operations A Trigger is represented as an operation with the lt lt gt gt stereotype DDL script for trigger example that creates trigger Gl CREATE TRIGGER logActions BEFORE INSERT OR DELETE OR UPDATI ON Person triggered SQL statement Representation using UML con
108. se is an opposite operation to the code generation The existing code can be converted to UML models with the help of MagicDraw reverse mechanism Prepare the sets in the exact same way that you did for code generation see Section Code Engineering Sets on page 1 6 2005 No Magic Inc 1 11 MagicDraw Code Engineering Introduction e Choose Reverse from the Code engineering sets item shortcut menu It allows code reversing for all already created sets e Choose Reverse from the selected set shortcut menu The UML model for the component can be reversed in the same way Just select the component you are interested in from the browser and click Reverse on it shortcut menu Models can be reversed without creating a set To reverse a model without creating a set 1 From the Tools menu choose Quick Reverse The Round Trip Set dialog box appears 2 Select the files from the Round Trip Set dialog box Add Files tab 3 Click OK The Reverse Options dialog box appears Reverse Options Untitledt Visualization rr Launch Model Visualizer Create new Class Diagram Add to active diagram General IV Look for classes classpath Create class fields as Attributes Associations Reset already created fields r Model refresh type Merge model and code Change model according to code OK Cancel Help Figure 6 Revers
109. straint example 2005 No Magic Inc 2 45 MagicDraw Code Engineering Database Engineering M UNNAMED CONSTRAINT REPRESENTATION AS A STEREOTYPE OF AN ATTRIBUTE Some column characteristics column primary key constraint column uniqueness constraint that apply to one specific column may be represented as stereotype of that attribute Example DDL script CREATE TABLE ConstraintExamplel coll INTEGER PRIMARY KEY col2 INTEGER UNIQUE Representation using UML concepts Figure 30 Column with unnamed constraint example Only one constraint can be represented as stereotype because only one stereotype can be assigned for the attribute If there are other constraints they should be represented as operations Although attribute may have several such constraints assigned in practice there is no need for more than one If attribute has primary key constraint it is unique too Example DDL script here unique constraint is unnecessary CREATE TABLE ConstraintExample2 coll INTEGER PRIMARY KEY UNIQUE Representation using UML concepts Figure 31 Column with two unnamed constraints example Index An Index is a physical data structure that speeds up the access to data It does not change the quality or the quantity of data retrieved The index specifies the columns 2 46 2005 No Magic Inc MagicDraw Code Enginee
110. t stereotype is created to represent Foreign Key Map indexes True default false An operation with lt lt gt gt stereotype is added into class to represent index Map triggers True default false An operation with lt lt trigger gt gt stereotype is added into class to represent trigger Map views Generation features True default false A class with lt lt view gt gt stereotype is created to represent view Default attribute multiplicity 0 0 1 any entered by user If the attribute multiplicity is not specitied the value of this property is used 2005 No Magic Inc MagicDraw Code Engineering Database Engineering Generate Null constraint True false default If true generates NULL constraint for column attribute with 0 1 multiplicity If DBMS you use support NULL you can enable this to generate NULL constrains See also GenerateNotNullConstraint AttributeDefaultMultiplicity Generate extended index True false default name Generate extended True false default trigger name If true generates index name of the form TableName IndexName If true generates trigger name of the form TableName TriggerName Generate index for True default false primary key If the DBMS you use requires explicit indexes for primary key you may enable explicit index creation using this flag See also GeneratelndexForUnique
111. t lt table gt gt Employee DESEE 19 1 lt lt PK gt id integer PK id integer FK ee FK columns id lt lt FK gt gt FK_1 id PK columns id lt stable gt gt Director i Figure 20 Single Inheritance and mapped representation Single inheritance can be modeled with the 1 1 relationship by creating the foreign key constraint on primary key in the derived class A script that creates a single inheritance CREATE TABLE Employee id INTEGER NOT NULL PRIMARY KEY TABLE Director id INTEGER NOT NULL PRIMARY KEY CONSTRAINT FK 1 FOREIGN KEY id REFERENCES Employee id NOTE The Employee table may have rows that do not have their counterpart rows within Director table MULTIPLE INHERITANCE The mapping of a multiple inheritance is similar to the mapping of a single inheritance 2005 No Magic Inc 2 37 yE MagicDraw Code Engineering Database Engineering FKcolumns2pi jd FK columns b2 id PK columns id PK columns id FK Figure 21 Multiple Inheritance and mapped representation A script that creates a multiple inheritance CREATE TABLE Basel id INTEGER NOT NULL PRIMARY KEY CREATE TABLE Base2 id INTEGER NOT NULL PRIMARY KEY CREATE TABLE Der
112. tation attribute attributeGroup anyAttribute lt attributeGroup gt When an lt attributeGroup gt appears as a daughter of lt schema gt or lt redefine gt it corresponds to an attribute group definition as below When it appears as a daughter of lt complexType gt or lt attributeGroup gt it does not correspond to any component as such attributeGroup UML Model example lt xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchema targetNamespace http nomagic com gt lt xs attributeGroup name global_attr_group gt xs attribute name address type xs string gt lt xs attributeGroup gt xs attributeGroup name attr group name gt xs annotation gt xs documentation attribute group documentation lt xs documentation gt lt xs annotation gt xs attribute name surname type xs string gt 5 90 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema xs attribute name name type xs string gt xs annotation xs documentation name attribute documentation lt xs documentation gt lt xs annotation gt lt xs attribute gt xs attributeGroup ref nm global attr group2 gt xs annotation xs documentation gt reference documentation lt xs documentation gt lt xs annotation gt lt xs attributeGroup gt xs anyAttribute gt xs attributeGroup xs attributeGroup name g
113. te initial value or TaggedValue with name value XML Representation Summary pattern Element Information ltem pattern id ID value anySimpleType any attributes with non schema namespace Content annotation pattern value must be a valid regular Example The following is the definition of a user derived datatype which is a better representation of postal codes in the United States by limiting strings to those which are matched by a specific regular expression simpleType name better us zipcode restriction base string 9 9 5 0 9 44 9V restriction lt simpleType gt pattern UML Model example For an example Section simpleType UML Model example on page 5 107 enumeration Maps to UML Attribute with stereotype XSDenumeration e value to Attribute name 2005 No Magic Inc 5 105 EE MagicDraw Code and Database Engineering XML Schema XML Representation Summary enumeration Element Information ltem enumeration id ID value anySimpleType any attributes with non schema namespace Content annotation lt enumeration gt Example The following example is a datatype definition for a user derived datatype which limits the values of dates to the three US holidays enumerated This datatype definition would appear in a schema authored by an end user and shows how to define a
114. ted here and the additional property mappings are as below Note that either lt restriction gt or lt extension gt must be chosen as the content of lt complexContent gt but their content models are different in this case from the case above when they occur as children of lt simpleContent gt The property mappings below are also used in the case where the third alternative neither lt simpleContent gt nor lt complexContent gt is chosen This case is understood as shorthand for 5 86 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema complex content restricting the ur type definition and the details of the mappings should be modified as necessary complexContent id ID mixed boolean any attributes with non schema namespace gt Content annotation restriction extension complexContent restriction base OName id ID any attributes with non schema namespace gt Content annotation group all choic sequence attribute attributeGroup anyAttribute lt restriction gt lt extension base QName id ID any attributes with non schema namespace gt Content annotation group all choice sequence attribute attributeGroup anyAttribute lt extension gt 2005 No Magic Inc 5 87 S MagicDraw Code and Database Engineering XML Schema complexType UML Model example lt lt X
115. tent group al attribute attributeGroup anyAttribute lt complexType gt 2005 No Magic Inc 5 85 EE MagicDraw Code and Database Engineering XML Schema When the lt simpleContent gt alternative is chosen the following elements are relevant and the remaining property mappings are as below Note that either lt restriction gt or lt extension gt must be chosen as the content of lt simpleContent gt lt simpleContent id ID any attributes with non schema namespace gt Content annotation restriction extension simpleContent restriction base QName ID any attributes with non schema namespace gt Content annotation simpleType minExclusive minInclusive maxE maxInclusive totalDigits fractionDigits length minLength maxLengt whiteSpace pattern attribute attributeGroup anyAttribute lt restriction gt lt extension base QName ID any attributes with non schema namespace Content annotation attribute attributeGroup anyAttribute lt extension gt lt attributeGroup ID ref QName fany attributes with non schema namespace Content annotation lt attributeGroup gt lt anyAttribute When the lt complexContent gt alternative is chosen the following elements are relevant as are the lt attributeGroup gt and lt anyAttribute gt elements not repea
116. tent annotation lt totalDigits gt Example The following is the definition of a user derived datatype which could be used to represent monetary amounts such as in a financial management application which does not have figures of 1M or more and only allows whole cents This definition would appear in a schema authored by an end user and shows how to define a datatype by specifying facet values which constrain the range of the base type in a manner specific to the base type different than specitying max min values as before simpleType name amount gt restriction base decimal gt lt totalDigits value 8 gt SECACCIOMDIG ies wel mixed rrue gt lt restriction gt lt simpleType gt totalDigits UML Model example For an example see Section simpleType UML Model example on page 5 107 fractionDigits Maps to UML Attribute with stereotype XSDfractionDigits Name and type of such attribute does not make sence e value to Attribute initial value XML Representation Summary fractionDigits Element Information ltem fractionDigits fixed boolean false id ID value nonNegativeInteger any attributes with non schema namespace Content annotation fractionDigits 2005 No Magic Inc 5 101 EE MagicDraw Code and Database Engineering XML Schema Example The following is the definition of a user derived datatype which could be used to represent the magnitude of
117. th surname gt lt xs key gt xs keyref name personRef refer fullName gt xs selector xpath personPointer gt xs field xpath first gt xs field xpath last gt lt xs keyref gt xs unique name nearlyID gt lt xa selector xpath T gs lt xestiele pa ban lt xs unique gt XML representations for the three kinds of identity constraint definitions 5 124 2003 No Magic Inc MagicDraw Code and Database Engineering XML Schema Example lt xs element name state gt lt xs complexType gt lt xs sequence gt lt xs element name code type twoLetterCode gt lt xs element ref vehicle maxOccurs unbounded gt lt xs element ref person maxOccurs unbounded gt lt xs sequence gt lt xs complexType gt lt xs key name reg gt lt vehicles are keyed by their plate within states gt lt xs selector xpath vehicle gt lt xs field xpath plateNumber gt lt xs key gt lt xs element gt lt xs element name root lt xs complexType gt lt xs sequence gt lt xs element ref state maxOccurs unbounded gt lt xs sequence gt lt xs complexType gt lt xs key name state lt states are keyed by their code gt xs selector xpath state xs field xpath code gt xs key xs keyref name vehicleState refer state xL every vehicle rerors to lrs Stare gt lt xs selector xpath vehicle gt
118. trieve the list of available Schemas from the database click the button and select the schema The schema name appears in the Schema text box NOTE Only when all other properties in this dialog box are correctly defined the list of schemas can be retrieved Property The name of the JDBC driver property Name NOTE If using Oracle drivers while retrieving db info from Oracle db e To retrieve comments on table and column set property as remarks true e To connect to a db as sysdba set property as internal logon sysdba Debug JDBC If selected all output from a JDBC driver will be directed to Message Driver Window Relode Driver default the Reload Driver check box is selected If you want that driver to not be reloaded clear the check box NE FORWARD ENGINEERING TO DDL SCRIPT This section describes to what data model constructs MagicDraw constructs are converted Packages The Database is represented as a Package with the lt database gt stereotype Each View or Table can be assigned to a Schema where the Schema is represented as a Package with the lt schema gt stereotype 2 30 2005 No Magic Inc Database Engineering MagicDraw Code Engineering A Package depending on a package stereotype is mapped to one of the following DDL constructs NOTE e A Database if the package has the lt lt database gt gt stereotype Elements CREATE DATABASE lt database_name gt Databas
119. ue e annotation to UML Attribute or AssociationEnd documentation e name to UML Attribute or AssociationEnd name e type or content simpleType to UML Attribute or AssociationEnd type 5 80 2005 No Magic Inc MagicDraw Code and Database Engineering XML Schema Other attributes or elements maps to corresponding tagged values attribute default string fixed string form qualified unqualified id ID name NCName ref QName type QName use optional prohibited required optional any attributes with non schema namespace gt Content annotation simpleType attribute Example xs attribute name age type xs positiveInteger use required gt ref value is generated from ref or refString TaggedValue One of ref or name must be present but not both If ref is present then all of lt simpleType gt form and type must be absent type and lt simpleType gt must not both be present attribute UML Model example xs schema xmlns nm http nomagic com xmlns xs http www w3 org 2001 XMLSchemo targetNamespace http nomagic com gt 2005 No Magic Inc 5 81 EE MagicDraw Code and Database Engineering XML Schema xs attribute name name type xs string default minde fixed fixed value form qualified use optional gt xs annotation xs documentation name attribute documentation lt xs documentation gt lt
120. wing widely used by dialects statements that are not the part of 5012 e Database definition statement CREATE DATABASE that creates database e Index statements CREATE INDEX DROP INDEX that create an index on table and remove it e Trigger statements CREATE TRIGGER DROP TRIGGER that create a trigger on table and remove it The following table provides details on mapping on the supported SQL schema manipulation statements into MagicDraw constructs 2 56 2005 No Magic Inc MagicDraw Code Engineering Database Engineering DDL Statement or Action model Description Visible Concept Item Alter table statement Modify class Elements table name and alter Yes table action Alter table action one of add column add table constraint alter column drop table constraint drop column Add column definition Define attribute Elements column definition Yes Add table constraint Define method Elements table constraint Yes definition definition Alter column definition Modify attribute Elements mandatory column Yes name default clause for add detault statement only Drop table constraint Delete method Elements constraint name drop Yes definition behavior Drop column definition Delete attribute Elements column name drop Yes behavior Drop schema statement Delete package Elements schema name drop Yes behavior Drop table statement Delete class Elements table name drop Yes b
121. x has the following options only CREATE statements DROP amp CREATE statements CREATE OR REPLACE statements only for Oracle dialect default for this dialect DROP IF EXISTS amp CREATE statements only for MySQL dialect default for this dialect The following table provides SQL2 SQL schema statements that are supported and that are NOT supported in MagicDrawTM UML SQL schema statement SQL schema definition statement SQL schema manipulation statement Some SQL schema statements e g schema definition table definition allow implicit Supported Schema definition Table definition View definition Alter table statement Grant statement Domain definition Assertion definition Character set definition Collation definition Translation definition Drop table statement Drop view statement Revoke statement Alter domain statement Drop assertion statement Drop domain statement Drop character set statement Drop collation statement Drop translation statement Yes No Yes Yes Yes Yes No No Yes Yes No No No No catalog name and unqualified schema name In addition to SQL schema statements the following SQL session statements must be supported 2005 No Magic Inc 2 55 MagicDraw Code Engineering Database Engineering e Set catalog statement sets the current default catalog name e Set schema statement sets the current default unqualified schema name MagicDraw supports the follo
122. xs documentation gt lt xs annotation gt xs restriction gt xs annotation gt lt xs documentation gt restriction documentation lt xs documentation gt lt xs annotation gt lt xs simpleType gt xs restriction base xs number gt lt xs simpleType gt lt xs enumeration value day gt xs annotation gt lt xs documentation gt day value lt xs documentation gt lt xs annotation gt lt xs enumeration gt lt xs enumeration value night gt xs annotation gt lt xs documentation gt night value lt xs documentation gt xs annotation lt xs enumeration gt lt xs restriction gt lt xs simpleType gt lt xs simpleType name sex final restriction gt xs annotation gt lt xs documentation gt documentation of simple type restriction lt xs documentation gt lt xs annotation gt lt xs restriction base xs string gt lt xs enumeration id some_id value male gt lt xs enumeration value female gt xs annotation gt lt xs documentation gt female value lt xs documentation gt 2005 No Magic Inc EE MagicDraw Code and Database Engineering XML Schema lt xs annotation gt lt xs enumeration gt lt xs restriction gt lt xs simpleType gt lt xs schema gt list example termes lt lt 5 Drestriction gt gt inding binding lt xml version 1 0 encoding UTF 8
123. y EJBReference or EJBLocalReference The name of the EJB Enterprise Bean s Home Interface local or remote EJBLink Dependency EJBReference or EJBLocalReference The name of the referenced EJB Enterprise Bean if it is in the same Archive or another archive in the same J2EE Application Unit or a path to the bean EJBMessageDrivenDestination Class EJBMessageDrivenBean An XML tag designating the type of destination and the durability used by the EJB Message Driven Bean EJBMessageSelector Class EJBMessageDrivenBean A String specifying the JMS message selector to be used in determining which messages a message driven bean is to receive EJBNamelnJAR Class EJBEnterpriseBean The name used for the EJB Enterprise Bean in the EJB JAR Defaults to the name of the EJB Remote Interface EJBPersistenceType Class EJBEntityBean An enumeration with values Bean or Container Indicates whether the persistence of the EJB Entity Bean is managed by the EJB Entity Bean or by its container respectively EJBQueryString Operation EJBFinder or EJBSelect The EJB QL statement corresponding to the method It is ignored for BMP Entity Beans EJBReentrant Class EJBEntityBean A Boolean value indicating whether or not the EJB Entity Bean can be called re entrantly 2005 No Magic Inc EJB 2 0 UML MagicDraw Code Engineering

Download Pdf Manuals

image

Related Search

Related Contents

MM-1 - D&M Import Audio  96801 ICC1D service manual  Bedienungsanleitung varix home CLIP  Scarica - Moretti SpA    SDM630Pulse USER MANUAL 2014 V1.0  User`s Manual TNC 124 - Absolute Machine Tools  Info Pro n° 6 - Une souris verte  Planungshinweise  取扱説明書  

Copyright © All rights reserved.
Failed to retrieve file