ontomde-java 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,167 @@
|
|
1
|
+
|
2
|
+
#/**
|
3
|
+
# * <p>An <strong>ExceptionHandler</strong> is configured in the Struts
|
4
|
+
# * configuration file to handle a specific type of exception thrown by an
|
5
|
+
# * <code>Action.execute</code> method.</p>
|
6
|
+
# *
|
7
|
+
# */
|
8
|
+
|
9
|
+
class Crdf_Repository
|
10
|
+
!!!!!!!!!!!!!!!!!
|
11
|
+
def struts_getExceptionHandlerClass
|
12
|
+
return umlx_reserved_model.struts_getExceptionHandlerClass
|
13
|
+
end
|
14
|
+
def struts_getFunctionalException
|
15
|
+
return umlx_reserved_model.struts_getFunctionalException
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module Muml_Element
|
20
|
+
def struts_getExceptionHandlerClass
|
21
|
+
m=umlx_getOrCreateClass("xmda.struts.exceptions.XMDAExceptionHandler")
|
22
|
+
if(m.java_import.empty?)
|
23
|
+
['org.apache.struts.Globals', 'org.apache.struts.action.ActionForm', 'org.apache.struts.action.ActionForward', 'org.apache.struts.action.ActionMapping', 'org.apache.struts.action.ActionMessage', 'org.apache.struts.action.ExceptionHandler', 'org.apache.struts.config.ExceptionConfig', 'org.apache.struts.util.ModuleException', 'javax.servlet.http.HttpServletResponse','javax.servlet.ServletException','javax.servlet.http.HttpServletRequest'].each { |c|
|
24
|
+
m.java_import_add(c);
|
25
|
+
}
|
26
|
+
m.apaCom_addLogger!
|
27
|
+
m.umlx_external=RDF_FALSE
|
28
|
+
#m.java_import_add(STRUTS_LVB)
|
29
|
+
m.db_isTransient=RDF_TRUE
|
30
|
+
m.struts_isForm=RDF_FALSE
|
31
|
+
m.java_extends_add(umlx_reserved_model.umlx_getOrCreateClass("org.apache.struts.action.ExceptionHandler"))
|
32
|
+
|
33
|
+
m.java_customCode= <<ENDCODE
|
34
|
+
|
35
|
+
/**
|
36
|
+
* <p> Handle the Exception. Return the ActionForward instance (if any)
|
37
|
+
* returned by the called ExceptionHandler. </p>
|
38
|
+
*
|
39
|
+
* @param ex The exception to handle
|
40
|
+
* @param ae The ExceptionConfig corresponding to the exception
|
41
|
+
* @param mapping The ActionMapping we are processing
|
42
|
+
* @param formInstance The ActionForm we are processing
|
43
|
+
* @param request The servlet request we are processing
|
44
|
+
* @param response The servlet response we are creating
|
45
|
+
* @return The <code>ActionForward</code> instance (if any) returned by
|
46
|
+
* the called <code>ExceptionHandler</code>.
|
47
|
+
* @throws ServletException if a servlet exception occurs
|
48
|
+
* @since Struts 1.1
|
49
|
+
*/
|
50
|
+
public ActionForward execute(Exception ex, ExceptionConfig ae,
|
51
|
+
ActionMapping mapping, ActionForm formInstance,
|
52
|
+
HttpServletRequest request, HttpServletResponse response)
|
53
|
+
throws ServletException {
|
54
|
+
log.debug("ExceptionHandler executing for exception " + ex);
|
55
|
+
|
56
|
+
ActionForward forward;
|
57
|
+
ActionMessage error;
|
58
|
+
String property;
|
59
|
+
|
60
|
+
// Build the forward from the exception mapping if it exists
|
61
|
+
// or from the form input
|
62
|
+
if (ex instanceof FunctionalException && ((FunctionalException)ex).getFwPath()!= null) {
|
63
|
+
String fwPath = ((FunctionalException)ex).getFwPath();
|
64
|
+
forward = new ActionForward(fwPath);
|
65
|
+
}
|
66
|
+
else if (ae.getPath() != null) {
|
67
|
+
forward = new ActionForward(ae.getPath());
|
68
|
+
} else {
|
69
|
+
forward = mapping.getInputForward();
|
70
|
+
}
|
71
|
+
|
72
|
+
// Figure out the error
|
73
|
+
if (ex instanceof ModuleException) {
|
74
|
+
error = ((ModuleException) ex).getActionMessage();
|
75
|
+
property = ((ModuleException) ex).getProperty();
|
76
|
+
} else {
|
77
|
+
error = new ActionMessage(ae.getKey(), ex.getMessage());
|
78
|
+
property = error.getKey();
|
79
|
+
}
|
80
|
+
|
81
|
+
this.logException(ex);
|
82
|
+
|
83
|
+
// Store the exception
|
84
|
+
request.setAttribute(Globals.EXCEPTION_KEY, ex);
|
85
|
+
this.storeException(request, property, error, forward, ae.getScope());
|
86
|
+
|
87
|
+
if (!response.isCommitted()) {
|
88
|
+
return forward;
|
89
|
+
}
|
90
|
+
|
91
|
+
log.debug("Response is already committed, so forwarding will not work."
|
92
|
+
+ " Attempt alternate handling.");
|
93
|
+
|
94
|
+
if (!silent(ae)) {
|
95
|
+
handleCommittedResponse(ex, ae, mapping, formInstance, request,
|
96
|
+
response, forward);
|
97
|
+
} else {
|
98
|
+
log.warn("ExceptionHandler configured with " + SILENT_IF_COMMITTED
|
99
|
+
+ " and response is committed.", ex);
|
100
|
+
}
|
101
|
+
|
102
|
+
return null;
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
/**
|
107
|
+
* <p>Indicate whether this Handler has been configured to be silent. In
|
108
|
+
* the base implementation, this is done by specifying the value
|
109
|
+
* <code>"true"</code> for the property "SILENT_IF_COMMITTED" in the
|
110
|
+
* ExceptionConfig.</p>
|
111
|
+
*
|
112
|
+
* @param config The ExceptionConfiguration we are handling
|
113
|
+
* @return True if Handler is silent
|
114
|
+
* @since Struts 1.3
|
115
|
+
*/
|
116
|
+
private boolean silent(ExceptionConfig config) {
|
117
|
+
return "true".equals(config.getProperty(SILENT_IF_COMMITTED));
|
118
|
+
}
|
119
|
+
ENDCODE
|
120
|
+
end
|
121
|
+
return m
|
122
|
+
end
|
123
|
+
|
124
|
+
STRUTS_FUNCTIONAL_EXCEPTION="xmda.struts.exceptions.FunctionalException"
|
125
|
+
def struts_getFunctionalException
|
126
|
+
m=umlx_getOrCreateClass(STRUTS_FUNCTIONAL_EXCEPTION)
|
127
|
+
if(m.java_customCode.empty?)
|
128
|
+
m.java_annotation_add(%{@SuppressWarnings("serial")})
|
129
|
+
m.apaCom_addLogger!
|
130
|
+
m.umlx_external=RDF_FALSE
|
131
|
+
#m.java_import_add(STRUTS_LVB)
|
132
|
+
m.db_isTransient=RDF_TRUE
|
133
|
+
m.struts_isForm=RDF_FALSE
|
134
|
+
m.java_extends_add(umlx_getOrCreateClass("java.lang.RuntimeException"))
|
135
|
+
|
136
|
+
m.java_customCode= <<ENDCODEend
|
137
|
+
private String fwPath =null;
|
138
|
+
public #{m.java_Name}() {
|
139
|
+
super();
|
140
|
+
}
|
141
|
+
public #{m.java_Name}(String mesg) {
|
142
|
+
super(mesg);
|
143
|
+
}
|
144
|
+
public #{m.java_Name}(String fwPath, String mesg) {
|
145
|
+
super(mesg);
|
146
|
+
this.fwPath = fwPath;
|
147
|
+
}
|
148
|
+
|
149
|
+
public #{m.java_Name}(String mesg, Throwable th) {
|
150
|
+
super(mesg, th);
|
151
|
+
}
|
152
|
+
|
153
|
+
public String getFwPath() {
|
154
|
+
return fwPath;
|
155
|
+
}
|
156
|
+
|
157
|
+
public void setFwPath(String fwPath) {
|
158
|
+
this.fwPath = fwPath;
|
159
|
+
}
|
160
|
+
ENDCODEend
|
161
|
+
end
|
162
|
+
return m
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
|
@@ -0,0 +1,128 @@
|
|
1
|
+
module Muml_Class
|
2
|
+
STRUTS_SWITH_TO_FLEX_ACTION="switchToFlex"
|
3
|
+
end
|
4
|
+
module Mrdf_Repository
|
5
|
+
def struts_footer_generate
|
6
|
+
write <<END
|
7
|
+
<!-- **********************************
|
8
|
+
************ BAS DE PAGE ***********
|
9
|
+
************************************ -->
|
10
|
+
<SCRIPT>
|
11
|
+
function #{::Muml_Class::STRUTS_SETLOCALE_ACTION}(lang) {
|
12
|
+
document.forms[0].#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}.value="#{::Muml_Class::STRUTS_SETLOCALE_ACTION}";
|
13
|
+
document.forms[0].#{Muml_Class::STRUTS_SETLOCALE_LANGUAGE_FIELD}.value=lang;
|
14
|
+
document.forms[0].submit();
|
15
|
+
}
|
16
|
+
function #{::Muml_Class::STRUTS_SETTIMEZONE_ACTION}(tz) {
|
17
|
+
document.forms[0].#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}.value="#{::Muml_Class::STRUTS_SETTIMEZONE_ACTION}";
|
18
|
+
document.forms[0].#{Muml_Class::STRUTS_SETTIMEZONE_FIELD}.value=tz;
|
19
|
+
document.forms[0].submit();
|
20
|
+
}
|
21
|
+
function #{::Muml_Class::STRUTS_SETSKIN_ACTION}(skin) {
|
22
|
+
alert("!!");
|
23
|
+
document.forms[0].#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}.value="#{::Muml_Class::STRUTS_SETSKIN_ACTION}";
|
24
|
+
document.forms[0].#{Muml_Class::STRUTS_SETSKIN_FIELD}.value=skin;
|
25
|
+
document.forms[0].submit();
|
26
|
+
}
|
27
|
+
function #{::Muml_Class::STRUTS_SWITH_TO_FLEX_ACTION}() {
|
28
|
+
document.forms[0].#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}.value="#{::Muml_Class::STRUTS_SWITH_TO_FLEX_ACTION}";
|
29
|
+
document.forms[0].submit();
|
30
|
+
}
|
31
|
+
|
32
|
+
</SCRIPT>
|
33
|
+
<br/>
|
34
|
+
<table>
|
35
|
+
<tr>
|
36
|
+
<td>
|
37
|
+
<img onClick="switchToFlex();" src="#{css_path_model}/#{css_color_class}/image/logoFrancetelecom.gif" border="0" alt=""/>
|
38
|
+
</td>
|
39
|
+
<td width="100%">
|
40
|
+
</td>
|
41
|
+
<td>
|
42
|
+
<a href="#">
|
43
|
+
<img onClick="#{::Muml_Class::STRUTS_SWITH_TO_FLEX_ACTION}();" src="#{css_path_model}/#{css_color_class}/image/btnFX.gif" width="28" height="25" border="0" alt=""/>
|
44
|
+
</a>
|
45
|
+
</td>
|
46
|
+
<td>
|
47
|
+
<a href="#">
|
48
|
+
<img src="#{css_path_model}/#{css_color_class}/image/btnSend.gif" width="25" height="25" border="0" alt="" />
|
49
|
+
</a>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
<a href="#">
|
53
|
+
<img src="#{css_path_model}/#{css_color_class}/image/btnUp.gif" width="25" height="25" border="0" alt=""/>
|
54
|
+
</a>
|
55
|
+
</td>
|
56
|
+
<td>
|
57
|
+
<img src="#{css_path_model}/#{css_color_class}/image/imgSprtr.gif" width="1" height="30" border="0" alt="" />
|
58
|
+
</td>
|
59
|
+
<td>
|
60
|
+
<a href="#">
|
61
|
+
<img onclick="setLocale('fr');" src="#{css_path_model}/#{css_color_class}/image/btnLanguage_Fr.gif" width="24" height="19" border="0" alt="" />
|
62
|
+
</a>
|
63
|
+
</td>
|
64
|
+
<td>
|
65
|
+
<a href="#">
|
66
|
+
<img onclick="setLocale('en');" src="#{css_path_model}/#{css_color_class}/image/btnLanguage_Eng.gif" width="24" height="19" border="0" alt="" />
|
67
|
+
</a>
|
68
|
+
</td>
|
69
|
+
<td>
|
70
|
+
<a href="#">
|
71
|
+
<img onclick="setLocale('de');" src="#{css_path_model}/#{css_color_class}/image/btnLanguage_Dch.gif" width="24" height="19" border="0" alt="" />
|
72
|
+
</a>
|
73
|
+
</td>
|
74
|
+
<td>
|
75
|
+
<img src="#{css_path_model}/#{css_color_class}/image/imgSprtr.gif" width="1" height="30" border="0" alt="" />
|
76
|
+
</td>
|
77
|
+
<td>
|
78
|
+
<html:hidden property="#{::Muml_Class::STRUTS_SETLOCALE_LANGUAGE_FIELD}"/>
|
79
|
+
<input type="hidden" name="#{::Muml_Class::STRUTS_SETSKIN_FIELD}"/>
|
80
|
+
END
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
write(struts_getTimeZoneSelect())
|
85
|
+
|
86
|
+
write %{
|
87
|
+
</td>
|
88
|
+
<td>
|
89
|
+
}
|
90
|
+
struts_writeTimeoutIndicator()
|
91
|
+
|
92
|
+
if context[:security]
|
93
|
+
# DISPLAY A WARNING IN WEB PAGE IF SERVER SECURITY IS DISABLED
|
94
|
+
write <<SECWARN
|
95
|
+
<%=
|
96
|
+
xmda.security.ProviderImpl.getSecurityIsDisabled()
|
97
|
+
? "<span style=\\"background-color:red; text-color:black\\" bgcolor=\\"black\\">ACCESS<br>CONTROL<br>DISABLED</span>"
|
98
|
+
: ""
|
99
|
+
%>
|
100
|
+
SECWARN
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
#cf: j_acegi_logout is handled in Application-security.xml
|
105
|
+
write <<END2
|
106
|
+
<td><html:link page="/j_spring_security_logout" title="Logout"><img src="res/orange/image/exit.gif" width="25" height="25" border="0" alt="exit"/></html:link></td>
|
107
|
+
END2
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
write <<END
|
112
|
+
|
113
|
+
</td>
|
114
|
+
</tr>
|
115
|
+
</table>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
END
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
module Muml_Class
|
125
|
+
def struts_footer_generate
|
126
|
+
rdf_Repository.struts_footer_generate
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,450 @@
|
|
1
|
+
module Muml_Element
|
2
|
+
# Struts LabelValueBean class qualified name.
|
3
|
+
STRUTS_LVB='org.apache.struts.util.LabelValueBean'
|
4
|
+
|
5
|
+
# LVB used for null object
|
6
|
+
NIL_LVB_KEY="nil"
|
7
|
+
NIL_LVB_RES_KEY="obj_nil"
|
8
|
+
end
|
9
|
+
|
10
|
+
module Mstruts_tab
|
11
|
+
end
|
12
|
+
class Cstruts_tab < Crdf_Resource
|
13
|
+
include Mstruts_tab
|
14
|
+
rdf_safe_attr_reader_many :struts_ownedAttribute
|
15
|
+
rdf_safe_attr_reader_many :java_Name
|
16
|
+
end
|
17
|
+
|
18
|
+
module Muml_Classifier
|
19
|
+
rdf_safe_attr_reader_many :struts_ownedTab
|
20
|
+
end
|
21
|
+
|
22
|
+
module Muml_Operation
|
23
|
+
#Struts ActionForm associated to this operation
|
24
|
+
rdf_safe_attr_reader_many :struts_actionForm
|
25
|
+
end
|
26
|
+
|
27
|
+
module Muml_Classifier
|
28
|
+
STRUTS_REQUESTED_CREATION_TYPE_FIELD_NAME="reqType"
|
29
|
+
STRUTS_REQUESTED_CREATION_TYPE_FIELD_PROP="ReqType"
|
30
|
+
STRUTS_DISPATCH_FIELD_NAME="doWhat"
|
31
|
+
STRUTS_DISPATCH_FIELD_METH="DoWhat"
|
32
|
+
STRUTS_REQUESTED_TAB="reqtab"
|
33
|
+
STRUTS_FORM_INTERFACE="xmda.struts.Form"
|
34
|
+
|
35
|
+
rdf_safe_attr_reader_many :struts_isForm
|
36
|
+
|
37
|
+
#class from which this StrutsActionForm was generated.
|
38
|
+
rdf_safe_attr_reader_many :struts_actionFormSrc
|
39
|
+
|
40
|
+
#Struts ActionForm associated to this class
|
41
|
+
rdf_safe_attr_reader_many :struts_actionForm
|
42
|
+
|
43
|
+
def struts_eachFormAttribute_deprec()
|
44
|
+
struts_formAttribute.each { |a|
|
45
|
+
yield(a)
|
46
|
+
}
|
47
|
+
end
|
48
|
+
#every attribute meant to appear in the form.
|
49
|
+
def struts_formAttribute(ignoreDbId=false)
|
50
|
+
#tab=context[:struts_tab,nil]
|
51
|
+
|
52
|
+
ret=Array.new
|
53
|
+
cgi=umlx_classifier_generalization_indirect
|
54
|
+
cgi.add(self)
|
55
|
+
cgi.each { |c|
|
56
|
+
c.uml_ownedAttribute.each { |a|
|
57
|
+
next if a.struts_ignoreInForm?(ignoreDbId)
|
58
|
+
ret << a
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return ret
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
#every method meant to appear in the form.
|
67
|
+
def struts_formOperation()
|
68
|
+
ret=Array.new
|
69
|
+
cgi=umlx_classifier_generalization_indirect
|
70
|
+
cgi.add(self)
|
71
|
+
cgi.each { |c|
|
72
|
+
c.uml_ownedOperation.each { |a|
|
73
|
+
#next if a.db_isTransient?
|
74
|
+
next if a.uml_isStatic?
|
75
|
+
#next if a.java_ignoreMe?
|
76
|
+
ret << a
|
77
|
+
}
|
78
|
+
}
|
79
|
+
return ret
|
80
|
+
end
|
81
|
+
|
82
|
+
def struts_getFormInterface
|
83
|
+
iform=umlx_getOrCreateInterface(STRUTS_FORM_INTERFACE)
|
84
|
+
if(iform.uml_ownedOperation.empty?)
|
85
|
+
iform.umlx_external=RDF_FALSE
|
86
|
+
iform.struts_addActionLocaleFormFields!
|
87
|
+
["initFromReference","copyToReference"].each {|m|
|
88
|
+
iform.umlx_createAndAddOperation(iform.rdf_uri+m,m);
|
89
|
+
}
|
90
|
+
iform.java_addAccessors! #ajouter getter/setter
|
91
|
+
end
|
92
|
+
return iform
|
93
|
+
end
|
94
|
+
|
95
|
+
def struts_addInitAndCopyToReference!
|
96
|
+
i=umlx_createAndAddOperation(rdf_uri+"initFromReference","initFromReference");
|
97
|
+
i.java_code="initFrom(getReference());"
|
98
|
+
|
99
|
+
c=umlx_createAndAddOperation(rdf_uri+"copyToReference","copyToReference");
|
100
|
+
c.java_code="copyTo(getReference());"
|
101
|
+
end
|
102
|
+
|
103
|
+
#Creates and add an action form corresponding to this class.
|
104
|
+
def struts_addActionForm!
|
105
|
+
#log.debug { "struts_addActionForm! for #{self}:#{self.class}" }
|
106
|
+
p=umlx_owner_one
|
107
|
+
p=p.umlx_getOrCreatePackage(context[:strutsFormPackage,context[:strutsActionFormPackage,"struts"]],p)
|
108
|
+
|
109
|
+
form=p.umlx_createAndAddClass(rdf_uri+"_ActionFormClass")
|
110
|
+
|
111
|
+
form.umlx_createAndAddImplementation(struts_getFormInterface)
|
112
|
+
form.struts_addInitAndCopyToReference!
|
113
|
+
|
114
|
+
form.struts_isForm=RDF_TRUE
|
115
|
+
form.db_isTransient=RDF_TRUE
|
116
|
+
|
117
|
+
form.struts_actionFormSrc=self
|
118
|
+
self.struts_actionForm=form
|
119
|
+
|
120
|
+
form.uml_name="#{uml_name}StrutsForm"
|
121
|
+
#af=umlx_getOrCreateClass("org.apache.struts.action.ActionForm")
|
122
|
+
#if (uml_generalization.empty?)
|
123
|
+
#NOTE: Forms inheritance DO NOT follow class inheritance.
|
124
|
+
# (to allow exact typing in redefined methods)
|
125
|
+
|
126
|
+
af=umlx_getOrCreateClass("org.apache.struts.validator.ValidatorForm")
|
127
|
+
form.umlx_createAndAddGeneralization(af)
|
128
|
+
|
129
|
+
form.java_makeSerializable!
|
130
|
+
#ag=umlx_getOrCreateClass("java.io.Serializable")
|
131
|
+
#form.umlx_createAndAddImplementation(ag)
|
132
|
+
#TODO ajouter implements interface
|
133
|
+
|
134
|
+
struts_addActionFormAttribute!(form)
|
135
|
+
struts_create_getXMLFormOperations!(form)
|
136
|
+
|
137
|
+
struts_addInitFrom!
|
138
|
+
struts_addCopyTo!
|
139
|
+
struts_addReset!
|
140
|
+
|
141
|
+
ref=form.umlx_createAndAddProperty(form.rdf_uri+"__ref","reference")
|
142
|
+
ref.uml_type=self
|
143
|
+
ref.java_noSuggester=RDF_TRUE
|
144
|
+
|
145
|
+
[STRUTS_DISPATCH_FIELD_NAME,STRUTS_SGBD_STATE,STRUTS_REQUESTED_CREATION_TYPE_FIELD_NAME].each {|p|
|
146
|
+
act=form.umlx_createAndAddProperty(form.rdf_uri+p)
|
147
|
+
act.uml_name=p
|
148
|
+
act.uml_type=umlx_dataType_string
|
149
|
+
}
|
150
|
+
|
151
|
+
form.struts_addActionLocaleFormFields!
|
152
|
+
|
153
|
+
form.java_addAccessors! #ajouter getter/setter
|
154
|
+
form.apaCom_addLogger!
|
155
|
+
end
|
156
|
+
|
157
|
+
STRUTS_ACCEPT_NULL_FIELD_IN_FORMS=true
|
158
|
+
def struts_addCopyTo!
|
159
|
+
#log.debug{ "addCopyTo #{self}" }
|
160
|
+
form=struts_actionForm_one
|
161
|
+
cpt=form.umlx_createAndAddOperation(form.rdf_uri+"_copyTo","copyTo")
|
162
|
+
cpt.java_annotation_add(%{@SuppressWarnings("unused")})
|
163
|
+
pcpt=cpt.umlx_createAndAddParameter(cpt.rdf_uri+"_to","_to")
|
164
|
+
pcpt.uml_direction=Cuml_ParameterDirectionKind::Inout
|
165
|
+
pcpt.uml_type=self
|
166
|
+
code="java.util.TimeZone currentTimeZone = java.util.TimeZone.getTimeZone(get#{STRUTS_SETTIMEZONE_BEAN}());"
|
167
|
+
struts_formAttribute.each { |a|
|
168
|
+
code=code+"if(this.get#{a.java_NameBean}()!=null) {\n " if(STRUTS_ACCEPT_NULL_FIELD_IN_FORMS)
|
169
|
+
code=code+"#{DatatypeMapping.instance.getMapping(a.uml_type_one).getFormCopyTo(a)}"
|
170
|
+
code=code+" }//test !=null\n" if(STRUTS_ACCEPT_NULL_FIELD_IN_FORMS)
|
171
|
+
}
|
172
|
+
|
173
|
+
cpt.java_code=code
|
174
|
+
end
|
175
|
+
|
176
|
+
def struts_addActionFormAttribute!(form)
|
177
|
+
struts_formAttribute.each { |a|
|
178
|
+
a.struts_addActionFormAttribute!(form)
|
179
|
+
}
|
180
|
+
#struts_addDateFormater!(form)
|
181
|
+
end
|
182
|
+
|
183
|
+
def struts_typeIsUsed?(type)
|
184
|
+
type=type.downcase
|
185
|
+
struts_formAttribute.each { |a|
|
186
|
+
t=a.uml_type_one
|
187
|
+
next unless t.kind_of?(Muml_Property)
|
188
|
+
next unless t.uml_name_one.downcase==type
|
189
|
+
return true
|
190
|
+
}
|
191
|
+
return false
|
192
|
+
end
|
193
|
+
|
194
|
+
def struts_addInitFrom!
|
195
|
+
form=struts_actionForm_one
|
196
|
+
inf=form.umlx_createAndAddOperation(form.rdf_uri+"_initFrom","initFrom")
|
197
|
+
inf.java_annotation_add(%{@SuppressWarnings("unused")})
|
198
|
+
pinf=inf.umlx_createAndAddParameter(inf.rdf_uri+"_from","_from")
|
199
|
+
pinf.uml_type=self
|
200
|
+
pinf.uml_direction=Cuml_ParameterDirectionKind::In
|
201
|
+
|
202
|
+
code="java.util.TimeZone currentTimeZone = java.util.TimeZone.getTimeZone(get#{STRUTS_SETTIMEZONE_BEAN}());\n"
|
203
|
+
struts_formAttribute.each { |a|
|
204
|
+
code=code+"#{DatatypeMapping.instance.getMapping(a.uml_type_one).getFormInitFrom(a)}"
|
205
|
+
|
206
|
+
}
|
207
|
+
inf.java_code=code
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
def struts_addReset!
|
212
|
+
form=struts_actionForm_one
|
213
|
+
o=form.umlx_createAndAddOperation(form.rdf_uri+"_reset","reset")
|
214
|
+
o.java_annotation_add("@Override")
|
215
|
+
o.java_code= <<END
|
216
|
+
// if the time zone is not set yet in the session
|
217
|
+
// we set the default value ("Europe/Paris") else
|
218
|
+
// we get the timezone saved in the user session.
|
219
|
+
this.set#{Muml_Classifier::STRUTS_SETTIMEZONE_BEAN}(xmda.tags.helpers.XMDARequestUtils.getUserTimeZone(request, null).getID());
|
220
|
+
END
|
221
|
+
p=o.umlx_createAndAddParameter(o.rdf_uri+"_mapping","mapping")
|
222
|
+
p.uml_type=o.umlx_getOrCreateClass("org.apache.struts.action.ActionMapping")
|
223
|
+
p=o.umlx_createAndAddParameter(o.rdf_uri+"_request","request")
|
224
|
+
p.uml_type=o.umlx_getOrCreateClass("javax.servlet.http.HttpServletRequest")
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
module Muml_Property
|
229
|
+
|
230
|
+
#real type of this form field (int,float, ...)
|
231
|
+
rdf_safe_attr_reader_many :struts_sourceProperty
|
232
|
+
|
233
|
+
|
234
|
+
def struts_ignoreInForm?(ignoreDbId=true)
|
235
|
+
return true if uml_type_one.db_isTransient? && !uml_type_one.kind_of?(Muml_Enumeration) && !uml_type_one.kind_of?(Muml_DataType)
|
236
|
+
return true if db_isTransient?
|
237
|
+
return true if uml_isStatic?
|
238
|
+
return true if java_ignoreMe?
|
239
|
+
return true if ignoreDbId && uml_name_one=="id"
|
240
|
+
return true if uml_name_one==Muml_Classifier::DB_OBJECT_VERSION_FIELD
|
241
|
+
#return true if java_getter_property_inv.empty?
|
242
|
+
#return true if java_setter_property_inv.empty?
|
243
|
+
# a is a property added for compatibility
|
244
|
+
return true unless umlx_stringMappingForEnum.empty?
|
245
|
+
return false
|
246
|
+
end
|
247
|
+
|
248
|
+
#field for paginating in lists
|
249
|
+
rdf_safe_attr_reader_many :struts_paginatorProperty
|
250
|
+
|
251
|
+
# adds a matching field in form
|
252
|
+
# adds a paginator field when cardinality >1
|
253
|
+
def struts_copyAsFormField!(form)
|
254
|
+
#log.debug { %{add form field #{self} to #{form}} }
|
255
|
+
a2=form.umlx_createAndAddProperty(rdf_uri+"_ActionFormField")
|
256
|
+
a2.uml_name=uml_name
|
257
|
+
a2.uml_upperValue=uml_upperValue
|
258
|
+
a2.uml_lowerValue=uml_lowerValue
|
259
|
+
a2.java_use_Arrays=RDF_TRUE
|
260
|
+
a2.struts_sourceProperty=self
|
261
|
+
|
262
|
+
if ! umlx_upperValueIsOne?
|
263
|
+
paginator=form.umlx_createAndAddProperty(rdf_uri+"_ActionFormField_page")
|
264
|
+
paginator.uml_name=uml_name.to_s+"_strutsPage"
|
265
|
+
paginator.uml_type=form.umlx_owner_one.umlx_dataType_integer
|
266
|
+
a2.struts_paginatorProperty=paginator
|
267
|
+
end
|
268
|
+
|
269
|
+
return a2
|
270
|
+
end
|
271
|
+
def struts_addActionFormAttribute!(form)
|
272
|
+
return if db_isTransient?
|
273
|
+
return if uml_isStatic?
|
274
|
+
|
275
|
+
|
276
|
+
if uml_type_one.kind_of?(Muml_Enumeration)
|
277
|
+
struts_addActionFormAttributeEnumeration!(form)
|
278
|
+
elsif uml_type_one.kind_of?(Muml_DataType)
|
279
|
+
a2=struts_copyAsFormField!(form)
|
280
|
+
#a2.uml_type=form.umlx_dataType_string
|
281
|
+
tpl=DatatypeMapping.instance.getMapping(uml_type_one)
|
282
|
+
a2.uml_type=tpl.getFormType(form)
|
283
|
+
else
|
284
|
+
struts_addActionFormAttributeReference!(form)
|
285
|
+
|
286
|
+
end
|
287
|
+
#TODO: ajouter autres proprietes
|
288
|
+
end
|
289
|
+
|
290
|
+
|
291
|
+
def nil_lvb(obj)
|
292
|
+
return %{new #{STRUTS_LVB}("#{obj.java_qualifiedName}.#{NIL_LVB_RES_KEY}", "#{NIL_LVB_KEY}")}
|
293
|
+
end
|
294
|
+
|
295
|
+
STRUTS_ENUM_AS_STRING=true
|
296
|
+
|
297
|
+
#Adds to the form class, a suggester operation corresponding to this attribute.
|
298
|
+
def struts_addActionFormAttributeEnumeration!(form)
|
299
|
+
return if uml_isReadOnly?
|
300
|
+
a2=struts_copyAsFormField!(form)
|
301
|
+
#a2.uml_type=form.umlx_dataType_integer
|
302
|
+
a2.uml_type=form.umlx_dataType_string
|
303
|
+
#a2.uml_type=form.umlx_getOrCreateClass("java.lang.Integer")
|
304
|
+
|
305
|
+
sug=form.umlx_createAndAddOperation(form.rdf_uri+"_sug","get#{self.java_NameBean}Sug")
|
306
|
+
ret=sug.umlx_createAndAddReturnParameter(sug.rdf_uri+"_return")
|
307
|
+
ret.uml_type=form.umlx_getOrCreateClass("#{STRUTS_LVB}")
|
308
|
+
ret.uml_upperValue=form.umlx_literal(-1)
|
309
|
+
ret.uml_isOrdered=RDF_TRUE
|
310
|
+
|
311
|
+
sug.java_code=%{
|
312
|
+
return #{form.struts_getFormHelper.java_qualifiedName}.#{STRUTS_FORM_HELPER_ENUMTOLVB}(#{self.uml_type_one.java_qualifiedName}.class,(#{self.uml_type_one.java_qualifiedName})null,getReference().get#{self.java_NameBean}Sug());
|
313
|
+
}
|
314
|
+
end
|
315
|
+
|
316
|
+
#suggester for a list of objects
|
317
|
+
def struts_addActionFormAttributeReference!(form)
|
318
|
+
a2=struts_copyAsFormField!(form)
|
319
|
+
a2.uml_type=form.umlx_dataType_string
|
320
|
+
|
321
|
+
if ! uml_isReadOnly?
|
322
|
+
sug=form.umlx_createAndAddOperation(form.rdf_uri+"_sug","get#{self.java_NameBean}Sug")
|
323
|
+
ret=sug.umlx_createAndAddReturnParameter(sug.rdf_uri+"_return")
|
324
|
+
ret.uml_type=form.umlx_getOrCreateClass("#{STRUTS_LVB}")
|
325
|
+
ret.uml_upperValue=form.umlx_literal(-1)
|
326
|
+
ret.uml_isOrdered=RDF_TRUE
|
327
|
+
|
328
|
+
sug.java_code= <<ENDJAVA
|
329
|
+
java.util.List<#{STRUTS_LVB}> ret=new java.util.ArrayList<#{STRUTS_LVB}>();
|
330
|
+
#{STRUTS_LVB} lvb=null;
|
331
|
+
//
|
332
|
+
// //#{self.umlx_manySide? ? "" : %{lvb=new #{STRUTS_LVB}("--","empty");
|
333
|
+
// //ret.add(lvb);} }
|
334
|
+
// return #{form.struts_getFormHelper.java_qualifiedName}.#{STRUTS_FORM_HELPER_ENUMTOLVB}(#{self.uml_type_one.java_qualifiedName}.class,(#{self.uml_type_one.java_qualifiedName})null,getReference().get#{self.java_NameBean}Sug());
|
335
|
+
|
336
|
+
for (#{self.uml_type_one.java_qualifiedName} item : getReference().get#{self.java_NameBean}Sug()) {
|
337
|
+
if(item!=null) {
|
338
|
+
lvb=new #{STRUTS_LVB}("obj:"+item.getId(), Long.toString(item.getId()));
|
339
|
+
} else {
|
340
|
+
lvb=#{nil_lvb(self.uml_type_one)};
|
341
|
+
}
|
342
|
+
ret.add(lvb);
|
343
|
+
}
|
344
|
+
return ret;
|
345
|
+
ENDJAVA
|
346
|
+
end
|
347
|
+
if(umlx_isComposite?)
|
348
|
+
m=java_createAndAddSuggester_one
|
349
|
+
r=nil
|
350
|
+
(m.uml_returnResult+m.uml_ownedParameter).each {|p| next unless p.uml_direction_one.isReturn? ; r=p.uml_type_one }
|
351
|
+
sugC=form.umlx_createAndAddOperation(form.rdf_uri+"_sugC","#{m.java_Name}")
|
352
|
+
ret=sugC.umlx_createAndAddReturnParameter("#{sugC.rdf_uri}_ret")
|
353
|
+
ret.uml_type=form.umlx_getOrCreateClass("#{STRUTS_LVB}")
|
354
|
+
ret.uml_upperValue=form.umlx_literal(-1)
|
355
|
+
ret.uml_isOrdered=RDF_TRUE
|
356
|
+
sugC.java_code=%{
|
357
|
+
return #{form.struts_getFormHelper.java_qualifiedName}.#{STRUTS_FORM_HELPER_ENUMTOLVB}(#{r.java_qualifiedName}.class,(#{r.java_qualifiedName})null,getReference().#{m.java_Name}(),true);
|
358
|
+
}
|
359
|
+
|
360
|
+
end
|
361
|
+
|
362
|
+
end
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
end
|
368
|
+
|
369
|
+
module Muml_Element
|
370
|
+
STRUTS_FORM_HELPER="xmda.struts.FormHelper"
|
371
|
+
STRUTS_FORM_HELPER_ENUMTOLVB="enumToLvb"
|
372
|
+
|
373
|
+
STRUTS_DATE_FORMATER_INSTANCE=STRUTS_FORM_HELPER+'.DfCalendar'
|
374
|
+
STRUTS_TIMESTAMP_FORMATER_INSTANCE=STRUTS_FORM_HELPER+'.DfTimestamp'
|
375
|
+
|
376
|
+
STRUTS_FORM_HELPER_CODE= <<ENDCODE
|
377
|
+
public static final java.text.SimpleDateFormat DfTimestamp=new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss",java.util.Locale.ENGLISH);
|
378
|
+
public static final java.text.SimpleDateFormat DfCalendar=new java.text.SimpleDateFormat("yyyy/MM/dd",java.util.Locale.ENGLISH);
|
379
|
+
|
380
|
+
/**
|
381
|
+
* Transform a timestamp date to its GMT equivalent date.
|
382
|
+
*
|
383
|
+
* @param fromTimeZone
|
384
|
+
* @param timestampToTransform
|
385
|
+
* @return date in GMT
|
386
|
+
*/
|
387
|
+
public static java.util.Date transformFromCurrentTZToGMT(final java.util.TimeZone fromTimeZone,final java.util.Date timestampToTransform) {
|
388
|
+
// the offset of this time zone from UTC.
|
389
|
+
int offset = fromTimeZone.getRawOffset();
|
390
|
+
|
391
|
+
java.util.GregorianCalendar gregCal = new java.util.GregorianCalendar();
|
392
|
+
gregCal.setTime(timestampToTransform);
|
393
|
+
gregCal.add(java.util.Calendar.HOUR_OF_DAY, (-offset / 3600000));
|
394
|
+
|
395
|
+
return gregCal.getTime();
|
396
|
+
}
|
397
|
+
|
398
|
+
public static java.util.Date transformFromGMTToCurrentTZ(final java.util.TimeZone currentTimeZone,final java.util.Date timestampToTransform) {
|
399
|
+
// the offset of this time zone from UTC.
|
400
|
+
int offset = currentTimeZone.getRawOffset();
|
401
|
+
|
402
|
+
java.util.GregorianCalendar gregorianCalendar = new java.util.GregorianCalendar();
|
403
|
+
gregorianCalendar.setTime(timestampToTransform);
|
404
|
+
gregorianCalendar.add(java.util.Calendar.HOUR_OF_DAY, (offset / 3600000));
|
405
|
+
return gregorianCalendar.getTime();
|
406
|
+
}
|
407
|
+
|
408
|
+
public static java.util.List<#{STRUTS_LVB}> #{STRUTS_FORM_HELPER_ENUMTOLVB}(final Class<?> enumType,final xmda.java.JavaEnumSig typeCheck, final java.util.List<?> enums) {
|
409
|
+
return #{STRUTS_FORM_HELPER_ENUMTOLVB}(enumType,typeCheck,enums,false);
|
410
|
+
}
|
411
|
+
// addNullItem is used for example to add a "add element" in creator selection.
|
412
|
+
public static java.util.List<#{STRUTS_LVB}> #{STRUTS_FORM_HELPER_ENUMTOLVB}(final Class<?> enumType,final xmda.java.JavaEnumSig typeCheck, final java.util.List<?> enums,final boolean addNullItem) {
|
413
|
+
try {
|
414
|
+
java.util.List<#{STRUTS_LVB}> ret=new java.util.ArrayList<#{STRUTS_LVB}>();
|
415
|
+
String prefix=enumType.getCanonicalName()+".";
|
416
|
+
#{STRUTS_LVB} lvb=null;
|
417
|
+
if(addNullItem) { ret.add(new #{STRUTS_LVB}(prefix+"obj_nil", "nil"));}
|
418
|
+
for ( Object itemObj : enums) {
|
419
|
+
xmda.java.JavaEnumSig item=(#{JAVA_ENUM_INTERFACE_QNAME})itemObj;
|
420
|
+
if(item!=null) {
|
421
|
+
//value is a localization resource key
|
422
|
+
lvb=new #{STRUTS_LVB}(prefix+item.name(),item.name());
|
423
|
+
} else {
|
424
|
+
lvb=new #{STRUTS_LVB}(prefix+"obj_nil", "nil");
|
425
|
+
}
|
426
|
+
ret.add(lvb);
|
427
|
+
}
|
428
|
+
return ret;
|
429
|
+
} catch (RuntimeException e) {
|
430
|
+
log.error(e);
|
431
|
+
throw(e);
|
432
|
+
}
|
433
|
+
}
|
434
|
+
ENDCODE
|
435
|
+
|
436
|
+
def struts_getFormHelper
|
437
|
+
helper=umlx_getOrCreateClass(STRUTS_FORM_HELPER)
|
438
|
+
if(helper.java_customCode.empty?)
|
439
|
+
helper.apaCom_addLogger!
|
440
|
+
helper.umlx_external=RDF_FALSE
|
441
|
+
#helper.java_import_add(STRUTS_LVB)
|
442
|
+
helper.db_isTransient=RDF_TRUE
|
443
|
+
helper.struts_isForm=RDF_FALSE
|
444
|
+
helper.java_customCode= STRUTS_FORM_HELPER_CODE
|
445
|
+
end
|
446
|
+
return helper;
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
|