如何从工作项中检索文档对象 ID



我需要从从进程引擎检索的工作项中检索文档对象 id(内容引擎文档 id(。我们获取从内容引擎中提取相应文档所需的文档 ID。我已经创建了 PE 会话并使用队列查询检索了工作对象。我不知道如何继续。是否有任何可用的 api 代码?

我不是 100% 确定您要问什么,但工作项没有文档 ID。工作项的唯一标识符是"工作对象编号"。要检索它,您可以执行

VWQueueElement.getWorkObjectNumber()

如果要检索工作项附件的文档 ID,则情况有所不同。你可以通过以下方式检索它

String attachmentName; // Set to name of attachment property used in Workflow
VWQueueQuery results = queue.createQuery(indexName, firstValues, lastValues, queryFlags, queryFilter, substitutionVars, VWFetchType.FETCH_TYPE_QUEUE_ELEMENT);
if(results != null)
{
    while(results.hasNext())
    {
        VWQueueElement e = (VWQueueElement) results.next();
        VWAttachment attachment = (VWAttachment) e.fetchWorkObject(false, false).getDataField(attachmentName).getValue();
        System.out.println(attachment.getId()); // Version Series Id
        System.out.println(attachment.getLibraryName()); // ObjectStore Name 
        System.out.println(attachment.getAttachmentDescription()); // Document Id 
        System.out.println(attachment.getAttachmentName()); // Attachment Name
    }
}

使用以下方法从 vwattachment 的版本系列 id 中获取文档 ID。

VersionSeries versionSeries = (VersionSeries)objectStore.getObject("VERSIONSERIES", "versionseriesid");    
Property pp= versionSeries.fetchProperty("CurrentVersion", null);
System.out.println(pp.getIdValue());
Document doc = Factory.Document.fetchInstance(objectStore, pp.getIdValue(),null );
System.out.println("document is "+doc.get_Name());

您可以从版本系列中获取文档的当前版本并获取该文档的 ID。

vs = Factory.VersionSeries.fetchInstance(objectStore, attachment.getId(), pf);
Id iDoc = ((Containable) vs.get_CurrentVersion()).get_Id();

最新更新