Expand my Community achievements bar.

SOLVED

PageMoveAction for rollout in AEM

Avatar

Community Advisor

Hi All,

 

I need to implement PageMoveAction on a blueprint page whenever any page moved within the blueprint pages. Anyone, could you please help me with how to implement this as I have 20 live copies and I need to move all live copies whenever the blueprint page moved.

 

Any suggestions would really help me.

 

Thanks,

Aruna

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Aruna_surukunta_,

If a Page move on Blueprint has to be rolled out to Live copy pages, 

Create custom rollout config with OOB Synchronization action named "PageMoveAction"

This action will retain pages in old location and newly moved location in live copy pages. It has to be followed by Standard rollout config which will help in removing the page from old location. More details about this behavior is clearly documented in https://experienceleague.adobe.com/docs/experience-manager-65/administering/introduction/msm-best-pr...

Steps for creating rollout configuration with desired action is documented in https://experienceleague.adobe.com/docs/experience-manager-65/developing/extending-aem/extending-msm...

Note : Position the actions based on the behavior expected in live copy pages. 

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @Aruna_surukunta_,

If a Page move on Blueprint has to be rolled out to Live copy pages, 

Create custom rollout config with OOB Synchronization action named "PageMoveAction"

This action will retain pages in old location and newly moved location in live copy pages. It has to be followed by Standard rollout config which will help in removing the page from old location. More details about this behavior is clearly documented in https://experienceleague.adobe.com/docs/experience-manager-65/administering/introduction/msm-best-pr...

Steps for creating rollout configuration with desired action is documented in https://experienceleague.adobe.com/docs/experience-manager-65/developing/extending-aem/extending-msm...

Note : Position the actions based on the behavior expected in live copy pages. 

Avatar

Community Advisor

Thank you @ Vijayalakshmi_S for the valuable suggestions.

 

I have created LiveActionFactory for my custom rollout and created livesync action under apps/msm/rolloutconfigs.

As mentioned below I have created factory class it is getting invoking when I move page but EXECUTE method is not triggerring.

Am I missing anything here. Please help me.

 

import java.util.Collections;
import com.day.cq.wcm.msm.api.ActionConfig;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.adobe.cq.commerce.common.ValueMapDecorator;
import com.day.cq.wcm.msm.api.ActionConfig;
import com.day.cq.wcm.msm.api.LiveAction;
import com.day.cq.wcm.msm.api.LiveActionFactory;
import com.day.cq.wcm.msm.api.LiveRelationship;
import com.day.cq.wcm.api.WCMException;

@component(service = LiveActionFactory.class, immediate = true, property = {
PageMoveActionFactory.ACTION_NAME + "=PageMoveAction" })
public class PageMoveActionFactory implements LiveActionFactory<LiveAction> {

private static Logger LOG = LoggerFactory.getLogger(PageMoveActionFactory.class);

@reference
private ResourceResolverFactory resourceResolverFactory;

static final String ACTION_NAME = LiveActionFactory.LIVE_ACTION_NAME;

@Override
public LiveAction createAction(Resource config) throws WCMException {
LOG.debug("INSIDE PAGE MOVE ACTION FACTORY >>>>>>" + ACTION_NAME);

return new PageMoveAction(ACTION_NAME, config);
}

@Override
public String createsAction() {
return ACTION_NAME;
}

/************* LiveAction ****************/
private static class PageMoveAction implements LiveAction {

private String name;
private static final Logger log = LoggerFactory.getLogger(PageMoveAction.class);


public PageMoveAction(String actionName, Resource config) {

log.debug(" *** invoked constructor PageMoveAction *** "+actionName);
actionName = actionName;
config = config;
}

public void execute(Resource source, Resource target, LiveRelationship liverel, boolean autoSave,
boolean isResetRollout) throws WCMException {
log.debug(" *** Executing PageMoveAction *** ");
LOG.debug("ARUNA HERE....");

}

@Override
@deprecated
public void execute(ResourceResolver arg0, LiveRelationship arg1, ActionConfig arg2, boolean arg3)
throws WCMException {

}

@Override
@deprecated
public void execute(ResourceResolver arg0, LiveRelationship arg1, ActionConfig arg2, boolean arg3, boolean arg4)
throws WCMException {

}

public String getName() {
return name;
}

@Override
@deprecated
public String getParameterName() {
return null;
}
@Override
@deprecated
public String[] getPropertiesNames() {
return null;
}

@Override
@deprecated
public int getRank() {
return 0;
}

@Override
@deprecated
public String getTitle() {
return null;
}

@Override
@deprecated
public void write(JSONWriter arg0) throws JSONException {

}

}
}