1 25 26 package org.snipsnap.semanticweb.rss; 27 28 import org.radeox.api.engine.RenderEngine; 29 import org.radeox.api.engine.context.RenderContext; 30 import org.snipsnap.app.Application; 31 import org.snipsnap.container.Components; 32 import org.snipsnap.render.context.SnipRenderContext; 33 import org.snipsnap.snip.*; 34 import org.snipsnap.snip.attachment.Attachments; 35 import org.snipsnap.snip.label.Labels; 36 import org.snipsnap.user.Permissions; 37 import org.snipsnap.user.User; 38 39 import javax.servlet.http.HttpServletRequest ; 40 import java.io.IOException ; 41 import java.io.Writer ; 42 import java.sql.Timestamp ; 43 import java.util.List ; 44 45 52 53 public class RssSnip implements Snip { 54 private Snip snip; 55 private String url; 56 private String title; 57 private String content; 58 59 public RssSnip(Snip snip) { 60 this.title = snip.getName(); 61 this.content = snip.getContent(); 62 this.snip = snip; 63 this.url = ""; 64 } 65 66 public RssSnip(Snip snip, String content) { 67 this(snip); 68 this.content = content; 69 } 70 71 public RssSnip(Snip snip, String content, String title) { 72 this(snip, content); 73 this.title = title; 74 } 75 76 public RssSnip(Snip snip, String content, String title, String url) { 77 this(snip, content, title); 78 this.url = "#" + url.replace(' ', '_'); 79 } 80 81 public int getVersion() { 82 return snip.getVersion(); 83 } 84 85 public void setVersion(int version) { 86 } 87 88 public void setParentName(String name) { 89 } 90 91 public String getParentName() { 92 return snip.getParentName(); 93 } 94 95 public String getCommentedName() { 96 return snip.getCommentedName(); 97 } 98 99 public void setCommentedName(String name) { 100 } 101 102 public SnipPath getPath() throws IOException { 103 return snip.getPath(); 104 } 105 106 public void setApplication(String applicationOid) { 107 } 108 109 public String getApplication() { 110 return snip.getApplication(); 111 } 112 113 public String getName() { 114 return title; 115 } 116 117 public String getTitle() { 118 return title; 119 } 120 121 public String getContent() { 122 return content; 123 } 124 125 public String getNameEncoded() { 126 return snip.getNameEncoded() + url; 127 } 128 129 public String toXML() { 130 return getXMLContent(); 131 } 132 133 public String getXMLContent() { 134 RenderEngine engine = (RenderEngine) Components.getContainer().getComponentInstance(Components.DEFAULT_ENGINE); 135 RenderContext context = new SnipRenderContext(snip, SnipSpaceFactory.getInstance()); 136 context.setParameters(Application.get().getParameters()); 137 return engine.render(content, context); 138 } 139 140 public void handle(HttpServletRequest request) { 142 return; 143 } 144 145 public String getLink() { 146 return null; 147 } 148 149 public String getOwner() { 150 return snip.getOwner(); 151 } 152 153 public Writer appendTo(Writer s) throws IOException { 154 return snip.appendTo(s); 155 } 156 157 public Access getAccess() { 158 return snip.getAccess(); 159 } 160 161 public boolean isOwner(User user) { 162 return snip.isOwner(user); 163 } 164 165 public Modified getModified() { 166 return snip.getModified(); 167 } 168 169 public boolean isWeblog() { 170 return snip.isWeblog(); 171 } 172 173 public boolean isNotWeblog() { 174 return snip.isNotWeblog(); 175 } 176 177 public void addPermission(String permission, String role) { 178 return; 179 } 180 181 public void setPermissions(Permissions permissions) { 182 return; 183 } 184 185 public Permissions getPermissions() { 186 return snip.getPermissions(); 187 } 188 189 public String getOUser() { 190 return snip.getOUser(); 191 } 192 193 public void setOUser(User oUser) { 194 return; 195 } 196 197 public void setOUser(String oUser) { 198 return; 199 } 200 201 public Attachments getAttachments() { 202 return snip.getAttachments(); 203 } 204 205 public void setAttachments(Attachments attachments) { 206 return; 207 } 208 209 public Labels getLabels() { 210 return snip.getLabels(); 211 } 212 213 public void setLabels(Labels labels) { 214 return; 215 } 216 217 public Links getBackLinks() { 218 return snip.getBackLinks(); 219 } 220 221 public Links getSnipLinks() { 222 return snip.getSnipLinks(); 223 } 224 225 public void setBackLinks(Links backLinks) { 226 return; 227 } 228 229 public void setSnipLinks(Links snipLinks) { 230 return; 231 } 232 233 public int getViewCount() { 234 return snip.getViewCount(); 235 } 236 237 public void setViewCount(int count) { 238 return; 239 } 240 241 public int incViewCount() { 242 return snip.getViewCount(); 243 } 244 245 public Timestamp getCTime() { 246 return snip.getCTime(); 247 } 248 249 public void setCTime(Timestamp cTime) { 250 return; 251 } 252 253 public Timestamp getMTime() { 254 return snip.getMTime(); 255 } 256 257 public void setMTime(Timestamp mTime) { 258 return; 259 } 260 261 public String getCUser() { 262 return snip.getCUser(); 263 } 264 265 public void setCUser(User cUser) { 266 return; 267 } 268 269 public void setCUser(String cUser) { 270 return; 271 } 272 273 public String getMUser() { 274 return snip.getMUser(); 275 } 276 277 public void setMUser(User mUser) { 278 return; 279 } 280 281 public void setMUser(String mUser) { 282 return; 283 } 284 285 public List getChildren() { 286 return snip.getChildren(); 287 } 288 289 public void setCommentedSnip(Snip comment) { 290 return; 291 } 292 293 public Snip getCommentedSnip() { 294 return snip.getCommentedSnip(); 295 } 296 297 public boolean isComment() { 298 return snip.isComment(); 299 } 300 301 public Comments getComments() { 302 return snip.getComments(); 303 } 304 305 public List getChildrenDateOrder() { 306 return snip.getChildrenDateOrder(); 307 } 308 309 public List getChildrenModifiedOrder() { 310 return snip.getChildrenModifiedOrder(); 311 } 312 313 public void addSnip(Snip snip) { 314 return; 315 } 316 317 public void removeSnip(Snip snip) { 318 return; 319 } 320 321 public Snip getParent() { 322 return snip.getParent(); 323 } 324 325 public void setDirectParent(Snip parentSnip) { 326 return; 327 } 328 329 public void setParent(Snip parentSnip) { 330 return; 331 } 332 333 public String getShortName() { 334 return title; 335 } 336 337 public void setName(String name) { 338 return; 339 } 340 341 public void setContent(String content) { 342 return; 343 } 344 345 public String getAttachmentString() { 346 return snip.getAttachmentString(); 347 } 348 349 public Snip copy(String newName) { 350 return new RssSnip(snip, content, title, url); 351 } 352 } 353 | Popular Tags |