ontomde-uml2-crank 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +16 -0
- data/README.txt +50 -0
- data/Rakefile +32 -0
- data/lib/ontomde-uml2-crank.rb +19 -0
- data/lib/ontomde-uml2-crank/context.rb +384 -0
- data/lib/ontomde-uml2-crank/crankJpa.rb +103 -0
- data/lib/ontomde-uml2-crank/equals.rb +83 -0
- data/lib/ontomde-uml2-crank/facelets.rb +243 -0
- data/lib/ontomde-uml2-crank/facesconfig.rb +113 -0
- data/lib/ontomde-uml2-crank/helper.rb +46 -0
- data/lib/ontomde-uml2-crank/main.rb +53 -0
- data/lib/ontomde-uml2-crank/menu.rb +39 -0
- data/lib/ontomde-uml2-crank/menu2.rb +78 -0
- data/lib/ontomde-uml2-crank/validation.rb +34 -0
- data/lib/ontomde-uml2-crank/version.rb +7 -0
- metadata +88 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
lib/ontomde-uml2-crank.rb
|
6
|
+
lib/ontomde-uml2-crank/context.rb
|
7
|
+
lib/ontomde-uml2-crank/crankJpa.rb
|
8
|
+
lib/ontomde-uml2-crank/equals.rb
|
9
|
+
lib/ontomde-uml2-crank/facelets.rb
|
10
|
+
lib/ontomde-uml2-crank/facesconfig.rb
|
11
|
+
lib/ontomde-uml2-crank/helper.rb
|
12
|
+
lib/ontomde-uml2-crank/main.rb
|
13
|
+
lib/ontomde-uml2-crank/menu.rb
|
14
|
+
lib/ontomde-uml2-crank/menu2.rb
|
15
|
+
lib/ontomde-uml2-crank/validation.rb
|
16
|
+
lib/ontomde-uml2-crank/version.rb
|
data/README.txt
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
ontomde-uml2-struts
|
2
|
+
by Philippe Dubosc
|
3
|
+
FIX (url)
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
FIX (describe your package)
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* FIX (list of features or problems)
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
FIX (code sample of usage)
|
16
|
+
|
17
|
+
== REQUIREMENTS:
|
18
|
+
|
19
|
+
* FIX (list of requirements)
|
20
|
+
|
21
|
+
== INSTALL:
|
22
|
+
|
23
|
+
* FIX (sudo gem install, anything else)
|
24
|
+
|
25
|
+
Additional information is available on ontoMDE web site :
|
26
|
+
http://ontomde.rubyforge.org/website/download.html
|
27
|
+
== LICENSE:
|
28
|
+
|
29
|
+
(The MIT License)
|
30
|
+
|
31
|
+
Copyright (c) 2007 FIX
|
32
|
+
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
34
|
+
a copy of this software and associated documentation files (the
|
35
|
+
'Software'), to deal in the Software without restriction, including
|
36
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
37
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
38
|
+
permit persons to whom the Software is furnished to do so, subject to
|
39
|
+
the following conditions:
|
40
|
+
|
41
|
+
The above copyright notice and this permission notice shall be
|
42
|
+
included in all copies or substantial portions of the Software.
|
43
|
+
|
44
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
45
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
46
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
47
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
48
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
49
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
50
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ontomde-hoe'
|
5
|
+
require './lib/ontomde-uml2-crank/version.rb'
|
6
|
+
|
7
|
+
OntomdeHoe.new('ontomde-uml2-crank', Ontomde::Uml2::Crank::VERSION) do |p|
|
8
|
+
p.rubyforge_name = 'ontomde'
|
9
|
+
p.author = 'Philippe Dubosc'
|
10
|
+
p.email = 'philippe.dubosc@orange-ftgroup.com'
|
11
|
+
p.summary = 'OntoMDE Crank generator cartridge'
|
12
|
+
# p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
13
|
+
# p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
|
14
|
+
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
15
|
+
|
16
|
+
p.extra_deps=[
|
17
|
+
[ 'ontomde-uml2-java',"= #{Ontomde::Uml2::Crank::VERSION}" ],
|
18
|
+
[ 'ontomde-uml2-apaCom',"= #{Ontomde::Uml2::Crank::VERSION}" ]
|
19
|
+
]
|
20
|
+
|
21
|
+
#spec.custom_add_dependency('core')
|
22
|
+
#spec.custom_add_dependency('uml2')
|
23
|
+
#spec.custom_add_dependency('uml2_java')
|
24
|
+
#spec.custom_add_dependency('uml2_jpa')
|
25
|
+
#spec.custom_add_dependency('uml2_jdo')
|
26
|
+
#spec.custom_add_dependency('uml2_apaCom')
|
27
|
+
#spec.custom_add_dependency('libJava')
|
28
|
+
|
29
|
+
p.spec_extras={ :required_ruby_version => '>=1.8.6' }
|
30
|
+
end
|
31
|
+
|
32
|
+
# vim: syntax=Ruby
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "ontomde-uml2-java"
|
2
|
+
require "ontomde-uml2-jpa"
|
3
|
+
require "ontomde-uml2-apaCom"
|
4
|
+
|
5
|
+
h="#{File.dirname(__FILE__)}/ontomde-uml2-crank"
|
6
|
+
|
7
|
+
puts "loading CRANK !!!!"
|
8
|
+
|
9
|
+
require "#{h}/version.rb"
|
10
|
+
require "#{h}/helper.rb"
|
11
|
+
require "#{h}/main.rb"
|
12
|
+
require "#{h}/context.rb"
|
13
|
+
require "#{h}/facesconfig.rb"
|
14
|
+
require "#{h}/facelets.rb"
|
15
|
+
require "#{h}/menu2.rb"
|
16
|
+
require "#{h}/validation.rb"
|
17
|
+
require "#{h}/equals.rb"
|
18
|
+
|
19
|
+
require "#{h}/crankJpa.rb"
|
@@ -0,0 +1,384 @@
|
|
1
|
+
|
2
|
+
module Muml_Model
|
3
|
+
def eachCrankBean
|
4
|
+
return rdf_model.eachCrankBean
|
5
|
+
end
|
6
|
+
|
7
|
+
def eachClassEnum
|
8
|
+
rdf_model.uml_Class_all.each { |c|
|
9
|
+
next unless c.kind_of?(Muml_Enumeration)
|
10
|
+
yield(c)
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
def crank_generate_context
|
15
|
+
|
16
|
+
p_context=umlx_getOrCreatePackage("xmda.crank")
|
17
|
+
c=p_context.umlx_createAndAddClass(p_context.rdf_uri+"_ctx")
|
18
|
+
c.db_isTransient=RDF_TRUE
|
19
|
+
c.uml_isAbstract=RDF_TRUE
|
20
|
+
c.uml_name="CrankCrudApplicationContext"
|
21
|
+
|
22
|
+
i = umlx_getOrCreateClass("org.crank.crud.jsf.xmda.ExtendedCrudJSFConfig")
|
23
|
+
i.db_isTransient=RDF_TRUE
|
24
|
+
c.umlx_createAndAddGeneralization(i)
|
25
|
+
|
26
|
+
c.java_annotation_add("@Configuration(defaultLazy = Lazy.TRUE)")
|
27
|
+
|
28
|
+
|
29
|
+
p=c.umlx_createAndAddProperty(c.rdf_uri+"_obj","managedObjects")
|
30
|
+
cObj = umlx_getOrCreateClass("List<CrudManagedObject>")
|
31
|
+
cObj.java_isGeneric=RDF_TRUE
|
32
|
+
p.uml_type=cObj
|
33
|
+
p.uml_visibility=::Cuml_VisibilityKind::Private
|
34
|
+
p.uml_isStatic=RDF_TRUE
|
35
|
+
|
36
|
+
|
37
|
+
m1=c.umlx_createAndAddOperation(c.rdf_uri+"_managed")
|
38
|
+
m1.uml_name="managedObjects"
|
39
|
+
m1.uml_class=c
|
40
|
+
m1.uml_visibility=Cuml_VisibilityKind::Public
|
41
|
+
r1=m1.umlx_createAndAddReturnParameter("#{m1.rdf_uri}_ret")
|
42
|
+
r1.uml_type=cObj
|
43
|
+
m1.java_annotation_add("@Bean(scope = DefaultScopes.SINGLETON)")
|
44
|
+
managedObj=<<CODE
|
45
|
+
if (managedObjects == null) {
|
46
|
+
managedObjects = new ArrayList<CrudManagedObject>();
|
47
|
+
CODE
|
48
|
+
crankBeans = eachCrankBean
|
49
|
+
crankBeans.each { |mc|
|
50
|
+
managedObj << " managedObjects.add(new CrudManagedObject(#{mc.java_Name}.class, #{mc.java_DAOClass_one.java_Name}.class));\n"
|
51
|
+
c.java_import_add(mc.java_qualifiedName)
|
52
|
+
c.java_import_add(mc.java_DAOClass_one.java_qualifiedName)
|
53
|
+
}
|
54
|
+
managedObj += <<CODE
|
55
|
+
}
|
56
|
+
return managedObjects;
|
57
|
+
CODE
|
58
|
+
m1.java_code=managedObj
|
59
|
+
|
60
|
+
|
61
|
+
m2=c.umlx_createAndAddOperation(c.rdf_uri+"_items")
|
62
|
+
m2.uml_name="selectItemGenerators"
|
63
|
+
m2.uml_class=c
|
64
|
+
m2.uml_visibility=Cuml_VisibilityKind::Public
|
65
|
+
m2.uml_raisedException_add(umlx_getOrCreateClass("Exception"))
|
66
|
+
r1=m2.umlx_createAndAddReturnParameter("#{m2.rdf_uri}_ret")
|
67
|
+
cObj2 = umlx_getOrCreateClass("Map<String, SelectItemGenerator>")
|
68
|
+
cObj2.java_isGeneric=RDF_TRUE
|
69
|
+
r1.uml_type=cObj2
|
70
|
+
m2.java_annotation_add("@SuppressWarnings(\"unchecked\")")
|
71
|
+
m2.java_annotation_add("@Bean(scope = DefaultScopes.SINGLETON)")
|
72
|
+
managedObj=<<CODE
|
73
|
+
Map<String, SelectItemGenerator> selectItemGenerators = super
|
74
|
+
.selectItemGenerators();
|
75
|
+
CODE
|
76
|
+
eachClassEnum { |mc|
|
77
|
+
managedObj << " SelectItemGenerator selectItemGenerator#{mc.java_Name} = new SelectItemGenerator();\n"
|
78
|
+
managedObj << " EnumDataSource<#{mc.java_Name}> dataSource#{mc.java_Name} = new EnumDataSource();\n"
|
79
|
+
managedObj << " dataSource#{mc.java_Name}.setType(#{mc.java_Name}.class);\n"
|
80
|
+
managedObj << " selectItemGenerator#{mc.java_Name}.setDataSource(dataSource#{mc.java_Name});\n"
|
81
|
+
managedObj << " selectItemGenerators.put(\"#{mc.java_Name}\", selectItemGenerator#{mc.java_Name});\n"
|
82
|
+
c.java_import_add(mc.java_qualifiedName)
|
83
|
+
}
|
84
|
+
managedObj += <<CODE
|
85
|
+
return selectItemGenerators;\n
|
86
|
+
CODE
|
87
|
+
m2.java_code=managedObj
|
88
|
+
|
89
|
+
|
90
|
+
m=c.umlx_createAndAddOperation(c.rdf_uri+"_unit")
|
91
|
+
m.uml_name="persistenceUnitName"
|
92
|
+
m.uml_class=c
|
93
|
+
m.uml_visibility=Cuml_VisibilityKind::Public
|
94
|
+
r=m.umlx_createAndAddReturnParameter("#{m.rdf_uri}_ret")
|
95
|
+
r.uml_type=umlx_getOrCreateDataType("String")
|
96
|
+
m.java_annotation_add("@Bean")
|
97
|
+
m.java_code=<<CODE
|
98
|
+
return "persistence-unit-test";
|
99
|
+
CODE
|
100
|
+
|
101
|
+
|
102
|
+
crankBeans.each { |mc|
|
103
|
+
mc.addCrudMethod
|
104
|
+
}
|
105
|
+
|
106
|
+
c.addImportForConfigurationClass
|
107
|
+
|
108
|
+
#Generate context with all the configurtion class
|
109
|
+
mtk_writeSession("#{context[:webResourcesDir]}/configContext.xml") {
|
110
|
+
write <<CONFIG
|
111
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
112
|
+
|
113
|
+
<beans xmlns="http://www.springframework.org/schema/beans"
|
114
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
115
|
+
xmlns:aop="http://www.springframework.org/schema/aop"
|
116
|
+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
117
|
+
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
|
118
|
+
|
119
|
+
<bean class="xmda.crank.CrankCrudApplicationContext" />
|
120
|
+
|
121
|
+
CONFIG
|
122
|
+
crankBeans.each {|c|
|
123
|
+
write " <bean class=\"#{c.crankConfigClass.java_qualifiedName}\" />\n"
|
124
|
+
}
|
125
|
+
write <<CONFIG
|
126
|
+
|
127
|
+
</beans>
|
128
|
+
CONFIG
|
129
|
+
}
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
module Muml_Classifier
|
135
|
+
|
136
|
+
attr_accessor :crankConfigClass
|
137
|
+
|
138
|
+
#Used for Crank Bean
|
139
|
+
def addCrudMethod
|
140
|
+
|
141
|
+
p_context=umlx_getOrCreatePackage("#{umlx_package.java_qualifiedName}.crank")
|
142
|
+
c=p_context.umlx_createAndAddClass(self.rdf_uri+"_cfg")
|
143
|
+
self.crankConfigClass = c
|
144
|
+
c.db_isTransient=RDF_TRUE
|
145
|
+
c.uml_isAbstract=RDF_TRUE
|
146
|
+
c.uml_name="#{self.java_Name}CrankConfig"
|
147
|
+
c.java_annotation_add("@Configuration(defaultLazy = Lazy.TRUE)")
|
148
|
+
c.addImportForConfigurationClass
|
149
|
+
|
150
|
+
m2=c.umlx_createAndAddOperation(self.rdf_uri+"_crud")
|
151
|
+
m2.uml_name="#{java_Name.downcase}Crud"
|
152
|
+
m2.uml_class=c
|
153
|
+
m2.uml_visibility=Cuml_VisibilityKind::Public
|
154
|
+
m2.uml_raisedException_add(umlx_getOrCreateClass("Exception"))
|
155
|
+
rm2=m2.umlx_createAndAddReturnParameter("#{m2.rdf_uri}_ret")
|
156
|
+
rm2.uml_type=umlx_getOrCreateClass("JsfCrudAdapter")
|
157
|
+
m2.java_annotation_add("@SuppressWarnings(\"unchecked\")")
|
158
|
+
m2.java_annotation_add("@Bean(scope = DefaultScopes.SESSION, aliases = \"#{m2.uml_name}Proxy\")")
|
159
|
+
m2.java_code=<<CODE
|
160
|
+
JsfCrudAdapter adapter = cruds().get("#{java_Name}");
|
161
|
+
CODE
|
162
|
+
#END OF THE CODE AFTER THE EACH
|
163
|
+
|
164
|
+
if self.crank_hasCrankBeanChild?
|
165
|
+
c.java_import_add("org.crank.crud.controller.CrudOperations");
|
166
|
+
c.java_import_add("java.util.Map");
|
167
|
+
c.java_import_add("java.util.HashMap");
|
168
|
+
m2.java_code_one << <<CODE
|
169
|
+
Map<Class, CrudOperations> map = new HashMap<Class, CrudOperations>();
|
170
|
+
CODE
|
171
|
+
crank_subCrankBean.each{|sc|
|
172
|
+
next if "#{sc.java_Name}" == "#{self.java_Name}"
|
173
|
+
c.crank_addCrudAlias(sc)
|
174
|
+
m2.java_code_one << <<CODE
|
175
|
+
JsfCrudAdapter #{sc.java_Name.downcase}CrudProxy = #{sc.java_Name.downcase}CrudProxy();
|
176
|
+
map.put(#{sc.java_Name}.class, #{sc.java_Name.downcase}CrudProxy.getController());
|
177
|
+
CODE
|
178
|
+
c.java_import_add("#{sc.java_qualifiedName}")
|
179
|
+
}
|
180
|
+
m2.java_code_one << <<CODE
|
181
|
+
((CrudController)adapter.getController()).setSubController(map);
|
182
|
+
adapter.setupSubCrudControllerWiring();
|
183
|
+
CODE
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
eachCrankBeanRelations.each { |a|
|
189
|
+
#ADD THIS CODE TO THE crud if MasterDetail
|
190
|
+
# if a.crank_isMasterFromMasterDetail?
|
191
|
+
# m2.java_code_one << <<CODE
|
192
|
+
# JsfDetailController jsf#{a.java_Name}DetailController = new JsfDetailController(#{a.uml_type_one.java_Name}.class);
|
193
|
+
# jsf#{a.java_Name}DetailController.setForceUpdate(true);
|
194
|
+
# adapter.getController().addChild("detail", jsf#{a.java_Name}DetailController);
|
195
|
+
#CODE
|
196
|
+
# end
|
197
|
+
c.java_import_add("#{a.uml_type_one.java_qualifiedName}")
|
198
|
+
|
199
|
+
m1=c.umlx_createAndAddOperation(a.rdf_uri+"_select")
|
200
|
+
m1.uml_name="#{a.java_Name.downcase}From#{java_Name}To#{a.uml_type_one.java_Name}Controller"
|
201
|
+
m1.uml_class=c
|
202
|
+
m1.uml_visibility=Cuml_VisibilityKind::Public
|
203
|
+
m1.uml_raisedException_add(umlx_getOrCreateClass("Exception"))
|
204
|
+
rm1=m1.umlx_createAndAddReturnParameter("#{m1.rdf_uri}_ret")
|
205
|
+
cRet = nil
|
206
|
+
#Indique si c'est une relation many esclave au framework
|
207
|
+
isMasterEnd=""
|
208
|
+
if a.java_isManyAssociation?
|
209
|
+
cRet = umlx_getOrCreateClass("JsfSelectManyController<#{a.uml_type_one.java_Name}, Long>")
|
210
|
+
cRet.java_isGeneric=RDF_TRUE
|
211
|
+
if a.java_isBinavAssociation? && !a.umlx_masterEnd?
|
212
|
+
isMasterEnd=",false"
|
213
|
+
end
|
214
|
+
mCode = ""
|
215
|
+
if a.crank_isMasterFromMasterDetail?
|
216
|
+
c.java_import_add("org.crank.crud.jsf.xmda.JsfDetailExtendedController")
|
217
|
+
mCode=<<CODE
|
218
|
+
JsfDetailExtendedController<#{a.uml_type_one.java_Name}, Long> controller = new JsfDetailExtendedController<#{a.uml_type_one.java_Name}, Long>(
|
219
|
+
(CrudController<#{a.uml_type_one.java_Name}, Long>) #{a.uml_type_one.java_Name.downcase}CrudProxy().getController(), "#{a.java_Name}", paginators().get("#{a.uml_type_one.java_Name}"), #{java_Name.downcase}CrudProxy().getController());
|
220
|
+
CODE
|
221
|
+
elsif
|
222
|
+
mCode=<<CODE
|
223
|
+
#{cRet.java_Name} controller = new JsfSelectManyExtendedController<#{a.uml_type_one.java_Name}, Long>(#{a.uml_type_one.java_Name}.class, "#{a.java_Name}", paginators().get("#{a.uml_type_one.java_Name}"), #{java_Name.downcase}CrudProxy().getController()#{isMasterEnd});
|
224
|
+
CODE
|
225
|
+
end
|
226
|
+
mCode << <<CODE
|
227
|
+
SelectManyRelationshipManager relationManager = controller.getManager();
|
228
|
+
relationManager.setAddToParentMethodName("add#{a.java_NameBean}");
|
229
|
+
relationManager.setRemoveFromParentMethodName("remove#{a.java_NameBean}");
|
230
|
+
return controller;
|
231
|
+
CODE
|
232
|
+
m1.java_code = mCode
|
233
|
+
c.crank_addCrudAlias(a.uml_type_one)
|
234
|
+
elsif
|
235
|
+
cRet = umlx_getOrCreateClass("JsfSelectOneListingController<#{a.uml_type_one.java_Name}, Long>")
|
236
|
+
cRet.java_isGeneric=RDF_TRUE
|
237
|
+
m1.java_code=<<CODE
|
238
|
+
#{cRet.java_Name} controller = new #{cRet.java_Name}(#{a.uml_type_one.java_Name}.class, "#{a.java_Name}", paginators().get("#{a.uml_type_one.java_Name}"), #{java_Name.downcase}CrudProxy().getController()#{isMasterEnd});
|
239
|
+
controller.setLabelProperty("#{a.uml_type_one.crank_guiProperty.java_Name}");
|
240
|
+
return controller;
|
241
|
+
CODE
|
242
|
+
c.java_import_add("#{a.uml_type_one.java_qualifiedName}")
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
rm1.uml_type=cRet
|
247
|
+
m1.java_annotation_add("@SuppressWarnings(\"unchecked\")")
|
248
|
+
m1.java_annotation_add("@Bean(scope = DefaultScopes.SESSION)")
|
249
|
+
|
250
|
+
}
|
251
|
+
#END OF THE CRUD CREATION CODE
|
252
|
+
m2.java_code_one << <<CODE
|
253
|
+
return adapter;
|
254
|
+
CODE
|
255
|
+
|
256
|
+
c.crank_addCrudAlias(self)
|
257
|
+
|
258
|
+
# Alias for cruds
|
259
|
+
m=c.umlx_createAndAddOperation(self.rdf_uri+"_cruds")
|
260
|
+
m.uml_name="cruds"
|
261
|
+
m.uml_class=c
|
262
|
+
m.uml_visibility=Cuml_VisibilityKind::Public
|
263
|
+
m.uml_isAbstract = RDF_TRUE
|
264
|
+
rm=m.umlx_createAndAddReturnParameter("#{m.rdf_uri}_ret")
|
265
|
+
crudsRetType=umlx_getOrCreateClass("Map<String, JsfCrudAdapter>")
|
266
|
+
crudsRetType.java_isGeneric=RDF_TRUE
|
267
|
+
crudsRetType.db_isTransient=RDF_TRUE
|
268
|
+
rm.uml_type=crudsRetType
|
269
|
+
m.java_annotation_add("@SuppressWarnings(\"unchecked\")")
|
270
|
+
m.java_annotation_add("@ExternalBean")
|
271
|
+
|
272
|
+
# Alias for paginators
|
273
|
+
mp=c.umlx_createAndAddOperation(self.rdf_uri+"_paginators")
|
274
|
+
mp.uml_name="paginators"
|
275
|
+
mp.uml_class=c
|
276
|
+
mp.uml_visibility=Cuml_VisibilityKind::Public
|
277
|
+
mp.uml_isAbstract = RDF_TRUE
|
278
|
+
rm=mp.umlx_createAndAddReturnParameter("#{m.rdf_uri}_ret")
|
279
|
+
retType=umlx_getOrCreateClass("Map<String, FilterablePageable>")
|
280
|
+
retType.java_isGeneric=RDF_TRUE
|
281
|
+
retType.db_isTransient=RDF_TRUE
|
282
|
+
rm.uml_type=retType
|
283
|
+
mp.java_annotation_add("@SuppressWarnings(\"unchecked\")")
|
284
|
+
mp.java_annotation_add("@ExternalBean")
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
def crank_addCrudAlias(crankBean)
|
289
|
+
aliasUri = self.rdf_uri+"_#{crankBean.java_Name}crudProxy"
|
290
|
+
#return si d�j� ajout�
|
291
|
+
uml_ownedOperation.each{|o|
|
292
|
+
return if o.rdf_uri == aliasUri
|
293
|
+
}
|
294
|
+
|
295
|
+
m=self.umlx_createAndAddOperation(aliasUri)
|
296
|
+
m.uml_name="#{crankBean.java_Name.downcase}CrudProxy"
|
297
|
+
m.uml_class=self
|
298
|
+
m.uml_visibility=Cuml_VisibilityKind::Public
|
299
|
+
m.uml_isAbstract = RDF_TRUE
|
300
|
+
rm=m.umlx_createAndAddReturnParameter("#{m.rdf_uri}_ret")
|
301
|
+
rm.uml_type=umlx_getOrCreateClass("JsfCrudAdapter")
|
302
|
+
m.java_annotation_add("@SuppressWarnings(\"unchecked\")")
|
303
|
+
m.java_annotation_add("@ExternalBean")
|
304
|
+
end
|
305
|
+
|
306
|
+
def eachCrankBeanRelations(ret=Set.new)
|
307
|
+
umlx_ownedAndInheritedAttribute.each { |a|
|
308
|
+
next if a.uml_type_one.db_isTransient?
|
309
|
+
if !a.umlx_isAttribute?
|
310
|
+
ret.add(a)
|
311
|
+
end
|
312
|
+
}
|
313
|
+
return ret.sort{ |a,b| a <=> b}
|
314
|
+
end
|
315
|
+
|
316
|
+
def crank_guiProperty(firstPropertyFound = nil, mustFoundGuiLabel = true)
|
317
|
+
# puts "#{java_Name}.crank_guiProperty"
|
318
|
+
uml_ownedAttribute.sort{ |a,b| a <=> b}.each {|a|
|
319
|
+
next unless a.umlx_isAttribute?
|
320
|
+
next if a.uml_isStatic?
|
321
|
+
if firstPropertyFound.nil?
|
322
|
+
firstPropertyFound = a
|
323
|
+
end
|
324
|
+
return a if a.umlx_hasStereotype?('GuiLabel')
|
325
|
+
}
|
326
|
+
res = nil
|
327
|
+
if self.kind_of?(Muml_Class)
|
328
|
+
uml_implementation.each { |g|
|
329
|
+
res = g.uml_supplier_one.crank_guiProperty(firstPropertyFound, false)
|
330
|
+
return res if !res.nil?
|
331
|
+
}
|
332
|
+
end
|
333
|
+
uml_generalization.sort{ |a,b| a <=> b}.each { |g|
|
334
|
+
# puts " -- #{g.uml_general_one.java_Name}.crank_guiProperty"
|
335
|
+
# next if g.kind_of?(Muml_Interface)
|
336
|
+
res = g.uml_general_one.crank_guiProperty(firstPropertyFound, false)
|
337
|
+
return res if !res.nil?
|
338
|
+
}
|
339
|
+
|
340
|
+
if mustFoundGuiLabel
|
341
|
+
if firstPropertyFound.nil?
|
342
|
+
raise Exception.new("no GuiLabel defined nor Property selected for Class #{self.java_Name} !!")
|
343
|
+
elsif
|
344
|
+
log.warn { "no GuiLabel defined for Class #{self.java_Name} : Property #{firstPropertyFound.java_Name} selected !!" }
|
345
|
+
end
|
346
|
+
end
|
347
|
+
return firstPropertyFound
|
348
|
+
end
|
349
|
+
|
350
|
+
#Used only for the configuration class
|
351
|
+
def addImportForConfigurationClass
|
352
|
+
self.java_import_add("java.util.ArrayList")
|
353
|
+
self.java_import_add("java.util.List")
|
354
|
+
self.java_import_add("java.util.Map")
|
355
|
+
|
356
|
+
self.java_import_add("org.crank.crud.controller.CrudManagedObject")
|
357
|
+
self.java_import_add("org.springframework.config.java.annotation.Bean")
|
358
|
+
self.java_import_add("org.springframework.config.java.annotation.ExternalBean")
|
359
|
+
self.java_import_add("org.springframework.config.java.annotation.Configuration")
|
360
|
+
self.java_import_add("org.springframework.config.java.annotation.Lazy")
|
361
|
+
self.java_import_add("org.springframework.config.java.util.DefaultScopes")
|
362
|
+
self.java_import_add("org.crank.crud.controller.FilterablePageable")
|
363
|
+
self.java_import_add("org.crank.crud.controller.CrudController")
|
364
|
+
self.java_import_add("org.crank.crud.jsf.support.*")
|
365
|
+
self.java_import_add("org.crank.crud.relationships.SelectManyRelationshipManager")
|
366
|
+
self.java_import_add("org.crank.crud.jsf.xmda.JsfSelectManyExtendedController")
|
367
|
+
self.java_import_add("org.crank.crud.controller.datasource.EnumDataSource")
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
module Muml_Property
|
372
|
+
def java_isBinavAssociation?
|
373
|
+
oe=umlx_otherEnd
|
374
|
+
return (!oe.nil?) && oe.umlx_isNavigable?
|
375
|
+
end
|
376
|
+
|
377
|
+
def java_isManyAssociation?
|
378
|
+
return !umlx_upperValueIsOne?
|
379
|
+
end
|
380
|
+
|
381
|
+
end
|
382
|
+
|
383
|
+
|
384
|
+
|