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
047    PublicationTree getPublicationTree(String treeName, CoreSession coreSession, Map<String, String> params,
048            DocumentModel currentDocument);
049
050    PublishedDocument publish(DocumentModel doc, PublicationNode targetNode);
051
052    PublishedDocument publish(DocumentModel doc, PublicationNode targetNode, Map<String, String> params);
053
054    void unpublish(DocumentModel doc, PublicationNode targetNode);
055
056    boolean isPublishedDocument(DocumentModel documentModel);
057
058    PublicationTree getPublicationTreeFor(DocumentModel doc, CoreSession coreSession);
059
060    PublicationNode wrapToPublicationNode(DocumentModel documentModel, CoreSession coreSession);
061
062    Map<String, String> getParametersFor(String treeConfigName);
063
064    RootSectionFinder getRootSectionFinder(CoreSession session);
065
066}