001/*
002 * (C) Copyright 2008 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: CreationContainerListProvider.java 30586 2008-02-26 14:30:17Z ogrisel $
018 */
019
020package org.nuxeo.ecm.platform.filemanager.service.extension;
021
022import org.nuxeo.ecm.core.api.CoreSession;
023import org.nuxeo.ecm.core.api.DocumentModelList;
024
025/**
026 * Interface to implement for contributions to the FileManagerService creationContainerListProvider extension point.
027 * <p>
028 * The provider should tell for a given (handled) document type the list of candidate container the user can create new
029 * document in.
030 *
031 * @author Olivier Grisel <ogrisel@nuxeo.com>
032 */
033public interface CreationContainerListProvider {
034
035    /**
036     * Unique name of the CreationContainerListProvider. The name of a provider should be used for the equals.
037     *
038     * @return the name
039     */
040    String getName();
041
042    void setName(String name);
043
044    /**
045     * Arrays of the document types accepted by the CreationContainerListProvider instance. null or empty array mean any
046     * document type is accepted.
047     *
048     * @return arrays of document types
049     */
050    String[] getDocTypes();
051
052    void setDocTypes(String[] docTypes);
053
054    /**
055     * Tell whether docType is handled by the provider.
056     *
057     * @param docType name of the document core type
058     * @return true is the docType is accepted
059     */
060    boolean accept(String docType);
061
062    /**
063     * Build the list of candidate containers for the given document type and session.
064     *
065     * @param documentManager the current session context
066     * @param docType the type of document to create
067     * @return the list of candidate containers
068     */
069    DocumentModelList getCreationContainerList(CoreSession documentManager, String docType);
070
071}