001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (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.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 *     Nuxeo - initial API and implementation
016 *
017 * $Id$
018 */
019
020package org.nuxeo.ecm.platform.filemanager.service.extension;
021
022import org.nuxeo.ecm.core.api.CoreSession;
023import org.nuxeo.ecm.core.api.DocumentModel;
024import org.nuxeo.ecm.platform.filemanager.service.FileManagerService;
025import org.nuxeo.ecm.platform.types.TypeManager;
026
027// Not used but please keep, it will be needed once the
028// FileManagerService#createDefaultFolder method is extracted to a plugin.
029public abstract class AbstractFolderImporter implements FolderImporter {
030
031    protected String name = "";
032
033    // to be used by plugin implementation to gain access to standard file
034    // creation utility methods without having to lookup the service
035    protected FileManagerService fileManagerService;
036
037    public DocumentModel create(CoreSession documentManager, String fullname, String path, boolean overwrite,
038            TypeManager typeManager) {
039        // sample implementation to override in a custom FolderImporter
040        // implementation
041        return fileManagerService.defaultCreateFolder(documentManager, fullname, path);
042    }
043
044    public String getName() {
045        return name;
046    }
047
048    public void setName(String name) {
049        this.name = name;
050    }
051
052    public void setFileManagerService(FileManagerService fileManagerService) {
053        this.fileManagerService = fileManagerService;
054    }
055
056}