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;
025
026/**
027 * An operation that set the step to the done state.
028 *
029 * @author <a href="mailto:arussel@nuxeo.com">Alexandre Russel</a>
030 * @deprecated since 5.9.2 - Use only routes of type 'graph'
031 */
032@Deprecated
033@Operation(id = StepDoneOperation.ID, category = DocumentRoutingConstants.OPERATION_CATEGORY_ROUTING_NAME, label = "Set Step Done", description = "Set the step as done.", addToStudio = false)
034public class StepDoneOperation {
035    public final static String ID = "Document.Routing.Step.Done";
036
037    @Context
038    protected OperationContext context;
039
040    @OperationMethod
041    public void setStepDone() {
042        DocumentRouteStep step = (DocumentRouteStep) context.get(DocumentRoutingConstants.OPERATION_STEP_DOCUMENT_KEY);
043        step.setDone(context.getCoreSession());
044    }
045}