ontomde-java 2.0.0 → 2.0.4
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/History.txt +11 -0
- data/Manifest.txt +1 -51
- data/lib/ontomde-java.rb +2 -0
- data/lib/ontomde-java/crank.rb +8 -8
- data/lib/ontomde-java/crank/crankJpa.rb +58 -8
- data/lib/ontomde-java/crank/main.rb +38 -21
- data/lib/ontomde-java/frontend/command.rb +7 -7
- data/lib/ontomde-java/frontend/command.rdoc +0 -583
- data/lib/ontomde-java/frontend/defaultOptions.rb +12 -7
- data/lib/ontomde-java/frontend/options.rb +19 -2
- data/lib/ontomde-java/frontend/steps.rb +36 -5
- data/lib/ontomde-java/java/accessorCode.rb +250 -94
- data/lib/ontomde-java/java/accessorSignature.rb +50 -4
- data/lib/ontomde-java/java/annotationOntoMDE.rb +38 -27
- data/lib/ontomde-java/java/component.rb +141 -68
- data/lib/ontomde-java/java/enumAssignable.rb +46 -5
- data/lib/ontomde-java/java/java.rb +111 -40
- data/lib/ontomde-java/java/javaDatatypeMapping.rb +35 -1
- data/lib/ontomde-java/java/javadoc.rb +35 -22
- data/lib/ontomde-java/java/operationAsClass.rb +13 -0
- data/lib/ontomde-java/java/security.rb +10 -2
- data/lib/ontomde-java/java/stateMachine.rb +137 -74
- data/lib/ontomde-java/java/tenant.rb +1 -0
- data/lib/ontomde-java/java/xsd.rb +1 -1
- data/lib/ontomde-java/jpa/configuration.rb +25 -1
- data/lib/ontomde-java/jpa/finder.rb +48 -13
- data/lib/ontomde-java/jpa/jpa.rb +30 -14
- data/lib/ontomde-java/jpa/mapping.rb +114 -60
- data/lib/ontomde-java/jpa/redefined.rb +21 -5
- data/lib/ontomde-java/jpa/simulationAutoImplement.rb +1 -1
- data/lib/ontomde-java/jpdl/processOperationToClass.rb +1 -2
- data/lib/ontomde-java/kbjava/rdfToJava.rb +25 -16
- data/lib/ontomde-java/struts.rb +1 -1
- data/lib/ontomde-java/struts/MessageResources.rb +15 -6
- data/lib/ontomde-java/struts/action.rb +37 -13
- data/lib/ontomde-java/struts/form.rb +97 -7
- data/lib/ontomde-java/struts/header.rb +7 -3
- data/lib/ontomde-java/struts/jsp_edit.rb +54 -24
- data/lib/ontomde-java/struts/jsp_edit_js.rb +1 -1
- data/lib/ontomde-java/struts/jsp_index.rb +6 -4
- data/lib/ontomde-java/struts/mappingForJsp.rb +11 -7
- data/lib/ontomde-java/struts/mappingToJavaHierarchy.rb +16 -2
- data/lib/ontomde-java/version.rb +1 -1
- data/lib/ontomde-java/vmware/vso.rb +329 -0
- data/test/test_export_ea7_1_829.rb +5 -0
- data/test/test_export_ea7_1_833.rb +5 -0
- data/test/test_export_ea7_5_843.rb +5 -0
- data/test/test_export_magicDraw.rb +4 -0
- data/test/test_export_oe530.rb +1 -1
- data/test/test_export_oe600.rb +1 -1
- data/test/test_export_rsm60.rb +1 -1
- data/test/{uml_test.rb → test_export_unitTests.rb} +6 -1
- metadata +9 -56
- data/generateRdocFile.sh +0 -16
- data/profiling.xls +0 -0
- data/test/.classpath +0 -14
- data/test/.project +0 -17
- data/test/.settings/org.eclipse.jdt.core.prefs +0 -23
- data/test/Rakefile +0 -71
- data/test/build.xml +0 -34
- data/test/classpath.rb +0 -15
- data/test/lib/junit-4.1.jar +0 -0
- data/test/load1.rb +0 -3
- data/test/load2.rb +0 -3
- data/test/log4j.properties +0 -46
- data/test/model/.project +0 -11
- data/test/model/BigProject.mdzip +0 -0
- data/test/model/BigProject.mdzip.nt +0 -102866
- data/test/model/ClassDiagram.EntArch.gif +0 -0
- data/test/model/ClassDiagram.emx.gif +0 -0
- data/test/model/ClassDiagram.mdzip.gif +0 -0
- data/test/model/model_ea71.bis.ea.xmi +0 -149
- data/test/model/model_ea71.ea.xmi +0 -4470
- data/test/model/model_ea71.eap +0 -0
- data/test/model/model_ea71_README.txt +0 -8
- data/test/model/multipleInheritance.emx +0 -466
- data/test/model/multipleInheritance.emx.nt +0 -2428
- data/test/model/simple1-530.ofp +0 -0
- data/test/model/simple1-includedAsReference.emx +0 -169
- data/test/model/simple1.emx +0 -3729
- data/test/model/simple1.emx.fragments.nt +0 -81
- data/test/model/simple1.emx.nt +0 -5760
- data/test/model/simple1.mdzip +0 -0
- data/test/model/simple1.mdzip.nt +0 -11500
- data/test/model/simple1.oe530.nt +0 -1986
- data/test/model/simple1.oe600.nt +0 -1627
- data/test/src/RuntimeTest.java +0 -656
- data/test/src/testsLevel1.java +0 -174
- data/test/src/testsLevel2.java +0 -29
- data/test/src/testsLevel3.java +0 -40
- data/test/test-ea7.sh +0 -15
- data/test/test-magicDraw.sh +0 -10
- data/test/test-mi.sh +0 -9
- data/test/test-oe530.sh +0 -10
- data/test/test-oe600.sh +0 -11
- data/test/test-rsm.sh +0 -11
- data/test/test_export_ea71.rb +0 -5
- data/test/trace +0 -419
- data/test/uml_test.xls +0 -0
- data/test/unit_test.rb +0 -6
|
@@ -9,7 +9,7 @@ class String
|
|
|
9
9
|
# replace escaped carriage return by true carriage return
|
|
10
10
|
# remove java comments (we are already inside a javadoc)
|
|
11
11
|
self.gsub(/\\r\\n/,"\n").gsub(/\*\//,'--').gsub(/\/\*/,'--').each { |line|
|
|
12
|
-
res.write("
|
|
12
|
+
res.write("\t * #{line}".tr("\n"," ").rstrip)
|
|
13
13
|
res.write("\n")
|
|
14
14
|
}
|
|
15
15
|
end
|
|
@@ -27,13 +27,13 @@ module Muml_Classifier
|
|
|
27
27
|
sep="\n"
|
|
28
28
|
}
|
|
29
29
|
mtk_protected(Mrdf_Resource::NOREVERSE,"javadoc",context[:hasGlobalReverse]||context[:hideJavadocReverseTag]) {
|
|
30
|
-
write("
|
|
30
|
+
write("\t/**\n");
|
|
31
31
|
c.java_writeJavadoc(self)
|
|
32
32
|
#Note: RSM exports adds an extraneous http://
|
|
33
33
|
#Note: TODO: This code is RSM 6 specific
|
|
34
34
|
%{@see <a href="#{context[:rsm6WebDocURI]}#{UriNamespace.instance.unalias(rdf_uri).gsub(/http:\/\/kb#/,"")}-content.html">UML documentation.</a>}.java_writeJavadoc(self) unless context[:rsm6WebDocURI].empty?
|
|
35
35
|
|
|
36
|
-
write("
|
|
36
|
+
write("\t */\n")
|
|
37
37
|
}
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -64,13 +64,18 @@ module Muml_Property
|
|
|
64
64
|
sep="\n"
|
|
65
65
|
}
|
|
66
66
|
mtk_protected(Mrdf_Resource::NOREVERSE,"javadoc",context[:hasGlobalReverse]||context[:hideJavadocReverseTag]) {
|
|
67
|
-
|
|
67
|
+
s=mtk_stss {
|
|
68
68
|
c.java_writeJavadoc(self)
|
|
69
69
|
#Note: RSM exports adds an extraneous http://
|
|
70
70
|
#Note: TODO: This code is RSM 6 specific
|
|
71
|
-
%{@see <a href="#{context[:rsm6WebDocURI]}#{UriNamespace.instance.unalias(rdf_uri).gsub(/http:\/\/kb#/,"")}-content.html">UML documentation.</a>}.java_writeJavadoc(self) unless context[:rsm6WebDocURI].empty?
|
|
71
|
+
# %{@see <a href="#{context[:rsm6WebDocURI]}#{UriNamespace.instance.unalias(rdf_uri).gsub(/http:\/\/kb#/,"")}-content.html">UML documentation.</a>}.java_writeJavadoc(self) unless context[:rsm6WebDocURI].empty?
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
}
|
|
74
|
+
if(!s.nil? && !s.empty?)
|
|
75
|
+
write("\t/**\n");
|
|
76
|
+
write(s)
|
|
77
|
+
write("\t */\n")
|
|
78
|
+
end
|
|
74
79
|
}
|
|
75
80
|
end
|
|
76
81
|
end
|
|
@@ -100,7 +105,6 @@ module Muml_Operation
|
|
|
100
105
|
|
|
101
106
|
#internal write javadoc
|
|
102
107
|
def java_writeJavadoc_internal
|
|
103
|
-
write(" /**\n");
|
|
104
108
|
hasDoc=false
|
|
105
109
|
|
|
106
110
|
# if !java_getter_property.empty? && !java_getter_property_one.uml_isDerived?
|
|
@@ -109,7 +113,7 @@ module Muml_Operation
|
|
|
109
113
|
# if !java_setter_property.empty? && !java_setter_property_one.uml_isDerived?
|
|
110
114
|
# "setter for property {@link #{java_setter_property_one.java_javadocLink}}".java_writeJavadoc(self)
|
|
111
115
|
# end
|
|
112
|
-
|
|
116
|
+
s=mtk_stss {
|
|
113
117
|
p=java_getter_property_one0
|
|
114
118
|
if !p.nil?
|
|
115
119
|
oe=p.umlx_otherEnd
|
|
@@ -122,6 +126,10 @@ module Muml_Operation
|
|
|
122
126
|
end
|
|
123
127
|
|
|
124
128
|
|
|
129
|
+
umlx_autoImplementedBy.each {|x|
|
|
130
|
+
%{@see #{x.java_javadocLink(self)}}.java_writeJavadoc(self)
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
if !uml_ownedComment.empty?
|
|
126
134
|
#write("* @return the \n");
|
|
127
135
|
uml_ownedComment.each { |comment|
|
|
@@ -140,26 +148,31 @@ module Muml_Operation
|
|
|
140
148
|
#if(!hasDoc)
|
|
141
149
|
# "TODO: document this element in source UML model".java_writeJavadoc(self)
|
|
142
150
|
#end
|
|
151
|
+
|
|
152
|
+
if !java_setter_property.empty?
|
|
153
|
+
hasDoc=true
|
|
154
|
+
p=java_setter_property_one
|
|
155
|
+
if !p.java_AttributeGlobalGetter.empty?
|
|
156
|
+
"@see #{p.java_AttributeGlobalGetter_one.java_javadocLink}".java_writeJavadoc(self)
|
|
157
|
+
end
|
|
158
|
+
end
|
|
143
159
|
|
|
144
|
-
|
|
160
|
+
}
|
|
161
|
+
if(!s.nil? && !s.empty?)
|
|
162
|
+
write("\t/**\n");
|
|
163
|
+
write(s)
|
|
164
|
+
uml_ownedParameter.each { |p|
|
|
145
165
|
c=""
|
|
146
166
|
p.uml_ownedComment.each { |comment|
|
|
147
167
|
c="#{c} #{comment.uml_body_one}"
|
|
148
168
|
}
|
|
149
169
|
c=" self-explanatory"
|
|
150
170
|
#next if c.empty? && p.uml_direction_one.isReturn?
|
|
151
|
-
"#{p.uml_direction_one.isReturn? ? %{@return}
|
|
171
|
+
"#{p.uml_direction_one.isReturn? ? %{@return}: %{@param }}#{p.java_Name unless p.uml_direction_one.isReturn?}#{c}".java_writeJavadoc(self)
|
|
152
172
|
}
|
|
153
|
-
|
|
154
|
-
if !java_setter_property.empty?
|
|
155
|
-
hasDoc=true
|
|
156
|
-
p=java_setter_property_one
|
|
157
|
-
if !p.java_AttributeGlobalGetter.empty?
|
|
158
|
-
"@see #{p.java_AttributeGlobalGetter_one.java_javadocLink}".java_writeJavadoc(self)
|
|
159
|
-
end
|
|
173
|
+
write("\t */\n")
|
|
160
174
|
end
|
|
161
175
|
|
|
162
|
-
write(" */\n")
|
|
163
176
|
end
|
|
164
177
|
end
|
|
165
178
|
|
|
@@ -172,9 +185,9 @@ module Muml_EnumerationLiteral
|
|
|
172
185
|
}
|
|
173
186
|
mtk_protected(Mrdf_Resource::NOREVERSE,"javadoc",context[:hasGlobalReverse]||context[:hideJavadocReverseTag]) {
|
|
174
187
|
unless c.empty?
|
|
175
|
-
write("
|
|
188
|
+
write("\t/**\n");
|
|
176
189
|
c.java_writeJavadoc(self)
|
|
177
|
-
write("
|
|
190
|
+
write("\t */\n")
|
|
178
191
|
end
|
|
179
192
|
}
|
|
180
193
|
end
|
|
@@ -235,13 +248,13 @@ module Mrdf_Repository
|
|
|
235
248
|
break
|
|
236
249
|
}
|
|
237
250
|
mtk_writeSession(fn) {
|
|
238
|
-
write("/**\n")
|
|
251
|
+
write("\t/**\n")
|
|
239
252
|
packageSet.each { |package|
|
|
240
253
|
package.uml_ownedComment.each { |comment|
|
|
241
254
|
comment.uml_body_one.java_writeJavadoc(self)
|
|
242
255
|
}
|
|
243
256
|
}
|
|
244
|
-
write("
|
|
257
|
+
write("\t */\n\n")
|
|
245
258
|
write("package #{packageName};\n")
|
|
246
259
|
}
|
|
247
260
|
}
|
|
@@ -59,6 +59,9 @@ module Mrdf_Repository
|
|
|
59
59
|
mpc.db_isTransient=RDF_TRUE
|
|
60
60
|
mpc.java_addTenantField!
|
|
61
61
|
|
|
62
|
+
# propagate template parameters
|
|
63
|
+
mpc.uml_ownedTemplateSignature=c.uml_ownedTemplateSignature unless c.uml_ownedTemplateSignature.empty?
|
|
64
|
+
|
|
62
65
|
m=mpc.umlx_createAndAddOperation(mpc.rdf_uri+"merge","merge");
|
|
63
66
|
#TODO merge referenced items
|
|
64
67
|
m.java_code="return this; "
|
|
@@ -70,6 +73,16 @@ module Mrdf_Repository
|
|
|
70
73
|
}}
|
|
71
74
|
end
|
|
72
75
|
end
|
|
76
|
+
module Muml_Property
|
|
77
|
+
def java_isMethodToClassReturn?
|
|
78
|
+
return uml_name.to_s==Muml_Classifier::STRUTS_RESULT_PARAM_NAME
|
|
79
|
+
end
|
|
80
|
+
def java_isMethodToClassApplyToOrReturn?
|
|
81
|
+
s=uml_name.to_s
|
|
82
|
+
return (s==Muml_Classifier::STRUTS_APPLY_TO_PARAM || s==Muml_Classifier::STRUTS_RESULT_PARAM_NAME)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
end
|
|
73
86
|
module Muml_Classifier
|
|
74
87
|
# source business operation from which this class was generated.
|
|
75
88
|
rdf_safe_attr_reader_many :struts_bizOperation
|
|
@@ -31,6 +31,9 @@ module Mrdf_Repository
|
|
|
31
31
|
uml_Class_all.each {|c|
|
|
32
32
|
next unless c.umlx_businessMethod?
|
|
33
33
|
next if c.kind_of?(Muml_Interface)
|
|
34
|
+
rns=c.umlx_rootNamespace_one0
|
|
35
|
+
next if (!rns.nil?)&& (rns.java_Name.to_s!='domain')
|
|
36
|
+
|
|
34
37
|
cn="#{c.java_qualifiedName}.class"
|
|
35
38
|
c.uml_ownedOperation.each {|op|
|
|
36
39
|
next unless op.umlx_businessMethod?
|
|
@@ -139,6 +142,10 @@ ENDHELP
|
|
|
139
142
|
|
|
140
143
|
next if c.kind_of?(Muml_Interface)
|
|
141
144
|
cn="#{c.java_qualifiedName}.class"
|
|
145
|
+
|
|
146
|
+
rns=c.umlx_rootNamespace_one0
|
|
147
|
+
next if (!rns.nil?)&& (rns.java_Name.to_s!='domain')
|
|
148
|
+
|
|
142
149
|
c.uml_ownedAttribute.each {|op|
|
|
143
150
|
#next unless op.umlx_businessMethod?
|
|
144
151
|
#operation was generated from an interface
|
|
@@ -205,6 +212,7 @@ END
|
|
|
205
212
|
uml_Class_all.each {|c|
|
|
206
213
|
#sec=false
|
|
207
214
|
next if c.kind_of?(Muml_Interface) || c.kind_of?(Muml_Enumeration)
|
|
215
|
+
next if c.umlx_hasStereotype?('DTO')
|
|
208
216
|
c.uml_ownedOperation.each {|o|
|
|
209
217
|
next unless o.umlx_isSecured?
|
|
210
218
|
o.java_annotation_add(JAVA_SECURE_ANNOTATION)
|
|
@@ -234,8 +242,8 @@ ENDHELP
|
|
|
234
242
|
|
|
235
243
|
#method default implementation
|
|
236
244
|
JAVA_GETSTATIC_ROLE_CODE=<<ENDROLECODE
|
|
237
|
-
//return empty list (every static role are denied)
|
|
238
|
-
return new java.util.HashSet<#{Mrdf_Repository::JAVA_GLOBAL_ACCESS_CONTROL_ENUM}>();
|
|
245
|
+
//return empty list (every static role are denied)
|
|
246
|
+
return new java.util.HashSet<#{Mrdf_Repository::JAVA_GLOBAL_ACCESS_CONTROL_ENUM}>();
|
|
239
247
|
ENDROLECODE
|
|
240
248
|
|
|
241
249
|
# Adds methods which returns computed grants to user.
|
|
@@ -33,59 +33,67 @@ module Muml_Classifier
|
|
|
33
33
|
rdf_safe_attr_reader_many :java_FSMContext
|
|
34
34
|
#State of the StateMachine
|
|
35
35
|
rdf_safe_attr_reader_many :java_FSMState
|
|
36
|
-
|
|
36
|
+
#list of states
|
|
37
|
+
rdf_safe_attr_reader_many :java_enumState
|
|
38
|
+
|
|
37
39
|
def java_addStateManagement
|
|
38
40
|
|
|
39
41
|
fsmState = self.java_FSMState_one
|
|
40
42
|
fsmContext = self.java_FSMContext_one
|
|
41
|
-
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
42
46
|
#TODO Corriger le bug avec JPA qui emp�che de rajouter cette interface
|
|
43
47
|
# typecomp=umlx_getOrCreateInterface("xmda.fsm.FsmComponent<#{fsmContext.java_qualifiedName}>")
|
|
44
48
|
# typecomp.java_isGeneric=RDF_TRUE
|
|
45
49
|
# umlx_createAndAddImplementation(typecomp)
|
|
46
50
|
|
|
47
|
-
fsm=umlx_createAndAddProperty(rdf_uri+
|
|
51
|
+
fsm=umlx_createAndAddProperty(rdf_uri+'_fsm', 'fsmCtx')
|
|
48
52
|
fsm.uml_type=java_FSMContext_one
|
|
49
53
|
fsm.db_isTransient=RDF_TRUE
|
|
50
54
|
fsm.uml_visibility=::Cuml_VisibilityKind::Private
|
|
51
|
-
fsm.java_annotation_add(
|
|
55
|
+
fsm.java_annotation_add('@javax.persistence.Transient')
|
|
56
|
+
|
|
52
57
|
get=java_addGlobalGetter!(fsm)
|
|
53
58
|
get.java_code=<<CODE
|
|
54
|
-
if (fsmCtx==null || getPersistedState().compareToIgnoreCase(fsmCtx.getState().getName()) != 0) {
|
|
55
|
-
|
|
56
|
-
fsmCtx = new
|
|
59
|
+
if (fsmCtx==null || getPersistedState().toString().compareToIgnoreCase(fsmCtx.getState().getName()) != 0) {
|
|
60
|
+
#{fsmState.java_qualifiedName} currentState = #{fsmState.java_qualifiedName}.findStateByName(getPersistedState().toString());
|
|
61
|
+
fsmCtx = new #{fsmContext.java_qualifiedName}(this, currentState);
|
|
57
62
|
}
|
|
58
63
|
return fsmCtx;
|
|
59
64
|
|
|
60
65
|
CODE
|
|
61
66
|
|
|
62
|
-
persState=umlx_createAndAddProperty(rdf_uri+
|
|
63
|
-
persState.uml_type=umlx_dataType_string
|
|
67
|
+
persState=umlx_createAndAddProperty(rdf_uri+'_state', 'persistedState')
|
|
68
|
+
persState.uml_type=fsmContext.java_enumState_one#umlx_dataType_string
|
|
64
69
|
persState.uml_visibility=::Cuml_VisibilityKind::Private
|
|
70
|
+
|
|
71
|
+
java_addAccessorsFor!(persState)
|
|
65
72
|
java_addGlobalSetter!(persState)
|
|
66
73
|
getState=java_addGlobalGetter!(persState)
|
|
67
74
|
getState.java_code=<<CODE
|
|
68
|
-
if (persistedState==null
|
|
69
|
-
fsmCtx = new
|
|
70
|
-
setPersistedState(fsmCtx.getState().getName());
|
|
75
|
+
if (persistedState==null) {
|
|
76
|
+
fsmCtx = new #{fsmContext.java_qualifiedName}(this);
|
|
77
|
+
setPersistedState(#{fsmContext.java_enumState_one.java_qualifiedName}.valueOf(fsmCtx.getState().getName()));
|
|
71
78
|
}
|
|
72
79
|
return persistedState;
|
|
73
80
|
CODE
|
|
74
81
|
|
|
75
82
|
|
|
76
83
|
# Gestion de la synchronisation du champ persistedState et fsmCtx transient
|
|
77
|
-
ent=umlx_getOrCreateInterface(
|
|
84
|
+
ent=umlx_getOrCreateInterface('java.beans.PropertyChangeListener')
|
|
78
85
|
umlx_createAndAddImplementation(ent)
|
|
79
|
-
m=umlx_createAndAddOperation(rdf_uri+
|
|
86
|
+
m=umlx_createAndAddOperation(rdf_uri+'_prop','propertyChange')
|
|
80
87
|
m.uml_visibility=Cuml_VisibilityKind::Public
|
|
81
|
-
arg1=m.umlx_createAndAddParameter(m.rdf_uri+
|
|
88
|
+
arg1=m.umlx_createAndAddParameter(m.rdf_uri+'_evt','evt')
|
|
82
89
|
arg1.uml_direction=Cuml_ParameterDirectionKind::In
|
|
83
90
|
arg1.uml_upperValue=umlx_literal(1)
|
|
84
91
|
arg1.uml_lowerValue=umlx_literal(1)
|
|
85
|
-
arg1.uml_type=umlx_getOrCreateInterface(
|
|
92
|
+
arg1.uml_type=umlx_getOrCreateInterface('java.beans.PropertyChangeEvent')
|
|
86
93
|
m.java_code=<<CODE
|
|
87
94
|
#{fsmState.java_qualifiedName} newState = (#{fsmState.java_qualifiedName}) evt.getNewValue();
|
|
88
|
-
setPersistedState(newState.getName());
|
|
95
|
+
setPersistedState(#{fsmContext.java_enumState_one.java_qualifiedName}.valueOf(newState.getName()));
|
|
96
|
+
//setPersistedState(newState.getName());
|
|
89
97
|
CODE
|
|
90
98
|
|
|
91
99
|
end
|
|
@@ -100,11 +108,11 @@ CODE
|
|
|
100
108
|
def java_getOrCreateOperationForTransition(t)
|
|
101
109
|
opForT = findOperationByName("#{t.uml_name}")
|
|
102
110
|
if opForT.nil?
|
|
103
|
-
opForT=umlx_createAndAddOperation(rdf_uri+"_#{t.
|
|
111
|
+
opForT=umlx_createAndAddOperation(rdf_uri+"_#{t.rdf_uri.str_to_uri}","#{t.uml_name}")
|
|
104
112
|
opForT.uml_visibility=Cuml_VisibilityKind::Public
|
|
105
113
|
opForT.umlx_businessMethod=RDF_TRUE
|
|
106
114
|
end
|
|
107
|
-
opForT.java_annotation_add(
|
|
115
|
+
opForT.java_annotation_add('@xmda.fsm.StateMachineTransition')
|
|
108
116
|
opForT.java_isFsmOperation=true
|
|
109
117
|
opForT.java_code=<<CODE
|
|
110
118
|
getFsmCtx().#{opForT.java_Name}();
|
|
@@ -114,7 +122,7 @@ end
|
|
|
114
122
|
module Muml_FinalState
|
|
115
123
|
def fsm_name
|
|
116
124
|
n=uml_name_one0
|
|
117
|
-
return n.nil? ?
|
|
125
|
+
return n.nil? ? 'Final' : n
|
|
118
126
|
end
|
|
119
127
|
end
|
|
120
128
|
module Muml_Pseudostate
|
|
@@ -125,10 +133,10 @@ module Muml_Pseudostate
|
|
|
125
133
|
self.uml_outgoing.each { |t|
|
|
126
134
|
fsmState = myClazz.java_FSMState_one
|
|
127
135
|
fsmContext = myClazz.java_FSMContext_one
|
|
128
|
-
construct=fsmContext.umlx_createAndAddOperation(fsmState.rdf_uri+
|
|
129
|
-
construct.uml_appliedStereotype_add(fsmContext.umlx_getOrCreateStereotype(
|
|
136
|
+
construct=fsmContext.umlx_createAndAddOperation(fsmState.rdf_uri+'_constructor','constructor')
|
|
137
|
+
construct.uml_appliedStereotype_add(fsmContext.umlx_getOrCreateStereotype('Create'))
|
|
130
138
|
construct.uml_visibility=Cuml_VisibilityKind::Public
|
|
131
|
-
arg1=construct.umlx_createAndAddParameter(construct.rdf_uri+
|
|
139
|
+
arg1=construct.umlx_createAndAddParameter(construct.rdf_uri+'_owner','owner')
|
|
132
140
|
arg1.uml_direction=Cuml_ParameterDirectionKind::In
|
|
133
141
|
arg1.uml_upperValue=fsmState.umlx_literal(1)
|
|
134
142
|
arg1.uml_lowerValue=fsmState.umlx_literal(1)
|
|
@@ -140,15 +148,15 @@ module Muml_Pseudostate
|
|
|
140
148
|
#{fsmState.java_qualifiedName}.#{t.uml_target_one.java_Name.downcase}state.Entry(this);
|
|
141
149
|
CODE
|
|
142
150
|
|
|
143
|
-
construct2=fsmContext.umlx_createAndAddOperation(fsmState.rdf_uri+
|
|
144
|
-
construct2.uml_appliedStereotype_add(fsmContext.umlx_getOrCreateStereotype(
|
|
151
|
+
construct2=fsmContext.umlx_createAndAddOperation(fsmState.rdf_uri+'_constructor2','constructor2')
|
|
152
|
+
construct2.uml_appliedStereotype_add(fsmContext.umlx_getOrCreateStereotype('Create'))
|
|
145
153
|
construct2.uml_visibility=Cuml_VisibilityKind::Public
|
|
146
|
-
arg3=construct2.umlx_createAndAddParameter(construct2.rdf_uri+
|
|
154
|
+
arg3=construct2.umlx_createAndAddParameter(construct2.rdf_uri+'_owner','owner')
|
|
147
155
|
arg3.uml_direction=Cuml_ParameterDirectionKind::In
|
|
148
156
|
arg3.uml_upperValue=fsmState.umlx_literal(1)
|
|
149
157
|
arg3.uml_lowerValue=fsmState.umlx_literal(1)
|
|
150
158
|
arg3.uml_type=myClazz
|
|
151
|
-
arg2=construct2.umlx_createAndAddParameter(construct2.rdf_uri+
|
|
159
|
+
arg2=construct2.umlx_createAndAddParameter(construct2.rdf_uri+'_initState','initState')
|
|
152
160
|
arg2.uml_direction=Cuml_ParameterDirectionKind::In
|
|
153
161
|
arg2.uml_upperValue=fsmState.umlx_literal(1)
|
|
154
162
|
arg2.uml_lowerValue=fsmState.umlx_literal(1)
|
|
@@ -161,8 +169,9 @@ CODE
|
|
|
161
169
|
|
|
162
170
|
}
|
|
163
171
|
else
|
|
164
|
-
raise Warning.new,
|
|
172
|
+
raise Warning.new,'PseudState not managed except ::Cuml_PseudostateKind::Initial'
|
|
165
173
|
end
|
|
174
|
+
return nil
|
|
166
175
|
end
|
|
167
176
|
|
|
168
177
|
def fsm_name
|
|
@@ -178,35 +187,50 @@ module Muml_Signal
|
|
|
178
187
|
end
|
|
179
188
|
module Muml_SignalTrigger
|
|
180
189
|
end
|
|
190
|
+
|
|
191
|
+
module Muml_Class
|
|
192
|
+
def getFSMPackage
|
|
193
|
+
myClazz=self
|
|
194
|
+
p=myClazz.umlx_package
|
|
195
|
+
p=p.umlx_getOrCreatePackage(myClazz.java_Name+'_fsm',p)
|
|
196
|
+
return p
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
181
200
|
module Muml_State
|
|
182
201
|
def processVertex(myClazz)
|
|
183
202
|
# Generate the class for this state
|
|
184
|
-
p=myClazz.
|
|
185
|
-
p=p.umlx_getOrCreatePackage("fsm",p)
|
|
203
|
+
p=myClazz.getFSMPackage
|
|
186
204
|
|
|
187
205
|
fsmState = myClazz.java_FSMState_one
|
|
188
206
|
fsmContext = myClazz.java_FSMContext_one
|
|
189
207
|
|
|
190
|
-
state=p.umlx_createAndAddClass(self.rdf_uri+
|
|
208
|
+
state=p.umlx_createAndAddClass(self.rdf_uri+'_State')
|
|
209
|
+
state.java_addSerialVersionUID!
|
|
191
210
|
state.uml_name="#{self.java_Name}State"
|
|
192
211
|
state.db_isTransient=RDF_TRUE
|
|
193
212
|
state.umlx_createAndAddGeneralization(fsmState)
|
|
194
|
-
|
|
195
|
-
|
|
213
|
+
|
|
214
|
+
enumState=fsmContext.java_enumState_one
|
|
215
|
+
lit=enumState.umlx_createAndAddLiteral(state.java_Name)
|
|
216
|
+
lit.java_initParameterValue_add("#{state.java_qualifiedName}.class")
|
|
217
|
+
|
|
218
|
+
construct=state.umlx_createAndAddOperation(state.rdf_uri+'_constructor','constructor')
|
|
219
|
+
construct.uml_appliedStereotype_add(state.umlx_getOrCreateStereotype('Create'))
|
|
196
220
|
construct.uml_visibility=Cuml_VisibilityKind::Public
|
|
197
221
|
construct.java_code=<<CODE
|
|
198
|
-
super(
|
|
222
|
+
super(#{enumState.java_qualifiedName}.#{lit.java_Name}.toString());
|
|
199
223
|
CODE
|
|
200
224
|
|
|
201
|
-
pconst=fsmState.umlx_createAndAddProperty(state.rdf_uri+
|
|
202
|
-
pconst.java_noAccessors=
|
|
225
|
+
pconst=fsmState.umlx_createAndAddProperty(state.rdf_uri+'_Const', "#{state.java_Name.downcase}")
|
|
226
|
+
pconst.java_noAccessors=RDF_TRUE
|
|
203
227
|
pconst.uml_type=state
|
|
204
228
|
pconst.uml_visibility=Cuml_VisibilityKind::Public
|
|
205
229
|
pconst.uml_isStatic=RDF_TRUE
|
|
206
|
-
pconst.java_isFinal="true"
|
|
207
|
-
pconst.java_code=<<CODE
|
|
208
|
-
new #{state.java_qualifiedName}();
|
|
209
|
-
CODE
|
|
230
|
+
# pconst.java_isFinal="true"
|
|
231
|
+
# pconst.java_code=<<CODE
|
|
232
|
+
# new #{state.java_qualifiedName}();
|
|
233
|
+
#CODE
|
|
210
234
|
|
|
211
235
|
# Ajouter les m�thodes � la super classe State et au State concern�
|
|
212
236
|
# Ajouter ou retrouver la m�thode de la classe m�re
|
|
@@ -214,9 +238,9 @@ CODE
|
|
|
214
238
|
m = fsmState.findOperationByName("#{t.uml_name}")
|
|
215
239
|
# Faire une seule fois (cas ou on a plusieurs transitions de m�me nom)
|
|
216
240
|
if m.nil?
|
|
217
|
-
m=fsmState.umlx_createAndAddOperation(fsmState.rdf_uri+"_#{t.
|
|
241
|
+
m=fsmState.umlx_createAndAddOperation(fsmState.rdf_uri+"_#{t.rdf_uri}","#{t.uml_name}")
|
|
218
242
|
m.uml_visibility=Cuml_VisibilityKind::Public
|
|
219
|
-
em=m.umlx_createAndAddParameter(m.rdf_uri+
|
|
243
|
+
em=m.umlx_createAndAddParameter(m.rdf_uri+'_ctx','ctx')
|
|
220
244
|
em.uml_type=fsmContext
|
|
221
245
|
em.uml_direction=Cuml_ParameterDirectionKind::In
|
|
222
246
|
em.uml_upperValue=fsmState.umlx_literal(1)
|
|
@@ -225,20 +249,20 @@ CODE
|
|
|
225
249
|
defaultBehavior(ctx);
|
|
226
250
|
CODE
|
|
227
251
|
|
|
228
|
-
m3=fsmContext.umlx_createAndAddOperation(fsmContext.rdf_uri+"_#{t.
|
|
252
|
+
m3=fsmContext.umlx_createAndAddOperation(fsmContext.rdf_uri+"_#{t.rdf_uri.str_to_uri}","#{t.uml_name}")
|
|
229
253
|
m3.uml_visibility=Cuml_VisibilityKind::Public
|
|
230
254
|
m3.java_code=<<CODE
|
|
231
|
-
_transition = "#{
|
|
232
|
-
getState().#{
|
|
255
|
+
_transition = "#{m3.java_Name}";
|
|
256
|
+
getState().#{m3.java_Name}(this);
|
|
233
257
|
_transition = null;
|
|
234
258
|
CODE
|
|
235
259
|
|
|
236
260
|
myClazz.java_getOrCreateOperationForTransition(t)
|
|
237
261
|
|
|
238
262
|
end
|
|
239
|
-
m2=state.umlx_createAndAddOperation(state.rdf_uri+"_#{t.
|
|
263
|
+
m2=state.umlx_createAndAddOperation(state.rdf_uri+"_#{t.rdf_uri.str_to_uri}","#{t.uml_name}")
|
|
240
264
|
m2.uml_visibility=Cuml_VisibilityKind::Public
|
|
241
|
-
em2=m2.umlx_createAndAddParameter(m2.rdf_uri+
|
|
265
|
+
em2=m2.umlx_createAndAddParameter(m2.rdf_uri+'_ctx','ctx')
|
|
242
266
|
em2.uml_type=fsmContext
|
|
243
267
|
em2.uml_direction=Cuml_ParameterDirectionKind::In
|
|
244
268
|
em2.uml_upperValue=state.umlx_literal(1)
|
|
@@ -250,7 +274,7 @@ CODE
|
|
|
250
274
|
CODE
|
|
251
275
|
|
|
252
276
|
}
|
|
253
|
-
|
|
277
|
+
return state
|
|
254
278
|
end
|
|
255
279
|
def fsm_name
|
|
256
280
|
n=uml_name_one0
|
|
@@ -265,22 +289,26 @@ module Muml_StateMachine
|
|
|
265
289
|
muml=mrdf.umlx_reserved_model
|
|
266
290
|
myClazz=mrdf.java_getClassWithQualifiedName("#{self.java_qualifiedName}")
|
|
267
291
|
raise Warning.new,"No Class with the same bame as ths StateMachine #{self.java_qualifiedName} !!!!" if myClazz.nil?
|
|
268
|
-
|
|
269
|
-
p=
|
|
292
|
+
|
|
293
|
+
p=myClazz.getFSMPackage
|
|
294
|
+
|
|
295
|
+
#p=myClazz.umlx_package
|
|
296
|
+
#p=p.umlx_getOrCreatePackage('fsm',p)
|
|
270
297
|
|
|
271
|
-
fsmCtx=umlx_getOrCreateClass(
|
|
272
|
-
fsmCtx.umlx_external=
|
|
273
|
-
fsmState=umlx_getOrCreateClass(
|
|
274
|
-
fsmState.umlx_external=
|
|
298
|
+
fsmCtx=umlx_getOrCreateClass('xmda.fsm.FSMContext')
|
|
299
|
+
fsmCtx.umlx_external=RDF_TRUE
|
|
300
|
+
fsmState=umlx_getOrCreateClass('xmda.fsm.State')
|
|
301
|
+
fsmState.umlx_external=RDF_TRUE
|
|
275
302
|
|
|
276
|
-
appFsmState=p.umlx_createAndAddClass(myClazz.rdf_uri+
|
|
303
|
+
appFsmState=p.umlx_createAndAddClass(myClazz.rdf_uri+'_FSMState')
|
|
304
|
+
appFsmState.java_addSerialVersionUID!
|
|
277
305
|
appFsmState.uml_name="#{myClazz.java_Name}State"
|
|
278
306
|
appFsmState.db_isTransient=RDF_TRUE
|
|
279
307
|
appFsmState.umlx_createAndAddGeneralization(fsmState)
|
|
280
308
|
myClazz.java_FSMState = appFsmState
|
|
281
|
-
construct=appFsmState.umlx_createAndAddOperation(fsmCtx.rdf_uri+
|
|
282
|
-
construct.uml_appliedStereotype_add(appFsmState.umlx_getOrCreateStereotype(
|
|
283
|
-
arg1=construct.umlx_createAndAddParameter(construct.rdf_uri+
|
|
309
|
+
construct=appFsmState.umlx_createAndAddOperation(fsmCtx.rdf_uri+'_constructor','constructor')
|
|
310
|
+
construct.uml_appliedStereotype_add(appFsmState.umlx_getOrCreateStereotype('Create'))
|
|
311
|
+
arg1=construct.umlx_createAndAddParameter(construct.rdf_uri+'_name','name')
|
|
284
312
|
arg1.uml_direction=Cuml_ParameterDirectionKind::In
|
|
285
313
|
arg1.uml_upperValue=umlx_literal(1)
|
|
286
314
|
arg1.uml_lowerValue=umlx_literal(1)
|
|
@@ -290,26 +318,26 @@ module Muml_StateMachine
|
|
|
290
318
|
super(name);
|
|
291
319
|
allStates.put(getName(), this);
|
|
292
320
|
CODE
|
|
293
|
-
pconst=appFsmState.umlx_createAndAddProperty(appFsmState.rdf_uri+
|
|
294
|
-
pconst.java_noAccessors=
|
|
295
|
-
typeconst=appFsmState.
|
|
296
|
-
typeconst.java_isGeneric=RDF_TRUE
|
|
321
|
+
pconst=appFsmState.umlx_createAndAddProperty(appFsmState.rdf_uri+'_AllConst', 'allStates')
|
|
322
|
+
pconst.java_noAccessors=RDF_TRUE
|
|
323
|
+
typeconst=appFsmState.umlx_getOrCreateGeneric("java.util.HashMap","String,#{appFsmState.java_qualifiedName}")
|
|
324
|
+
#typeconst.java_isGeneric=RDF_TRUE
|
|
297
325
|
pconst.uml_type=typeconst
|
|
298
326
|
pconst.uml_visibility=Cuml_VisibilityKind::Private
|
|
299
327
|
pconst.uml_isStatic=RDF_TRUE
|
|
300
|
-
pconst.java_isFinal="true"
|
|
301
|
-
pconst.java_code=<<CODE
|
|
302
|
-
new #{typeconst.java_qualifiedName}();
|
|
303
|
-
CODE
|
|
304
|
-
mfind=appFsmState.umlx_createAndAddOperation(appFsmState.rdf_uri+
|
|
328
|
+
# pconst.java_isFinal="true"
|
|
329
|
+
# pconst.java_code=<<CODE
|
|
330
|
+
# new #{typeconst.java_qualifiedName}();
|
|
331
|
+
#CODE
|
|
332
|
+
mfind=appFsmState.umlx_createAndAddOperation(appFsmState.rdf_uri+'_find','findStateByName')
|
|
305
333
|
mfind.uml_visibility=Cuml_VisibilityKind::Public
|
|
306
334
|
mfind.uml_isStatic=RDF_TRUE
|
|
307
|
-
argfind=mfind.umlx_createAndAddParameter(mfind.rdf_uri+
|
|
335
|
+
argfind=mfind.umlx_createAndAddParameter(mfind.rdf_uri+'_name','name')
|
|
308
336
|
argfind.uml_direction=Cuml_ParameterDirectionKind::In
|
|
309
337
|
argfind.uml_upperValue=umlx_literal(1)
|
|
310
338
|
argfind.uml_lowerValue=umlx_literal(1)
|
|
311
339
|
argfind.uml_type=umlx_dataType_string
|
|
312
|
-
rp=mfind.umlx_createAndAddParameter(mfind.rdf_uri+
|
|
340
|
+
rp=mfind.umlx_createAndAddParameter(mfind.rdf_uri+'_ret_param','return')
|
|
313
341
|
rp.uml_direction=Cuml_ParameterDirectionKind::Return
|
|
314
342
|
rp.uml_upperValue=umlx_literal(1)
|
|
315
343
|
rp.uml_lowerValue=umlx_literal(1)
|
|
@@ -319,14 +347,31 @@ CODE
|
|
|
319
347
|
CODE
|
|
320
348
|
|
|
321
349
|
|
|
322
|
-
appFsmCtx=p.umlx_createAndAddClass(myClazz.rdf_uri+
|
|
350
|
+
appFsmCtx=p.umlx_createAndAddClass(myClazz.rdf_uri+'_FSMContext')
|
|
351
|
+
appFsmCtx.java_addSerialVersionUID!
|
|
323
352
|
appFsmCtx.uml_name="#{myClazz.java_Name}FSMContext"
|
|
324
353
|
appFsmCtx.db_isTransient=RDF_TRUE
|
|
325
354
|
appFsmCtx.umlx_createAndAddGeneralization(fsmCtx)
|
|
326
355
|
myClazz.java_FSMContext = appFsmCtx
|
|
327
|
-
|
|
356
|
+
enumState=appFsmCtx.umlx_owner_one.umlx_createAndAddEnumeration(appFsmCtx.rdf_uri+"_fsmStateEnum",myClazz.uml_name_one.to_s+"_fsmStates")
|
|
357
|
+
enumState.umlx_createAndAddImplementation(enumState.java_getJavaEnumInterface)
|
|
358
|
+
enumState.umlx_createAndAddImplementation(umlx_getOrCreateInterface('xmda.fsm.FsmStateEnum'))
|
|
359
|
+
|
|
360
|
+
enumState.java_customCode=<<ENDCUSTOM
|
|
361
|
+
public Class<?> getStateClass() {
|
|
362
|
+
return stateClass ;
|
|
363
|
+
}
|
|
364
|
+
Class<?> stateClass=null;
|
|
365
|
+
#{enumState.java_Name}(Class<?> x) {
|
|
366
|
+
stateClass=x;
|
|
367
|
+
}
|
|
368
|
+
ENDCUSTOM
|
|
369
|
+
|
|
370
|
+
appFsmCtx.java_enumState=enumState
|
|
371
|
+
|
|
372
|
+
m=appFsmCtx.umlx_createAndAddOperation(fsmCtx.rdf_uri+'_ret','getState')
|
|
328
373
|
m.uml_visibility=Cuml_VisibilityKind::Public
|
|
329
|
-
rp=m.umlx_createAndAddParameter(m.rdf_uri+
|
|
374
|
+
rp=m.umlx_createAndAddParameter(m.rdf_uri+'_ret_param','return')
|
|
330
375
|
rp.uml_direction=Cuml_ParameterDirectionKind::Return
|
|
331
376
|
rp.uml_upperValue=umlx_literal(1)
|
|
332
377
|
rp.uml_lowerValue=umlx_literal(1)
|
|
@@ -334,18 +379,32 @@ CODE
|
|
|
334
379
|
m.java_code=<<CODE
|
|
335
380
|
return (#{appFsmState.java_qualifiedName})_state;
|
|
336
381
|
CODE
|
|
337
|
-
p2=appFsmCtx.umlx_createAndAddProperty(fsmState.rdf_uri+
|
|
382
|
+
p2=appFsmCtx.umlx_createAndAddProperty(fsmState.rdf_uri+'_prop_owner', 'owner')
|
|
338
383
|
p2.uml_type=myClazz
|
|
339
384
|
p2.uml_visibility=::Cuml_VisibilityKind::Private
|
|
340
385
|
appFsmCtx.java_addGlobalGetter!(p2)
|
|
341
386
|
appFsmCtx.java_addGlobalSetter!(p2)
|
|
342
387
|
|
|
388
|
+
codeBlocStatic = <<CODE
|
|
389
|
+
allStates = new #{typeconst.java_qualifiedName}();\n
|
|
390
|
+
CODE
|
|
343
391
|
uml_region.each { |reg|
|
|
344
392
|
reg.uml_subvertex.each { |v|
|
|
345
|
-
v.processVertex(myClazz)
|
|
393
|
+
state = v.processVertex(myClazz)
|
|
394
|
+
if !state.nil?
|
|
395
|
+
# Ajouter l'initalisation de la propri�t� dans le bloc statique
|
|
396
|
+
codeBlocStatic << "#{state.java_Name.downcase} = new #{state.java_qualifiedName}();\n"
|
|
397
|
+
end
|
|
346
398
|
}
|
|
347
399
|
}
|
|
348
400
|
|
|
401
|
+
blocstatic=appFsmState.umlx_createAndAddOperation(appFsmState.rdf_uri+'_static','static_for_fsm')
|
|
402
|
+
blocstatic.uml_visibility=Cuml_VisibilityKind::Public
|
|
403
|
+
blocstatic.uml_isStatic=RDF_TRUE
|
|
404
|
+
blocstatic.java_code=codeBlocStatic
|
|
405
|
+
stereo = p.umlx_createAndAddStereotype(rdf_uri+'Create', 'Create')
|
|
406
|
+
blocstatic.uml_appliedStereotype = stereo
|
|
407
|
+
|
|
349
408
|
# Rajouter le contexte dans la classe
|
|
350
409
|
myClazz.java_addStateManagement
|
|
351
410
|
#Chercher ou la g�n�rer pour chaque transition
|
|
@@ -407,8 +466,12 @@ module Muml_VisibilityKind
|
|
|
407
466
|
end
|
|
408
467
|
module Mrdf_Repository
|
|
409
468
|
def java_addStateMachine!()
|
|
469
|
+
s=Set.new
|
|
410
470
|
each_value { |sm|
|
|
411
471
|
next unless sm.kind_of?(Muml_StateMachine)
|
|
472
|
+
s.add(sm)
|
|
473
|
+
}
|
|
474
|
+
s.each { |sm|
|
|
412
475
|
sm.processStateMachine
|
|
413
476
|
}
|
|
414
477
|
end
|