1 25 26 package org.snipsnap.semanticweb.rss; 27 28 import org.snipsnap.snip.Blog; 29 import org.snipsnap.snip.SnipSpaceFactory; 30 import org.snipsnap.snip.Snip; 31 import org.snipsnap.snip.SnipSpace; 32 import org.snipsnap.snip.storage.query.QueryKit; 33 import org.snipsnap.snip.storage.query.Query; 34 import org.snipsnap.app.Application; 35 import org.snipsnap.feeder.Feeder; 36 37 import java.util.List ; 38 39 47 48 public class NewCommentFeeder implements Feeder { 49 private SnipSpace space; 50 private String snipName; 51 private Query commentQuery = new Query() { 52 public boolean fit(Object object) { 53 return isComment((Snip) object); 54 } 55 }; 56 57 public NewCommentFeeder() { 58 this(Application.get().getConfiguration().getStartSnip()); 59 } 60 61 public NewCommentFeeder(String snipName) { 62 this.snipName = snipName; 63 space = SnipSpaceFactory.getInstance(); 64 } 65 66 public String getName() { 67 return "comments"; 68 } 69 70 public List getFeed() { 71 List changed = space.getChanged(); 72 return QueryKit.query(changed, commentQuery); 73 } 74 75 public Snip getContextSnip() { 76 return space.load(snipName); 77 } 78 79 public boolean isComment(Snip snip) { 80 return (snip.getName().indexOf("comment") >=0); 81 } 82 } 83 | Popular Tags |