chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CMIS-639) AtomPub: Query result entries are missing the <atom:content> element
Date Mon, 18 Mar 2013 14:14:15 GMT

    [ https://issues.apache.org/jira/browse/CMIS-639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13605144#comment-13605144
] 

Florian Müller commented on CMIS-639:
-------------------------------------

Section 3.4.1.3.6 defines the content tag for uploads. Therefore it is irrelevant for queries.
Section 3.5.2 defines that a content tag SHOULD be present if an Atom entry represents a document.
Query results never represent documents, but pseudo CMIS objects (see section 2.1.10.1.3).
These pseudo objects don't have content and therefore there is no content tag.

                
> AtomPub: Query result entries are missing the <atom:content> element
> --------------------------------------------------------------------
>
>                 Key: CMIS-639
>                 URL: https://issues.apache.org/jira/browse/CMIS-639
>             Project: Chemistry
>          Issue Type: Bug
>          Components: opencmis-server
>    Affects Versions: OpenCMIS 0.8.0
>            Reporter: Stefan Kopf
>
> Acording to CMIS spec, the <atom:content> element is required in every <atom:entry>
element. See Sections 3.5.2 and 3.4.1.3.6.
> The <atom:content> element is present in every <atom:entry> returned for
getChildren in the NavigationService or for getObject in the ObjectService.
> For some reason, the method writeQueryResultEntry in the ...atompub.DiscoveryService
does not make use of AtomPubUtils.writeObjectEntry but assembles the result itself. But in
this process, the <atom:content> element is missing.
> This problem can be fixed as follows in org.apache.chemistry.opencmis.server.impl.atompub.DiscoveryService:
> {code:java}
>     private static void writeQueryResultEntry(AtomEntry entry, ObjectData result, String
id, GregorianCalendar now, UrlBuilder baseUrl)
>             throws Exception {
>         CmisObjectType resultJaxb = convert(result);
>         if (resultJaxb == null) {
>             return;
>         }
>         // start
>         entry.startEntry(false);
>         // write Atom base tags
>         entry.writeAuthor("");
>         entry.writeId(entry.generateAtomId(id));
>         entry.writePublished(now);
>         entry.writeTitle("Query Result " + id);
>         entry.writeUpdated(now);
>         
>         // BUGFIX start
>         String fileName = getStringProperty(result, PropertyIds.CONTENT_STREAM_FILE_NAME);
>         String mimeType = getStringProperty(result, PropertyIds.CONTENT_STREAM_MIME_TYPE);
>         String streamId = getIdProperty(result, PropertyIds.CONTENT_STREAM_ID);
>         BigInteger length = getIntegerProperty(result, PropertyIds.CONTENT_STREAM_LENGTH);
>         boolean hasContent = fileName != null || mimeType != null || streamId != null
|| length != null;
>         String contentSrc = null;
>         if (hasContent) {
>             UrlBuilder contentSrcBuilder = compileUrlBuilder(baseUrl, AtomPubUtils.RESOURCE_CONTENT,
result.getId());
>             if (fileName != null) {
>                 contentSrcBuilder.addPathSegment(fileName);
>             }
>             contentSrc = contentSrcBuilder.toString();
>         }
>         entry.writeContent(contentSrc, mimeType);
>         // BUGFIX end
>         // write query result object
>         JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createObject(resultJaxb),
entry.getWriter(), true);
>         // we are done
>         entry.endEntry();
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message