001/* 002 * (C) Copyright 2010-2012 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Alexandre Russel 016 * Florent Guillaume 017 */ 018package org.nuxeo.ecm.platform.routing.core.impl; 019 020import java.io.Serializable; 021import java.util.Map; 022 023import org.nuxeo.ecm.core.api.CoreSession; 024import org.nuxeo.ecm.platform.routing.api.DocumentRoute; 025import org.nuxeo.ecm.platform.routing.api.DocumentRouteElement; 026 027/** 028 * Runner responsible to run or undo an element of a route. 029 */ 030public interface ElementRunner { 031 032 /** 033 * Run this element. 034 */ 035 void run(CoreSession session, DocumentRouteElement element, Map<String, Serializable> map); 036 037 /** 038 * Run this element. If an exception is thrown while doing, it cancels the route. 039 */ 040 void run(CoreSession session, DocumentRouteElement element); 041 042 /** 043 * Resumes this graph route on a given node. 044 * 045 * @since 5.6 046 */ 047 void resume(CoreSession session, DocumentRouteElement element, String nodeId, String taskId, 048 Map<String, Object> data, String status); 049 050 /** 051 * Run the undo chain on this element. If this element is not a step, then throw an exception. 052 * 053 * @deprecated since 5.9.2 - Use only routes of type 'graph' 054 */ 055 @Deprecated 056 void undo(CoreSession session, DocumentRouteElement element); 057 058 /** 059 * Cancel this element. 060 * 061 * @see DocumentRoute#cancel(CoreSession) 062 */ 063 void cancel(CoreSession session, DocumentRouteElement element); 064}