[ https://issues.apache.org/jira/browse/CMIS-849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Florian Müller reassigned CMIS-849: ----------------------------------- Assignee: Florian Müller > 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)