计算在 Documentum 中更新了多少个对象

count how many objects have been updated in Documentum

我正在做一个连接到 Documentum 数据存储的项目。我正在尝试使用以下函数更新分配给文件夹子文件夹的所有 acl 名称:

try {
        StringBuilder str = new StringBuilder();
        str.append(dirDestination);
        str.append("/");
        str.append(companyName);

        String query = "update dm_folder object set acl_name = '@acl_name' , set acl_domain ='@acl_domain' where folder ('@acl_dirPath',descend)";
        query = query.replace("@acl_name",newAclName);
        query = query.replace("@acl_domain",inheritedAclDomain );
        query = query.replace("@acl_dirPath",str.toString() );



        IDfQuery ACLQuery = new DfQuery();
        ACLQuery.setDQL(query);
        ACLQuery.execute(_session, IDfQuery.DF_EXEC_QUERY);
        log.info("All the sub folders have received the new ACL.");

}catch(Exception E){
    System.out.println(E.getLocalizedMessage());
}

该函数工作得很好,但我想知道有多少文件夹由于使用这些代码行而被更新。 一种方法是使用 IDfCollections ,它似乎不适用于此 DQL,因为我已经编写了以下内容并且我不断得到 1 :

try{
    StringBuilder path = new StringBuilder();
    path.append(dirDestination);
    path.append("/" + companyName);
    String query = "update dm_folder object set acl_name = '@newAclName' , set acl_domain ='@newAclDomain' where folder ('@aclPath',descend)";
    query = query.replace("@newAclName" , newAclName );
    query = query.replace("@newAclDomain" , inheritedAclDomain );
    query = query.replace("@aclPath" , path );
    IDfQuery ACLQuery = new DfQuery();
    ACLQuery.setDQL(query);
    IDfCollection count = ACLQuery.execute(_session, IDfQuery.DF_EXEC_QUERY);
    int counter = 0 ;
    while (count.next()){
        counter++ ;

    }
    System.out.println("counter for sub folders ==> " + counter);
     log.info("The ACl name for all the sub folders are updated .");
}catch(Exception E ){
    System.out.println(E.getLocalizedMessage());
}

所以问题是我如何知道有多少对象的元数据已更新?另一种方法是根据对象的修改日期进行检查。但是还有其他更简单(更直接)的方法吗?

您只需要获取 objects_updated 而不是在 while 循环中增加变量:

IDfCollection count = ACLQuery.execute(_session, IDfQuery.DF_EXEC_QUERY);

int counter = 0 ;
if (count.next()) {
  counter   = count.getInt("objects_updated");
}

System.out.println("count of updated sub folders ==> " + counter   );