ontomde-uml2 1.0.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest.txt +38 -22
- data/README.txt +21 -2
- data/Rakefile +1 -1
- data/bin/ontomde-umlToProtege +4 -0
- data/lib/ontomde-uml2.rb +19 -17
- data/lib/ontomde-uml2/UMLdatatypeMapping.rb +441 -0
- data/lib/ontomde-uml2/autoImplement.rb +170 -166
- data/lib/ontomde-uml2/check.rb +1 -1
- data/lib/ontomde-uml2/component.rb +45 -0
- data/lib/ontomde-uml2/createAndAdd.rb +32 -20
- data/lib/ontomde-uml2/dotDiagram.rb +1 -1
- data/lib/ontomde-uml2/kb.rb +4 -0
- data/lib/ontomde-uml2/kb/MYMODEL_kb.pprj +2377 -0
- data/lib/ontomde-uml2/kb/MYMODEL_kb.rdf +2 -0
- data/lib/ontomde-uml2/kb/MYMODEL_kb.rdfs +441 -0
- data/lib/ontomde-uml2/kb/MYMODEL_meta.pprj +874 -0
- data/lib/ontomde-uml2/kb/command.rb +143 -0
- data/lib/ontomde-uml2/kb/datatypeMapping.rb +99 -0
- data/lib/ontomde-uml2/kb/protege.rb +687 -0
- data/lib/ontomde-uml2/multipleInheritance.rb +1 -1
- data/lib/ontomde-uml2/salvageErrors.rb +1 -1
- data/lib/ontomde-uml2/select.rb +83 -5
- data/lib/ontomde-uml2/shortcut.rb +23 -8
- data/lib/ontomde-uml2/uml2.pprj +943 -0
- data/lib/ontomde-uml2/uml2.rb +62 -29
- data/lib/ontomde-uml2/uml2.rdf +768 -0
- data/lib/ontomde-uml2/uml2.rdfs +3233 -0
- data/lib/ontomde-uml2/umlx.rb +31 -9
- data/lib/ontomde-uml2/version.rb +1 -1
- data/lib/ontomde-uml2/versionSignature.rb +1 -1
- data/lib/ontomde-uml2/xsd.pprj +1063 -0
- data/lib/ontomde-uml2/xsd.rdf +2 -0
- data/lib/ontomde-uml2/xsd.rdfs +17 -0
- data/test/_test_dot.rb +1 -1
- data/test/_test_perf.rb +1 -1
- data/test/test_base.rb +1 -1
- data/test/test_clone.rb +5 -5
- data/test/test_misc.rb +3 -3
- metadata +47 -29
data/Manifest.txt
CHANGED
@@ -2,39 +2,55 @@ History.txt
|
|
2
2
|
Manifest.txt
|
3
3
|
README.txt
|
4
4
|
Rakefile
|
5
|
+
bin/ontomde-umlToProtege
|
5
6
|
lib/ontomde-uml2.rb
|
6
|
-
lib/ontomde-uml2/
|
7
|
-
lib/ontomde-uml2/
|
7
|
+
lib/ontomde-uml2/UMLdatatypeMapping.rb
|
8
|
+
lib/ontomde-uml2/autoImplement.rb
|
8
9
|
lib/ontomde-uml2/cardinality.rb
|
9
10
|
lib/ontomde-uml2/check.rb
|
10
|
-
lib/ontomde-uml2/
|
11
|
-
lib/ontomde-uml2/dotDiagram.rb
|
12
|
-
lib/ontomde-uml2/nt_old_to_nt_new.sh
|
11
|
+
lib/ontomde-uml2/component.rb
|
13
12
|
lib/ontomde-uml2/createAndAdd.rb
|
14
|
-
lib/ontomde-uml2/enumerated.rb
|
15
|
-
lib/ontomde-uml2/select.rb
|
16
|
-
lib/ontomde-uml2/salvageErrors.rb
|
17
|
-
lib/ontomde-uml2/multipleInheritance.rb
|
18
|
-
lib/ontomde-uml2/uml2.rb
|
19
|
-
lib/ontomde-uml2/owner.rb
|
20
|
-
lib/ontomde-uml2/versionSignature.rb
|
21
13
|
lib/ontomde-uml2/depencies.rb
|
14
|
+
lib/ontomde-uml2/dotDiagram.rb
|
15
|
+
lib/ontomde-uml2/enumerated.rb
|
22
16
|
lib/ontomde-uml2/extension.rb
|
23
|
-
lib/ontomde-uml2/umlx.rb
|
24
|
-
lib/ontomde-uml2/autoImplement.rb
|
25
|
-
lib/ontomde-uml2.rb
|
26
17
|
lib/ontomde-uml2/helper.rb
|
18
|
+
lib/ontomde-uml2/kb.rb
|
19
|
+
lib/ontomde-uml2/kb/MYMODEL_kb.pprj
|
20
|
+
lib/ontomde-uml2/kb/MYMODEL_kb.rdf
|
21
|
+
lib/ontomde-uml2/kb/MYMODEL_kb.rdfs
|
22
|
+
lib/ontomde-uml2/kb/MYMODEL_meta.pprj
|
23
|
+
lib/ontomde-uml2/kb/command.rb
|
24
|
+
lib/ontomde-uml2/kb/datatypeMapping.rb
|
25
|
+
lib/ontomde-uml2/kb/protege.rb
|
26
|
+
lib/ontomde-uml2/multipleInheritance.rb
|
27
|
+
lib/ontomde-uml2/nt_old_to_nt_new.sh
|
28
|
+
lib/ontomde-uml2/owner.rb
|
29
|
+
lib/ontomde-uml2/salvageErrors.rb
|
30
|
+
lib/ontomde-uml2/select.rb
|
27
31
|
lib/ontomde-uml2/shortcut.rb
|
32
|
+
lib/ontomde-uml2/uml2.pprj
|
33
|
+
lib/ontomde-uml2/uml2.rb
|
34
|
+
lib/ontomde-uml2/uml2.rdf
|
35
|
+
lib/ontomde-uml2/uml2.rdfs
|
36
|
+
lib/ontomde-uml2/uml2.rdfs.nt
|
37
|
+
lib/ontomde-uml2/uml2.rdfs.nt.completion.rb
|
38
|
+
lib/ontomde-uml2/umlx.rb
|
39
|
+
lib/ontomde-uml2/version.rb
|
40
|
+
lib/ontomde-uml2/versionSignature.rb
|
41
|
+
lib/ontomde-uml2/xsd.pprj
|
42
|
+
lib/ontomde-uml2/xsd.rdf
|
43
|
+
lib/ontomde-uml2/xsd.rdfs
|
44
|
+
test/_test_dot.rb
|
28
45
|
test/_test_perf.rb
|
29
|
-
test/
|
30
|
-
test/test_base.rb
|
31
|
-
test/test_ontomde-uml2.rb
|
46
|
+
test/model/.project
|
32
47
|
test/model/SID.emx
|
33
48
|
test/model/SID.emx.nt
|
34
|
-
test/model/simple2WithProfile.emx
|
35
|
-
test/model/simple2.emx
|
36
49
|
test/model/SID.uml2
|
37
|
-
test/model
|
50
|
+
test/model/simple2.emx
|
38
51
|
test/model/simple2.emx.nt
|
52
|
+
test/model/simple2WithProfile.emx
|
53
|
+
test/test_base.rb
|
39
54
|
test/test_clone.rb
|
40
|
-
test/
|
55
|
+
test/test_misc.rb
|
56
|
+
test/test_ontomde-uml2.rb
|
data/README.txt
CHANGED
@@ -5,7 +5,9 @@ ontomde-uml2
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
7
|
ontoMDE-uml2 contains UML2 meta-model and helper files to manipulate a UML2 model.
|
8
|
-
ontoMDE-uml2 uses
|
8
|
+
ontoMDE-uml2 uses ontoMDE-core which provides core fonctionalities for loading a model in RDF/RDFS format. ontoMDE-UML2 is used by ontoMDE-java which contains rules for generating java Code.
|
9
|
+
|
10
|
+
ontoMDE contains primitives for converting a UML2 model into a Prot�g� 2000 RDF/RDFS model. UML2 classes are converted into RDFS classes to allow data instances to be created. This feature is used heavily for providing editors for creating tests data for programs.
|
9
11
|
|
10
12
|
== FEATURES/PROBLEMS:
|
11
13
|
|
@@ -16,6 +18,21 @@ ontoMDE-uml2 uses ontoMDA-core which provides core fonctionalities for loading a
|
|
16
18
|
* UML model manipulations helpers (add interface implementations, transform multiple inheritance into single inheritance, ...)
|
17
19
|
|
18
20
|
|
21
|
+
UML2 to Protege 2000 features:
|
22
|
+
* single and incremental use.
|
23
|
+
* transparent update of name changes from source to target mode.
|
24
|
+
* class
|
25
|
+
* abstract class
|
26
|
+
* interface
|
27
|
+
* enumerated types
|
28
|
+
* generalization links
|
29
|
+
* implementation links
|
30
|
+
* property, association, composition and aggregation
|
31
|
+
* single and multivalued properties
|
32
|
+
* mandatory fields (cardinaly=0 or >0)
|
33
|
+
* UML documentation notes export to Protege 2000 for easy reference.
|
34
|
+
|
35
|
+
|
19
36
|
== SYNOPSIS:
|
20
37
|
|
21
38
|
require 'ontomde-uml2'
|
@@ -48,7 +65,9 @@ ontoMDE-uml2 uses ontoMDA-core which provides core fonctionalities for loading a
|
|
48
65
|
|
49
66
|
== REQUIREMENTS:
|
50
67
|
|
51
|
-
*
|
68
|
+
* ontomde-core gem
|
69
|
+
* ontomde-redland-win gem under windows. (REDLAND library is used to convert from Prot�g� 2000 RDF/XML and ontoMDE RDF/ntriples formats. ontoMDE is bundled with REDLAND for windows.
|
70
|
+
* redland rapper binary command installed and available in for path for Linux.
|
52
71
|
|
53
72
|
== INSTALL:
|
54
73
|
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ require './lib/ontomde-uml2/version.rb'
|
|
6
6
|
|
7
7
|
OntomdeHoe.new('ontomde-uml2', Ontomde::Uml2::VERSION) do |p|
|
8
8
|
p.rubyforge_name = 'ontomde'
|
9
|
-
p.author = '
|
9
|
+
p.author = 'Orange-labs BIZZ/CIL/SAM'
|
10
10
|
p.email = 'stephanepierre.carrie -nospam- @orange-ftgroup.com'
|
11
11
|
p.summary = 'OntoMDE UML2 handling cartridge'
|
12
12
|
p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
data/lib/ontomde-uml2.rb
CHANGED
@@ -10,22 +10,24 @@ require "#{__FILE__[0..-4]}/version.rb"
|
|
10
10
|
|
11
11
|
UML2_RDFS_NT_FILE="#{here}/uml2.rdfs.nt"
|
12
12
|
require 'ontomde-core'
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
13
|
+
require 'ontomde-uml2/extension.rb'
|
14
|
+
require 'ontomde-uml2/enumerated.rb'
|
15
|
+
require 'ontomde-uml2/umlx.rb'
|
16
|
+
require 'ontomde-uml2/cardinality.rb'
|
17
|
+
require 'ontomde-uml2/uml2.rb'
|
18
|
+
require 'ontomde-uml2/dotDiagram.rb'
|
19
|
+
require 'ontomde-uml2/createAndAdd.rb'
|
20
|
+
require 'ontomde-uml2/autoImplement.rb'
|
21
|
+
require 'ontomde-uml2/owner.rb'
|
22
|
+
require 'ontomde-uml2/select.rb'
|
23
|
+
require 'ontomde-uml2/depencies.rb'
|
24
|
+
require 'ontomde-uml2/multipleInheritance.rb'
|
25
|
+
require 'ontomde-uml2/salvageErrors.rb'
|
26
|
+
require 'ontomde-uml2/check.rb'
|
27
|
+
require 'ontomde-uml2/versionSignature.rb'
|
28
|
+
require 'ontomde-uml2/helper.rb'
|
29
|
+
require 'ontomde-uml2/shortcut.rb'
|
30
|
+
require 'ontomde-uml2/UMLdatatypeMapping.rb'
|
31
|
+
require 'ontomde-uml2/component.rb'
|
30
32
|
|
31
33
|
|
@@ -0,0 +1,441 @@
|
|
1
|
+
#Template used for jsp input field generation
|
2
|
+
|
3
|
+
#wrapper to easylly create a new datatype mapping
|
4
|
+
#* umlDataTypeName is the name of the data type in source uml model
|
5
|
+
#* baseMapping is the base definition mapping to derive from
|
6
|
+
#* regexp is the string regexp used for display
|
7
|
+
def addDataTypeMapping(umlDataTypeName,baseMapping,regexp=nil,&block)
|
8
|
+
if !baseMapping.kind_of?(Class)
|
9
|
+
raise Exception.new(%{Bad parameter type used for baseMapping got "#{baseMapping.class}" and expected "Class"})
|
10
|
+
end
|
11
|
+
|
12
|
+
rubyName=umlDataTypeName.tr('^a-zA-Z0-9','_')
|
13
|
+
s=%{
|
14
|
+
class DatatypeMapping#{rubyName} < #{baseMapping.name}
|
15
|
+
include Singleton
|
16
|
+
def appliesTo?(datatype)
|
17
|
+
return datatype.uml_name.to_s=="#{umlDataTypeName}"
|
18
|
+
end
|
19
|
+
#{regexp.nil? ? "" : %{
|
20
|
+
def getValidationRegexp
|
21
|
+
return /#{regexp.source}/
|
22
|
+
end
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
DatatypeMapping#{rubyName}.class_eval( &block ) unless block.nil?
|
27
|
+
|
28
|
+
DatatypeMapping#{rubyName}.instance #register
|
29
|
+
}
|
30
|
+
t=eval s
|
31
|
+
puts "Added datatype '#{umlDataTypeName}'"
|
32
|
+
end
|
33
|
+
|
34
|
+
class DatatypeMapping
|
35
|
+
include Singleton
|
36
|
+
def getMappings
|
37
|
+
return @@types
|
38
|
+
end
|
39
|
+
@@types=Array.new
|
40
|
+
def initialize
|
41
|
+
return if self.class==DatatypeMapping
|
42
|
+
@@types << self
|
43
|
+
#log.debug { %{registered(##{@@types.size}): #{self.class}} }
|
44
|
+
end
|
45
|
+
# returns true if this templates applies to datatype
|
46
|
+
def appliesTo?(datatype)
|
47
|
+
# inheriting class should redefine this method
|
48
|
+
log.error %{appliesTo? not implemented for #{self.class}}
|
49
|
+
return false
|
50
|
+
end
|
51
|
+
def getMapping(datatype)
|
52
|
+
@@types.each {|t|
|
53
|
+
next unless t.appliesTo?(datatype)
|
54
|
+
return t
|
55
|
+
}
|
56
|
+
if !datatype.context[:silentlyForceUnknownDatatypeToString,false]
|
57
|
+
msg= <<END
|
58
|
+
|
59
|
+
ERROR: OntoMDE generator encountered in your UML model
|
60
|
+
ERROR: an unknown datatype named "#{datatype}".
|
61
|
+
HELP:
|
62
|
+
HELP: OntoMDE should be provided a datatype mapping
|
63
|
+
HELP: definition in order to map your custom datatype
|
64
|
+
HELP: to target code (java conversion, jsp code,
|
65
|
+
HELP: ..., validation code, ...)
|
66
|
+
HELP: This mapping definition should be placed in a
|
67
|
+
HELP: file that is loaded by your ontomde generation script.
|
68
|
+
HELP: (ontomde-java script uses --load option
|
69
|
+
HELP: to load configuration files)
|
70
|
+
HELP:
|
71
|
+
HELP: Sample1:
|
72
|
+
HELP: restriction of DatatypeMappingText for string mapping
|
73
|
+
HELP: a particular regexp:
|
74
|
+
HELP: addDataTypeMapping("#{datatype}",
|
75
|
+
HELP: DatatypeMappingText,
|
76
|
+
HELP: /[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][0-9][0-9][0-9][0-9]/ )
|
77
|
+
HELP:
|
78
|
+
HELP: Sample2:
|
79
|
+
HELP: restriction of DatatypeMappingText for string mapping a particular regexp.
|
80
|
+
HELP: addDataTypeMapping("#{datatype}",
|
81
|
+
HELP: DatatypeMappingText,
|
82
|
+
HELP: /[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][0-9][0-9][0-9][0-9]/ ) {
|
83
|
+
HELP: # a datatype mapping definition is a set
|
84
|
+
HELP: # of method called by generator.
|
85
|
+
HELP: # Any method may be redefined :
|
86
|
+
HELP: def java_getType
|
87
|
+
HELP: return "java.lang.String"
|
88
|
+
HELP: end
|
89
|
+
HELP: #def getFormCopyTo(field)
|
90
|
+
HELP: # (...)
|
91
|
+
HELP: #end
|
92
|
+
HELP: #def getFormInitFrom(field)
|
93
|
+
HELP: # (...)
|
94
|
+
HELP: #end
|
95
|
+
HELP: }
|
96
|
+
HELP:
|
97
|
+
HELP: Available datatypes mapping in current running instance are:
|
98
|
+
#{@@types.collect {|t| "HELP: "+"#{t.class} : #{t.getHelp} \n"}}.
|
99
|
+
|
100
|
+
|
101
|
+
End of help on adding custom datatype mapping definition.
|
102
|
+
END
|
103
|
+
log.error msg unless log_already_displayed?(msg)
|
104
|
+
end
|
105
|
+
|
106
|
+
return DatatypeMappingText.instance
|
107
|
+
#return DatatypeMappingerror.instance
|
108
|
+
end
|
109
|
+
|
110
|
+
# max length of this element represented as a string
|
111
|
+
attr :maxStringLength
|
112
|
+
attr_writer :maxStringLength
|
113
|
+
@maxStringLength=nil
|
114
|
+
|
115
|
+
def getValidationRegexp
|
116
|
+
#log.error %{getValidationRegexp not implemented for #{self.class}}
|
117
|
+
return nil #%{/* TODO: implement ruby getValidationRegexp for #{self.class}*/}
|
118
|
+
end
|
119
|
+
|
120
|
+
#return a help message on this datatype mapping definition.
|
121
|
+
def getHelp
|
122
|
+
return "No help available for datatype mapping #{self.class}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
class DatatypeMappingText < DatatypeMapping
|
126
|
+
include Singleton
|
127
|
+
|
128
|
+
#default string length
|
129
|
+
@maxStringLength=10
|
130
|
+
|
131
|
+
MATCHING_UML_NAME=["String","string"]
|
132
|
+
#MATCHING_JAVA_NAME=["String","java.lang.String"]
|
133
|
+
|
134
|
+
def appliesTo?(datatype)
|
135
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
136
|
+
#return true if MATCHING_JAVA_NAME.include?(datatype.java_qualifiedName)
|
137
|
+
return false
|
138
|
+
end
|
139
|
+
|
140
|
+
def getHelp
|
141
|
+
return "any string of any length and any content displayable on one line."
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
class DatatypeMappingLargeText < DatatypeMappingText
|
146
|
+
include Singleton
|
147
|
+
HELPMSG=" "
|
148
|
+
MATCHING_UML_NAME=["LargeText"]
|
149
|
+
def appliesTo?(datatype)
|
150
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
151
|
+
return false
|
152
|
+
end
|
153
|
+
|
154
|
+
def getHelp
|
155
|
+
return "any string of any length and any content displayable on many line"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
class DatatypeMappingMimeType < DatatypeMappingText
|
161
|
+
include Singleton
|
162
|
+
MATCHING_UML_NAME=["MimeType"]
|
163
|
+
def appliesTo?(datatype)
|
164
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
165
|
+
end
|
166
|
+
|
167
|
+
def getHelp
|
168
|
+
return "string defining a mime type"
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
class DatatypeMappingOrdinal < DatatypeMappingText
|
173
|
+
include Singleton
|
174
|
+
|
175
|
+
def getHelp
|
176
|
+
return "any ordinal type (this in an abstract mapping meant to be derived)"
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
class DatatypeMappingInteger < DatatypeMappingOrdinal
|
181
|
+
include Singleton
|
182
|
+
MATCHING_UML_NAME=["integer","Integer","int"]
|
183
|
+
#MATCHING_JAVA_NAME=[]
|
184
|
+
def appliesTo?(datatype)
|
185
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
186
|
+
# return true if MATCHING_JAVA_NAME.include?(datatype.java_qualifiedName)
|
187
|
+
return false
|
188
|
+
end
|
189
|
+
|
190
|
+
def getHelp
|
191
|
+
return "any valid integer"
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
class DatatypeMappingLong < DatatypeMappingOrdinal
|
196
|
+
include Singleton
|
197
|
+
MATCHING_UML_NAME=["long"]
|
198
|
+
#MATCHING_JAVA_NAME=[]
|
199
|
+
def appliesTo?(datatype)
|
200
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
201
|
+
# return true if MATCHING_JAVA_NAME.include?(datatype.java_qualifiedName)
|
202
|
+
return false
|
203
|
+
end
|
204
|
+
|
205
|
+
def getHelp
|
206
|
+
return "any valid long"
|
207
|
+
end
|
208
|
+
end
|
209
|
+
class DatatypeMappingLongObject < DatatypeMappingOrdinal
|
210
|
+
include Singleton
|
211
|
+
MATCHING_UML_NAME=["Long"]
|
212
|
+
#MATCHING_JAVA_NAME=[]
|
213
|
+
def appliesTo?(datatype)
|
214
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
215
|
+
# return true if MATCHING_JAVA_NAME.include?(datatype.java_qualifiedName)
|
216
|
+
return false
|
217
|
+
end
|
218
|
+
|
219
|
+
def getHelp
|
220
|
+
return "any valid long value or null"
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
class DatatypeMappingFile < DatatypeMapping
|
225
|
+
include Singleton
|
226
|
+
MATCHING_UML_NAME=["file"]
|
227
|
+
def appliesTo?(datatype)
|
228
|
+
return false unless datatype.kind_of?(Muml_DataType)
|
229
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
230
|
+
#return datatype.struts_isBlob?
|
231
|
+
#return ["image"].include?(datatype.java_qualifiedName)
|
232
|
+
end
|
233
|
+
|
234
|
+
def getHelp
|
235
|
+
super
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
class DatatypeMappingBoolean < DatatypeMapping
|
240
|
+
include Singleton
|
241
|
+
MATCHING_UML_NAME=["Boolean","boolean"]
|
242
|
+
#MATCHING_JAVA_NAME=[]
|
243
|
+
def appliesTo?(datatype)
|
244
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
245
|
+
# return true if MATCHING_JAVA_NAME.include?(datatype.java_qualifiedName)
|
246
|
+
return false
|
247
|
+
end
|
248
|
+
|
249
|
+
def getHelp
|
250
|
+
return "boolean true or false"
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
#struts jsp template for a timestamp datatype.
|
255
|
+
#A timestamp is a precise periode in time, including date,hours,minutes and seconds.
|
256
|
+
#NOTE:
|
257
|
+
# "Date" datatype name is discourage because it is ambiguous.
|
258
|
+
# (a java date is a timestamp)
|
259
|
+
# Calendar and TimeStamp should be prefered.
|
260
|
+
class DatatypeMappingTimeStamp < DatatypeMapping
|
261
|
+
include Singleton
|
262
|
+
MATCHING_UML_NAME=["TimeStamp","Date"]
|
263
|
+
#MATCHING_JAVA_NAME=[]
|
264
|
+
def appliesTo?(datatype)
|
265
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
266
|
+
#return true if MATCHING_JAVA_NAME.include?(datatype.java_qualifiedName)
|
267
|
+
return false
|
268
|
+
end
|
269
|
+
def getValidationRegexp
|
270
|
+
return nil
|
271
|
+
end
|
272
|
+
def getHelp
|
273
|
+
return "An absolute precise moment in time (independent of timezone)"
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|
277
|
+
|
278
|
+
#struts jsp template for a Calendar datatype.
|
279
|
+
#A Calendar datatype is a calendar date, not including hours,minutes and seconds
|
280
|
+
#A Calendar is not to be mistaken for a TimeStamp
|
281
|
+
#NOTE:
|
282
|
+
# "Date" datatype name is not used because it is ambiguous.
|
283
|
+
# Calendar and TimeStamp are used instead
|
284
|
+
class DatatypeMappingCalendar < DatatypeMapping
|
285
|
+
include Singleton
|
286
|
+
MATCHING_UML_NAME=["Calendar"]
|
287
|
+
#MATCHING_JAVA_NAME=[]
|
288
|
+
def appliesTo?(datatype)
|
289
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
290
|
+
#return true if MATCHING_JAVA_NAME.include?(datatype.java_qualifiedName)
|
291
|
+
return false
|
292
|
+
end
|
293
|
+
|
294
|
+
def getValidationRegexp
|
295
|
+
return nil
|
296
|
+
end
|
297
|
+
|
298
|
+
def getHelp
|
299
|
+
return "a day "
|
300
|
+
end
|
301
|
+
|
302
|
+
end
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
class DatatypeMappingGenericClass < DatatypeMapping
|
308
|
+
include Singleton
|
309
|
+
def appliesTo?(datatype)
|
310
|
+
return false if datatype.kind_of?(Muml_Enumeration)
|
311
|
+
return false if datatype.kind_of?(Muml_DataType)
|
312
|
+
#return true if datatype.kind_of?(Muml_Class)
|
313
|
+
return true
|
314
|
+
end
|
315
|
+
|
316
|
+
|
317
|
+
def getHelp
|
318
|
+
return "Any object reference"
|
319
|
+
end
|
320
|
+
|
321
|
+
end
|
322
|
+
|
323
|
+
class DatatypeMappingGenericEnum < DatatypeMapping
|
324
|
+
include Singleton
|
325
|
+
def appliesTo?(datatype)
|
326
|
+
return true if datatype.kind_of?(Muml_Enumeration)
|
327
|
+
return false
|
328
|
+
end
|
329
|
+
|
330
|
+
def getHelp
|
331
|
+
return "Any enumerated value"
|
332
|
+
end
|
333
|
+
|
334
|
+
end
|
335
|
+
|
336
|
+
|
337
|
+
class DatatypeMappingURL < DatatypeMappingText
|
338
|
+
include Singleton
|
339
|
+
MATCHING_UML_NAME=["URL","URI"]
|
340
|
+
#MATCHING_JAVA_NAME=[]
|
341
|
+
def appliesTo?(datatype)
|
342
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
343
|
+
#return true if MATCHING_JAVA_NAME.include?(datatype.java_qualifiedName)
|
344
|
+
return false
|
345
|
+
end
|
346
|
+
|
347
|
+
def getHelp
|
348
|
+
return "Any URL"
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
class DatatypeMappingBLOB < DatatypeMapping
|
353
|
+
include Singleton
|
354
|
+
MATCHING_UML_NAME=["Blob"]
|
355
|
+
def appliesTo?(datatype)
|
356
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
357
|
+
return false
|
358
|
+
end
|
359
|
+
def getHelp
|
360
|
+
return "Any BLOB"
|
361
|
+
end
|
362
|
+
end
|
363
|
+
class DatatypeMappingIMG < DatatypeMappingBLOB
|
364
|
+
include Singleton
|
365
|
+
MATCHING_UML_NAME=["Img","Image"]
|
366
|
+
def appliesTo?(datatype)
|
367
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
368
|
+
return false
|
369
|
+
end
|
370
|
+
def getHelp
|
371
|
+
return "Any image"
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
class DatatypeMappingGRAPHVIZ < DatatypeMappingLargeText
|
376
|
+
include Singleton
|
377
|
+
MATCHING_UML_NAME=["Graphviz"]
|
378
|
+
def appliesTo?(datatype)
|
379
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
380
|
+
return false
|
381
|
+
end
|
382
|
+
def getHelp
|
383
|
+
return "Any graphivz dot file"
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
class DatatypeMappingPassword < DatatypeMappingText
|
388
|
+
include Singleton
|
389
|
+
MATCHING_UML_NAME=["Password"]
|
390
|
+
def appliesTo?(datatype)
|
391
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
392
|
+
return false
|
393
|
+
end
|
394
|
+
|
395
|
+
def getHelp
|
396
|
+
return "any String of any length meant to be used as passowrd"
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
class DatatypeMappingEmailAddress < DatatypeMappingText
|
401
|
+
include Singleton
|
402
|
+
MATCHING_UML_NAME=["EmailAdress"]
|
403
|
+
def appliesTo?(datatype)
|
404
|
+
return true if MATCHING_UML_NAME.include?(datatype.uml_name_one)
|
405
|
+
return false
|
406
|
+
end
|
407
|
+
|
408
|
+
# EMAIL address regexp
|
409
|
+
# cf : http://www.regular-expressions.info/email.html
|
410
|
+
def getValidationRegexp
|
411
|
+
return /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/
|
412
|
+
end
|
413
|
+
|
414
|
+
def getHelp
|
415
|
+
return "any e-mail address"
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
DatatypeMappingGenericEnum.instance #register
|
422
|
+
|
423
|
+
DatatypeMappingCalendar.instance #register
|
424
|
+
DatatypeMappingText.instance #register
|
425
|
+
DatatypeMappingLargeText.instance #register
|
426
|
+
DatatypeMappingPassword.instance #register
|
427
|
+
DatatypeMappingEmailAddress.instance #register
|
428
|
+
DatatypeMappingURL.instance #register
|
429
|
+
DatatypeMappingFile.instance #register
|
430
|
+
DatatypeMappingBoolean.instance #register
|
431
|
+
DatatypeMappingTimeStamp.instance #register
|
432
|
+
DatatypeMappingGenericClass.instance #register
|
433
|
+
DatatypeMappingLong.instance #register
|
434
|
+
DatatypeMappingLongObject.instance #register
|
435
|
+
DatatypeMappingInteger.instance #register
|
436
|
+
DatatypeMappingBLOB.instance #register
|
437
|
+
DatatypeMappingIMG.instance #register
|
438
|
+
DatatypeMappingGRAPHVIZ.instance #register
|
439
|
+
DatatypeMappingMimeType.instance #register
|
440
|
+
|
441
|
+
|