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$
018 */
019
020package org.nuxeo.ecm.webapp.contentbrowser;
021
022import java.io.Serializable;
023
024import org.nuxeo.ecm.core.api.DocumentModel;
025import org.nuxeo.ecm.platform.types.Type;
026import org.nuxeo.ecm.platform.url.api.DocumentView;
027import org.nuxeo.ecm.webapp.action.TypesTool;
028
029/**
030 * @author <a href="mailto:rcaraghin@nuxeo.com">Razvan Caraghin</a>
031 */
032public interface DocumentActions extends Serializable {
033
034    String CHILDREN_DOCUMENT_LIST = "CHILDREN_DOCUMENT_LIST";
035
036    /**
037     * Returns the edit view of a document.
038     *
039     * @deprecated since 5.3: edit views are managed through tabs, the edit view is not used.
040     */
041    @Deprecated
042    String editDocument();
043
044    /**
045     * Saves changes held by the changeableDocument document model.
046     *
047     * @deprecated since 5.4.2, currentDocument should be used in edition screens instead of changeableDocument, so
048     *             {@link #updateCurrentDocument()} should be used instead
049     */
050    @Deprecated
051    String updateDocument();
052
053    /**
054     * Saves changes held by the given document, and updates the current document context with the new version.
055     * <p>
056     * Makes it possible to specify whether current tabs should be restored or not after edition.
057     *
058     * @since 5.7
059     * @param restoreCurrentTabs
060     * @return the JSF outcome for navigation after document edition.
061     */
062    String updateDocument(DocumentModel document, Boolean restoreCurrentTabs);
063
064    /**
065     * Saves changes held by the changeableDocument document model in current version and then create a new current one.
066     */
067    String updateDocumentAsNewVersion();
068
069    /**
070     * Updates document considering that current document model holds edited values.
071     */
072    String updateCurrentDocument();
073
074    /**
075     * Creates a document with type given by {@link TypesTool} and stores it in the context as the current changeable
076     * document.
077     * <p>
078     * Returns the create view of given document type.
079     */
080    String createDocument();
081
082    /**
083     * Creates a document with given type and stores it in the context as the current changeable document.
084     * <p>
085     * Returns the create view of given document type.
086     */
087    String createDocument(String typeName);
088
089    /**
090     * Creates the document from the changeableDocument put in request.
091     */
092    String saveDocument();
093
094    /**
095     * Creates the given document.
096     */
097    String saveDocument(DocumentModel newDocument);
098
099    /**
100     * Downloads file as described by given document view.
101     * <p>
102     * To be used by url pattern descriptors performing a download.
103     *
104     * @param docView the document view as generated through the url service
105     */
106    void download(DocumentView docView);
107
108    @Deprecated
109    String downloadFromList();
110
111    /**
112     * @return ecm type for current document, <code>null</code> if current doc is null.
113     */
114    Type getCurrentType();
115
116    Type getChangeableDocumentType();
117
118    /**
119     * Checks the current document write permission.
120     *
121     * @return <code>true</code> if the user has WRITE permission on current document
122     */
123    boolean getWriteRight();
124
125    /**
126     * Returns the comment to attach to the document
127     *
128     * @deprecated since 5.4: comment can be put directly in the document context data using key 'request/comment'.
129     */
130    @Deprecated
131    String getComment();
132
133    /**
134     * Sets the comment to attach to a document
135     *
136     * @deprecated since 5.4: comment can be put directly in the document context data using key 'request/comment'.
137     */
138    @Deprecated
139    void setComment(String comment);
140
141    /**
142     * This method is used to test whether the logged user has enough rights for the unpublish support.
143     *
144     * @return true if the user can unpublish, false otherwise
145     */
146    boolean getCanUnpublish();
147
148    /**
149     * @deprecated since 5.6: nxl:documentLayout tag now offers the same features
150     */
151    @Deprecated
152    String getCurrentDocumentSummaryLayout();
153
154    void followTransition(DocumentModel changedDocument);
155
156}