How to activate subpage programmatically?
I would like to activate subPage of myPage programmatically everytimes
when the author activates the parent page (in my case myPage). I use
eventhandler to detect an activation action and try to activate the subPae
with a replicatior as follows:
@Property(name = "event.topics", value = { ReplicationAction.EVENT_TOPIC })
public class mySubPageActivator extends AbstractRepositoryService
implements EventHandler {
public void handleEvent(final Event event) {
ReplicationAction action = ReplicationAction.fromEvent(event);
if (action.getType().equals(ReplicationActionType.ACTIVATE)) {
Replicator repl = getResourceResolver().adaptTo(Replicator.class);
repl.replicate(getAdminSession(), ReplicationActionType.ACTIVATE,
subPagePath);
}
}
}
the compiler prints java.lang.NullPointerException.
No comments:
Post a Comment