001/*
002 * (C) Copyright 2010 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 */
017package org.nuxeo.ecm.platform.routing.api.operation;
018
019import org.nuxeo.ecm.automation.OperationContext;
020import org.nuxeo.ecm.automation.core.annotations.Context;
021import org.nuxeo.ecm.automation.core.annotations.Operation;
022import org.nuxeo.ecm.automation.core.annotations.OperationMethod;
023import org.nuxeo.ecm.platform.routing.api.DocumentRouteStep;
024import org.nuxeo.ecm.platform.routing.api.DocumentRoutingConstants;
025import org.nuxeo.ecm.platform.routing.api.helper.StepResumeRunner;
026
027/**
028 * An Operation that allows to resume a step.
029 *
030 * @author <a href="mailto:arussel@nuxeo.com">Alexandre Russel</a>
031 * @deprecated since 5.9.2 - Use only routes of type 'graph'
032 */
033@Deprecated
034@Operation(id = ResumeStepOperation.ID, category = DocumentRoutingConstants.OPERATION_CATEGORY_ROUTING_NAME, label = "Resume Step", description = "Resume a step that were in running step.", addToStudio = false)
035public class ResumeStepOperation {
036    public final static String ID = "Document.Routing.Resume.Step";
037
038    @Context
039    protected OperationContext context;
040
041    @OperationMethod
042    public void resume() {
043        DocumentRouteStep step = (DocumentRouteStep) context.get(DocumentRoutingConstants.OPERATION_STEP_DOCUMENT_KEY);
044        StepResumeRunner runner = new StepResumeRunner(step.getDocument().getId());
045        runner.resumeStep(context.getCoreSession());
046    }
047}