How can I add a published property on to an asset node? | Community
Skip to main content
LB_PC
Level 2
Jun 17, 2021 3:41 PM UTC
Solved

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

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.
Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Jun 17, 2021 5:06 PM UTC

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!

6 replies

joerghoh
Employee
Jun 18, 2021 4:30 PM UTC

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?

Translate
shelly-goel
Employee
Jun 18, 2021 5:05 AM UTC

@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

Translate
LB_PC
LB_PCAuthor
Level 2
Jun 18, 2021 8:57 AM UTC
Is the cq:lastReplicated essentially telling if it has been published?
Translate
Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Jun 17, 2021 5:06 PM UTC

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!

Translate
LB_PC
LB_PCAuthor
Level 2
Jun 18, 2021 8:58 AM UTC
Thanks I'll take a look.
Translate