I am trying to retrieve the page details using groovy script. I need to get replication status from those details but, the cq:lastReplicationAction is not available for the page in the jcr content.
What is the way to achieve this. A code snippet will be really helpful.
Solved! Go to Solution.
Views
Replies
Total Likes
@YashW In your groovy script, adapt resource/page to ReplicationStatus
ReplicationStatus replicationStatus = resource.adaptTo(ReplicationStatus.class)
or
ReplicationStatus replicationStatus = page.adaptTo(ReplicationStatus.class)
now you can add conditions to validate if resource/page is activated
if ( null != replicationStatus){
return replicationStatus.isActivated()
}
This will return true if page is activated
def replicationStatus = pageResource.adaptTo(ReplicationStatus)
if(null != replicationStatus{
def status = replicationStatus.isActivated();
if(status){
// Your operation
}
}
You may use this for reference, and apply to your use case
@YashW In your groovy script, adapt resource/page to ReplicationStatus
ReplicationStatus replicationStatus = resource.adaptTo(ReplicationStatus.class)
or
ReplicationStatus replicationStatus = page.adaptTo(ReplicationStatus.class)
now you can add conditions to validate if resource/page is activated
if ( null != replicationStatus){
return replicationStatus.isActivated()
}
This will return true if page is activated
def replicationStatus = pageResource.adaptTo(ReplicationStatus)
if(null != replicationStatus{
def status = replicationStatus.isActivated();
if(status){
// Your operation
}
}
You may use this for reference, and apply to your use case
Thank you @shubhanshu_singh
Views
Likes
Replies
Views
Like
Replies