How to query Jackrabbit for a property value on all the file versions?

274 views Asked by At

I've got an application where I'm required to sync files from a remote server to JCR.

Sync rules

  1. If a new file (file path) is found on the remote server, this file is added to JCR. Remote server also returns a updateTimestamp field which is stored as property to the content node as updateTimestamp.
  2. If the file (file path) exists in JCR, but updateTimestamp received from the remote server is different to what we have in JCR then we add a new version of the same file in JCR with the new updateTimestamp set in the new file content node keeping previous version untouched.

Timestamp returned from the remote server is a String value in the format dd/MM/YYYY hh:mm:ss

Rule 2 requires me to query all the version of the file with the property updateTimestamp. I've got the following query which returns all the files with the updateTimestamp. But is it possible to query all the version of this file with the property updateTimestamp ?

SELECT parent.*
FROM [nt:file] as parent
INNER JOIN [nt:base] as child ON ISCHILDNODE(child, parent)
WHERE ISDESCENDANTNODE(parent, [/files/id/documents])
AND parent.[jcr:path] like '%test1.wav%'
AND child.[cti:updateTimestamp] = '12/29/2016 11:53:54 PM'
0

There are 0 answers