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: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $
018 */
019
020package org.nuxeo.ecm.webapp.documenttemplates;
021
022import org.nuxeo.ecm.core.api.DocumentModel;
023import org.nuxeo.ecm.core.api.DocumentModelList;
024
025/**
026 * Stateful Seam component.
027 * <ul>
028 * <li>lookup of document templates
029 * <li>creation of document from a template
030 * </ul>
031 */
032public interface DocumentTemplatesActions {
033
034    /**
035     * @return list of DocumentModels of available templates of currently selected type.
036     */
037    DocumentModelList getTemplates();
038
039    DocumentModelList getTemplates(String targetTypeName);
040
041    /**
042     * Factory accessor on the getter.
043     */
044    DocumentModelList templatesListFactory();
045
046    /**
047     * Creates a Document from a template.
048     *
049     * @param doc the DocumentModel with edited data
050     * @param templateId the template id
051     */
052    String createDocumentFromTemplate(DocumentModel doc, String templateId);
053
054    /**
055     * Creates a Document from a template using the selectedTemplateId.
056     */
057    String createDocumentFromTemplate(DocumentModel doc);
058
059    /**
060     * Creates a Document from a template using the selectedTemplateId and the changeableDocument.
061     */
062    String createDocumentFromTemplate();
063
064    /**
065     * Getter of the selected template id.
066     */
067    String getSelectedTemplateId();
068
069    /**
070     * Setter for the template to use.
071     */
072    void setSelectedTemplateId(String requestedId);
073
074    /**
075     * Getter for type of the document to be created.
076     */
077    String getTargetType();
078
079    /**
080     * Setter for the type of document to be created.
081     */
082    void setTargetType(String targetType);
083
084    /**
085     * Listener to children changed event.
086     */
087    void documentChildrenChanged();
088
089    /**
090     * Listener for domain changed event.
091     */
092    void domainChanged();
093
094}