Quantum entnagled
Quantum entnagled

Reputation: 77

How to locate the node in JCR using uuid from query

This is the error I get.

16.03.2016 12:02:16.413 WARN [xxx.xxx.xx.xxx [1458147736268] GET /en/employees-leaders/employee-s-toolkit2/epd-update/epd-update-archives/caterpillar-news/upcoming-brand-webinarfocusonmarketing.html HTTP/1.1] com.day.cq.wcm.core.impl.LanguageManagerImpl Error while retrieving language property. javax.jcr.AccessDeniedException: cannot read item xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (alpha-numeric)

I am trying to locate the node in JCR using the xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, which I believe is uuid, using a query in AEM.

I tried running a sql with the above id in the jcr, but it returned no result.

//*[jcr:contains(., '91186155-45ad-474-9ad9-d5156a398629')] order by @jcr:score descending

Any other insights would be much appreciated.

Upvotes: 2

Views: 2967

Answers (3)

Yogi
Yogi

Reputation: 1

Use QueryBuilderDebugger, (localhost:4502/libs/cq/search/content/querydebug.html) and run similar query as below to get the node for a given uuid:

property=jcr:uuid
property.value=e69b256e-a466-3730-866b-de22c82ab8ck
path=/home
type=rep:Group
p.limit=10

Upvotes: 0

Bertrand Delacretaz
Bertrand Delacretaz

Reputation: 6100

You don't need a query if you know the Node's UUID, just use the Session.getNodeByIdentifier(String id) method.

Upvotes: 6

nateyolles
nateyolles

Reputation: 1921

Your query is not SQL as you stated, it's XPATH. Is that a typo or did you run the query incorrectly?

It certainly looks like a UUID. You can query for the jcr:uuid property or you can continue doing a full text search.

XPATH:

/jcr:root//*[jcr:contains(., '91186155-45ad-474-9ad9-d5156a398629')]

/jcr:root//*[@jcr:uuid='91186155-45ad-474-9ad9-d5156a398629']

JCR-SQL2:

SELECT * FROM [nt:base] AS s WHERE contains(s.*, '91186155-45ad-474-9ad9-d5156a398629')

SELECT * FROM [nt:base] WHERE [jcr:uuid] = '91186155-45ad-474-9ad9-d5156a398629'

What read permissions does your account have? You're going to find a lot of results for a jcr:uuid query will be under /jcr:system/jcr:versionStorage.

Upvotes: 2

Related Questions