1 package net.sourceforge.blogentis.plugins.impl;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 }