001/*
002 * (C) Copyright 2006-2009 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.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
016 */
017
018package org.nuxeo.ecm.platform.publisher.api;
019
020import org.nuxeo.ecm.core.api.CoreSession;
021import org.nuxeo.ecm.core.api.DocumentModel;
022import org.nuxeo.ecm.platform.publisher.helper.RootSectionFinder;
023
024import java.util.List;
025import java.util.Map;
026
027/**
028 * Main publication Service.
029 *
030 * @author tiry
031 */
032public interface PublisherService {
033
034    String DOMAIN_NAME_KEY = "DomainName";
035
036    List<String> getAvailablePublicationTree();
037
038    /**
039     * Returns a {@code Map} with tree name as key and tree title as value.
040     */
041    Map<String, String> getAvailablePublicationTrees();
042
043    PublicationTree getPublicationTree(String treeName, CoreSession coreSession, Map<String, String> params)
044            throws PublicationTreeNotAvailable;
045
046    PublicationTree getPublicationTree(String treeName, CoreSession coreSession, Map<String, String> params,
047            DocumentModel currentDocument) throws PublicationTreeNotAvailable;
048
049    PublishedDocument publish(DocumentModel doc, PublicationNode targetNode);
050
051    PublishedDocument publish(DocumentModel doc, PublicationNode targetNode, Map<String, String> params);
052
053    void unpublish(DocumentModel doc, PublicationNode targetNode);
054
055    boolean isPublishedDocument(DocumentModel documentModel);
056
057    PublicationTree getPublicationTreeFor(DocumentModel doc, CoreSession coreSession);
058
059    PublicationNode wrapToPublicationNode(DocumentModel documentModel, CoreSession coreSession) throws
060            PublicationTreeNotAvailable;
061
062    Map<String, String> getParametersFor(String treeConfigName);
063
064    void releaseAllTrees(String sessionId);
065
066    RootSectionFinder getRootSectionFinder(CoreSession session);
067
068}