How to get the modified node lists before calling session.save()?

275 Views Asked by At

Is it possible to get the modified nodes list before calling session's save method? I want to know what nodes were modified or added, and right now I use a very inefficient way for this:

Looping through the 'content' path and calling these methods for each node:
  node.isModified()
  node.isNew()

It looks very bad solution, but I didn't find any better one for the problem.

Thanks for your help in advance!

1

There are 1 best solutions below

0
On

You can try using SQL2 to query for nodes updated or modified since a given timestamp

For example all nodes modified or created since 2014-10-27T14:00:00.801-08:00:

SELECT * FROM [nt:base] as s WHERE [jcr:lastModified] > '2014-10-27T14:00:00.801-08:00' OR [jcr:created] > '2014-10-27T14:00:00.801-08:00'

Note: performance will vary based on the returned dataset