【问题标题】:How to get CURRENT version label number through DFC code?如何通过 DFC 代码获取当前版本标签号?
【发布时间】:2018-12-30 11:37:28
【问题描述】:
public static IDfCollection getVersions() {
    IDfQuery query = clientX.getQuery();// obtain an idfObject
    query.setDQL(
            "select r_object_id,object_name,r_version_label,owner_name from dm_document(all) where i_chronicle_id='090008868006d5be'");
    IDfCollection collection = null;
    try {
        collection = query.execute(SessionFile.getSession(), IDfQuery.DF_READ_QUERY);
    } catch (DfException e) {
        e.printStackTrace();
    }
    return collection;

}

public class Versions {
public static void main(String[] args) {
    IDfCollection collection = AllOperations.getVersions();
    try {
        int versionsCount = collection.getValueCount("r_object_id");
        //IDfSysObject dfSysObject=(IDfSysObject) SessionFile.getSession().getObject(new DfId("09000886800a143e"));
        while (collection.next()) {
            //String versionNum = dfSysObject.getVersionLabels().getImplicitVersionLabel();
            int i = 0;
            while (i < versionsCount) {
                System.out.println(collection.getRepeatingValue("r_version_label", i));
                i++;
            }
        }
    } catch (DfException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

}

上述代码的输出是: 1.0, 1.1, 1.2, 当前

代替“当前”标签,我想“获取版本号”,例如 2.0 或 3.0 等,这是最新的文档版本号。

需要如下输出:

【问题讨论】:

    标签: version-control version ecm dfc documentum-dfc


    【解决方案1】:

    首先,这一行:

    int versionsCount = collection.getValueCount("r_object_id");
    

    应该是

    int versionsCount = collection.getValueCount("r_version_label");
    

    并且必须在 while(collection.next()) 循环中,这样它将正确地遍历所有 r_version_label 值,因此代码现在将输出:

    1.0
    1.1
    1.2 
    CURRENT
    2.0
    

    您现在可以摆脱 CURRENT(或者通常摆脱所有无法解析为浮点数的非值)。

    【讨论】:

    • 如果我在下面添加这个 int versionsCount = collection.getValueCount("r_version_label");我在线程“main”com.documentum.fc.client.impl.typeddata.MissingValueException 中收到此错误异常:属性“r_version_label”还没有值@KarolBe
    • 你必须把“while (collection.next())”下面的行移到
    • 谢谢它现在正在工作,如果你喜欢我的问题,请投票,谢谢@KarolBe
    猜你喜欢
    • 1970-01-01
    • 2023-03-29
    • 2011-04-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-28
    • 2018-07-01
    • 2017-03-17
    相关资源
    最近更新 更多