Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Retrieving the page version of the page in java class

PRADEEP_KUMAR
Level 1
Level 1

Hi,

 I have created a version for the page. How can i retrieve the page version of the page like cq:lastReplicated we can retrieve the last published date. Is it possible to retrieve the page version of the page.

Thanks in advance.

1 Accepted Solution
Tim_Donovanuk
Correct answer by
Level 2
Level 2

You can use PageManager to get all revisions (I think what you are calling 'versions') of a page by calling PageManager.getRevisions - this returns a Collection of Revisions, and on a Revision you can do .getVersion, .getLabel etc. See:

http://docs.adobe.com/docs/kr/aem/6-0/develop/ref/javadoc/com/day/cq/wcm/api/PageManager.html#getRev..., java.util.Calendar)

http://docs.adobe.com/docs/kr/aem/6-0/develop/ref/javadoc/com/day/cq/wcm/api/Revision.html

View solution in original post

0 Replies
kalyanar
Employee
Employee

last published is last replicated...the code is as follows

com.day.cq.replication.ReplicationStatus rs=jcrcontentresource.adaptTo(ReplicationStatus.class);
            if(rs!=null&&rs.getLastPublished()!=null){
            activatedTime=rs.getLastPublished().getTimeInMillis();
            }

Tim_Donovanuk
Correct answer by
Level 2
Level 2

You can use PageManager to get all revisions (I think what you are calling 'versions') of a page by calling PageManager.getRevisions - this returns a Collection of Revisions, and on a Revision you can do .getVersion, .getLabel etc. See:

http://docs.adobe.com/docs/kr/aem/6-0/develop/ref/javadoc/com/day/cq/wcm/api/PageManager.html#getRev..., java.util.Calendar)

http://docs.adobe.com/docs/kr/aem/6-0/develop/ref/javadoc/com/day/cq/wcm/api/Revision.html