Class: JavaMapping
- Inherits:
-
Object
show all
- Defined in:
- lib/ontomde-uml2-struts/jsp_edit.rb,
lib/ontomde-uml2-struts/mappingForJsp.rb,
lib/ontomde-uml2-struts/mappingForBean.rb,
lib/ontomde-uml2-struts/mappingToJavaHierarchy.rb,
lib/ontomde-uml2-struts/mappingToJavaHierarchy.rb
Instance Method Summary
collapse
Instance Method Details
#addActionFieldMethod!(field, action, form) ⇒ Object
adds special action for this type
13
14
|
# File 'lib/ontomde-uml2-struts/mappingForJsp.rb', line 13
def addActionFieldMethod!(field,action,form)
end
|
returns code to be inserted in struts form copyTo def getFormCopyTo(field) # inheriting class should redefine this method log.error %not implemented for #{self.class} return %TODO: implement ruby getFormCopyTo for #{self.class*/} end returns code to be inserted in struts form initFrom def getFormInitFrom(field) # inheriting class should redefine this method log.error %not implemented for #{self.class} return %TODO: implement ruby getFormInitFrom for #{self.class*/} end
17
18
19
|
# File 'lib/ontomde-uml2-struts/mappingForBean.rb', line 17
def getFormCopyTo(field)
return %{_to.set#{field.java_NameBean}(#{getJavaParse(%{this.get#{field.java_NameBean}()})});\n}
end
|
20
21
22
|
# File 'lib/ontomde-uml2-struts/mappingForBean.rb', line 20
def getFormInitFrom(field)
return %{this.set#{field.java_NameBean}(#{getJavaToString(%{_from.get#{field.java_NameBean}()})});\n}
end
|
23
24
25
|
# File 'lib/ontomde-uml2-struts/mappingForBean.rb', line 23
def getFormType(field)
return field.umlx_dataType_string
end
|
#getJSP(datatype, field, owner) ⇒ Object
returns true if this templates applies to datatype
6
7
8
9
10
|
# File 'lib/ontomde-uml2-struts/mappingForJsp.rb', line 6
def getJSP(datatype,field,owner)
log.error %{getJSP not implemented for #{self.class}}
return %{<!-- TODO: implement ruby getJSP for #{self.class} --!>}
end
|
#java_helper_addMethods!(c) ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/ontomde-uml2-struts/mappingToJavaHierarchy.rb', line 65
def java_helper_addMethods!(c)
return
m=c.umlx_createAndAddOperation(self.rdf_uri+"_parse","parse")
r=m.umlx_createAndAddReturnParameter(m.rdf_uri+"ret")
r.uml_type=c.umlx_getOrCreateClass("java.lang.Object")
r=m.umlx_createAndAddParameter(m.rdf_uri+"tr","tr")
r.uml_type=c.umlx_dataType_string
m=c.umlx_createAndAddOperation(self.rdf_uri+"_parse","to_s")
r=m.umlx_createAndAddReturnParameter(m.rdf_uri+"ret")
r.uml_type=c.umlx_getOrCreateClass("java.lang.Object")
r=m.umlx_createAndAddParameter(m.rdf_uri+"elt","elt")
r.uml_type=c.umlx_dataType_string
end
|
#java_helper_customCode ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/ontomde-uml2-struts/mappingToJavaHierarchy.rb', line 35
def java_helper_customCode
return if self.class==JavaMapping
return <<END
protected #{java_Name}() {};
private static #{java_Name} instance=new #{java_Name}();
public #{java_Name} getInstance() {
return instance;
}
public #{getJavaType} parse(final String str,final #{getJavaType} nullCast ) {
#{if respond_to?(:getJavaParse)
"return #{getJavaParse("str")};"
else
%{throw new java.lang.RuntimeException("Method not implemented");}
end
}
}
public String toString(final #{getJavaType} elt) {
#{if respond_to?(:getJavaToString)
"return #{getJavaToString("elt")};"
else
%{throw new java.lang.RuntimeException("Method not implemented");}
end
}
}
END
end
|
#java_Name ⇒ Object
12
13
14
|
# File 'lib/ontomde-uml2-struts/mappingToJavaHierarchy.rb', line 12
def java_Name
return self.class.name
end
|
#java_qualifiedName ⇒ Object
15
16
17
|
# File 'lib/ontomde-uml2-struts/mappingToJavaHierarchy.rb', line 15
def java_qualifiedName
return rdf_uri
end
|
#rdf_uri ⇒ Object
18
19
20
|
# File 'lib/ontomde-uml2-struts/mappingToJavaHierarchy.rb', line 18
def rdf_uri
return "xmda.datatypes.#{java_Name}"
end
|
#struts_edit_writeFieldGeneric_DisplayTable_displayTag_column(prop) ⇒ Object
828
829
830
831
|
# File 'lib/ontomde-uml2-struts/jsp_edit.rb', line 828
def struts_edit_writeFieldGeneric_DisplayTable_displayTag_column(prop)
prop.write %{<display:column property="#{prop.java_Name}" titleKey="#{prop.umlx_owner_one.java_qualifiedName}.#{prop.java_Name}" decorator="xmda.displayTag.extensions.I18nColumnDecorator"/>\n}
end
|
#struts_generateHelper(model) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/ontomde-uml2-struts/mappingToJavaHierarchy.rb', line 21
def struts_generateHelper(model)
return unless self.respond_to?("getJavaType")
c=model.umlx_reserved_model.umlx_getOrCreateClass(java_qualifiedName)
return c unless c.umlx_external?
c.umlx_external=RDF_FALSE
c.db_isTransient=RDF_TRUE
c.struts_isForm=RDF_FALSE
c.umlx_businessMethod=RDF_FALSE
c.umlx_createAndAddGeneralization(self.class.superclass.instance.struts_generateHelper(model)) if self.class.superclass.respond_to?("instance")
c.java_customCode=java_helper_customCode
java_helper_addMethods!(c)
return c
end
|