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