Как получить имя, тип MIME и содержимое VWAttachment в Filenet P8?

Я пытался получить имя, тип MIME и содержимое VWAttachment в FileNet P8. Содержимое должно быть массивом байтов или входным потоком.

ОБНОВИТЬ:

String name = attachment.getAttachmentName();

Дает мне имя VWAttachment. И скажем, глядя на расширение файла, я могу определить правильный тип MIME. Мне нужно знать, как я могу получить содержимое вложения в InputStream

Любая помощь приветствуется. Спасибо!


person sin    schedule 21.03.2014    source источник


Ответы (1)


Вам нужно использовать информацию в объекте 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();
person Chris Aitchison    schedule 24.03.2014