<?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 How to get complex type list document ref of complex type list custom in java? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-get-complex-type-list-document-ref-of-complex-type-list/m-p/319217#M6218</link>
    <description>&lt;P&gt;Hi Guys!&lt;/P&gt;
&lt;P&gt;I have the next code:
Scheme:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;xs:element name="documentosRespuestaInterno" type="nxs:documentoRespuestaInternoListType"/&amp;gt;

&amp;lt;xs:complexType name="documentoRespuestaInternoListType"&amp;gt;    
	&amp;lt;xs:sequence&amp;gt;        
		&amp;lt;xs:element name="item" type="nxs:documentoRespuestaInternoType" minOccurs="0" maxOccurs="unbounded"/&amp;gt;    
	&amp;lt;/xs:sequence&amp;gt;
&amp;lt;/xs:complexType&amp;gt;

&amp;lt;xs:complexType name="documentoRespuestaInternoType"&amp;gt;    
	&amp;lt;xs:sequence&amp;gt;        
		&amp;lt;xs:element name="nombre" type="xs:string"/&amp;gt;        
		&amp;lt;xs:element name="docRespuestaInterno"&amp;gt;            
			&amp;lt;xs:simpleType&amp;gt;                
				&amp;lt;xs:list&amp;gt;                    
					&amp;lt;xs:simpleType&amp;gt;                        
						&amp;lt;xs:restriction base="xs:string" ref:resolver="documentResolver" ref:store="id"/&amp;gt;                    
					&amp;lt;/xs:simpleType&amp;gt;                
				&amp;lt;/xs:list&amp;gt;            
			&amp;lt;/xs:simpleType&amp;gt;        
		&amp;lt;/xs:element&amp;gt;    
	&amp;lt;/xs:sequence&amp;gt;
