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