KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snipsnap > snip > Snip


1 /*
2  * This file is part of "SnipSnap Wiki/Weblog".
3  *
4  * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
5  * All Rights Reserved.
6  *
7  * Please visit http://snipsnap.org/ for updates and contact.
8  *
9  * --LICENSE NOTICE--
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  * --LICENSE NOTICE--
24  */

25
26 package org.snipsnap.snip;
27
28 import org.snipsnap.serialization.Appendable;
29 import org.snipsnap.snip.attachment.Attachments;
30 import org.snipsnap.snip.label.Labels;
31 import org.snipsnap.user.Permissions;
32 import org.snipsnap.user.User;
33 import org.snipsnap.render.macro.list.Linkable;
34 import org.snipsnap.render.macro.list.Nameable;
35
36 import javax.servlet.http.HttpServletRequest JavaDoc;
37 import java.sql.Timestamp JavaDoc;
38 import java.util.List JavaDoc;
39 import java.io.IOException JavaDoc;
40
41 /**
42  * Interface for snips
43  *
44  * @author Stephan J. Schmidt
45  * @version $Id: Snip.java 1607 2004-05-18 12:25:29Z leo $
46  */

47
48 public interface Snip extends Linkable, Ownable, Nameable, Appendable JavaDoc {
49   public void handle(HttpServletRequest JavaDoc request);
50
51   // HACK: looks like java beans framework does not find Nameable
52
public String JavaDoc getName();
53
54   public Access getAccess();
55
56   public Modified getModified();
57
58   /**
59    * Returns true, when the snip is a weblog.
60    * Currently only test against 'start'.
61    * Should be extendet to test a "weblog"-label
62    *
63    * @return true, if the snip is a weblog
64    */

65   public boolean isWeblog();
66
67   /**
68    * Conveniance function for JSP
69    *
70    * @return true, if snip is not a weblog
71    */

72   public boolean isNotWeblog();
73
74   public int getVersion();
75
76   public void setVersion(int version);
77
78   public void addPermission(String JavaDoc permission, String JavaDoc role);
79
80   public void setPermissions(Permissions permissions);
81
82   public Permissions getPermissions();
83
84   public void setApplication(String JavaDoc applicationOid);
85
86   public String JavaDoc getApplication();
87
88   public String JavaDoc getOUser();
89
90   public void setOUser(User oUser);
91
92   public void setOUser(String JavaDoc oUser);
93
94   public Attachments getAttachments();
95
96   public void setAttachments(Attachments attachments);
97
98   public Labels getLabels();
99
100   public void setLabels(Labels labels);
101
102   public Links getBackLinks();
103
104   public Links getSnipLinks();
105
106   public void setBackLinks(Links backLinks);
107
108   public void setSnipLinks(Links snipLinks);
109
110   public int getViewCount();
111
112   public void setViewCount(int count);
113
114   public int incViewCount();
115
116   public Timestamp JavaDoc getCTime();
117
118   public void setCTime(Timestamp JavaDoc cTime);
119
120   public Timestamp JavaDoc getMTime();
121
122   public void setMTime(Timestamp JavaDoc mTime);
123
124   public String JavaDoc getCUser();
125
126   public void setCUser(User cUser);
127
128   public void setCUser(String JavaDoc cUser);
129
130   public String JavaDoc getMUser();
131
132   public void setMUser(User mUser);
133
134   public void setMUser(String JavaDoc mUser);
135
136   public List JavaDoc getChildren();
137
138   public void setCommentedSnip(Snip comment);
139
140   public Snip getCommentedSnip();
141
142   public boolean isComment();
143
144   public Comments getComments();
145
146   public List JavaDoc getChildrenDateOrder();
147
148   public List JavaDoc getChildrenModifiedOrder();
149
150   /**
151    * Add a child snip. Sets the parent of
152    * the child to this snip and <b>stores</b> the
153    * child because of the new parent.
154    *
155    * @param snip Snip to add as child
156    */

157   public void addSnip(Snip snip);
158
159   /**
160    * Removes child snip from this nsip
161    *
162    * @param snip Child to remove
163    */

164   public void removeSnip(Snip snip);
165
166   public void setParentName(String JavaDoc name);
167
168   public String JavaDoc getParentName();
169
170   public void setCommentedName(String JavaDoc name);
171
172   public String JavaDoc getCommentedName();
173
174   public Snip getParent();
175
176   public void setDirectParent(Snip parentSnip);
177
178   public void setParent(Snip parentSnip);
179
180   /**
181    * Return a short version of the name.
182    * Useful for vertical snip listings, where
183    * the snips should not be to long.
184    * End of snip name will be replaced with "..."
185    *
186    * @return Short name of snip
187    */

188   public String JavaDoc getShortName();
189
190   /**
191    * Return an encoded version of the name,
192    * especially spaces replaced with "+"
193    *
194    * @return encoded name of snip
195    */

196   public String JavaDoc getNameEncoded();
197
198   public void setName(String JavaDoc name);
199
200   public String JavaDoc getContent();
201
202   public void setContent(String JavaDoc content);
203
204   public String JavaDoc getAttachmentString();
205
206   public String JavaDoc toXML();
207
208   public String JavaDoc getXMLContent();
209
210   public SnipPath getPath() throws IOException JavaDoc;
211
212   public String JavaDoc getTitle();
213
214   public Snip copy(String JavaDoc newName);
215 }
216
Popular Tags