如何在复制之前获取页面内容信息(DELETE)?

时间:2016-02-18 15:02:52

标签: osgi cq5 aem sling

在CQ5中,我需要从页面属性和子节点属性中收集一些信息,以便进行复制(删除)

如果我实施EventHandler

@Component(immediate = true)
@Service
@Property(name = EventConstants.EVENT_TOPIC, value = ReplicationAction.EVENT_TOPIC)
public class RedisVideoUpdaterService implements EventHandler {
..................

    public void handleEvent(Event event) {            

    ReplicationAction action = ReplicationAction.fromEvent(event);
    ReplicationActionType actionType = action.getType();

    if (actionType.equals(ReplicationActionType.DELETE)) {
        //process data collecting
    }

...............

触发handelEvent后,该页面已被删除。

如果我实施Preprocessor

@Component(immediate = true)
@Service
public class RedisVideoUpdaterService implements Preprocessor{
..................

   public void preprocess(ReplicationAction action, ReplicationOptions replicationOptions) throws ReplicationException {         

    ReplicationActionType actionType = action.getType();

    if (actionType.equals(ReplicationActionType.DELETE)) {
        //process data collecting
    }

...............
删除操作完全没有触发

preprocess方法。

这两种情况都适用于创造/停用。

如何在删除页面之前处理页面?

1 个答案:

答案 0 :(得分:0)

正如我注意到的那样。仅在已激活页面的删除时触发Preppocessor。这种行为对我来说没问题。