User generated content activation | Community
Skip to main content
Level 2
October 3, 2017
Solved

User generated content activation

  • October 3, 2017
  • 3 replies
  • 1050 views

While using a Blog component in SCF if i configure to use it in the author mode and wish to activate the page and send the content to publish what would be the best way to do that?

Activating the page does not activate the /content/usergenerated/asi/jcr/content path content (containing the post infos)

When I use activate  tree it fails as well. What is the way out?

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 VeenaVikraman

one solution I could recommend is to write an event listener on page activation. If you have a generic pattern for the node where the content is saved; on activation of the page , just activate the node programatically.

This would be something like below

@Component

@Service

@Property(name = "event.topics", value = ReplicationAction.EVENT_TOPIC)

public class ReplicatonEventHandler implements Runnable, EventHandler {

private Logger LOG = LoggerFactory.getLogger(this.getClass());

private BundleContext bundleContext;

@Override

public void handleEvent(Event event) {

   

    ReplicationAction action = ReplicationAction.fromEvent(event);

if (action != null) {

  LOG.info("Replication action {} occured on {} ", action.getType().getName(), action.getPath());

     if ("Activate".equalsIgnoreCase(action.getType().getName())) {

//Your logic here

}

}

}

public void run() {

LOG.info("Running...");

}

protected void activate(ComponentContext ctx) {

this.bundleContext = ctx.getBundleContext();

}

protected void deactivate(ComponentContext ctx) {

this.bundleContext = null;

}

}

Let me know if this doesn't help you .

Thanks

Veena

3 replies

smacdonald2008
Level 10
October 3, 2017

Please refer to the official documentation here: Blog Feature

titliAuthor
Level 2
October 3, 2017

I did go through the information. However my requirement is to write the content in the author environment and publish the page once done. Usually when u activate the page it works but here the content lying in a different location does not get published. That is the problem for which Im searching for a solution.

VeenaVikraman
Community Advisor
VeenaVikramanCommunity AdvisorAccepted solution
Community Advisor
October 3, 2017

one solution I could recommend is to write an event listener on page activation. If you have a generic pattern for the node where the content is saved; on activation of the page , just activate the node programatically.

This would be something like below

@Component

@Service

@Property(name = "event.topics", value = ReplicationAction.EVENT_TOPIC)

public class ReplicatonEventHandler implements Runnable, EventHandler {

private Logger LOG = LoggerFactory.getLogger(this.getClass());

private BundleContext bundleContext;

@Override

public void handleEvent(Event event) {

   

    ReplicationAction action = ReplicationAction.fromEvent(event);

if (action != null) {

  LOG.info("Replication action {} occured on {} ", action.getType().getName(), action.getPath());

     if ("Activate".equalsIgnoreCase(action.getType().getName())) {

//Your logic here

}

}

}

public void run() {

LOG.info("Running...");

}

protected void activate(ComponentContext ctx) {

this.bundleContext = ctx.getBundleContext();

}

protected void deactivate(ComponentContext ctx) {

this.bundleContext = null;

}

}

Let me know if this doesn't help you .

Thanks

Veena