<?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: Document query casting error? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313022#M23</link>
    <description>&lt;P&gt;My container document has several documents of different types. It appears the DocumentModelCollector returns a document model list. Which then returns each DocumentModel contained in the parent document. For some reason the DocumentModelCollector itself is being returned NOT each individual DocumentModel.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Apr 2012 00:20:54 GMT</pubDate>
    <dc:creator>karl_harris_</dc:creator>
    <dc:date>2012-04-04T00:20:54Z</dc:date>
    <item>
      <title>Document query casting error?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313019#M20</link>
      <description>&lt;P&gt;I've done the following query two ways:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Using parent/child in Studio.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Using NXQL query in Studio and get the same error. Here is the NXQL.&lt;/P&gt;
&lt;P&gt;SELECT * FROM Document WHERE ecm:isCheckedInVersion = 0 AND  ecm:parentId = '@{Context["TRAVELERID"]}' AND ecm:primaryType = '@{Context["NEXTRECIPEDOCTYPE"]}' AND ecm:currentLifeCycleState = '@{Context["NEXTRECIPESTARTSTATE"]}'&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;All of the context variables resolve correctly in both cases. I have used similar queries in content views with success.&lt;/P&gt;
&lt;P&gt;I get the following error:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;org.nuxeo.ecm.automation.core.collectors.DocumentModelCollector cannot be cast to org.nuxeo.ecm.core.api.DocumentModel
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I basically have a container document that has just made a state transition and I want to select one of the documents in the container. The query is trying to retrieve the "now active" document context so I can edit the  metadata.&lt;/P&gt;
&lt;P&gt;Any suggestions on what is wrong and how to troubleshoot this effort!?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2012 23:08:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313019#M20</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-03-30T23:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Document query casting error?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313020#M21</link>
      <description>&lt;P&gt;After digging a bit in the code it appears the public class OperationServiceImpl which  implements AutomationService returns a DocumentModelCollector rather than a DocumentModel which produces the error above.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2012 16:56:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313020#M21</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-04-03T16:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Document query casting error?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313021#M22</link>
      <description>&lt;P&gt;I also tried Get Children rather that Get Child and go the same error.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2012 17:00:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313021#M22</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-04-03T17:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Document query casting error?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313022#M23</link>
      <description>&lt;P&gt;My container document has several documents of different types. It appears the DocumentModelCollector returns a document model list. Which then returns each DocumentModel contained in the parent document. For some reason the DocumentModelCollector itself is being returned NOT each individual DocumentModel.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 00:20:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313022#M23</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-04-04T00:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Document query casting error?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313023#M24</link>
      <description>&lt;P&gt;I found the automation chain I was calling did not return a document this was by my design.  I was using Run Document Chain which expects a document or documents to be returned. Since nothing was returned (the end result of the called chain was a task being queued) the casting error was thrown.&lt;/P&gt;
&lt;P&gt;The Fix:&lt;/P&gt;
&lt;P&gt;Changing the the Automation command to Run Chain fixed the casting issue.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 22:27:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/document-query-casting-error/m-p/313023#M24</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-04-04T22:27:43Z</dc:date>
    </item>
  </channel>
</rss>

