in a workflow I need to write the content of an attached document to a file in the filesystem. I did this by obtaining the content as a string with the ce_operation getContent(), and then writing the string in a java custom work performer to the filesystem.
Unfortunately, as I had to realize, this doesn't work with e.g. pdf or excel files.
So I thought I would probably have to read the content of the document from the InputStream returned by Document.accessContentStream(). But for this I first need to somehow pass the Document to my java code. The class VWAttachment is an allowed component operation parameter type. But from the javadoc of this class I don't see how I can get to the target of the attachment; there is nothing like "getTarget()" or alike.
So I am again pretty lost. I couldn't find anything in the installed filenet help and Google failed me, too.
Can anybody tell me, what the recommended way is of writing binary content from a filenet document to the filesystem?
Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Pinned topic writing binary content of a document to the filesystem
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2011-09-15T16:38:32Z at 2011-09-15T16:38:32Z by kr42
drdamour 0600029F9D15 Posts
Re: writing binary content of a document to the filesystem2011-09-14T17:54:41ZThis is the accepted answer. This is the accepted answer.yeah the PE and CE API's aren't really "compatible" as you would think. a Vwattachment is just a pointer to content, and there's no way to follow the pointer OOTB.
We just have a static method that takes a VWAttachment and returns a CE object reference to fix this limitation. In a component manager your JAAS credentials should be established adn you can get the CE connection from the filenet.pe.bootstrap.ceuri system property. The VWAttachment's getLibraryName method will give you the object store to access, then based on the type (doc, folder, custom object) you can perform the appropriate fetch operation using the id returned from the getId method.
Then you have the CE reference and can access the content stream.
Too bad java doesn't have extension methods, this is a great candidate for an extension method on the VWAttachment class, wouldn't it?
TL;DR: You need to establish a CE connection yourself and query yourself
I am Just a new Boy,
A Stranger in this Town,
Where are All the Good Times,
Who's Gonna Show this Stranger Around?