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-849) Rendition.GetContentstream always returns null for QueryResults
Date Tue, 30 Sep 2014 11:08:34 GMT

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

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

The patch doesn't work in all cases because a repository doesn't need not provide property
IDs in query results. Then it is (nearly) impossible to find the object ID. Also if two objects
are JOINed this fails because the object ID is ambiguous.
I'll look into it.


> Rendition.GetContentstream always returns null for QueryResults
> ---------------------------------------------------------------
>
>                 Key: CMIS-849
>                 URL: https://issues.apache.org/jira/browse/CMIS-849
>             Project: Chemistry
>          Issue Type: Improvement
>          Components: dotcmis
>    Affects Versions: DotCMIS 0.6
>         Environment: DotCMIS 0.6 on .NET 3.5 / Windows 7 x64
> Alfresco 5.0.a on Ubuntu 12.0.4 LTS
>            Reporter: Pascal O.
>            Assignee: Florian Müller
>            Priority: Minor
>         Attachments: client-objects.diff
>
>
> How to reproduce:
> {code}
> var ctx = session.CreateOperationContext();
> ctx.RenditionFilterString = "cmis:thumbnail";
> // Assumption: the returned document has a thumbnail rendition, edit query to match situation
> var result = session.Query("select * from cmis:document", false, ctx).getPage(1).FirstOrDefault();
> var contentStream = result.Renditions[0].GetContentStream()
> {code}
> Expected: contentStream is an instance of a class that implements IContentStream
> Found: null
> ----
> Details: 
> The implementation of DotCMIS.Client.Impl.QueryResult.QueryResult constructor creates
all renditions with an id set to "null". This has probably been done because cmis:objectId
might not have been selected by the query:
> {code:title=client-object.cs:1581}
> Renditions.Add(of.ConvertRendition(null, rd));
> {code}
> Looking at the implementation of DotCMIS.Client.Impl.Rendition.GetContentStream() we
can see, that a null ID always leads to a null content stream. Thus, a query result will never
by able to get the content stream of the rendition:
> {code:title=client-object.cs:1513}
>         public IContentStream GetContentStream()
>         {
>             if (objectId == null || StreamId == null)
>             {
>                 return null;
>             }
> {code}
> Instead you will have to call session.getContentStream and select and input values appropriately
by hand, which I find is not very comfortable.
> I attached a patch that makes this work. Anyway this means, that the "query author" needs
to remember, that cmis:objectId must be selected by the query, otherwise he still gets null
- maybe this is the main reason why you chose to always go with null.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message