View Javadoc

1   package net.sourceforge.blogentis.plugins.impl;
2   
3   //-----------------------------------------------------------------------
4   //Blogentis - a blog publishing platform.
5   //Copyright (C) 2004 Tassos Bassoukos <abassouk@gmail.com>
6   //
7   //This library is free software; you can redistribute it and/or
8   //modify it under the terms of the GNU Lesser General Public
9   //License as published by the Free Software Foundation; either
10  //version 2.1 of the License, or (at your option) any later version.
11  //
12  //This library is distributed in the hope that it will be useful,
13  //but WITHOUT ANY WARRANTY; without even the implied warranty of
14  //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  //Lesser General Public License for more details.
16  //
17  //You should have received a copy of the GNU Lesser General Public
18  //License along with this library; if not, write to the Free Software
19  //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  //-----------------------------------------------------------------------
21  //
22  //$Id: PostEditExtensionPointImpl.java,v 1.1 2004/10/22 17:34:14 tassos Exp $
23  //
24  
25  import java.util.Iterator;
26  
27  import net.sourceforge.blogentis.om.Blog;
28  import net.sourceforge.blogentis.om.Post;
29  import net.sourceforge.blogentis.plugins.AbstractBlogExtensionPoint;
30  import net.sourceforge.blogentis.plugins.IPlugin;
31  import net.sourceforge.blogentis.plugins.base.IPostEditExtension;
32  import net.sourceforge.blogentis.plugins.base.IPostEditExtensionPoint;
33  import net.sourceforge.blogentis.turbine.BlogRunData;
34  
35  /***
36   * @author abas
37   */
38  public class PostEditExtensionPointImpl
39          extends AbstractBlogExtensionPoint
40          implements IPostEditExtensionPoint {
41  
42      public PostEditExtensionPointImpl(IPlugin plugin, Blog blog) {
43          super(plugin, blog);
44      }
45  
46      public String getName() {
47          return "Post Edit Extension Point";
48      }
49  
50      public Class getExtensionClass() {
51          return IPostEditExtension.class;
52      }
53  
54      public void postNew(BlogRunData data, final Post post) {
55          for(Iterator i = extensions.iterator(); i.hasNext();) {
56              IPostEditExtension ipe = (IPostEditExtension)i.next();
57              ipe.postNew(data, post);
58          }
59      }
60  
61      public void postModified(BlogRunData data, Post post) {
62          for(Iterator i = extensions.iterator(); i.hasNext();) {
63              IPostEditExtension ipe = (IPostEditExtension)i.next();
64              ipe.postModified(data, post);
65          }
66      }
67  
68      public void postPublicationStatusChanged(BlogRunData data, Post post,
69                                               int newState) {
70          for(Iterator i = extensions.iterator(); i.hasNext();) {
71              IPostEditExtension ipe = (IPostEditExtension)i.next();
72              ipe.postPublicationStatusChanged(data, post, newState);
73          }
74      }
75  
76      public void postDeleted(BlogRunData data, Post post) {
77          for(Iterator i = extensions.iterator(); i.hasNext();) {
78              IPostEditExtension ipe = (IPostEditExtension)i.next();
79              ipe.postDeleted(data, post);
80          }
81      }
82  
83      public String buildOptionsHTML(BlogRunData data, Post post) {
84          StringBuffer sb = new StringBuffer();
85          for(Iterator i = extensions.iterator(); i.hasNext();) {
86              IPostEditExtension ipe = (IPostEditExtension)i.next();
87              sb.append(ipe.buildOptionsHTML(data,post));
88          }
89          return sb.toString();
90      }
91  }