Filenet从store存储和获取对象-Java Step处理器

Filenet从store存储和获取对象-Java Step处理器,java,filenet,filenet-process-engine,Java,Filenet,Filenet Process Engine,我正在实现Filenet Java Step处理器。我必须从对象存储中获取一个文档,moddify并将修改后的版本存储到同一个对象存储中。我有一个可用于测试的小程序。我不能要求用户提供额外的发送登录名和密码,我必须使用VWSession对象。我必须得到的文件作为步骤附件发送。我知道如何获取附加文档ID。如何使用VWSession对象作为对象存储的连接点从Java Step Processor按ID获取文档?获取用户凭据并不困难。在stepprocessor java模块中,只需执行以下操作: S

我正在实现Filenet Java Step处理器。我必须从对象存储中获取一个文档,moddify并将修改后的版本存储到同一个对象存储中。我有一个可用于测试的小程序。我不能要求用户提供额外的发送登录名和密码,我必须使用
VWSession
对象。我必须得到的文件作为步骤附件发送。我知道如何获取附加文档ID。如何使用
VWSession
对象作为对象存储的连接点从Java Step Processor按ID获取文档?

获取用户凭据并不困难。在stepprocessor java模块中,只需执行以下操作:

String userName = controller.getDataStore().getServerCredentials().getUserId();
String userPwd = controller.getDataStore().getServerCredentials().getPassword();
对于获取文档,您的意思是,通常您不会通过VWConnection获取文档,而是通过内容引擎连接获取文档

通过ID获取您的文档:

Factory.Document.fetchInstance(objectStore, guid, null);

希望它能帮助

获取ObjectStore实例(从VWSession获取domainId,并使用VWSession的连接构造域),并将附件传递给以下方法:

private String getIdFromAttachment(VWAttachment att, ObjectStore os) {
    if (att.getLibraryType() != 3) {
        String libtype = String.valueOf(att.getLibraryType());
        throw new VWException("hk.ibm.ecm.cpa.uwfcustomcomponent.InvalidLibraryType",
                "Cannot convert object from non-CE repository, type {0}.", libtype);
    }

    String attId = att.getId();
    switch (att.getType()) {
    case 3:
    case 4:
        VersionSeries vs = (VersionSeries) os.getObject("VersionSeries", attId);
        vs.refresh();
        String ver = att.getVersion();
        return getIdBasedOnVersion(vs, ver);
    default:
        return attId;
    }
}

private String getIdBasedOnVersion(VersionSeries vs, String ver) {
    if (ver == null) {
        Document current = (Document) vs.get_CurrentVersion();
        current.refresh();
        return current.get_Id().toString();
    } else if ("-1".equals(ver)) {
        Document released = (Document) vs.get_ReleasedVersion();
        released.refresh();
        return released.get_Id().toString();
    } else {
        return ver;
    }
}