我一直在尝试在FileNet P8中获取VWAttachment的名称,MIME类型和内容。内容应该是字节数组或输入流。
更新:
String name = attachment.getAttachmentName();
给我VWAttachment
的名字。让我们通过查看文件扩展名来说我可以决定正确的MIME类型。我需要知道如何在InputStream
感谢任何帮助。谢谢!
答案 0 :(得分:4)
您需要使用VWAttachment对象中的信息从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();