AnsweredAssumed Answered

Query a type:int property causes error 500

Question asked by konda on Feb 1, 2013
Hi all,

I'm using Apache Chemistry and Alfresco community edition (ver. 4.2.c)

I have this critical issue: If I make a simple query like:


String query="SELECT O.ax:versione_STATUSPRATICA FROM ax:PRATICA AS D JOIN ax:propertiesPRATICA AS O ON D.cmis:objectId = O.cmis:objectId";
ItemIterable<QueryResult> returnSet = client.getSession().query(query, false);
for(QueryResult q : returnSet){
   //do something
}

Where ax:versione_STATUSPRATICA is defined as a <type>d:int</type> property.

I obtain the following stack trace error:

<blockcode>
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: 01010044 Request failed 500 /solr/alfresco/cmis?wt=json&amp;fl=DBID%2Cscore&amp;rows=100&amp;df=TEXT&amp;start=0&amp;locale=it_IT&amp;fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&amp;fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:452)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:570)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:142)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
   at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(CollectionIterator.java:48)
   at org.alfresco.test.CMIStest.main(CMIStest.java:64)
</blockcode>

Instead, if I modify the code in:


String query="SELECT * FROM ax:PRATICA AS D JOIN ax:propertiesPRATICA AS O ON D.cmis:objectId = O.cmis:objectId";
ItemIterable<QueryResult> returnSet = client.getSession().query(query, false);
for(QueryResult q : returnSet){
   System.out.println(q.getPropertyById("ax:versione_STATUSPRATICA"));
}


The println says

<blockcode>
Property [id=ax:versione_STATUSPRATICA, display Name=VERSIONE_PRATICA, local name=versione_STATUSPRATICA, query name=O.ax:versione_STATUSPRATICA, values=[0]][extensions=null]
</blockcode>

And this is correct, because there are documents having ax:versione_STATUSPRATICA=0!

If necessary, here is the content model

<blockcode>
<model name="ax:axa" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Modello Axa</description>
   <author/>
   <version>1.0</version>
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <namespaces>
      <!– Define a Namespace for my new definitions –>
      <namespace uri="http://www.olivetti.com/model/custom/ax/content/1.0" prefix="ax"/>
   </namespaces>
   <constraints>
      <constraint name="ax:STATO_PRATICA" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>0</value>
               <value>1</value>
            </list>
         </parameter>
         <parameter name="caseSensitive">
            <value>false</value>
         </parameter>
      </constraint>
   </constraints>
   <types>
      <type name="ax:PRATICA">
         <title>Dossier_Pratica</title>
         <parent>cm:content</parent>
         <mandatory-aspects>
            <aspect>ax:propertiesPRATICA</aspect>
            <aspect>ax:propertiesSTATUSPRATICA</aspect>
         </mandatory-aspects>
      </type>
   </types>
   <aspects>

      <aspect name="ax:propertiesPRATICA">
         <title>Proprieta Pratica</title>
         <properties>
            <property name="ax:codAdesione_PRATICA">
               <title>CODICE_ADESIONE</title>
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>20</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:codCompagnia_PRATICA">
               <title>CODICE_COMPAGNIA</title>
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>3</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:codPolizza_PRATICA">
               <title>CODICE_POLIZZA</title>
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>10</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:codProdotto_PRATICA">
               <title>CODICE_PRODOTTO</title>
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>3</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:tipoMovimento_PRATICA">
               <title>TIPO_MOVIMENTO</title>         
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>2</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:versione_STATUSPRATICA">
               <title>VERSIONE_PRATICA</title>
               <type>d:int</type>
            </property>
         </properties>
      </aspect>
      <aspect name="ax:propertiesSTATUSPRATICA">
         <title>Proprieta Stato Pratica</title>
         <properties>
            <property name="ax:stato_STATUSPRATICA">
               <title>STATO_PRATICA</title>
               <type>d:int</type>
               <mandatory>true</mandatory>
               <default>0</default>
               <!–<constraints>
                  <constraint ref="ax:STATO_PRATICA"/>
               </constraints>–>
            </property>
         </properties>
      </aspect>
   </aspects>
</model>
</blockcode>

I opened a bug report https://issues.alfresco.com/jira/browse/ALF-17792 with a screenshot

[I'm sorry but I can't disable these emoticons -.-]

Outcomes