001/*
002 * Copyright (c) 2006-2011 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 */
011
012package org.nuxeo.ecm.automation.jsf.operations;
013
014import org.nuxeo.ecm.automation.OperationContext;
015import org.nuxeo.ecm.automation.core.Constants;
016import org.nuxeo.ecm.automation.core.annotations.Context;
017import org.nuxeo.ecm.automation.core.annotations.Operation;
018import org.nuxeo.ecm.automation.core.annotations.OperationMethod;
019import org.nuxeo.ecm.automation.jsf.OperationHelper;
020import org.nuxeo.ecm.core.api.DocumentModel;
021import org.nuxeo.ecm.core.api.DocumentModelList;
022import org.nuxeo.ecm.webapp.documentsLists.DocumentsListsManager;
023
024/**
025 * @author <a href="mailto:td@nuxeo.com">Thierry Delprat</a>
026 */
027@Operation(id = PushToClipboard.ID, category = Constants.CAT_UI, requires = Constants.SEAM_CONTEXT, label = "Push to Clipboard", description = "Add a input document(s) to clipboard. Returns back the document(s)", aliases = { "Seam.AddToClipboard" })
028public class PushToClipboard {
029
030    public static final String ID = "WebUI.AddToClipboard";
031
032    @Context
033    protected OperationContext ctx;
034
035    @OperationMethod
036    public DocumentModel run(DocumentModel doc) {
037        OperationHelper.getDocumentListManager().addToWorkingList(DocumentsListsManager.CLIPBOARD, doc);
038        return doc;
039    }
040
041    @OperationMethod
042    public DocumentModelList run(DocumentModelList docs) {
043        OperationHelper.getDocumentListManager().addToWorkingList(DocumentsListsManager.CLIPBOARD, docs);
044        return docs;
045    }
046
047}