How can I add a published property on to an asset node? | Community
Skip to main content
LB_PC
Level 2
June 17, 2021
Solved

How can I add a published property on to an asset node?

  • June 17, 2021
  • 3 replies
  • 1699 views

Hi, 

 

I know that the lastpublished and lastpublishedby properties are not used any more so I was wondering how can I set a custom property that says if a asset is unpublished or published?

 

Thank you for the help!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

Hi @lb_pc 

 

You can write a Replication PreProcessor and add the custom property to any assets that you replicate.

Please refer the sample code here.

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/core/src/main/java/com/adobe/acs/samples/replication/impl/SampleReplicationPreprocessor.java

 

Thanks!

3 replies

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
June 17, 2021

Hi @lb_pc 

 

You can write a Replication PreProcessor and add the custom property to any assets that you replicate.

Please refer the sample code here.

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/core/src/main/java/com/adobe/acs/samples/replication/impl/SampleReplicationPreprocessor.java

 

Thanks!

LB_PC
LB_PCAuthor
Level 2
June 18, 2021
Thanks I'll take a look.
shelly-goel
Adobe Employee
Adobe Employee
June 18, 2021

@lb_pc  May be I'm missing something in your question but you still have below properties set which you can refer to:

cq:lastReplicated

cq:lastReplicatedBy

cq:lastReplicationAction

LB_PC
LB_PCAuthor
Level 2
June 18, 2021
Is the cq:lastReplicated essentially telling if it has been published?
joerghoh
Adobe Employee
Adobe Employee
June 18, 2021

You should not do that, because these properties are an implementation detail of AEM, and are only set by the replication (subsystem). 

 

Why do you need to set the replication state from your own code?