&amp;lt;/xs:complexType&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Java Class:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@OperationMethod(collector = DocumentModelCollector.class)
public DocumentModel run(DocumentRef docRef) throws Exception {    
DocumentModel doc = session.getDocument(docRef);    
	ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; referencias = (ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt;)
	doc.getPropertyValue("doc_base:documentosRespuestaInterno");    
	for (Map&amp;lt;String, Object&amp;gt; referencia : referencias) {        
		String name = (String) referencia.get("nombre");        
		List&amp;lt;Document&amp;gt; docs = (List&amp;lt;Document&amp;gt;) referencia.get("docRespuestaInterno");        
		ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; docs1 = (ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt;) referencia.get("docRespuestaInterno");
	DocumentModelList docs2 = (DocumentModelList) referencia.get("docRespuestaInterno");        
	List&amp;lt;DocumentModel&amp;gt; docs3 = (List&amp;lt;DocumentModel&amp;gt;) referencia.get("docRespuestaInterno");        
	log2.info("Referencia[1] : nombre = " + name + " docs = " + referencia.get("docRespuestaInterno"));        
	// PRINT CORRECT PROPERTY NOMBRE BUT docRespuestaInterno Wrong
	//Referencia[1] : nombre = revisor docs = [Ljava.lang.String;@72e86051        
	//Referencia[1] : nombre = gestor docs = [Ljava.lang.String;@78373eef    
}    
updateResponses(docRef);    
return doc;
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I try get value property for docRespuestaInterno (Type list of documentRefs) the program output Error in log similar (depend of case cast property):&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Caused by: java.lang.ClassCastException: class [Ljava.lang.String; cannot be cast to class java.util.List ([Ljava.lang.String; and java.util.List are in module java.base of loader 'bootstrap')&lt;/STRONG&gt;&lt;/P&gt;
&lt;H2&gt;Then, How to get correctly property for cast of &lt;CODE&gt;DocumentModel&lt;/CODE&gt;  ?&lt;/H2&gt;
&lt;H3&gt;I need change de transition for all documents in the list&lt;/H3&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;for (DocumentModel response : listDocuments) 
{    if (response.getCurrentLifeCycleState().equals("firmado")) 
	{        response.followTransition("to_tramitado");    
	}
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Regards!
Gabo.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jan 2022 22:50:53 GMT</pubDate>
    <dc:creator>Gabino_Reyes</dc:creator>
    <dc:date>2022-01-13T22:50:53Z</dc:date>
    <item>
      <title>How to get complex type list document ref of complex type list custom in java?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-get-complex-type-list-document-ref-of-complex-type-list/m-p/319217#M6218</link>
      <description>&lt;P&gt;Hi Guys!&lt;/P&gt;
&lt;P&gt;I have the next code:
Scheme:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;xs:element name="documentosRespuestaInterno" type="nxs:documentoRespuestaInternoListType"/&amp;gt;

&amp;lt;xs:complexType name="documentoRespuestaInternoListType"&amp;gt;    
	&amp;lt;xs:sequence&amp;gt;        
		&amp;lt;xs:element name="item" type="nxs:documentoRespuestaInternoType" minOccurs="0" maxOccurs="unbounded"/&amp;gt;    
	&amp;lt;/xs:sequence&amp;gt;
&amp;lt;/xs:complexType&amp;gt;

&amp;lt;xs:complexType name="documentoRespuestaInternoType"&amp;gt;    
	&amp;lt;xs:sequence&amp;gt;        
		&amp;lt;xs:element name="nombre" type="xs:string"/&amp;gt;        
		&amp;lt;xs:element name="docRespuestaInterno"&amp;gt;            
			&amp;lt;xs:simpleType&amp;gt;                
				&amp;lt;xs:list&amp;gt;                    
					&amp;lt;xs:simpleType&amp;gt;                        
						&amp;lt;xs:restriction base="xs:string" ref:resolver="documentResolver" ref:store="id"/&amp;gt;                    
					&amp;lt;/xs:simpleType&amp;gt;                
				&amp;lt;/xs:list&amp;gt;            
			&amp;lt;/xs:simpleType&amp;gt;        
		&amp;lt;/xs:element&amp;gt;    
	&amp;lt;/xs:sequence&amp;gt;
&amp;lt;/xs:complexType&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Java Class:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@OperationMethod(collector = DocumentModelCollector.class)
public DocumentModel run(DocumentRef docRef) throws Exception {    
DocumentModel doc = session.getDocument(docRef);    
	ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; referencias = (ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt;)
	doc.getPropertyValue("doc_base:documentosRespuestaInterno");    
	for (Map&amp;lt;String, Object&amp;gt; referencia : referencias) {        
		String name = (String) referencia.get("nombre");        
		List&amp;lt;Document&amp;gt; docs = (List&amp;lt;Document&amp;gt;) referencia.get("docRespuestaInterno");        
		ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; docs1 = (ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt;) referencia.get("docRespuestaInterno");
	DocumentModelList docs2 = (DocumentModelList) referencia.get("docRespuestaInterno");        
	List&amp;lt;DocumentModel&amp;gt; docs3 = (List&amp;lt;DocumentModel&amp;gt;) referencia.get("docRespuestaInterno");        
	log2.info("Referencia[1] : nombre = " + name + " docs = " + referencia.get("docRespuestaInterno"));        
	// PRINT CORRECT PROPERTY NOMBRE BUT docRespuestaInterno Wrong
	//Referencia[1] : nombre = revisor docs = [Ljava.lang.String;@72e86051        
	//Referencia[1] : nombre = gestor docs = [Ljava.lang.String;@78373eef    
}    
updateResponses(docRef);    
return doc;
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I try get value property for docRespuestaInterno (Type list of documentRefs) the program output Error in log similar (depend of case cast property):&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Caused by: java.lang.ClassCastException: class [Ljava.lang.String; cannot be cast to class java.util.List ([Ljava.lang.String; and java.util.List are in module java.base of loader 'bootstrap')&lt;/STRONG&gt;&lt;/P&gt;
&lt;H2&gt;Then, How to get correctly property for cast of &lt;CODE&gt;DocumentModel&lt;/CODE&gt;  ?&lt;/H2&gt;
&lt;H3&gt;I need change de transition for all documents in the list&lt;/H3&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;for (DocumentModel response : listDocuments) 
{    if (response.getCurrentLifeCycleState().equals("firmado")) 
	{        response.followTransition("to_tramitado");    
	}
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Regards!
Gabo.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 22:50:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-get-complex-type-list-document-ref-of-complex-type-list/m-p/319217#M6218</guid>
      <dc:creator>Gabino_Reyes</dc:creator>
      <dc:date>2022-01-13T22:50:53Z</dc:date>
    </item>
  </channel>
</rss>

