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 *     bstefanescu
011 */
012package org.nuxeo.ecm.automation.core.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.core.collectors.BlobCollector;
020import org.nuxeo.ecm.automation.core.util.BlobList;
021import org.nuxeo.ecm.core.api.Blob;
022
023/**
024 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
025 */
026@Operation(id = FetchContextBlob.ID, category = Constants.CAT_FETCH, label = "Context File(s)", description = "Fetch the input of the context as a file or list of files. The file(s) will become the input for the next operation.")
027public class FetchContextBlob {
028
029    public static final String ID = "Context.FetchFile";
030
031    @Context
032    protected OperationContext ctx;
033
034    @OperationMethod(collector = BlobCollector.class)
035    public Blob run(Blob blob) {
036        return blob;
037    }
038
039    public BlobList run(BlobList blobs) {
040        return blobs;
041    }
042
043}