jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: uuid as column in QueryResult
Date Wed, 18 Nov 2009 18:53:43 GMT
On Wed, Nov 18, 2009 at 14:59, Torgeir Veimo <torgeir@netenviron.com> wrote:
> Is there a way to get an uuid as one of the values in a row, when
> fetching a row from a QueryResults?
>
> I'd like to call;
>
> RowIterator iterator = queryResult.getRows();
> while (iterator.hasNext()) {
>  Row row = iterator.nextRow();
>  String id = row.getValue(JcrConstants.JCR_UUID).getString();
> [...]
> }

You have to go over a Node object. In JCR 1.0 you have to do this:

Node node = (Node) session.getItem(row.getValue("jcr:path").getString());
String uuid = node.getUUID();

In JCR 2.0 it's simpler:
Node node = row.getNode();
String uuid = node.getUUID(); // or node.getIdentifier()

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message