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