Module: Mrdf_Model

Defined in:
lib/ontomde-uml2-crank/main.rb,
lib/ontomde-uml2-crank/menu.rb,
lib/ontomde-uml2-crank/menu2.rb,
lib/ontomde-uml2-crank/facesconfig.rb

Instance Method Summary collapse

Instance Method Details

#crank_faces_crankbeanObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/ontomde-uml2-crank/facesconfig.rb', line 76

def crank_faces_crankbean   
  eachCrankBean.each { |c|
  write <<BEAN
<navigation-rule>
  <navigation-case>
    <from-outcome>#{c.java_Name.upcase}</from-outcome>
    <to-view-id>/pages/crud/#{c.java_Name}/Listing.xhtml</to-view-id>
  </navigation-case>
</navigation-rule>

<navigation-rule>
  <navigation-case>
    <from-outcome>#{c.java_Name.upcase}_FORM</from-outcome>
    <to-view-id>/pages/crud/#{c.java_Name}/Form.xhtml</to-view-id>
  </navigation-case>
</navigation-rule>

BEAN
if !context[:crankXmdaNav]
    write <<BEAN
<navigation-rule>
  <from-view-id>/pages/crud/#{c.java_Name}/*</from-view-id>
  <navigation-case>
    <from-outcome>LISTING</from-outcome>
    <to-view-id>/pages/crud/#{c.java_Name}/Listing.xhtml</to-view-id>
  </navigation-case>
  <navigation-case>
    <from-outcome>FORM</from-outcome>
    <to-view-id>/pages/crud/#{c.java_Name}/Form.xhtml</to-view-id>
  </navigation-case>    
</navigation-rule>

BEAN
  end
  }
end


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ontomde-uml2-crank/facesconfig.rb', line 54

def crank_faces_footer
    if context[:crankXmdaNav]    
      write <<END
      <navigation-rule>
    <from-view-id>/pages/crud/*</from-view-id>
    <navigation-case>
      <from-outcome>LISTING</from-outcome>
      <to-view-id>\#{%sCrudProxy.crudViewHandler.calculateListingViewId}</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>FORM</from-outcome>
      <to-view-id>\#{%sCrudProxy.crudViewHandler.calculateFormViewId}</to-view-id>
    </navigation-case>    
  </navigation-rule>    
END
    end
    write <<END

</faces-config>
END
end

#crank_faces_headerObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ontomde-uml2-crank/facesconfig.rb', line 7

def crank_faces_header
  write <<END
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
  version="1.2">

<!-- 
<lifecycle>
  <phase-listener>org.crank.jsf.support.DebugPhaseListener</phase-listener>
</lifecycle>
 -->
  
<application>
  <action-listener>org.crank.crud.jsf.support.JsfMessageActionListener</action-listener>
  <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
  <message-bundle>messages</message-bundle>
</application>

<!-- 
<component>
  <component-type>org.crank.javax.faces.SelectOne</component-type>
  <component-class>org.crank.javax.faces.component.UISelectOne</component-class>
</component>
<render-kit>
    <renderer>
    <component-family>javax.faces.SelectOne</component-family>
    <renderer-type>org.crank.javax.faces.Listbox</renderer-type>
    <renderer-class>
    org.crank.javax.faces.component.ListboxRenderer
    </renderer-class>
  </renderer>

</render-kit>
 -->

<navigation-rule>
  <navigation-case>
    <from-outcome>HOME</from-outcome>
    <to-view-id>/pages/Home.xhtml</to-view-id>
  </navigation-case>
</navigation-rule>
END
end

#crank_generate_facesconfigObject



45
46
47
48
49
50
51
# File 'lib/ontomde-uml2-crank/main.rb', line 45

def crank_generate_facesconfig
  mtk_writeSession("#{context[:webContentDir]}/WEB-INF/faces-config.xml") {
    crank_faces_header
    crank_faces_crankbean  
    crank_faces_footer
  }
end

#crank_generate_ForEachBeanObject



18
19
20
21
22
23
24
25
# File 'lib/ontomde-uml2-crank/main.rb', line 18

def crank_generate_ForEachBean
  crank_generate_facesconfig
  crank_generate_home
  eachCrankBean.each { |c|
    c.crank_generate_listing
    c.crank_generate_form
  }
end

#crank_generate_ForEachBeanAfterTransformObject

Called after java transformation



28
29
30
31
32
33
34
# File 'lib/ontomde-uml2-crank/main.rb', line 28

def crank_generate_ForEachBeanAfterTransform
  umlx_reserved_model.crank_generate_context
  eachCrankBean.each { |c|
    c.crank_generate_validation
    c.java_generate_equalsAndHash
  }
end

#crank_generate_homeObject



37
38
39
40
41
42
43
# File 'lib/ontomde-uml2-crank/main.rb', line 37

def crank_generate_home
  mtk_writeSession("#{context[:webContentDir]}/pages/Menu.xhtml") {
    crank_home_header
    crank_home_crankbean  
    crank_home_footer
  }
end

#crank_home_crankbeanObject



31
32
33
34
35
36
37
# File 'lib/ontomde-uml2-crank/menu.rb', line 31

def crank_home_crankbean   
  eachCrankBean.each { |c|
  write <<BEAN
  <li><h:commandLink action="#{c.java_Name.upcase}" value="#{c.java_Name}s" styleClass="titleCommandLink"/></li>
BEAN
  }
end


22
23
24
25
26
27
28
29
# File 'lib/ontomde-uml2-crank/menu.rb', line 22

def crank_home_footer
   write <<FOOTER
</ul>
</div>
</h:form>
</ui:composition>
FOOTER
end

#crank_home_headerObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ontomde-uml2-crank/menu.rb', line 7

def crank_home_header
  write <<END
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
>
  <h:form>
<div class="blocmenu">

<h2>Menu Principal</h2>
<ul>

END
end

#eachCrankBean(ret = Set.new) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ontomde-uml2-crank/main.rb', line 5

def eachCrankBean(ret=Set.new)
  uml_Class_all.each { |c|
    next if c.kind_of?(Muml_Enumeration)
    next if c.kind_of?(Muml_Interface)
    next if c.java_ignoreMe?
    next if c.db_isTransient?
#      next if c.uml_isAbstract?
    ret.add(c)
  }
  return ret.sort{ |a,b| a <=> b}
end