ontomde-uml2-crank 1.0.6

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.
@@ -0,0 +1,46 @@
1
+
2
+
3
+ module Muml_Classifier
4
+ #returns every type assignable to this classifier
5
+ #(this includes self and any class deriving from it)
6
+ def umlx_ownedAndInheritedAttribute(ret=Set.new)
7
+ uml_ownedAttribute.each {|biz|
8
+ ret << biz
9
+ }
10
+ uml_generalization.each { |g|
11
+ next if g.kind_of?(Muml_Interface)
12
+ g.uml_general_one.umlx_ownedAndInheritedAttribute(ret)
13
+ }
14
+ return ret
15
+ end
16
+
17
+ def crank_isTopCrankBean
18
+ uml_generalization.each { |g|
19
+ next if g.kind_of?(Muml_Interface)
20
+ return false if !g.uml_general_one.db_isTransient?
21
+ }
22
+ return true;
23
+ end
24
+
25
+ def crank_hasCrankBeanChild?
26
+ uml_general_inv.each { |g|
27
+ return true
28
+ }
29
+ return false
30
+ end
31
+
32
+ #Include the class too
33
+ def crank_subCrankBean(ret=Set.new, abstractIncluded=false)
34
+ umlx_assignableClassifier().sort{ |a,b| a <=> b}.each{ |c|
35
+ ret.add(c) if abstractIncluded || !c.uml_isAbstract?
36
+ }
37
+ return ret
38
+ end
39
+ end
40
+
41
+ module Muml_NamedElement
42
+ def <=>(other)
43
+ "#{self.java_Name}" <=> "#{other.java_Name}"
44
+ end
45
+
46
+ end
@@ -0,0 +1,53 @@
1
+ module Mrdf_Model
2
+
3
+
4
+
5
+ def eachCrankBean(ret=Set.new)
6
+ uml_Class_all.each { |c|
7
+ next if c.kind_of?(Muml_Enumeration)
8
+ next if c.kind_of?(Muml_Interface)
9
+ next if c.java_ignoreMe?
10
+ next if c.db_isTransient?
11
+ # next if c.uml_isAbstract?
12
+ ret.add(c)
13
+ }
14
+ return ret.sort{ |a,b| a <=> b}
15
+ end
16
+
17
+
18
+ def crank_generate_ForEachBean
19
+ crank_generate_facesconfig
20
+ crank_generate_home
21
+ eachCrankBean.each { |c|
22
+ c.crank_generate_listing
23
+ c.crank_generate_form
24
+ }
25
+ end
26
+
27
+ #Called after java transformation
28
+ def crank_generate_ForEachBeanAfterTransform
29
+ umlx_reserved_model.crank_generate_context
30
+ eachCrankBean.each { |c|
31
+ c.crank_generate_validation
32
+ c.java_generate_equalsAndHash
33
+ }
34
+ end
35
+
36
+
37
+ def crank_generate_home
38
+ mtk_writeSession("#{context[:webContentDir]}/pages/Menu.xhtml") {
39
+ crank_home_header
40
+ crank_home_crankbean
41
+ crank_home_footer
42
+ }
43
+ end
44
+
45
+ def crank_generate_facesconfig
46
+ mtk_writeSession("#{context[:webContentDir]}/WEB-INF/faces-config.xml") {
47
+ crank_faces_header
48
+ crank_faces_crankbean
49
+ crank_faces_footer
50
+ }
51
+ end
52
+
53
+ end
@@ -0,0 +1,39 @@
1
+
2
+ module Mrdf_Model
3
+
4
+
5
+
6
+
7
+ def crank_home_header
8
+ write <<END
9
+ <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
10
+ xmlns:h="http://java.sun.com/jsf/html"
11
+ >
12
+ <h:form>
13
+ <div class="blocmenu">
14
+
15
+ <h2>Menu Principal</h2>
16
+ <ul>
17
+
18
+ END
19
+ end
20
+
21
+
22
+ def crank_home_footer
23
+ write <<FOOTER
24
+ </ul>
25
+ </div>
26
+ </h:form>
27
+ </ui:composition>
28
+ FOOTER
29
+ end
30
+
31
+ def crank_home_crankbean
32
+ eachCrankBean.each { |c|
33
+ write <<BEAN
34
+ <li><h:commandLink action="#{c.java_Name.upcase}" value="#{c.java_Name}s" styleClass="titleCommandLink"/></li>
35
+ BEAN
36
+ }
37
+ end
38
+
39
+ end
@@ -0,0 +1,78 @@
1
+
2
+ module Mrdf_Model
3
+
4
+
5
+ def crank_home_header
6
+ write <<END
7
+ <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
8
+ xmlns:h="http://java.sun.com/jsf/html"
9
+ xmlns:f="http://java.sun.com/jsf/core"
10
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
11
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich"
12
+ xmlns:c="http://java.sun.com/jstl/core"
13
+ xmlns:crank="http://www.googlecode.com/crank"
14
+ >
15
+ <h:form>
16
+ <rich:panelMenu>
17
+ END
18
+ end
19
+
20
+
21
+ def crank_home_footer
22
+ write <<FOOTER
23
+ </rich:panelMenu>
24
+ </h:form>
25
+ </ui:composition>
26
+ FOOTER
27
+ end
28
+
29
+ def crank_home_crankbean
30
+ pkg=Hash.new
31
+ eachCrankBean.each {|c|
32
+ p=c.uml_ownedMember_inv_one
33
+ pkg[p]=Array.new if pkg[p].nil?
34
+ pkg[p] << c
35
+ }
36
+ pkg.keys.sort {|a,b| a.uml_name.to_s <=> b.uml_name.to_s }.each { |p|
37
+ write <<BEAN
38
+ <rich:panelMenuGroup label="#{p.java_qualifiedName}" iconExpanded="triangleDown" iconCollapsed="triangleUp">
39
+ BEAN
40
+ clazz = pkg[p].sort { |a,b| a.uml_name.to_s <=> b.uml_name.to_s }
41
+ clazz.each {|c|
42
+ c.crank_class_submenu if c.crank_isTopCrankBean
43
+ }
44
+ write <<BEAN
45
+ </rich:panelMenuGroup>
46
+ BEAN
47
+ }
48
+ end
49
+ end
50
+
51
+ module Muml_Class
52
+ def crank_class_submenu
53
+ subClazz = Set.new
54
+ crank_subCrankBean(subClazz, true)
55
+ if crank_isTopCrankBean && subClazz.length>1
56
+ write <<BEAN
57
+ <rich:panelMenuGroup label="#{self.java_Name}" iconExpanded="triangleDown" iconCollapsed="triangleUp">
58
+ BEAN
59
+ subClazz.sort { |a,b| a.uml_name.to_s <=> b.uml_name.to_s }.each{|c|
60
+ c.crank_menu_item
61
+ }
62
+ write <<BEAN
63
+ </rich:panelMenuGroup>
64
+ BEAN
65
+ elsif
66
+ crank_menu_item
67
+ end
68
+ end
69
+
70
+ def crank_menu_item
71
+ write <<BEAN
72
+ <rich:panelMenuItem submitMode="none">
73
+ <h:commandLink action="#{self.java_Name.upcase}" value="#{self.java_Name}" styleClass="titleCommandLink"/>
74
+ </rich:panelMenuItem>
75
+ BEAN
76
+ end
77
+ end
78
+
@@ -0,0 +1,34 @@
1
+
2
+
3
+ module Muml_Classifier
4
+
5
+ def crank_generate_validation
6
+ uml_ownedAttribute.each { |a|
7
+ #next if a.umlx_isComposite?
8
+ #next unless a.umlx_isAttribute?
9
+
10
+ if a.umlx_hasStereotype?('Required')
11
+ a.java_annotation_add("@org.crank.annotations.validation.Required")
12
+ end
13
+ if a.uml_type_one.kind_of?(Muml_DataType) && !a.uml_type_one.crank_validation_annotation.nil?
14
+ a.java_annotation_add(a.uml_type_one.crank_validation_annotation)
15
+ end
16
+ }
17
+ end
18
+
19
+ end
20
+
21
+ module Muml_DataType
22
+
23
+ def crank_validation_annotation
24
+ tpl=JavaMapping.instance.getTemplate(self)
25
+ tpl.crank_validation_annotation
26
+ end
27
+
28
+ end
29
+
30
+ class JavaMapping
31
+ def crank_validation_annotation
32
+ return nil
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ module Ontomde
2
+ module Uml2
3
+ module Crank
4
+ VERSION = '1.0.6'
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ontomde-uml2-crank
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Philippe Dubosc
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-03-25 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ontomde-uml2-java
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - "="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.6
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: ontomde-uml2-apaCom
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - "="
30
+ - !ruby/object:Gem::Version
31
+ version: 1.0.6
32
+ version:
33
+ description: FIX (describe your package)
34
+ email: philippe.dubosc@orange-ftgroup.com
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - History.txt
41
+ - Manifest.txt
42
+ - README.txt
43
+ files:
44
+ - History.txt
45
+ - Manifest.txt
46
+ - README.txt
47
+ - Rakefile
48
+ - lib/ontomde-uml2-crank.rb
49
+ - lib/ontomde-uml2-crank/context.rb
50
+ - lib/ontomde-uml2-crank/crankJpa.rb
51
+ - lib/ontomde-uml2-crank/equals.rb
52
+ - lib/ontomde-uml2-crank/facelets.rb
53
+ - lib/ontomde-uml2-crank/facesconfig.rb
54
+ - lib/ontomde-uml2-crank/helper.rb
55
+ - lib/ontomde-uml2-crank/main.rb
56
+ - lib/ontomde-uml2-crank/menu.rb
57
+ - lib/ontomde-uml2-crank/menu2.rb
58
+ - lib/ontomde-uml2-crank/validation.rb
59
+ - lib/ontomde-uml2-crank/version.rb
60
+ has_rdoc: true
61
+ homepage: FIX (describe your package)
62
+ post_install_message:
63
+ rdoc_options:
64
+ - --main
65
+ - README.txt
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 1.8.6
73
+ version:
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ version:
80
+ requirements: []
81
+
82
+ rubyforge_project: ontomde
83
+ rubygems_version: 1.0.1
84
+ signing_key:
85
+ specification_version: 2
86
+ summary: OntoMDE Crank generator cartridge
87
+ test_files: []
88
+