I have a problem putting together an ordered query in Java integrated with Alfresco. I’m using OpenCMIS to integrate with Alfresco and I would like to perform a query similar to this
String query = "SELECT * FROM personalizedType:personalizedType WHERE " + "personalizedType:propertyNumber like '" + number + "' AND " + "cmis:name LIKE '" + name + "' AND "+ "personalizedType:propertyString like '" + nome + "' " + "ORDER BY personalizedType:propertyString"; ItemIterable<QueryResult> results = session.query(query, false);
I have a custom type that I created in Alfresco: “personalizedType:personalizedType” (personalizedType is merely an example, lol), and its metadata are “propertyNumber” and “propertyString”… I need to bring up the results ordered by the “propertyString” property, but my query only works if I search for a native OpenCMIS property, such as cmis:name. Could anyone help me by indicating some way to order the query by query using custom metadata? The error I receive is this:
org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Ordering is not support for personalizedType:propertyString at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:490) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:717) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:181) at org.apache.chemistry.opencmis.client.runtime.SessionImpl$6.fetchPage(SessionImpl.java:1000) at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:131) at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getTotalNumItems(AbstractIterator.java:68) at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterable.getTotalNumItems(AbstractIterable.java:101)
My “org.apache.chemistry.opencmis.client.api” version is 1.1.0, and Java version is 17.
<dependency> <groupId>org.apache.chemistry.opencmis</groupId> <artifactId>chemistry-opencmis-client-impl</artifactId> <version>1.1.0</version> </dependency>
I’ve tried several different solutions, such as:
“ORDER BY personalizedType:personalizedType:propertyString”,
“ORDER BY F:personalizedType:personalizedType:propertyString”,
“ORDER BY personalizedType:@personalizedType:propertyString”,
“ORDER BY ‘@personalizedType:propertyString'”
But nothing worked. On some occasions, a selector error was pointed out.
Mario Henrique is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.