Hello Wouter,

It's me again, I tried the new 'file' tagged value and here is what I got :

The Interface generated for the deferred operation (StrutsFormInterface.vsl) doesn't use the
org.apache.struts.upload.FormFile (but java.io.File mapped to datatype::File).


This causes compilation error since the FrontEndView generated form (StrutsForm.vsl)
does use the FormFile type.


Regards,
Fred.

----- Original Message ----- From: "Wouter Zoons (JIRA)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 23, 2004 11:44 AM
Subject: [Andromda-devel] [AndroMDA/JIRA] Closed: (BPM-112) file Upload



[ http://team.andromda.org:8080/jira/browse/BPM-112?page=history ]

Wouter Zoons closed BPM-112:
----------------------------

   Resolution: Fixed

I did not try this in a real project yet .. the generated code looks fine to me. Could someone give this a try and let me know if something is wrong ? thanks.

file Upload
-----------

         Key: BPM-112
         URL: http://team.andromda.org:8080/jira/browse/BPM-112
     Project: Bpm4Struts Cartridge
        Type: Improvement
    Reporter: Carlos Cuenca
    Assignee: Wouter Zoons



Hi all,
I had created a patch to allow a File widget which uploads a file to the server, basicalley two modificacions in the model, one on the BPM4StrutsMetafacadeModel.xml.zip to add a boolean file property to the Parameter, and another one at the UMLMetafacadeModel.xml.zip to add a method fileType at the classifier facade.
Carlos
here is the patch:
Index: cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/Bpm4StrutsProfile.java
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/Bpm4StrutsProfile.java,v
retrieving revision 1.21
diff -u -r1.21 Bpm4StrutsProfile.java
--- cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/Bpm4StrutsProfile.java 9 Nov 2004 01:10:19 -0000 1.21
+++ cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/Bpm4StrutsProfile.java 18 Nov 2004 00:17:22 -0000
@@ -56,6 +56,7 @@
public static final String TAGGEDVALUE_INPUT_TYPE_PASSWORD = "password";
public static final String TAGGEDVALUE_INPUT_TYPE_MULTIBOX = "multibox";
public static final String TAGGEDVALUE_INPUT_TYPE_LINK = "link";
+ public static final String TAGGEDVALUE_INPUT_TYPE_FILE = "file";
public static final int TAGGEDVALUE_INPUT_TYPE_OPTION_DEFAULT_COUNT = 3;
public static final String TAGGEDVALUE_INPUT_DEFAULT_DATEFORMAT = "dd/MM/yyyy";
Index: cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsParameterLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsParameterLogicImpl.java,v
retrieving revision 1.56
diff -u -r1.56 StrutsParameterLogicImpl.java
--- cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsParameterLogicImpl.java 22 Oct 2004 09:05:35 -0000 1.56
+++ cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsParameterLogicImpl.java 18 Nov 2004 00:53:22 -0000
@@ -744,6 +744,10 @@
{
widgetType = "password";
}
+ else if (Bpm4StrutsProfile.TAGGEDVALUE_INPUT_TYPE_FILE.equalsIgnoreCase(fieldType))
+ {
+ widgetType = "file";
+ }
else if (isTableLink())
{
if (Bpm4StrutsProfile.TAGGEDVALUE_INPUT_TYPE_LINK.equalsIgnoreCase(fieldType))
@@ -1270,4 +1274,10 @@
return (index >= tokens.length) ? null : tokens[index];
}
-}
+ /* (non-Javadoc)
+ * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsParameterLogic#handleIsFile()
+ */
+ protected boolean handleIsFile() {
+ return getType().isFileType();
+ }
+}
\ No newline at end of file
Index: cartridges/andromda-bpm4struts/src/templates/StrutsAction.vsl
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/templates/StrutsAction.vsl,v
retrieving revision 1.36
diff -u -r1.36 StrutsAction.vsl
--- cartridges/andromda-bpm4struts/src/templates/StrutsAction.vsl 18 Nov 2004 05:54:21 -0000 1.36
+++ cartridges/andromda-bpm4struts/src/templates/StrutsAction.vsl 18 Nov 2004 10:56:04 -0000
@@ -39,6 +39,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.struts.upload.FormFile;
+
+
/**
$action.getDocumentation(" * ")
*/
Index: cartridges/andromda-bpm4struts/src/templates/StrutsActionJsp.vsl
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/templates/StrutsActionJsp.vsl,v
retrieving revision 1.33
diff -u -r1.33 StrutsActionJsp.vsl
--- cartridges/andromda-bpm4struts/src/templates/StrutsActionJsp.vsl 17 Nov 2004 23:53:15 -0000 1.33
+++ cartridges/andromda-bpm4struts/src/templates/StrutsActionJsp.vsl 18 Nov 2004 10:56:04 -0000
@@ -29,7 +29,7 @@
#else
#set ($onsubmit = "")
#end
- <html:form action="${action.actionPath}" onsubmit="$onsubmit">
+ <html:form action="${action.actionPath}" method="post" enctype="multipart/form-data" onsubmit="$onsubmit">
#if ($action.tabbed)
#set ($tabSwitchFunction = "select${actionTrigger.name}FieldTab")
Index: cartridges/andromda-bpm4struts/src/templates/StrutsController.vsl
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/templates/StrutsController.vsl,v
retrieving revision 1.34
diff -u -r1.34 StrutsController.vsl
--- cartridges/andromda-bpm4struts/src/templates/StrutsController.vsl 13 Nov 2004 10:47:36 -0000 1.34
+++ cartridges/andromda-bpm4struts/src/templates/StrutsController.vsl 18 Nov 2004 02:12:10 -0000
@@ -18,7 +18,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+import org.apache.struts.upload.FormFile;
+import org.apache.struts.upload.MultipartRequestWrapper;
/**
* @see ${controllerPackageName}.${controllerClassName}
*/
Index: cartridges/andromda-bpm4struts/src/templates/StrutsForm.vsl
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/templates/StrutsForm.vsl,v
retrieving revision 1.27
diff -u -r1.27 StrutsForm.vsl
--- cartridges/andromda-bpm4struts/src/templates/StrutsForm.vsl 13 Nov 2004 10:47:36 -0000 1.27
+++ cartridges/andromda-bpm4struts/src/templates/StrutsForm.vsl 18 Nov 2004 11:39:04 -0000
@@ -11,6 +11,9 @@
##
package $action.formBeanPackageName;
+import org.apache.struts.upload.FormFile;
+import org.apache.struts.upload.MultipartRequestWrapper;
+
public class $formBeanClassName
extends org.apache.struts.validator.ValidatorForm
implements java.io.Serializable
@@ -28,10 +31,16 @@
#if ($field.type.arrayType || $field.selectable)
#set ($arrayPresent = true)
#end
- private $field.type.fullyQualifiedName $field.name;
+#if ($field.file)
+ private org.apache.struts.upload.FormFile $field.name = null;
+#else
+ private $field.type.fullyQualifiedName $field.name;
+#end
#if ($field.date)
private final static java.text.DateFormat ${field.name}DateFormatter = new java.text.SimpleDateFormat("${field.dateFormat}");
#end
+
+
#if ($field.selectable)
private Object[] $field.valueListName;
private Object[] $field.labelListName;
@@ -149,6 +158,19 @@
{
return ${formBeanClassName}.${fieldName}DateFormatter;
}
+#elseif ($field.file)
+ public void ${field.setterName}(org.apache.struts.upload.FormFile $fieldName)
+ {
+ this.$fieldName = $fieldName;
+ }
+
+ /**
+$field.getDocumentation(" * ")
+ */
+ public org.apache.struts.upload.FormFile ${field.getterName}()
+ {
+ return this.$fieldName;
+ }
#else
public void ${field.setterName}($fieldType $fieldName)
{
@@ -163,7 +185,6 @@
return this.$fieldName;
}
#end
-
#if ($field.selectable)
#set ($hasSelectableField = true)
#set ($listType = "Object[]")
Index: cartridges/andromda-bpm4struts/src/templates/StrutsJSP.vm
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/templates/StrutsJSP.vm,v
retrieving revision 1.42
diff -u -r1.42 StrutsJSP.vm
--- cartridges/andromda-bpm4struts/src/templates/StrutsJSP.vm 17 Nov 2004 14:15:22 -0000 1.42
+++ cartridges/andromda-bpm4struts/src/templates/StrutsJSP.vm 18 Nov 2004 01:57:22 -0000
@@ -183,6 +183,12 @@
${indent} ${${linkName}}
${indent}</html:link>
##
+## F I L E
+##
+#elseif ($widgetType == 'file')
+${indent}<html:$widgetType name="$formBeanName" property="$fieldName" #if($hints)onmouseover="hints.show('$field.titleKey')" onmouseout="hints.hide()"#end></html:file>
+##
+##
## P L A I N T E X T
##
#else
Index: cartridges/andromda-bpm4struts/src/uml/BPM4StrutsMetafacadeModel.xml.zip
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-bpm4struts/src/uml/BPM4StrutsMetafacadeModel.xml.zip,v
retrieving revision 1.73
diff -u -r1.73 BPM4StrutsMetafacadeModel.xml.zip
Binary files /tmp/cvsG7jeFG and BPM4StrutsMetafacadeModel.xml.zip differ
Index: maven/andromdapp/plugin-resources/andromdapp/templates/j2ee-app/web/project.xml.vsl
===================================================================
RCS file: /cvsroot/andromda/maven/andromdapp/plugin-resources/andromdapp/templates/j2ee-app/web/project.xml.vsl,v
retrieving revision 1.6
diff -u -r1.6 project.xml.vsl
--- maven/andromdapp/plugin-resources/andromdapp/templates/j2ee-app/web/project.xml.vsl 13 Nov 2004 17:44:48 -0000 1.6
+++ maven/andromdapp/plugin-resources/andromdapp/templates/j2ee-app/web/project.xml.vsl 18 Nov 2004 11:50:46 -0000
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+ÃÂÂ<?xml version="1.0" encoding="UTF-8"?>
<project>
<extend>../project.xml</extend>
@@ -52,6 +52,14 @@
<war.bundle>true</war.bundle>
</properties>
</dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.0</version>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
<dependency>
<groupId>servletapi</groupId>
<artifactId>servletapi</artifactId>
Index: metafacades/uml/common/src/uml/UMLMetafacadeModel.xml.zip
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/common/src/uml/UMLMetafacadeModel.xml.zip,v
retrieving revision 1.90
diff -u -r1.90 UMLMetafacadeModel.xml.zip
Binary files /tmp/cvsYW8KVg and UMLMetafacadeModel.xml.zip differ
Index: metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/ClassifierFacadeLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/ClassifierFacadeLogicImpl.java,v
retrieving revision 1.40
diff -u -r1.40 ClassifierFacadeLogicImpl.java
--- metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/ClassifierFacadeLogicImpl.java 4 Nov 2004 21:43:38 -0000 1.40
+++ metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/ClassifierFacadeLogicImpl.java 17 Nov 2004 21:53:02 -0000
@@ -396,4 +396,12 @@
}
return javaNullString;
}
+
+ /* (non-Javadoc)
+ * @see org.andromda.metafacades.uml14.ClassifierFacadeLogic#handleIsFileType()
+ */
+ protected boolean handleIsFileType()
+ {
+ return UMLMetafacadeUtils.isType(this, UMLMetafacadeGlobals.FILE_TYPE_NAME);
+ }
}
\ No newline at end of file
Index: metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/UMLMetafacadeGlobals.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/UMLMetafacadeGlobals.java,v
retrieving revision 1.6
diff -u -r1.6 UMLMetafacadeGlobals.java
--- metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/UMLMetafacadeGlobals.java 14 Oct 2004 17:08:33 -0000 1.6
+++ metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/UMLMetafacadeGlobals.java 17 Nov 2004 21:53:36 -0000
@@ -41,5 +41,9 @@
* that will be identified as a booleon type must specialize this type.
*/
public static final String BOOLEAN_TYPE_NAME = "datatype.boolean";
-
+ /**
+ * Used to indentify a File type in the model, any other type
+ * that will be identified as a booleon type must specialize this type.
+ */
+ public static final String FILE_TYPE_NAME = "datatype.File";
}
\ No newline at end of file

-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://team.andromda.org:8080/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel

Reply via email to