I've got an application where I'm required to sync files from a remote server to JCR.
Sync rules
- 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 asupdateTimestamp
. - 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 newupdateTimestamp
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'