在Documentation 上搜索,没有关于它的示例,只是针对特定路径的代码的 sn-p。
像这样:
获取子路径的父文件夹:
String childFolderPath = "/Loans/MyLoans";
Folder currentFolder = Factory.Folder.fetchInstance(os, childFolderPath, null);
Folder parent = currentFolder.get_Parent();
获取路径中直接包含的文件夹
String folderPath = "/Loans";
Folder currentFolder = Factory.Folder.fetchInstance(os, folderPath, null);
FolderSet childFolders = currentFolder.get_SubFolders();
顺便说一句,通过 FEM 进行研究,很容易构建一个只寻址部分名称的 sql。像这样:
SELECT * FROM [Folder] WHERE ([FolderName] like '%Folder1a%')
与自定义元数据类似:
SELECT * FROM [YourFolderSubType] WHERE ([YourCustomAttribute] = 'yourValue')
然后,访问属性PathName 会为您提供完整的路径。或者,您也可以只检索它的 ID 以便从中获取 Folder 对象。
您可以尝试从 API 执行类似的查询,然后将每个结果转换为 Folder 对象以便对其进行处理。
一个例子(未经测试):
SearchSQL sqlObject = new SearchSQL(sqlStatement);
RepositoryRowSet rowSet = searchScope.fetchRows(sqlObject, null, null, new Boolean(true));
Iterator iter = myRows.iterator();
while (iter.hasNext()) {
RepositoryRow row = (RepositoryRow) iter.next();
row.getProperties().getStringValue("ID");
com.filenet.api.core.Folder folder = Factory.Folder.fetchInstance(os, id, null);
}
希望这会有所帮助。