<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Convert currentDocumentIncomingRelations into DocumentModel in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/convert-currentdocumentincomingrelations-into-documentmodel/m-p/325695#M12696</link>
    <description>&lt;P&gt;This works fine.&lt;/P&gt;
&lt;P&gt;Thank you very much for your answer.&lt;/P&gt;</description>
    <pubDate>Wed, 23 May 2012 09:37:40 GMT</pubDate>
    <dc:creator>fabrice_</dc:creator>
    <dc:date>2012-05-23T09:37:40Z</dc:date>
    <item>
      <title>Convert currentDocumentIncomingRelations into DocumentModel</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/convert-currentdocumentincomingrelations-into-documentmodel/m-p/325693#M12694</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I've created a new type of document in Studio to store a set of pictures. To store these pictures I simply create relations between my documents and the pictures. I'd like to display the thumbnails of the pictures referenced but I don't know how to pass the variable.&lt;/P&gt;
&lt;P&gt;Here's what I tried :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;h:dataTable var="statement"
    value="#{currentDocumentIncomingRelations}"
    styleClass="dataOutput"
    rowClasses="dataRowEven, dataRowOdd"
    columnClasses="relationPredicateColumn, relationObjectColumn, relationCommentColumn, relationCommentColumn, relationCommentColumn, relationActionsColumn"&amp;gt;
    
    &amp;lt;h:column&amp;gt;
    	&amp;lt;f:facet name="thumbnail"&amp;gt;
        	&amp;lt;h:outputText value="image" /&amp;gt;
		&amp;lt;/f:facet&amp;gt;
        &amp;lt;h:graphicImage
			value="#{nxd:fileUrl('downloadPicture', statement , 'Thumbnail:content', currentDocument.dublincore.modified)}" /&amp;gt;
	&amp;lt;/h:column&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course I get an error&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Cannot convert org.nuxeo.ecm.platform.relations.web.StatementInfoImpl@a23ec4 of type class org.nuxeo.ecm.platform.relations.web.StatementInfoImpl to interface org.nuxeo.ecm.core.api.DocumentModel
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you know how I could display the thumbnails of the pictures relations ?&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;Fabrice&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2012 16:52:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/convert-currentdocumentincomingrelations-into-documentmodel/m-p/325693#M12694</guid>
      <dc:creator>fabrice_</dc:creator>
      <dc:date>2012-05-22T16:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Convert currentDocumentIncomingRelations into DocumentModel</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/convert-currentdocumentincomingrelations-into-documentmodel/m-p/325694#M12695</link>
      <description>&lt;P&gt;The "statement" variable represents the relation. As you're displaying incoming relations, you probably want to use the statement subject instead of its object (that should be a representation of the current document). So you can try something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;h:graphicImage value="#{nxd:fileUrl('downloadPicture', statement.subjectInfo.documentModel, 'Thumbnail:content', 'image title here')}" /&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Be careful if you also display outgoing relations: the statement object might not represent a document (as relations can also point to a literal, or an URI that does not represent a document). There is API on the node to check for that, there is also another API to check that the document can be accessed by the current user.&lt;/P&gt;
&lt;P&gt;Also note that the JSF function nxd:fileUrl is waiting for the image title as a last argument, so using a date with expression currentDocument.dc.modified is not a good idea.&lt;/P&gt;
&lt;P&gt;Taking example on default templates displaying relations might help, see &lt;A href="https://github.com/nuxeo/nuxeo-features/blob/release-5.5/nuxeo-platform-relations/nuxeo-platform-relations-web/src/main/resources/web/nuxeo.war/incl/tabs/document_relations.xhtml"&gt;https://github.com/nuxeo/nuxeo-features/blob/release-5.5/nuxeo-platform-relations/nuxeo-platform-relations-web/src/main/resources/web/nuxeo.war/incl/tabs/document_relations.xhtml&lt;/A&gt; and also &lt;A href="https://github.com/nuxeo/nuxeo-features/blob/release-5.5/nuxeo-platform-relations/nuxeo-platform-relations-web/src/main/resources/web/nuxeo.war/relation_node_template.xhtml"&gt;https://github.com/nuxeo/nuxeo-features/blob/release-5.5/nuxeo-platform-relations/nuxeo-platform-relations-web/src/main/resources/web/nuxeo.war/relation_node_template.xhtml&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2012 00:16:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/convert-currentdocumentincomingrelations-into-documentmodel/m-p/325694#M12695</guid>
      <dc:creator>Anahide_Tchertc</dc:creator>
      <dc:date>2012-05-23T00:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Convert currentDocumentIncomingRelations into DocumentModel</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/convert-currentdocumentincomingrelations-into-documentmodel/m-p/325695#M12696</link>
      <description>&lt;P&gt;This works fine.&lt;/P&gt;
&lt;P&gt;Thank you very much for your answer.&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2012 09:37:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/convert-currentdocumentincomingrelations-into-documentmodel/m-p/325695#M12696</guid>
      <dc:creator>fabrice_</dc:creator>
      <dc:date>2012-05-23T09:37:40Z</dc:date>
    </item>
  </channel>
</rss>

