chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller <florian.muel...@alfresco.com>
Subject Re: Different result with same query but other OpenCMIS version
Date Wed, 20 Apr 2011 13:35:51 GMT
Well, it is not incorrect. Most repositories don't recognize the transmitted locale. So in
most cases it doesn't matter.
Alfresco uses the locale to return localized values. And it is also used to parametrize queries.
It depends on the application and the data if that makes sense.
If you want to be on the safe side and just want the default behavior, don't specify the locale.

Florian


On 20/04/2011 14:25, Geert Vanheusden wrote:
> Ok. That does the trick.
> 
> Is it incorrect to define those parameters?
> 
> Geert
> 
> ----- Original Message -----
> From: "Florian Müller"<florian.mueller@alfresco.com>
> To: "Geert Vanheusden"<g.vanheusden@aca-it.be>
> Sent: Wednesday, April 20, 2011 3:16:57 PM
> Subject: Re: Different result with same query but other OpenCMIS version
> 
> Please remove all LOCALE session parameters and run the query again.
> 
> Florian
> 
> 
> On 20/04/2011 13:47, Geert Vanheusden wrote:
>> Ok.
>>
>> Added the following:
>>
>> for (QueryResult queryResult : query) {
>>        System.out.println("- " + queryResult.getPropertyValueById("cmis:objectId"));
>> }
>> System.out.println("Total results: " + query.getTotalNumItems());
>>
>>
>> Results:
>>
>> 0.2.0:
>> ------
>> - workspace://SpacesStore/586dbf3c-dc8d-4b5a-a331-7f04c5b9d7ad
>> Total results: 1
>>
>> 0.3.0:
>> ------
>> Total results: 0
>>
>>
>> And the links to the Wireshark packets:
>>
>> http://dl.dropbox.com/u/623463/alf/OpenCMIS-0.2.0-debug.txt
>> http://dl.dropbox.com/u/623463/alf/OpenCMIS-0.3.0-debug.txt
>>
>> The POST url looks identical... very strange.
>>
>> Kind regards,
>>
>> Geert
>>
>> ----- Original Message -----
>> From: "Florian Müller"<florian.mueller@alfresco.com>
>> To: dev@chemistry.apache.org, "Geert Vanheusden"<g.vanheusden@aca-it.be>
>> Sent: Wednesday, April 20, 2011 2:05:37 PM
>> Subject: Re: Different result with same query but other OpenCMIS version
>>
>> Could you please iterate through all results - even though getTotalNumItems() returns
0 - and count the results?
>> Would it be possible to capture the network traffic?
>>
>> Florian
>>
>>
>> On 20/04/2011 12:30, Geert Vanheusden wrote:
>>> Ok, I extracted some code in a separate application.
>>>
>>> -------------------------------------
>>>
>>> package be.idewe.park;
>>>
>>> import java.util.HashMap;
>>> import java.util.Map;
>>>
>>> import org.apache.chemistry.opencmis.client.api.ItemIterable;
>>> import org.apache.chemistry.opencmis.client.api.QueryResult;
>>> import org.apache.chemistry.opencmis.client.api.Session;
>>> import org.apache.chemistry.opencmis.client.api.SessionFactory;
>>> import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
>>> import org.apache.chemistry.opencmis.commons.SessionParameter;
>>> import org.apache.chemistry.opencmis.commons.enums.BindingType;
>>>
>>> public class TestQuery {
>>>
>>> 	/**
>>> 	 * @param args
>>> 	 */
>>> 	public static void main(String[] args) {
>>> 		TestQuery testQuery = new TestQuery();
>>> 		
>>> 		Session session = testQuery.getSession();
>>> 		ItemIterable<QueryResult>    query = session.query("SELECT DOCUMENT.*,
EMPLOYEEDOCUMENT.* FROM park:document AS DOCUMENT JOIN park:employeeDocument AS EMPLOYEEDOCUMENT
ON DOCUMENT.cmis:objectId = EMPLOYEEDOCUMENT.cmis:objectId WHERE (EMPLOYEEDOCUMENT.employeeDoc:currentEmployeeName
LIKE '%VANHEUSDEN%')", false);
>>> 		
>>> 		System.out.println(query.getTotalNumItems());
>>>
>>> 	}
>>> 	
>>> 	public Session getSession() {
>>> 		// default factory implementation of client runtime
>>> 		SessionFactory f = SessionFactoryImpl.newInstance();
>>> 		Map<String, String>    parameter = new HashMap<String, String>();
>>>
>>> 		// user credentials
>>> 		parameter.put(SessionParameter.USER, "admin");
>>> 		parameter.put(SessionParameter.PASSWORD, "admin");
>>>
>>> 		// connection settings
>>> 		parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:7070/alfresco/s/cmis");
>>> 		parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
>>>
>>> 		// session locale
>>> 		parameter.put(SessionParameter.LOCALE_ISO3166_COUNTRY, "be");
>>> 		parameter.put(SessionParameter.LOCALE_ISO639_LANGUAGE, "nl");
>>> 		parameter.put(SessionParameter.LOCALE_VARIANT, "");
>>> 		
>>> 		parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
>>>
>>> 		return f.getRepositories(parameter).get(0).createSession();
>>>          }
>>>
>>> }
>>> ----------------------------
>>>
>>> And here a POM snippet:
>>>
>>>      <dependencies>
>>> 		<!-- OpenCMIS -->
>>> 		<dependency>
>>> 		<groupId>org.apache.chemistry.opencmis</groupId>
>>> 		<artifactId>chemistry-opencmis-client-impl</artifactId>
>>> 		<version>0.3.0</version>
>>> 		</dependency>
>>> 		<dependency>
>>> 		<groupId>org.alfresco.cmis.client</groupId>
>>> 		<artifactId>alfresco-opencmis-extension</artifactId>
>>> 		<version>0.2</version>
>>> 		</dependency>
>>>      </dependencies>
>>>
>>> ---------------------------
>>>
>>> So when I execute this code I get "0" (incorrect). If I replace the dependency
with "0.2.0-incubating" it returns "1".
>>>
>>> Kind regards,
>>>
>>> Geert
>>>
>>>
>>> ----- Original Message -----
>>> From: "Florian Müller"<florian.mueller@alfresco.com>
>>> To: dev@chemistry.apache.org
>>> Sent: Wednesday, April 20, 2011 12:44:01 PM
>>> Subject: Re: Different result with same query but other OpenCMIS version
>>>
>>> No, Alfresco uses a different parser.
>>> If the CMIS query didn't change and the repository implementation didn't change,
only the interpretation of the results can be different on the client side. But we haven't
touched that code for quite a while.
>>>
>>> Florian
>>>
>>>
>>> On 20/04/2011 11:37, Jens Hübel wrote:
>>>> Does the Alfresco implementation use the opencmis query parser? Even that
should not have been changed with the exception of a few minor patches. Is there a chance
to find out what native queries are generated from the CMIS one?
>>>>
>>>> Jens
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Geert Vanheusden [mailto:g.vanheusden@aca-it.be]
>>>> Sent: Mittwoch, 20. April 2011 11:41
>>>> To: dev
>>>> Subject: Different result with same query but other OpenCMIS version
>>>>
>>>> Dear,
>>>>
>>>> I just upgraded to OpenCMIS 0.3.0 (coming from 0.2.0-incubating) and I noticed
that the same query I used before returns an incorrect result.
>>>>
>>>> I have a custom document type (park:document) and a park:employeeDocument
aspect.
>>>>
>>>> When I execute the following query using OpenCMIS 0.2.0-incubating I have
one document as a result (correct). If I execute the same query using OpenCMIS 0.3.0 then
there are no documents returned.
>>>>
>>>> cmisSession.query("
>>>> SELECT DOCUMENT.*, EMPLOYEEDOCUMENT.*
>>>> FROM park:document AS DOCUMENT
>>>> JOIN park:employeeDocument AS EMPLOYEEDOCUMENT
>>>> ON DOCUMENT.cmis:objectId = EMPLOYEEDOCUMENT.cmis:objectId
>>>> WHERE (EMPLOYEEDOCUMENT.employeeDoc:currentEmployeeName LIKE '%VANHEUSDEN%')
>>>> ", false)
>>>>
>>>> I am using the alfresco-opencmis-extension 0.2 and querying against an Alfreso
enterprise 3.4.
>>>> If I execute the same query in the latest version of the OpenCMIS workbench
I have also one document as a result (correct).
>>>>
>>>> Any ideas? Maybe a bug in OpenCMIS 0.3.0?
>>>>
>>>> Kind regards,
>>>>
>>>> Geert Vanheusden
>>>>
>>>>
>>>> _________________________________________________
>>>>
>>>>      We published a new company movie featuring YOU!
>>>>              See http://www.aca-it.be/movie
>>>> _________________________________________________
>>>
>>
> 


Mime
View raw message