From: Mark Addison Date: Fri, 3 Oct 2003 13:17:28 +0000 (+0000) Subject: Made dataType a proper obj instead of just a name. X-Git-Tag: v0.04~152 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5365ac899671d182b96411226f0ea170ab49505b;p=dbsrgits%2FSQL-Translator.git Made dataType a proper obj instead of just a name. --- diff --git a/lib/SQL/Translator/Parser/XML/XMI.pm b/lib/SQL/Translator/Parser/XML/XMI.pm index cbe69e2..b1e426c 100644 --- a/lib/SQL/Translator/Parser/XML/XMI.pm +++ b/lib/SQL/Translator/Parser/XML/XMI.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::XML::XMI; # ------------------------------------------------------------------- -# $Id: XMI.pm,v 1.9 2003-10-01 17:17:24 grommit Exp $ +# $Id: XMI.pm,v 1.10 2003-10-03 13:17:28 grommit Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Mark Addison , # @@ -30,7 +30,7 @@ Class diagrams stored in XMI format. use strict; use vars qw[ $DEBUG $VERSION @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -128,7 +128,7 @@ sub classes2schema { $data{default_value} = $attr->{initialValue} if exists $attr->{initialValue}; $data{data_type} = $attr->{_map_taggedValues}{dataType}{dataValue} - || $attr->{datatype}; + || $attr->{dataType}{name}; $data{size} = $attr->{_map_taggedValues}{size}{dataValue}; $data{is_nullable}=$attr->{_map_taggedValues}{nullable}{dataValue}; diff --git a/lib/SQL/Translator/XMI/Parser/V12.pm b/lib/SQL/Translator/XMI/Parser/V12.pm index c14d539..508c2f3 100644 --- a/lib/SQL/Translator/XMI/Parser/V12.pm +++ b/lib/SQL/Translator/XMI/Parser/V12.pm @@ -1,7 +1,7 @@ package SQL::Translator::XMI::Parser::V12; # ------------------------------------------------------------------- -# $Id: V12.pm,v 1.2 2003-10-01 17:45:47 grommit Exp $ +# $Id: V12.pm,v 1.3 2003-10-03 13:17:28 grommit Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Mark Addison , # @@ -31,7 +31,7 @@ SQL::Translator::XMI::Parser::V12 - Version 1.2 parser. use strict; use 5.006_001; use vars qw/$VERSION/; -$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; use base qw(SQL::Translator::XMI::Parser); @@ -119,10 +119,6 @@ $spec12->{attribute} = { default => "", }, { - name => "datatype", - path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)/@name', - }, - { name => "initialValue", path => 'UML:Attribute.initialValue/UML:Expression/@body', }, @@ -135,9 +131,32 @@ $spec12->{attribute} = { multiplicity => "*", map => "name", }, + { + name => "dataType", + path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)', + class => "dataType", + multiplicity => "1", + }, + ], +}; + +$spec12->{dataType} = { + name => "datatype", + plural => "datatypes", + default_path => '//UML:DataType[@xmi.id]', + attrib_data => + [qw/name visibility isSpecification isRoot isLeaf isAbstract/], + path_data => [ + { + name => "stereotype", + path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name', + default => "", + }, ], }; + + $spec12->{operation} = { name => "operation", plural => "operations",