protected int doTask(IDfWorkitem workitem, IDfProperties activityParameters,PrintWriter printWriter) throws Exception
{
/*Read the activity parameters */
1 String requestPackage =
activityParameters.getString(REQUEST_PACKAGE);
String outputPackage =
activityParameters.getString(OUTPUT_PACKAGE);
String extension =
activityParameters.getString(OUTPUT_FILE_EXTENSION);
IDfId xslDocID = activityParameters.getID(XSL_FILE_ID);
File xsl = null;
File xml = null;
File result = null;
try {
/* Read the content of the XML and XSL files */
2 xml = getContent(requestPackage);
3 xsl = OperationsHelper.exportDocument(workitem.getsession().xslDocId);
result = File.createTempFile("xslresults", "." +
(extension != null ? extension: "xml"));
/* Invoke the XSL Tranformer to create new content */
4 transform(new FileReader(xsl), new FileReader(xml),
new FileReader(result));
/*Attach the newly created content to the workflow */
5 if (outputPackage != null)
setContent(outputPackage, result, null);
/* Updating process variables, i.e sdt. For more info on IDfWorkitemEx,
refer to java doc corresponding to com.documentum.bpm.IDfWorkitemEx*/
if (workitem instanceof IDfWorkitemEx) {
IDfWorkitemEx workitemEx = (IDfWorkitemEx) workitem;
Object var0 = workitemEx.getPrimitiveVariableValue("Var0");
//Some useful operation with var0
workitemEx.setPrimitiveObjectValue("Var0", var0);
6 return 0;
}
7 finally {
if (xsl != null)
xsl.delete();
if (result != null)
result.delete();
}
}