I am trying to implement a custom method that can be used with a business process. The method should be able to get the content of the object in the process package.
First, I overrode the doTask method of the WorkflowActivity class:
@Override
protected int doTask(IDfWorkitem workitem, IDfProperties activityProperties, PrintWriter printWriter)
throws Exception {
Then I get all the attachments associated with this activity:
IDfCollection attachmentCollection = workitem.getAttachments();
IDfDocument attachmentDoc = null;
I search the collection of attachments for the attachment I want, then cast it to IDfDocument:
while (attachmentCollection.next())
{
IDfWorkflowAttachment attachment = (IDfWorkflowAttachment)attachmentCollection;
IDfType attachmentType = attachment.getType();
if (attachmentType.getName().equals("dl_model"))
{
attachmentDoc = (IDfDocument)attachment;
}
}
Is this the correct approach? Or is there a better way?