001/*
002 * (C) Copyright 2014 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 *     annejubert
016 */
017
018package org.nuxeo.io.fsexporter;
019
020import org.nuxeo.ecm.automation.core.Constants;
021import org.nuxeo.ecm.automation.core.annotations.Context;
022import org.nuxeo.ecm.automation.core.annotations.Operation;
023import org.nuxeo.ecm.automation.core.annotations.OperationMethod;
024import org.nuxeo.ecm.automation.core.annotations.Param;
025import org.nuxeo.ecm.core.api.CoreSession;
026
027@Operation(id = ExportStructureToFS.ID, category = Constants.CAT_SERVICES, label = "ExportStructureToFS", description = "This operation enables to export the structure contained in the Root name path to the File System Target path. You can declare your own query to choose the document being exported.")
028public class ExportStructureToFS {
029
030    public static final String ID = "ExportStructureToFS";
031
032    @Context
033    FSExporterService service;
034
035    @Context
036    protected CoreSession session;
037
038    @Param(name = "Root Path", required = true)
039    protected String RootPath;
040
041    @Param(name = "File System Target", required = true)
042    protected String FileSystemTarget;
043
044    @Param(name = "Query", required = false)
045    protected String customQuery;
046
047    @OperationMethod
048    public void run() throws Exception {
049        service.export(session, RootPath, FileSystemTarget, customQuery);
050    }
051
052}