使用 OpenCMIS 获取 Alfresco 扩展属性

发布于 2024-09-05 12:18:05 字数 1756 浏览 7 评论 0原文

我正在编写一个基于 OpenCMIS 的应用程序,它从 Alfresco 3.3 中提取一些数据。

它可以与标准 CMIS 属性配合使用,例如cmis:namecmis:contentStreamMimeType;但是,我无法访问 Alfresco 特定属性,这些属性作为“Alfresco 扩展”出现在 CMIS AtomPub 提要上:

<cmisra:object>
  <cmis:properties>
    <cmis:propertyString propertyDefinitionId="cmis:name" displayName="Name" queryName="cmis:name">
      <cmis:value>test document</cmis:value>
    </cmis:propertyString>
    <cmis:propertyString propertyDefinitionId="cmis:contentStreamMimeType" displayName="Content Stream MIME Type" queryName="cmis:contentStreamMimeType">
      <cmis:value>text/html</cmis:value>
    </cmis:propertyString>
    ...
    <alf:aspects>
      ...
      <alf:properties>
        <cmis:propertyString propertyDefinitionId="cm:description" displayName="Description" queryName="cm:description">
          <cmis:value>This is just a test document</cmis:value>
        </cmis:propertyString>
      </alf:properties>
    </alf:aspects>
  </cmis:properties>
</cmisra:object>

有没有什么方法可以使用 OpenCMIS 获取 cm:descripcion 的值?

我的猜测是,我需要使用 DocumentType 接口而不是 Document,然后调用其 getExtensions() 方法。但我不知道如何获取 DocumentType 的实例。

任何帮助将不胜感激。

问候


编辑:虽然 Florian 的答案已经为我解决了,但我刚刚意识到我也可以使用 CMIS SQL 获取这些属性的值:

select d.*, t.*, a.*
from   cmis:document d
join   cm:titled t on d.cmis:objectid = t.cmis:objectid
join   cm:author a on d.cmis:objectid = a.cmis:objectid
where  t.cm:description like ...

I'm writing an OpenCMIS based application, which extracts some data from Alfresco 3.3.

It works fine with standard CMIS properties such as cmis:name or cmis:contentStreamMimeType; however, I can't access Alfresco especific properties, which are present on the CMIS AtomPub feed as "Alfresco extensions":

<cmisra:object>
  <cmis:properties>
    <cmis:propertyString propertyDefinitionId="cmis:name" displayName="Name" queryName="cmis:name">
      <cmis:value>test document</cmis:value>
    </cmis:propertyString>
    <cmis:propertyString propertyDefinitionId="cmis:contentStreamMimeType" displayName="Content Stream MIME Type" queryName="cmis:contentStreamMimeType">
      <cmis:value>text/html</cmis:value>
    </cmis:propertyString>
    ...
    <alf:aspects>
      ...
      <alf:properties>
        <cmis:propertyString propertyDefinitionId="cm:description" displayName="Description" queryName="cm:description">
          <cmis:value>This is just a test document</cmis:value>
        </cmis:propertyString>
      </alf:properties>
    </alf:aspects>
  </cmis:properties>
</cmisra:object>

Is there any way in which I can get the value of cm:descripcion, with OpenCMIS?

My guess is that I need to use the DocumentType interface instead of Document, and then call its getExtensions() method. But I don't know how to get an instance of DocumentType.

Any help would be really appreciated.

Regards


Edit: altough Florian's answer already worked out for me, I've just realized that I can get these properties' values with CMIS SQL, too:

select d.*, t.*, a.*
from   cmis:document d
join   cm:titled t on d.cmis:objectid = t.cmis:objectid
join   cm:author a on d.cmis:objectid = a.cmis:objectid
where  t.cm:description like ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心的憧憬 2024-09-12 12:18:08

恐怕 OpenCMIS 高级 API 还无法访问所有扩展。它在我们的待办事项清单上。目前,您必须使用低级 API。
像这样的东西应该有效:

ObjectData doc = session.getBinding().getObjectService().getObject(...);
org.w3c.dom.Node domNode = (org.w3c.dom.Node) doc.getProperties().getExtensions().get(0); // <alf:aspects>
domNode.getFirstChild() ... 

I'm afraid the OpenCMIS high-level API cannot access all extensions yet. It's on our to-do list. For now, you have to use the low-level API.
Something like this should work:

ObjectData doc = session.getBinding().getObjectService().getObject(...);
org.w3c.dom.Node domNode = (org.w3c.dom.Node) doc.getProperties().getExtensions().get(0); // <alf:aspects>
domNode.getFirstChild() ... 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文