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 *     ${user}
018 *
019 * $Id
020 */
021package org.nuxeo.ecm.platform.forum.web.api;
022
023import java.io.Serializable;
024
025import org.nuxeo.ecm.core.api.Blob;
026import org.nuxeo.ecm.core.api.DocumentModel;
027
028/**
029 * Represents the Action Listener for a Post, created inside a Thread.
030 *
031 * @author <a href="bchaffangeon@nuxeo.com">Brice Chaffangeon</a>
032 * @author Anahide Tchertchian
033 */
034public interface PostAction extends Serializable {
035
036    boolean checkWritePermissionOnThread();
037
038    /**
039     * Creates the Post and add it inside the Thread.
040     *
041     * @return the view id
042     */
043    String addPost();
044
045    /**
046     * Deletes the Post and in a the Thread.
047     *
048     * @return the view id after delete operation
049     */
050    String deletePost();
051
052    /**
053     * Cancels the action of adding a Post.
054     *
055     * @return the view id to stay on thread view
056     */
057    String cancelPost();
058
059    /**
060     * Gets the Thread in which the Post is.
061     */
062    DocumentModel getParentThread();
063
064    /**
065     * Returns true if the post is published, false otherwise.
066     */
067    boolean isPostPublished(DocumentModel post);
068
069    String approvePost(DocumentModel post);
070
071    String rejectPost(DocumentModel post);
072
073    // FIXME : all getters/setters on document metadata should be replaced by a
074    // single getter/setter tupole using a document model
075
076    /**
077     * Gets the title of the post at creation time.
078     */
079    String getTitle();
080
081    /**
082     * Sets the title of the post at creation time.
083     */
084    void setTitle(String title);
085
086    /**
087     * Gets the text of the post at creation time.
088     */
089    String getText();
090
091    /**
092     * Sets the text of the post at creation time.
093     */
094    void setText(String text);
095
096    /**
097     * Gets the name of the attached file of the post at creation time.
098     */
099    String getFilename();
100
101    /**
102     * Sets the name of the attached file of the post at creation time.
103     */
104    void setFilename(String filename);
105
106    /**
107     * Gets the content of the attached file of the post at creation time.
108     */
109    Blob getFileContent();
110
111    /**
112     * Sets the content of the attached file of the post at creation time.
113     */
114    void setFileContent(Blob fileContent);
115
116}