[opencms-dev] abort a publish
Sandrine Prousteau
s.prousteau at eurelis.com
Thu Oct 16 16:28:12 CEST 2014
I just found this :
Make a Module action class, and in initialize, do this:
PublishEventListener listener = new PublishEventListener();
OpenCms.addCmsEventListener(listener);
With your PublishEventListener implementing I_CmsEventListener, I_CmsPublishEventListener
Then in your PublishEventListener class, do this:
public void cmsEvent(CmsEvent event) {
if(event.getType()==I_CmsEventListener.EVENT_BEFORE_PUBLISH_PROJECT){
LOG.debug("Start cmsEvent EVENT_BEFORE_PUBLISH_PROJECT...");
OpenCms.getPublishManager().addPublishListener(this);
LOG.debug("End cmsEvent EVENT_BEFORE_PUBLISH_PROJECT...");
}
}
So this class is also loaded with publishManager after a publish request.
And then your can add in the same class :
public void onStart(CmsPublishJobEnqueued job) {
LOG.debug("Start onStart...");
//do wath you want with the job
LOG.debug("End onStart...");
}
De : opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] De la part de Dudu Zoltan
Envoyé : lundi 28 juillet 2014 20:19
À : The OpenCms mailing list
Objet : [opencms-dev] abort a publish
Hi,
I have an action class that listens to I_CmsEventListener.EVENT_BEFORE_PUBLISH_PROJECT event and perform some actions in response
I want to abort the publish if there is an error
I looked at CmsPublishManager but how can I use it from the cmsEvent() method?
thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20141016/ccbc478c/attachment.htm>
More information about the opencms-dev
mailing list