Hello.
I'm designing a process whose input document is a doc which contains a couple of attach (and an XML portion of data); during the life of the process, I use the AssignTask service to render a form in workspace and allow a "backend" user to complete the form.
Such user can also add notes and attachments.
I programmed the AssignTask as to output attachments in a list named "doclist".
As soon as the backend user confirms the form, I created a Script in executeScript whose role is to prepare a DDX string as to produce a new document with attachs; in the code I iterate the list as to get:
. the attachname using doc.getAttribute("wsfilename");
. the mime-type using doc.getContentType();
The former does work (I'm able to see the name of the attachs/notes) but the getContentType always returns NULL.
I see that Xpath does offer the getDocContentType but I'm trying to avoid having too much processes and I think getContentType() should give the same results.
This is the piece of code I'm writing:
=== cut here === 8< ===
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
import com.adobe.idp.Document;
List docList = patExecContext.getProcessDataListValue("/process_data/doclist");
Map attachMap = new HashMap();
Iterator it = docList.iterator();
String ddx = "<?xml version='1.0' encoding='UTF-8'?>";
ddx += "<DDX xmlns='http://ns.adobe.com/DDX/1.0/'>";
ddx += "<PDF result='doc_out.pdf'>";
while (it.hasNext()) {
Document attDoc = (Document) it.next();
String name = (String) attDoc.getAttribute("wsfilename");
System.out.println("Aggiungo alla lista "+name);
String mtype = (String)attDoc.getContentType();
if (mtype != null && mtype.length() == 0) {
mtype="application/octet-stream";
}
System.out.println("Mime type: "+mtype);
attachMap.put(name,attDoc);
ddx += "<FileAttachments source='"+name+"' namekey='*'>";
ddx += "<File filename='"+name+"' mimetype='"+mtype+"' />";
ddx +="</FileAttachments>";
}
ddx += "<PDF source='docesaminato' />";
ddx += "</PDF>";
ddx += "</DDX>";
patExecContext.setProcessDataMapValue("/process_data/attach_map",attac hMap);
patExecContext.setProcessDataStringValue("/process_data/ddx_string",d dx);
=== cut here === 8< ===
What am I missing?
I'm still learning LCES so please be patient... :-)
Thanks,
Rob