001/*
002 * Copyright (c) 2006-2013 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 * Vladimir Pasquier <vpasquier@nuxeo.com>
011 */
012package org.nuxeo.ecm.automation.core.operations.business;
013
014import org.nuxeo.ecm.automation.core.Constants;
015import org.nuxeo.ecm.automation.core.annotations.Context;
016import org.nuxeo.ecm.automation.core.annotations.Operation;
017import org.nuxeo.ecm.automation.core.annotations.OperationMethod;
018import org.nuxeo.ecm.automation.core.operations.business.adapter.BusinessAdapter;
019import org.nuxeo.ecm.core.api.CoreSession;
020import org.nuxeo.ecm.core.api.DocumentModel;
021
022/**
023 * This operation map pojo client side to document adapter server side and update the related NX document.
024 *
025 * @since 5.7
026 */
027@Operation(id = BusinessUpdateOperation.ID, category = Constants.CAT_BUSINESS, label = "BusinessUpdateOperation", description = "This operation map pojo client side to document adapter server side and update the related NX document.", addToStudio = false)
028public class BusinessUpdateOperation {
029
030    public static final String ID = "Business.BusinessUpdateOperation";
031
032    @Context
033    protected CoreSession session;
034
035    @OperationMethod
036    public BusinessAdapter run(BusinessAdapter input) throws ClassNotFoundException {
037        DocumentModel document = input.getDocument();
038        session.saveDocument(document);
039        return input;
040    }
041
042}