ontomde-uml2-struts 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ #module Muml_DataType
2
+ # def struts_isBlob?
3
+ # return java_qualifiedName=="java.sql.Blob"
4
+ # end
5
+ #end
6
+
7
+ #module Muml_Property
8
+ # def struts_isBlobField?
9
+ # return uml_type_one.kind_of?(Muml_DataType) && uml_type_one.struts_isBlob?
10
+ # end
11
+ #end
@@ -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_Model
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_Model
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_acegi_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_model.struts_footer_generate
127
+ end
128
+ end