ontomde-java 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/History.txt +10 -0
- data/Manifest.txt +156 -0
- data/README.txt +98 -0
- data/Rakefile +21 -0
- data/bin/ontomde-java +5 -0
- data/generateRdocFile.sh +16 -0
- data/lib/ontomde-java.rb +45 -0
- data/lib/ontomde-java/crank.rb +13 -0
- data/lib/ontomde-java/crank/context.rb +384 -0
- data/lib/ontomde-java/crank/crankJpa.rb +103 -0
- data/lib/ontomde-java/crank/equals.rb +83 -0
- data/lib/ontomde-java/crank/facelets.rb +243 -0
- data/lib/ontomde-java/crank/facesconfig.rb +113 -0
- data/lib/ontomde-java/crank/helper.rb +46 -0
- data/lib/ontomde-java/crank/main.rb +51 -0
- data/lib/ontomde-java/crank/menu.rb +39 -0
- data/lib/ontomde-java/crank/menu2.rb +78 -0
- data/lib/ontomde-java/crank/validation.rb +34 -0
- data/lib/ontomde-java/ejb2.rb +3 -0
- data/lib/ontomde-java/ejb2/main-ejb2.rb +194 -0
- data/lib/ontomde-java/flex.rb +7 -0
- data/lib/ontomde-java/flex/Editor.mxml.as.rb +184 -0
- data/lib/ontomde-java/flex/Editor.mxml.rb +701 -0
- data/lib/ontomde-java/flex/ImportationAS.rb +40 -0
- data/lib/ontomde-java/flex/ValueObjectAS.rb +338 -0
- data/lib/ontomde-java/flex/fileTypes.rb +19 -0
- data/lib/ontomde-java/flex/main.rb +347 -0
- data/lib/ontomde-java/frontend/command.rb +324 -0
- data/lib/ontomde-java/frontend/command.rdoc +583 -0
- data/lib/ontomde-java/frontend/defaultOptions.rb +124 -0
- data/lib/ontomde-java/frontend/options.rb +555 -0
- data/lib/ontomde-java/frontend/steps.rb +287 -0
- data/lib/ontomde-java/java/accessorCode.rb +528 -0
- data/lib/ontomde-java/java/accessorSignature.rb +347 -0
- data/lib/ontomde-java/java/annotationOntoMDE.rb +88 -0
- data/lib/ontomde-java/java/apache.rb +34 -0
- data/lib/ontomde-java/java/build.rb +80 -0
- data/lib/ontomde-java/java/collectionMapping.rb +112 -0
- data/lib/ontomde-java/java/component.rb +446 -0
- data/lib/ontomde-java/java/contextualize.rb +43 -0
- data/lib/ontomde-java/java/enumAssignable.rb +75 -0
- data/lib/ontomde-java/java/enumCompatibilityLayer.rb +195 -0
- data/lib/ontomde-java/java/equals.rb +91 -0
- data/lib/ontomde-java/java/groovy.rb +95 -0
- data/lib/ontomde-java/java/java.rb +1329 -0
- data/lib/ontomde-java/java/java.rdoc +78 -0
- data/lib/ontomde-java/java/javaDatatypeMapping.rb +156 -0
- data/lib/ontomde-java/java/javaHelper.rb +25 -0
- data/lib/ontomde-java/java/java_todo.rdoc +3 -0
- data/lib/ontomde-java/java/javadoc.rb +254 -0
- data/lib/ontomde-java/java/meta.rb +28 -0
- data/lib/ontomde-java/java/operationAsClass.rb +144 -0
- data/lib/ontomde-java/java/security.rb +260 -0
- data/lib/ontomde-java/java/stateMachine.rb +415 -0
- data/lib/ontomde-java/java/tenant.rb +65 -0
- data/lib/ontomde-java/java/xsd.rb +1363 -0
- data/lib/ontomde-java/java/xsdCollectionMapping.rb +112 -0
- data/lib/ontomde-java/java/xsdDatatypeMapping.rb +103 -0
- data/lib/ontomde-java/jpa.rb +17 -0
- data/lib/ontomde-java/jpa/configuration.rb +176 -0
- data/lib/ontomde-java/jpa/finder.rb +102 -0
- data/lib/ontomde-java/jpa/jpa.rb +531 -0
- data/lib/ontomde-java/jpa/jpa.rdoc +20 -0
- data/lib/ontomde-java/jpa/locking.rb +18 -0
- data/lib/ontomde-java/jpa/mapping.rb +314 -0
- data/lib/ontomde-java/jpa/redefined.rb +77 -0
- data/lib/ontomde-java/jpa/simulationAutoImplement.rb +54 -0
- data/lib/ontomde-java/jpdl.rb +9 -0
- data/lib/ontomde-java/jpdl/bpm.pprj +1745 -0
- data/lib/ontomde-java/jpdl/bpm.rdf +140 -0
- data/lib/ontomde-java/jpdl/bpm.rdfs +231 -0
- data/lib/ontomde-java/jpdl/constant.rb +5 -0
- data/lib/ontomde-java/jpdl/graphic.rb +52 -0
- data/lib/ontomde-java/jpdl/jpdl.rb +281 -0
- data/lib/ontomde-java/jpdl/jpdl_deploy.rb +114 -0
- data/lib/ontomde-java/jpdl/main.rb +348 -0
- data/lib/ontomde-java/jpdl/main.rdoc +2 -0
- data/lib/ontomde-java/jpdl/processOperationToClass.rb +316 -0
- data/lib/ontomde-java/kbjava.rb +6 -0
- data/lib/ontomde-java/kbjava/rdfToJava.rb +407 -0
- data/lib/ontomde-java/struts.rb +27 -0
- data/lib/ontomde-java/struts/MessageResources.rb +359 -0
- data/lib/ontomde-java/struts/action.rb +883 -0
- data/lib/ontomde-java/struts/blob.rb +11 -0
- data/lib/ontomde-java/struts/exceptionHandling.rb +167 -0
- data/lib/ontomde-java/struts/footer.rb +128 -0
- data/lib/ontomde-java/struts/form.rb +450 -0
- data/lib/ontomde-java/struts/header.rb +37 -0
- data/lib/ontomde-java/struts/header_link.rb +39 -0
- data/lib/ontomde-java/struts/jsp_edit.rb +870 -0
- data/lib/ontomde-java/struts/jsp_edit_field.rb +1 -0
- data/lib/ontomde-java/struts/jsp_edit_js.rb +124 -0
- data/lib/ontomde-java/struts/jsp_index.rb +136 -0
- data/lib/ontomde-java/struts/localeAction.rb +641 -0
- data/lib/ontomde-java/struts/main.rb +41 -0
- data/lib/ontomde-java/struts/mappingForBean.rb +132 -0
- data/lib/ontomde-java/struts/mappingForJsp.rb +272 -0
- data/lib/ontomde-java/struts/mappingToJavaHierarchy.rb +87 -0
- data/lib/ontomde-java/struts/reloadAction.rb +33 -0
- data/lib/ontomde-java/struts/spring.rb +89 -0
- data/lib/ontomde-java/struts/struts-config.rb +232 -0
- data/lib/ontomde-java/struts/validation.rb +116 -0
- data/lib/ontomde-java/struts/validator.rb +341 -0
- data/lib/ontomde-java/struts/webXml.rb +195 -0
- data/lib/ontomde-java/struts/xmlForm.rb +308 -0
- data/lib/ontomde-java/version.rb +5 -0
- data/profiling.xls +0 -0
- data/test/.classpath +14 -0
- data/test/.project +17 -0
- data/test/.settings/org.eclipse.jdt.core.prefs +23 -0
- data/test/Rakefile +71 -0
- data/test/build.xml +34 -0
- data/test/classpath.rb +15 -0
- data/test/lib/junit-4.1.jar +0 -0
- data/test/load1.rb +3 -0
- data/test/load2.rb +3 -0
- data/test/log4j.properties +46 -0
- data/test/model/.project +11 -0
- data/test/model/BigProject.mdzip +0 -0
- data/test/model/BigProject.mdzip.nt +102866 -0
- 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 +149 -0
- data/test/model/model_ea71.ea.xmi +4470 -0
- data/test/model/model_ea71.eap +0 -0
- data/test/model/model_ea71_README.txt +8 -0
- data/test/model/multipleInheritance.emx +466 -0
- data/test/model/multipleInheritance.emx.nt +2428 -0
- data/test/model/simple1-530.ofp +0 -0
- data/test/model/simple1-includedAsReference.emx +169 -0
- data/test/model/simple1.emx +3729 -0
- data/test/model/simple1.emx.fragments.nt +81 -0
- data/test/model/simple1.emx.nt +5760 -0
- data/test/model/simple1.mdzip +0 -0
- data/test/model/simple1.mdzip.nt +11500 -0
- data/test/model/simple1.oe530.nt +1986 -0
- data/test/model/simple1.oe600.nt +1627 -0
- data/test/src/RuntimeTest.java +656 -0
- data/test/src/testsLevel1.java +174 -0
- data/test/src/testsLevel2.java +29 -0
- data/test/src/testsLevel3.java +40 -0
- data/test/test-ea7.sh +15 -0
- data/test/test-magicDraw.sh +10 -0
- data/test/test-mi.sh +9 -0
- data/test/test-oe530.sh +10 -0
- data/test/test-oe600.sh +11 -0
- data/test/test-rsm.sh +11 -0
- data/test/test_export_ea71.rb +5 -0
- data/test/test_export_oe530.rb +4 -0
- data/test/test_export_oe600.rb +4 -0
- data/test/test_export_rsm60.rb +4 -0
- data/test/trace +419 -0
- data/test/uml_test.rb +1434 -0
- data/test/uml_test.xls +0 -0
- data/test/unit_test.rb +6 -0
- metadata +224 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
|
2
|
+
module Mrdf_Resource
|
3
|
+
#returns directory containing compiled
|
4
|
+
#java classes and other ressources in classpath.
|
5
|
+
def java_ClassRelativeDir
|
6
|
+
p="#{context[:javaDir]}"
|
7
|
+
p="#{context[:webContentRelativeDir,p]}"
|
8
|
+
p="#{p}/WEB-INF/classes"
|
9
|
+
p="#{context[:javaClassDir,p]}"
|
10
|
+
return p
|
11
|
+
end
|
12
|
+
end
|
13
|
+
module Mrdf_Repository
|
14
|
+
#returns directory containing compiled
|
15
|
+
#java classes and other ressources in classpath.
|
16
|
+
def java_ClassRelativeDir
|
17
|
+
p="#{context[:javaDir]}"
|
18
|
+
p="#{context[:webContentRelativeDir,p]}"
|
19
|
+
p="#{p}/WEB-INF/classes"
|
20
|
+
p="#{context[:javaClassDir,p]}"
|
21
|
+
return p
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module Mrdf_Repository
|
26
|
+
def java_generateAntBuildFile
|
27
|
+
return unless context[:generateAntBuildFile,false]
|
28
|
+
|
29
|
+
mtk_writeSession("#{context[:targetDir]}/build.xml") {
|
30
|
+
write %{
|
31
|
+
<project name="demo" default="all">
|
32
|
+
|
33
|
+
<target name="all" depends="compile,log4j" />
|
34
|
+
|
35
|
+
<target name="compile">
|
36
|
+
<mkdir dir="#{java_ClassRelativeDir}" />
|
37
|
+
<sync todir="#{java_ClassRelativeDir}">
|
38
|
+
<fileset dir="#{context[:javaRelativeDir]}">
|
39
|
+
<include name="**/*"/>
|
40
|
+
<exclude name="**/*.java"/>
|
41
|
+
</fileset>
|
42
|
+
<!-- only supported if ant >=1.7
|
43
|
+
<preserveintarget>
|
44
|
+
<include name="**/*.class"/>
|
45
|
+
</preserveintarget>
|
46
|
+
-->
|
47
|
+
</sync>
|
48
|
+
<javac srcdir="#{context[:javaRelativeDir]}" destdir="#{java_ClassRelativeDir}" debug="yes">
|
49
|
+
<classpath>
|
50
|
+
<!-- catch-all -->
|
51
|
+
<fileset dir="." includes="**/*.jar" />
|
52
|
+
</classpath>
|
53
|
+
<compilerarg value="-Xlint:deprecation"/>
|
54
|
+
<compilerarg value="-Xlint:unchecked"/>
|
55
|
+
</javac>
|
56
|
+
</target>
|
57
|
+
<target name="log4j">
|
58
|
+
<concat destfile="#{java_ClassRelativeDir}/log4j.properties">
|
59
|
+
<header filtering="no" trimleading="yes">
|
60
|
+
# ---------------------------------------
|
61
|
+
# Changes to this file will be deleted
|
62
|
+
# on next ant build because
|
63
|
+
# this file is the concatenation of
|
64
|
+
# file matching log4j*.properties
|
65
|
+
# in #{context[:javaRelativeDir]}"
|
66
|
+
# ---------------------------------------
|
67
|
+
</header>
|
68
|
+
|
69
|
+
<fileset dir="#{context[:javaRelativeDir]}" includes="log4j*.properties"/>
|
70
|
+
</concat>
|
71
|
+
</target>
|
72
|
+
<target name="clean" />
|
73
|
+
|
74
|
+
</project>
|
75
|
+
}
|
76
|
+
}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# Java collection mapping rules for UML property and UML parameter.
|
2
|
+
|
3
|
+
module Muml_MultiplicityElement
|
4
|
+
#returns a Java_collectionMaping object containing mapping rules to java collection element
|
5
|
+
#
|
6
|
+
#Examples:
|
7
|
+
# * Array
|
8
|
+
# * List
|
9
|
+
# * Set
|
10
|
+
#
|
11
|
+
#Reference:
|
12
|
+
# * #java_use_Arrays?
|
13
|
+
def java_getCollectionMapping
|
14
|
+
if self.umlx_upperValueIsOne?
|
15
|
+
return Java_collectionMapping_None.instance
|
16
|
+
elsif java_use_Arrays?
|
17
|
+
return Java_collectionMapping_Array.instance
|
18
|
+
elsif uml_isOrdered?
|
19
|
+
# this mapping is used wether or not isUnique
|
20
|
+
return Java_collectionMapping_List_ArrayList.instance
|
21
|
+
elsif uml_isUnique
|
22
|
+
return Java_collectionMapping_Set_HashSet.instance
|
23
|
+
else
|
24
|
+
return Java_collectionMapping_Collection_ArrayList.instance
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Helper class for wrapping a base type in ad-hoc collection.
|
30
|
+
class Java_collectionMapping_None
|
31
|
+
include Singleton
|
32
|
+
#return type enclosed in collection interface declaration
|
33
|
+
def addCollectionInterface(type)
|
34
|
+
return type
|
35
|
+
end
|
36
|
+
#return type enclosed in collection implementation declaration
|
37
|
+
def addCollectionImplem(type)
|
38
|
+
return type
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Helper class for wrapping a base type in ad-hoc collection.
|
43
|
+
class Java_collectionMapping_base
|
44
|
+
# return type enclosed in collection interface declaration
|
45
|
+
def addCollectionInterface(type)
|
46
|
+
return "#{getInterface}<#{type}>"
|
47
|
+
end
|
48
|
+
# return type enclosed in collection implementation declaration
|
49
|
+
def addCollectionImplem(type)
|
50
|
+
return "#{getImplem}<#{type}>"
|
51
|
+
end
|
52
|
+
# return new element type collection creator
|
53
|
+
def addNew(type)
|
54
|
+
return "new #{getImplem}<#{type}>()"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Helper class for wrapping a base type in ad-hoc collection.
|
59
|
+
class Java_collectionMapping_Collection_ArrayList < Java_collectionMapping_base
|
60
|
+
include Singleton
|
61
|
+
# returns interface type for this collection
|
62
|
+
def getInterface
|
63
|
+
return "Collection"
|
64
|
+
end
|
65
|
+
# returns implementation class for this collection
|
66
|
+
def getImplem
|
67
|
+
return "java.util.ArrayList"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Helper class for wrapping a base type in ad-hoc collection.
|
72
|
+
class Java_collectionMapping_List_ArrayList < Java_collectionMapping_base
|
73
|
+
include Singleton
|
74
|
+
# returns interface type for this collection
|
75
|
+
def getInterface
|
76
|
+
return "java.util.List"
|
77
|
+
end
|
78
|
+
# returns implementation class for this collection
|
79
|
+
def getImplem
|
80
|
+
return "java.util.ArrayList"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Helper class for wrapping a base type in ad-hoc collection.
|
85
|
+
class Java_collectionMapping_Set_HashSet < Java_collectionMapping_base
|
86
|
+
include Singleton
|
87
|
+
# returns interface type for this collection
|
88
|
+
def getInterface
|
89
|
+
return "java.util.Set"
|
90
|
+
end
|
91
|
+
# returns implementation class for this collection
|
92
|
+
def getImplem
|
93
|
+
return "java.util.HashSet"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Helper class for wrapping a base type in ad-hoc collection.
|
98
|
+
class Java_collectionMapping_Array
|
99
|
+
include Singleton
|
100
|
+
# return type enclosed in collection interface declaration
|
101
|
+
def addCollectionInterface(type)
|
102
|
+
return "#{type}[]"
|
103
|
+
end
|
104
|
+
# return type enclosed in collection implementation declaration
|
105
|
+
def addCollectionImplem(type)
|
106
|
+
return "#{type}[]"
|
107
|
+
end
|
108
|
+
# return new element type collection creator
|
109
|
+
def addNew(type)
|
110
|
+
return "new #{type}[0]"
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,446 @@
|
|
1
|
+
|
2
|
+
module Mrdf_Repository
|
3
|
+
#process every component
|
4
|
+
|
5
|
+
def java_autoGenerateCrudComponents!
|
6
|
+
uml_Class_all.each { |c|
|
7
|
+
next unless c.kind_of?(Cuml_Class)
|
8
|
+
c.java_createCrudComponent!
|
9
|
+
}
|
10
|
+
end
|
11
|
+
def java_processComponents!
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
uml_Component_all.each { |c|
|
16
|
+
c.java_processComponent!
|
17
|
+
}
|
18
|
+
|
19
|
+
mtk_writeSession("#{context[:webContentDir]}/WEB-INF/jwsContext.xml") {
|
20
|
+
jws_config_write
|
21
|
+
}
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def jws_config_write
|
26
|
+
write <<JWS
|
27
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
28
|
+
|
29
|
+
<beans xmlns="http://www.springframework.org/schema/beans"
|
30
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
31
|
+
xmlns:context="http://www.springframework.org/schema/context"
|
32
|
+
xmlns:cxf="http://cxf.apache.org/core"
|
33
|
+
xmlns:jaxws="http://cxf.apache.org/jaxws"
|
34
|
+
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
35
|
+
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
36
|
+
http://www.springframework.org/schema/context
|
37
|
+
http://www.springframework.org/schema/context/spring-context-2.5.xsd
|
38
|
+
http://cxf.apache.org/core
|
39
|
+
http://cxf.apache.org/schemas/core.xsd
|
40
|
+
http://cxf.apache.org/jaxws
|
41
|
+
http://cxf.apache.org/schemas/jaxws.xsd"
|
42
|
+
default-autowire="byName">
|
43
|
+
|
44
|
+
<!-- Load CXF modules from cxf.jar -->
|
45
|
+
<import resource="classpath:META-INF/cxf/cxf.xml" />
|
46
|
+
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
|
47
|
+
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
|
48
|
+
|
49
|
+
<!-- Enable message logging using the CXF logging feature -->
|
50
|
+
<cxf:bus>
|
51
|
+
<cxf:features>
|
52
|
+
<cxf:logging/>
|
53
|
+
</cxf:features>
|
54
|
+
</cxf:bus>
|
55
|
+
|
56
|
+
<!-- Aegis data binding -->
|
57
|
+
<bean id="aegisBean"
|
58
|
+
class="org.apache.cxf.aegis.databinding.AegisDatabinding"
|
59
|
+
scope="prototype"/>
|
60
|
+
<bean id="jaxws-and-aegis-service-factory"
|
61
|
+
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
|
62
|
+
scope="prototype">
|
63
|
+
<property name="dataBinding" ref="aegisBean"/>
|
64
|
+
<property name="serviceConfigurations">
|
65
|
+
<list>
|
66
|
+
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
|
67
|
+
<bean class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
|
68
|
+
<bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
|
69
|
+
</list>
|
70
|
+
</property>
|
71
|
+
</bean>
|
72
|
+
JWS
|
73
|
+
|
74
|
+
uml_Component_all.each { |c|
|
75
|
+
c.writeJWSConfig
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
write <<JWS
|
80
|
+
</beans>
|
81
|
+
JWS
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
module Muml_Component
|
87
|
+
def umlx_isStatelessComponent?
|
88
|
+
return uml_ownedAttribute.empty?
|
89
|
+
end
|
90
|
+
|
91
|
+
def writeJWSConfig
|
92
|
+
write <<CONFIG
|
93
|
+
<!-- Service endpoint -->
|
94
|
+
<bean id="#{self.java_Name}" class="#{self.java_qualifiedName}"/>
|
95
|
+
<jaxws:endpoint id="#{self.java_Name}EndPoint"
|
96
|
+
implementorClass="#{self.java_qualifiedName}"
|
97
|
+
implementor="##{self.java_Name}"
|
98
|
+
address="/#{self.java_Name}">
|
99
|
+
<jaxws:serviceFactory>
|
100
|
+
<ref bean="jaxws-and-aegis-service-factory"/>
|
101
|
+
</jaxws:serviceFactory>
|
102
|
+
</jaxws:endpoint>
|
103
|
+
CONFIG
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
def java_processComponent!
|
109
|
+
# if umlx_isStatelessComponent?
|
110
|
+
# java_annotation_add("@javax.ejb.Stateless")
|
111
|
+
# java_annotation_add("@javax.jws.WebService")
|
112
|
+
# else
|
113
|
+
# java_annotation_add("@javax.ejb.Statefull")
|
114
|
+
# end
|
115
|
+
java_annotation_add("@javax.jws.WebService")
|
116
|
+
|
117
|
+
uml_ownedOperation.each { |op|
|
118
|
+
op.java_annotation_add("@javax.jws.WebMethod")
|
119
|
+
op.uml_ownedParameter.each{|p|
|
120
|
+
next if p.uml_direction_one==Cuml_ParameterDirectionKind::Return
|
121
|
+
p.java_annotation_add("@javax.jws.WebParam(name=\"#{p.java_Name}\")")
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
module Muml_TypedElement
|
129
|
+
#mode requested for soa
|
130
|
+
rdf_attr :soa_requestedMode,[::Mrdfs_Literal]
|
131
|
+
end
|
132
|
+
module Muml_Class
|
133
|
+
|
134
|
+
|
135
|
+
# create a CRUD component associated to this class
|
136
|
+
# for exposing CRUD services on this object.
|
137
|
+
def java_createCrudComponent!
|
138
|
+
|
139
|
+
return if umlx_hasStereotype?('DTO')
|
140
|
+
return if db_isDAO?
|
141
|
+
return unless umlx_businessMethod?
|
142
|
+
|
143
|
+
base=self
|
144
|
+
p=base.umlx_owner_one
|
145
|
+
p=p.umlx_getOrCreatePackage(base.context[:crudComponentPackage,"ws"],p)
|
146
|
+
|
147
|
+
c=p.umlx_createAndAddComponent("#{self.rdf_uri}_crudc","#{uml_name} CRUD")
|
148
|
+
#puts "component created: #{c}"
|
149
|
+
#struts_addCreateAndAddActions!
|
150
|
+
|
151
|
+
create=c.umlx_createAndAddOperation("#{c.rdf_uri}_create","create")
|
152
|
+
ret=create.umlx_createAndAddReturnParameter("#{create.rdf_uri}")
|
153
|
+
ret.uml_type=base
|
154
|
+
ret.soa_requestedMode="ID"
|
155
|
+
|
156
|
+
update=c.umlx_createAndAddOperation("#{c.rdf_uri}_update","update")
|
157
|
+
p1=update.umlx_createAndAddParameter("#{update.rdf_uri}","updateData")
|
158
|
+
p1.uml_type=base
|
159
|
+
p1.soa_requestedMode="FULL"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
module Mrdf_Repository
|
164
|
+
def dto_generateCustomDTO()
|
165
|
+
data_model=self[:dataModel]
|
166
|
+
return if data_model.nil?
|
167
|
+
cdfs=Set.new
|
168
|
+
data_model.each { |k,v|
|
169
|
+
next unless v.kind_of?(Msoa_customDataFilter)
|
170
|
+
cdfs.add(v)
|
171
|
+
}
|
172
|
+
|
173
|
+
dto_autoPopulate!
|
174
|
+
|
175
|
+
|
176
|
+
uml_Class_all.each { |c|
|
177
|
+
next unless c.kind_of?(Muml_Class)
|
178
|
+
next if c.umlx_hasStereotype?('DTO')
|
179
|
+
next if c.db_isDAO?
|
180
|
+
next unless c.umlx_businessMethod?
|
181
|
+
|
182
|
+
cdfs.each { |v|
|
183
|
+
#next unless v.kind_of?(Msoa_customDataFilter)
|
184
|
+
#puts "v --> #{v.class}"
|
185
|
+
v.dto_getFilteredClass(c)
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
#puts "!!!!!!!!!!!!!!!!!!!!!!!!!!! Proc "
|
190
|
+
|
191
|
+
s=Set.new
|
192
|
+
data_model.each_value { |rule|
|
193
|
+
next unless rule.kind_of?(Msoa_dataParameterFilterRule)
|
194
|
+
s.add(rule)
|
195
|
+
}
|
196
|
+
s.each{|rule|
|
197
|
+
# puts "°°°°°Processing filter #{rule}"
|
198
|
+
# puts "??? #{rule.soa_filteredProperty_one}"
|
199
|
+
# puts "??? #{rule.soa_useDataFilter_one}"
|
200
|
+
#
|
201
|
+
prop=rule.soa_filteredProperty_one
|
202
|
+
prop_uml=self[prop.rdf_uri]
|
203
|
+
# puts "prop_uml: #{prop_uml}:#{prop_uml.class}"
|
204
|
+
filter=rule.soa_useDataFilter_one
|
205
|
+
fc_uml=filter.dto_getFilteredClass(prop_uml.uml_type_one)
|
206
|
+
# puts "fc_uml: #{fc_uml}:#{fc_uml.class}"
|
207
|
+
|
208
|
+
# Replacing core type by filtered type
|
209
|
+
# puts "#{__LINE__} changing #{prop_uml.uml_type} to #{fc_uml} in #{prop_uml}"
|
210
|
+
prop_uml.uml_type=fc_uml
|
211
|
+
}
|
212
|
+
|
213
|
+
each_value { |prop_uml|
|
214
|
+
next unless prop_uml.kind_of?(Muml_TypedElement)
|
215
|
+
next if prop_uml.soa_requestedMode.empty?
|
216
|
+
|
217
|
+
filter=dto_findFilterByName(prop_uml.soa_requestedMode.to_s)
|
218
|
+
fc_uml=filter.dto_getFilteredClass(prop_uml.uml_type_one)
|
219
|
+
# puts "!!!@@@!!! soa_requestedMode : #{prop_uml.soa_requestedMode} --> #{filter}"
|
220
|
+
# puts "#{__LINE__} changing #{prop_uml.uml_type} to #{fc_uml}"
|
221
|
+
prop_uml.uml_type=fc_uml
|
222
|
+
}
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
end
|
227
|
+
attr_reader :soa_IgnoreDataFilter #, [::Mrdf_Resource ]
|
228
|
+
attr_writer :soa_IgnoreDataFilter #, [::Mrdf_Resource ]
|
229
|
+
|
230
|
+
# automatically add missing predefined mappings
|
231
|
+
# to repository.
|
232
|
+
def dto_autoPopulate!
|
233
|
+
data_model=self[:dataModel]
|
234
|
+
found=Set.new
|
235
|
+
data_model.each_value { |rule|
|
236
|
+
next unless rule.kind_of?(Msoa_predefinedDataFilter)
|
237
|
+
found.add(rule.soa_dataFilterName.to_s)
|
238
|
+
}
|
239
|
+
["FULL","ID","debug","INCLUDE"].each {|s|
|
240
|
+
next if found.include?(s)
|
241
|
+
#puts "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ creating #{s}"
|
242
|
+
pdf=Csoa_predefinedDataFilter.new(data_model,"predefinedDataFilter:#{s}")
|
243
|
+
pdf.soa_dataFilterName=s
|
244
|
+
}
|
245
|
+
end
|
246
|
+
|
247
|
+
def dto_findFilterByName(filterName)
|
248
|
+
data_model=self[:dataModel]
|
249
|
+
data_model.each_value { |rule|
|
250
|
+
next unless rule.kind_of?(Msoa_dataFilter)
|
251
|
+
next unless rule.soa_dataFilterName.to_s==filterName
|
252
|
+
return rule
|
253
|
+
}
|
254
|
+
return soa_getPredefinedDataFilter(filterName) if ["IGNORE","FULL","ID"].include?(filterName)
|
255
|
+
raise Exception.new("soa filter not found with name='#{filterName}'")
|
256
|
+
end
|
257
|
+
|
258
|
+
def dto_addFilter!(typedElement, filterName)
|
259
|
+
data_model=self[:dataModel]
|
260
|
+
filter=dto_findFilterByName(filterName)
|
261
|
+
|
262
|
+
dpfr=Csoa_dataParameterFilterRule(data_model,"#{typeElement}_filter")
|
263
|
+
dpfr.soa_filteredProperty=typedElement
|
264
|
+
dpfr.soa_useDataFilter=filter
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
module Muml_Class
|
269
|
+
rdf_attr :dto_isPopulated, [ ::Mrdfs_Literal ]
|
270
|
+
end
|
271
|
+
|
272
|
+
module Msoa_dataFilter
|
273
|
+
#return predefinedFilterRule none
|
274
|
+
def soa_getIgnoreDataFilter()
|
275
|
+
return soa_getPredefinedDataFilter('IGNORE', self.rdf_Repository.soa_IgnoreDataFilter) { |v|
|
276
|
+
self.rdf_Repository.soa_IgnoreDataFilter=v
|
277
|
+
}
|
278
|
+
end
|
279
|
+
#return predefinedFilterRule none
|
280
|
+
def soa_getIdDataFilter()
|
281
|
+
return soa_getPredefinedDataFilter('ID')
|
282
|
+
end
|
283
|
+
def soa_getFullDataFilter()
|
284
|
+
return soa_getPredefinedDataFilter('FULL')
|
285
|
+
end
|
286
|
+
|
287
|
+
def soa_getPredefinedDataFilter(name,suggestion=nil)
|
288
|
+
ret=suggestion
|
289
|
+
if ret.nil?
|
290
|
+
rdf_Repository.each {|k,v|
|
291
|
+
next unless v.kind_of?(Msoa_predefinedDataFilter)
|
292
|
+
next unless v.soa_dataFilterName.to_s==name
|
293
|
+
ret=v
|
294
|
+
break
|
295
|
+
}
|
296
|
+
if ret.nil?
|
297
|
+
ret=Csoa_predefinedDataFilter.new(rdf_Repository,"uri://soa_filter_#{name}")
|
298
|
+
ret.soa_dataFilterName=name
|
299
|
+
end
|
300
|
+
yield(ret)
|
301
|
+
end
|
302
|
+
#puts "!!! #{name} filter"
|
303
|
+
return ret
|
304
|
+
end
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
def dto_findFilterByName(filterName)
|
310
|
+
data_model=rdf_Repository #self[:dataModel]
|
311
|
+
data_model.each_value { |rule|
|
312
|
+
next unless rule.kind_of?(Msoa_dataFilter)
|
313
|
+
next unless rule.soa_dataFilterName.to_s==filterName
|
314
|
+
return rule
|
315
|
+
}
|
316
|
+
raise Exception.new("soa filter not found with name='#{filterName}'")
|
317
|
+
end
|
318
|
+
|
319
|
+
def dto_getDataFilter(sourceField)
|
320
|
+
if self.soa_dataFilterName.to_s=="ID"
|
321
|
+
return (sourceField.uml_name.to_s=="id") ? dto_findFilterByName("INCLUDE") : soa_getIgnoreDataFilter()
|
322
|
+
end
|
323
|
+
if self.soa_dataFilterName.to_s=="FULL"
|
324
|
+
return dto_findFilterByName("ID")
|
325
|
+
end
|
326
|
+
|
327
|
+
filterRule=dto_getFilterRule(sourceField)
|
328
|
+
if filterRule.nil?
|
329
|
+
#puts "field ignored :#{sourceField} (#{sourceField.umlx_owner_one})"
|
330
|
+
return soa_getIgnoreDataFilter
|
331
|
+
end
|
332
|
+
filter=filterRule.soa_useDataFilter_one0
|
333
|
+
return soa_getIgnoreDataFilter if filter.nil?
|
334
|
+
return filter
|
335
|
+
end
|
336
|
+
|
337
|
+
def dto_getFilterRule(field)
|
338
|
+
raise Exception.new("field nil") if field.nil?
|
339
|
+
r=nil
|
340
|
+
soa_sourceDataFilter_inv.each { |f|
|
341
|
+
#puts "f --> #{f.class} #{f.soa_filteredProperty.class}:[#{f.soa_filteredProperty}] #{field.rdf_uri} "
|
342
|
+
found=false
|
343
|
+
f.soa_filteredProperty.each {|z|
|
344
|
+
# z is a Ckb_UML_SLOT
|
345
|
+
#puts "z----> #{z.to_s} #{field.rdf_uri}"
|
346
|
+
next unless z.to_s==field.rdf_uri.to_s
|
347
|
+
found=true
|
348
|
+
break
|
349
|
+
}
|
350
|
+
next unless found
|
351
|
+
#next unless f.soa_filteredProperty.include?(field)
|
352
|
+
|
353
|
+
#puts "f --> OK "
|
354
|
+
unless r.nil?
|
355
|
+
puts "TODO: error multiple source data filter for field #{f}"
|
356
|
+
end
|
357
|
+
r=f
|
358
|
+
}
|
359
|
+
return r
|
360
|
+
end
|
361
|
+
|
362
|
+
def dto_getFilteredClass(umlClass)
|
363
|
+
#puts "dto_getFilteredClass(#{umlClass}:#{umlClass.class})"
|
364
|
+
|
365
|
+
if umlClass.kind_of?(Muml_PrimitiveType) || umlClass.kind_of?(Muml_DataType)
|
366
|
+
return umlClass
|
367
|
+
#tpl=DatatypeMapping.instance.getMapping(umlClass)
|
368
|
+
#return tpl.getFormType(umlClass) #Note: class instead of field
|
369
|
+
end
|
370
|
+
return umlClass if self.soa_dataFilterName.to_s=="INCLUDE"
|
371
|
+
#puts "#{__LINE__} #{umlClass.class} #{umlClass.java_Name} #{umlClass.java_qualifiedName}"
|
372
|
+
return umlClass if umlClass.java_qualifiedName.to_s.index("java.")==0
|
373
|
+
|
374
|
+
|
375
|
+
dto=umlClass.umlx_getOrCreateClass("filter."+self.soa_dataFilterName.to_s+"."+umlClass.java_qualifiedName.to_s+"_"+self.soa_dataFilterName.to_s)
|
376
|
+
return dto if dto.dto_isPopulated?
|
377
|
+
dto.dto_isPopulated=RDF_TRUE
|
378
|
+
dto.umlx_external=RDF_FALSE
|
379
|
+
dto.db_isTransient=RDF_TRUE
|
380
|
+
dto.umlx_businessMethod=RDF_FALSE
|
381
|
+
|
382
|
+
#puts "dto=#{dto}"
|
383
|
+
umlClass.uml_generalization.each {|g|
|
384
|
+
#adds generalization from element in same mode as current.
|
385
|
+
clazz=dto_getFilteredClass(g.uml_general_one)
|
386
|
+
#puts "generalization for #{umlClass} : #{g.uml_general_one} --> #{clazz}"
|
387
|
+
if clazz.nil?
|
388
|
+
puts "No filter #{self} for #{g.uml_general_one}. Class ignore in inheritance"
|
389
|
+
next
|
390
|
+
end
|
391
|
+
dto.umlx_createAndAddGeneralization(clazz)
|
392
|
+
}
|
393
|
+
|
394
|
+
umlClass.uml_ownedAttribute.each { |sourceField|
|
395
|
+
# puts "p-->#{p}"
|
396
|
+
# f=dto_getFilterRule(p)
|
397
|
+
next if sourceField.uml_isStatic?
|
398
|
+
#next if sourceField.uml_isFinal?
|
399
|
+
dto_createAssociatedField(dto,sourceField)
|
400
|
+
}
|
401
|
+
return dto
|
402
|
+
end
|
403
|
+
|
404
|
+
# create a field in dto class associated to sourceField.
|
405
|
+
def dto_createAssociatedField(dtoClass,sourceField)
|
406
|
+
#log.debug { %{add form field #{self} to #{form}} }
|
407
|
+
|
408
|
+
#return unless sourceField.umlx_businessMethod?
|
409
|
+
|
410
|
+
#puts "adding field for #{sourceField} in dto #{dtoClass}"
|
411
|
+
|
412
|
+
filter=dto_getDataFilter(sourceField)
|
413
|
+
# if filter.nil?
|
414
|
+
# puts "missing useDataFilter for filterRule #{filterRule}"
|
415
|
+
# return
|
416
|
+
# end
|
417
|
+
|
418
|
+
if filter.soa_dataFilterName.to_s=="IGNORE"
|
419
|
+
#puts "IGNORE data filter"
|
420
|
+
return
|
421
|
+
end
|
422
|
+
|
423
|
+
# puts "filter=#{filter.soa_dataFilterName}"
|
424
|
+
targetType=filter.dto_getFilteredClass(sourceField.uml_type_one)
|
425
|
+
if targetType.nil?
|
426
|
+
puts "nil filtered type returned for #{sourceField}"
|
427
|
+
return
|
428
|
+
end
|
429
|
+
|
430
|
+
|
431
|
+
a2=dtoClass.umlx_createAndAddProperty(sourceField.rdf_uri+"_dtoField")
|
432
|
+
a2.uml_name=sourceField.uml_name
|
433
|
+
a2.uml_upperValue=sourceField.uml_upperValue
|
434
|
+
a2.uml_lowerValue=sourceField.uml_lowerValue
|
435
|
+
a2.java_use_Arrays=RDF_TRUE
|
436
|
+
# a2.struts_sourceProperty=self
|
437
|
+
|
438
|
+
a2.uml_type=targetType
|
439
|
+
a2.uml_type=a2.umlx_owner_one.umlx_dataType_string if a2.uml_type_one0.nil?
|
440
|
+
return a2
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|