내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

activate just the jcr:content

Avatar

Level 4

Hi community,

I'm trying to find a way to activate the page properties without activating the content of the components.

So, I want to activate only the jcr:content node without the child nodes.
I've read the replication API but I can't find something to help me. ReplicationContentFilter and also check EventHandler

I've all the code, I added a new button in the top bar of sites.html, which invokes a servlet to make the publication. But when using replicator.replicate with the jcr: content node, the content of the child components is also activated.

Does anyone have any idea how to do it?

Thanks in advance

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Level 4

Finally i found the solution!! and yes, it is using Sling Content Distribution api.

Find below the most import part of the code and let me know if you have questions  

 

 

 

...
import org.apache.sling.distribution.DistributionRequestType;
import org.apache.sling.distribution.DistributionResponse;
import org.apache.sling.distribution.Distributor;
import org.apache.sling.distribution.SimpleDistributionRequest;
...



@Reference
    private Distributor slingDistributor;

...
 DistributionResponse distributionResponse = distributeResource(resourceResolver, path);
....


private DistributionResponse distributeResource(ResourceResolver resolver, String path) {
        SimpleDistributionRequest sdr =
                new SimpleDistributionRequest(DistributionRequestType.ADD, false, path);
        return slingDistributor.distribute("publish", resolver, sdr);
    }

 

 

 Thanks!

원본 게시물의 솔루션 보기

4 답변 개

Avatar

Employee Advisor

The replication API is not designed to replicate single nodes which do have child nodes.

 

For your case I would build a content-package, which just contains the jcr:content node you are interested in and replicate this package then. Please make sure that your merge settings are correct (otherwise you might purge all nodes below on publish).

 

Jörg

Avatar

Level 4

Hi Jörg_Hoh

Can i do that by code? I need to add a custom action for the authors.

What do you think about 

https://sling.apache.org/documentation/bundles/distribution.html#forward-distribution and 
SimpleDistributionRequest sdr =
        new SimpleDistributionRequest(DistributionRequestType.ADD, true, assetPath);
    slingDistributor.distribute(PUBLISH_AGENT_NAME, resolver, sdr);
 
Thanks

Avatar

Employee Advisor
I guess that it's using the same approach, and that it cannot just change some properties of a node, and not others. Though I haven't tried it. Be aware, that sling distribution is not identical to AEM replication.

Avatar

정확한 답변 작성자:
Level 4

Finally i found the solution!! and yes, it is using Sling Content Distribution api.

Find below the most import part of the code and let me know if you have questions  

 

 

 

...
import org.apache.sling.distribution.DistributionRequestType;
import org.apache.sling.distribution.DistributionResponse;
import org.apache.sling.distribution.Distributor;
import org.apache.sling.distribution.SimpleDistributionRequest;
...



@Reference
    private Distributor slingDistributor;

...
 DistributionResponse distributionResponse = distributeResource(resourceResolver, path);
....


private DistributionResponse distributeResource(ResourceResolver resolver, String path) {
        SimpleDistributionRequest sdr =
                new SimpleDistributionRequest(DistributionRequestType.ADD, false, path);
        return slingDistributor.distribute("publish", resolver, sdr);
    }

 

 

 Thanks!