0

我想知道 Alfresco 中“Company Home”目录下的所有文件夹名称,但出现错误。

代码 -

ItemIterable<QueryResult> results = session.query("SELECT * FROM cmis:folder where IN_TREE('/Company Home')", false);
try {
    for (QueryResult result : results) {
        folderId = result.getPropertyValueById(PropertyIds.OBJECT_ID);
        Folder folder = (Folder) session.getObject(folderId);
        System.out.println("Folder Name " + folder.getName());
    }
} catch(Exception e) {
    e.printStackTrace();
}

错误 -

org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: 00270668 Request failed 500 /solr/alfresco/cmis?wt=json&amp;fl=DBID%2Cscore&amp;rows=100&amp;df=TEXT&amp;start=0&amp;locale=en_US&amp;fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&amp;fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:452)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:570)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:142)
    at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:567)
    at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
    at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(CollectionIterator.java:48)
    at main.java.org.apache.chemistry.opencmis.doc.QueryTest.folderName(QueryTest.java:180)
4

2 回答 2

3

IN_TREE 采用对象 id,而不是对象路径。如果您提供“公司主页”文件夹的 ID,则此查询应该有效。

于 2013-01-28T08:13:36.920 回答
1

Company Home 是根文件夹,我建议您使用以下内容:

    Session session = createSession();

    Folder rootFolder = session.getRootFolder();

    ItemIterable<CmisObject> children = rootFolder.getChildren();

    for (CmisObject child : children) {

        System.out.println(child.getName());

    }
于 2013-01-28T07:58:23.037 回答