我一直试图在FileNet P8中获得vwatattachment的名称,MIME类型和内容。内容应该是字节数组或输入流。
更新: String name = attachment.getAttachmentName();
给出VWAttachment
的名称。假设通过查看文件扩展名,我可以决定适当的MIME类型。我需要知道如何在一个InputStream
任何帮助都是感激的。谢谢!
您需要使用vwatattachment对象中的信息从Content Engine获取正确的文档。
例如:com.filenet.api.core.Domain domain = (...you need to get this);
VWAttachment vwAttachment = (...you already have this);
ObjectStore objectStore = Factory.ObjectStore.getInstance(domain, vwAttachment.getLibraryName());
VersionSeries vs = Factory.VersionSeries.fetchInstance(objectStore, new Id( vwAttachment.getId()), null);
Document document = (Document) vs.get_CurrentVersion();
ContentTransfer contentTransfer = (ContentTransfer) document.get_ContentElements().get(0);
InputStream inputStream = contentTransfer.accessContentStream();