001/*
002 * (C) Copyright 2013 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-2.1.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 *     dmetzler
016 */
017package org.nuxeo.ecm.automation.test.helpers;
018
019import org.nuxeo.ecm.automation.core.Constants;
020import org.nuxeo.ecm.automation.core.annotations.Operation;
021import org.nuxeo.ecm.automation.core.annotations.OperationMethod;
022import org.nuxeo.ecm.automation.core.annotations.Param;
023import org.nuxeo.ecm.core.api.Blob;
024import org.nuxeo.ecm.core.api.DocumentModel;
025import org.nuxeo.ecm.core.api.DocumentModelList;
026
027/**
028 * Basic operation that just record the documents on which it was called and the parameters used
029 *
030 * @since 5.7.2
031 */
032@Operation(id = TestOperation.ID, category = Constants.CAT_SERVICES, label = "log call params", description = "Test operation that log call in a static map")
033public class TestOperation {
034
035    public static final String ID = "testOp";
036
037    @Param(name = "one")
038    String one;
039
040    @Param(name = "two")
041    Integer two;
042
043    @OperationMethod
044    public DocumentModel run(DocumentModel doc) {
045        return doc;
046    }
047
048    @OperationMethod
049    public DocumentModelList run(DocumentModelList docs) {
050        return docs;
051    }
052
053    @OperationMethod
054    public Blob run(Blob blob) throws Exception {
055        return blob;
056    }
057
058}