cancel
Showing results for 
Search instead for 
Did you mean: 

Using webservices to property info based on a node reference

aurora7795
Champ in-the-making
Champ in-the-making
Hi there,
I'm having some problems finding data in Alfresco based on a Lucene query.

I'm trying to create a relatively simple method in Java to access the properties of a Node based on a Node reference. I've been looking at the sample code provided in the SDK and am trying to run a query written in Lucene that I found there and have tried modded. This is what I have so far:

(Note, NodeRefParam is a string which contains, for example, the value:
29c8e154-53b8-11db-9cbc-d90940ce52b6
)

String ActualQuery = "@cm\\:node-uuid:"+NodeRefParam+"";

I have a trace line after this line to show me what the string looks like and it is showing:

@cm\:node-uuid:29c8e154-53b8-11db-9cbc-d90940ce52b6

The problem is that my code is telling me that no data is being returned in the result set. I know that the node id exists so that isn't the problem. My code is also working ok against the Lucene queries in from the sample code provided in the SDK so I can eliminate that as a problem. I'm pretty sure that the issue is with my Lucene query.

Anyone have any ideas? I don't need to use Lucene to structure the query, if anyone can give me a pointers/examples as to another other way of achieving my goal, I'm open to suggestion.

Thanks,
Martin BG
3 REPLIES 3

andy
Champ on-the-rise
Champ on-the-rise
Hi

- is a special character in lucene and needs to be escaped. See http://lucene.apache.org/java/docs/queryparsersyntax.html

The LuceneQueryParser has support for doing the escaping for you …

If you know the store (which you need for the query) you could just build a NodeRef object and then go to the NodeService for the properties.

Regards

Andy

jtorres
Champ in-the-making
Champ in-the-making
Hi people, this is my first post ;-):

I'm not sure to understand the answer: how can I recover a node or a reference from Alfresco using WebServices (in JAVA) given its uuid?

This is, what query I need to implement the following methods?

public Reference getReference(String UUID){
     // Query to find the node given it's UUID
     return result;
}

public Node getNode(String UUID){
     // Query to find the node given it's UUID
     return result;
}


Thanks a lot people. See you around.

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

You dont need to go to the server to retrieve a Reference.  A reference can be built on the client from the store protocol, store address and node uuid.  You can not build a reference from uuid alone, you must also have the store information.

In order to get the Node from a Reference use the get method on the repository web service.

Cheers,
Roy