Event Type change required on clicking custom activate button on siteadmin
Hi ,
I need a way to change the ReplicationAction.fromEvent(event).getType() to say which is unique say solr.Please let me know how to do it??
In siteadmin have added a extra menu item :-say activateSolr under Acitivate menu by adding /apps/wcm/core/content/siteadmin/actions/activate/menu/SolrActivate
and copied the below to solrActivate node
http://localhost:4502/libs/wcm/core/content/siteadmin/actions/activate/menu/activateNow.json
{"isDefaultAction":true,"handler":"CQ.wcm.SiteAdmin.activatePage","cls":"cq-siteadmin-activate-now","context":["toolbar","contextmenu"],"conditions":["CQ.wcm.SiteAdmin.hasAnySelection","CQ.wcm.SiteAdmin.notLocked"],"target":"CQ.wcm.SiteAdmin.getAnyTarget","jcr:primaryType":"nt:unstructured","text":"Activate"}
Now when i click on solrActivate it sends an event that is similar to activation ,with Event [topic=com/day/cq/replication] and could be mapped with ReplicationAction.fromEvent(event).getType()= ACTIVATE and replicationaction gives me the data
ReplicationAction ReplicationAction{type=ACTIVATE, path[0]='/content/abc', time=1452329377136, userId='admin', revision='null'}
My need is that i need something different for mapping say ReplicationAction.fromEvent(event).getType()= SOLR. so by this way i will know that user has clicked in particual activateSolr menu item in particula
I am using the below code to map the same
public class ActivateEventHandler implements EventHandler, JobProcessor {
@Override
public void handleEvent(Event event) {
if ((null != event && event.getTopic().equals(ReplicationAction.EVENT_TOPIC))) {
log.info("the ReplicationAction.fromEvent(event).getType()= {}", ReplicationAction.fromEvent(event).getType() );
if(ReplicationAction.fromEvent(event).getType().equals(ReplicationActionType.ACTIVATE)){
if (EventUtil.isLocal(event)) {
JobUtil.processJob(event, this);
}
}
}
}