ReverseReplicateProcess.java 1.78 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.cq.replication.Agent
 *  com.day.cq.replication.AgentConfig
 *  com.day.cq.replication.AgentFilter
 *  com.day.cq.replication.ReplicationActionType
 *  com.day.cq.replication.ReplicationOptions
 *  com.day.cq.workflow.exec.WorkflowProcess
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Property
 *  org.apache.felix.scr.annotations.Service
 */
package com.day.cq.wcm.workflow.process;

import com.day.cq.replication.Agent;
import com.day.cq.replication.AgentConfig;
import com.day.cq.replication.AgentFilter;
import com.day.cq.replication.ReplicationActionType;
import com.day.cq.replication.ReplicationOptions;
import com.day.cq.wcm.workflow.process.ReplicatePageProcess;
import com.day.cq.workflow.exec.WorkflowProcess;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;

@Component
@Service(value={WorkflowProcess.class})
@Property(name="process.label", value={"Reverse Replicate Content"})
public class ReverseReplicateProcess
extends ReplicatePageProcess {
    private static final AgentFilter MOD_DISTRIBUTE_FILTER = new AgentFilter(){

        public boolean isIncluded(Agent agent) {
            return agent.getConfiguration().isTriggeredOnDistribute();
        }
    };

    @Override
    public ReplicationActionType getReplicationType() {
        return ReplicationActionType.ACTIVATE;
    }

    @Override
    protected ReplicationOptions prepareOptions(ReplicationOptions opts) {
        if (opts == null) {
            opts = new ReplicationOptions();
        }
        opts.setFilter(MOD_DISTRIBUTE_FILTER);
        opts.setSuppressStatusUpdate(true);
        return opts;
    }

}