cancel
Showing results for 
Search instead for 
Did you mean: 

Attachments in activiti forms

ivan_hajdinjak
Champ in-the-making
Champ in-the-making
Greetings,

i'm interested in transfering/sending attachments through forms in activiti. For example, First assignee uploads attachment (doc,pdf,jpeg…)and send it to second assignee. How is this possible to develop ? Do i need to have a repository (Alfresco DMS) to put this attachments and downloaa them on other form through the link which represents document or there is some other solution ?

True regards,
Ivan Hajdinjak
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
If you are using 5.4, look into attachments on the taskservice.

Writing a form that can handle it, is a matter of extening the form properties defined in your process (if you want the same with the .form approach, it'll be much harder)

ivan_hajdinjak
Champ in-the-making
Champ in-the-making
How do I connect Java class with .form Form ? I tried with JSP way of connecting .form with random java class, but i can't access that event in debbuger. The html code is:

<%@ page import="upload.execute" %>

<jsp:useBean id="mybean" scope="page" class="upload.execute" />
<h1>Expense refund</h1>
<p>Please fill in the following fields as detailed as possible, as this will speed up the handling of your request.</p>
<table>
<tr>
  <label>
  <td>Employee name:</td>
  <td><input type='text' name='Employeename' value='' />
  <input type='hidden' name='Employeename_required' value='true' </td>
  </label>
</tr>
<tr>
  <label>
  <td>Amount:</td>
  <td><input type='number' name='Amount' value='' <input type='hidden' name='Amount_type' value='Integer' <input type='hidden' name='Amount_required' value='true' </td>
  </label>
</tr>
<tr>
  <label><td>Motivation:</td>
  <td><input type='text' name='Motivation' value='' /></td>
  </label>
</tr>
<tr>
  <label><td>Upload:</td>
  <td><input class="button" type="file" name="filedata" id="filedata"/>
        </td>
  </label>
</tr>
</table>


and the java class is

import java.util.HashMap;
import java.util.Map;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.apache.chemistry.opencmis.client.api.Session;
import org.apache.chemistry.opencmis.client.api.SessionFactory;
import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
import org.apache.chemistry.opencmis.commons.SessionParameter;
import org.apache.chemistry.opencmis.commons.enums.BindingType;


public class upload implements JavaDelegate{

@Override
public void execute(DelegateExecution execution) throws Exception {
 
  System.out.println("ušlo u metodu upload.execute");
  // default factory implementation
  SessionFactory factory = SessionFactoryImpl.newInstance();
  Map<String, String> parameter = new HashMap<String, String>();

  // user credentials
  parameter.put(SessionParameter.USER, "admin");
  parameter.put(SessionParameter.PASSWORD, "MCop92");

  // connection settings
  parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8090/cmis/atom");
  parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
  parameter.put(SessionParameter.REPOSITORY_ID, "http://localhost:8090/alfresco/service/cmis/index.html");

  // create session
  Session session = factory.createSession(parameter);
 
}

}

The component that I use in bpmn 2.0 is UserTask..

Thanks in advance !!!

jbarrez
Star Contributor
Star Contributor