8 Replies Latest reply on Jan 22, 2009 5:55 AM by smjain

    upload file in a task ?

    secmask

      hi all !
      i have trouble when try to modify jbpm-console and task form define.
      at first, i want to upload a file at a task and it' will show at the next task, i've searched this forum and many many in the google but not found any solution that can use.

      all of my work as follow:
      1- modify task.xhtml of jbpm-console, add attribute 'enctype="multipart/form-data".
      2- in task form, add a file filed input as :

      <jbpm:datacell>
       <f:facet name="header">
       <h:outputText value="File:"/>
       </f:facet>
       <gd:inputFile target="#{stream}" maxSize="104857600"/>
       </jbpm:datacell>
       <jbpm:datacell>
       <f:facet name="header">
       <h:outputText value="Actions:"/>
       </f:facet>
       <tf:saveButton value="Save">
       </tf:saveButton>
       <h:commandButton value="upload">
       <j4j:doUploadFile archive="#{stream}" target="link" />
       <n:nav outcome="success" redirect="true" storeMessages="true"/>
       <n:nav outcome="error" redirect="true" storeMessages="true"/>
       </h:commandButton>
       </jbpm:datacell>
      


      <j4j:doUploadFile archive="#{stream}" target="link" /> is my custom tag, it's similar to <j4j:deployProcess>

      the problem that when i use "Save" button, it's only save other user input to process variables, upload file action listener is not called. Use "upload" button will only upload the file (it's good) but it does not save process variables. I want it do both of work (save process variables and upload the file) but don't know how to do it. i've try

       <tf:saveButton value="Save">
       <j4j:doUploadFile archive="#{stream}" target="link" />
       <n:nav outcome="success" redirect="true" storeMessages="true"/>
       <n:nav outcome="error" redirect="true" storeMessages="true"/>
       </tf:saveButton>
      


      but is raise an exception (UITaskFormButtonBase:getEnclosingForm() catch NULL).

      please help me ! any suggest.
      thank very much.

        • 1. Re: upload file in a task ?
          secmask

          please !!!

          • 2. Re: upload file in a task ?
            kukeltje

            you are welcome

            • 3. Re: upload file in a task ?
              secmask

              oh, help me, kuke !
              I've looked at some topic link this, but it's not help very much!
              hum??????

              • 4. Re: upload file in a task ?
                jalamos

                I have the same problem,...Someone knows about this issue??,,

                secmask = where you create your custom tag <j4j?



                thank!..

                • 5. Re: upload file in a task ?
                  johnnyright

                  Hi all

                  I have the same problem!, what about this post? any solution please, I need to attach a file to a process

                  secmask please answer,

                  thanks

                  • 6. Re: upload file in a task ?
                    kukeltje

                    jsf4jbpm was, afaik, developed without much guidence from the community (neutral statement, no positive or negative judgement). There are only 10 types of people that understand jbpm4jsf. Those who do and those who don't. Most of us don't and it is advised *NOT* to use jbpm4jsf to develop applications or extending the console. Use e.g. seam with richfaces.

                    • 7. Re: upload file in a task ?
                      vtysh

                      You shouldn't put action command to the tf:saveButton directly because all jbpm form actions described directly in the j4j:taskForm tag in the JBPM console application.
                      To upload files in the task variable map you should to have own tag and use it inside standard action components commandButton or commandLink in your task form. For example:

                      <gd:inputFile target="#{stream}"/>
                      <h:commandLink value="upload">
                       <customnamespace:addFile dataStream="#{stream}" target="#{var['file']}"/>
                      </h:commandLink>
                      

                      To avoid variable map reload you should to specify some context variable value during upload action and check it on variable map loading action. If variable is set then do not reaload variable map.
                      Replace the line in the task.xhtml
                      <j4j:getVariableMap target="#{taskVariableMap}" value="#{task}"/>
                      

                      with the next
                      <j4j:getVariableMap target="#{taskVariableMap}" value="#{task}" unless="#{yourCustomVariableWhichIndicatesFileUpload}"/>
                      

                      And of course do not forget to change form enctype to multipart.
                      Hope it will help to everybody searching the JBPM console file uploading solution for task

                      • 8. Re: upload file in a task ?
                        smjain

                        I am unable to do an upload in jbpm task form..
                        Tried to integrate rich faces as you had suggested. If i put the rich faces jar in the jbpm-console.war file the war is not getting deployed
                        If I dont do it the rich tag is itself not found..
                        Please help
                        Shashank