001/*
002 * (C) Copyright 2006-2009 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo
018 */
019
020package org.nuxeo.ecm.platform.publisher.api;
021
022import org.nuxeo.ecm.core.api.CoreSession;
023import org.nuxeo.ecm.core.api.DocumentModel;
024import org.nuxeo.ecm.platform.publisher.helper.RootSectionFinder;
025
026import java.util.List;
027import java.util.Map;
028
029/**
030 * Main publication Service.
031 *
032 * @author tiry
033 */
034public interface PublisherService {
035
036    String DOMAIN_NAME_KEY = "DomainName";
037
038    List<String> getAvailablePublicationTree();
039
040    /**
041     * Returns a {@code Map} with tree name as key and tree title as value.
042     */
043    Map<String, String> getAvailablePublicationTrees();
044
045    PublicationTree getPublicationTree(String treeName, CoreSession coreSession, Map<String, String> params)
046            throws PublicationTreeNotAvailable;
047
048    PublicationTree getPublicationTree(String treeName, CoreSession coreSession, Map<String, String> params,
049            DocumentModel currentDocument) throws PublicationTreeNotAvailable;
050
051    PublishedDocument publish(DocumentModel doc, PublicationNode targetNode);
052
053    PublishedDocument publish(DocumentModel doc, PublicationNode targetNode, Map<String, String> params);
054
055    void unpublish(DocumentModel doc, PublicationNode targetNode);
056
057    boolean isPublishedDocument(DocumentModel documentModel);
058
059    PublicationTree getPublicationTreeFor(DocumentModel doc, CoreSession coreSession);
060
061    PublicationNode wrapToPublicationNode(DocumentModel documentModel, CoreSession coreSession) throws
062            PublicationTreeNotAvailable;
063
064    Map<String, String> getParametersFor(String treeConfigName);
065
066    void releaseAllTrees(String sessionId);
067
068    RootSectionFinder getRootSectionFinder(CoreSession session);
069
070}