本文整理汇总了Java中com.rometools.rome.feed.synd.SyndEntryImpl类的典型用法代码示例。如果您正苦于以下问题:Java SyndEntryImpl类的具体用法?Java SyndEntryImpl怎么用?Java SyndEntryImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SyndEntryImpl类属于com.rometools.rome.feed.synd包,在下文中一共展示了SyndEntryImpl类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSyndEntry
import com.rometools.rome.feed.synd.SyndEntryImpl; //导入依赖的package包/类
protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {
final SyndEntryImpl syndEntry = new SyndEntryImpl();
if (preserveWireItem) {
syndEntry.setWireEntry(item);
}
syndEntry.setModules(ModuleUtils.cloneModules(item.getModules()));
final List<Element> foreignMarkup = item.getForeignMarkup();
if (!foreignMarkup.isEmpty()) {
syndEntry.setForeignMarkup(foreignMarkup);
}
syndEntry.setUri(item.getUri());
syndEntry.setLink(item.getLink());
syndEntry.setTitle(item.getTitle());
syndEntry.setLink(item.getLink());
syndEntry.setSource(createSource(item.getSource()));
return syndEntry;
}
示例2: asRss
import com.rometools.rome.feed.synd.SyndEntryImpl; //导入依赖的package包/类
public SyndEntry asRss() {
SyndEntry entry = new SyndEntryImpl();
entry.setUri(getGuid());
entry.setTitle(getTitle());
entry.setAuthor(getAuthor());
SyndContentImpl content = new SyndContentImpl();
content.setValue(getContent());
entry.setContents(Arrays.<SyndContent> asList(content));
if (getEnclosureUrl() != null) {
SyndEnclosureImpl enclosure = new SyndEnclosureImpl();
enclosure.setType(getEnclosureType());
enclosure.setUrl(getEnclosureUrl());
entry.setEnclosures(Arrays.<SyndEnclosure> asList(enclosure));
}
entry.setLink(getUrl());
entry.setPublishedDate(getDate());
return entry;
}
示例3: setUp
import com.rometools.rome.feed.synd.SyndEntryImpl; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
url = "http://" + rsg.generate(10);
uri = rsg.generate(10);
opdsPath = rsg.generate(10);
extLibrary = new ExtLibrary();
extLibrary.setUrl(url);
extLibrary.setOpdsPath(opdsPath);
bookService = mock(BookService.class);
connectionService = mock(ExtLibConnection.class);
extLib = createExtLib(extLibrary);
syndFeed = new SyndFeedImpl();
syndFeed.setTitle(rsg.generate(10));
syndEntry = new SyndEntryImpl();
syndEntry.setUri(rsg.generate(10));
syndEntry.setTitle(rsg.generate(10));
syndLink = new SyndLinkImpl();
syndLink.setType("profile=opds-catalog");
syndLink.setHref(rsg.generate(10));
syndLink.setRel(rsg.generate(10));
syndEntry.setLinks(Collections.singletonList(syndLink));
syndContent = new SyndContentImpl();
syndContent.setType(rsg.generate(10));
syndContent.setValue(rsg.generate(10));
syndContent.setMode("xml");
syndEntry.setContents(Collections.singletonList(syndContent));
syndFeed.setEntries(Collections.singletonList(syndEntry));
when(connectionService.getData(eq(uri), any())).thenReturn(syndFeed);
}
示例4: writeRevisionsFeed
import com.rometools.rome.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private void writeRevisionsFeed(HttpServletRequest request, HttpServletResponse response, ServiceMap serviceMap) throws IOException, FeedException, ServiceException, PublicInterfaceNotFoundException {
long poid = Long.parseLong(request.getParameter("poid"));
SProject sProject = serviceMap.getServiceInterface().getProjectByPoid(poid);
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType(FEED_TYPE);
feed.setTitle("BIMserver.org revisions feed for project '" + sProject.getName() + "'");
feed.setLink(request.getContextPath());
feed.setDescription("This feed represents all the revisions of project '" + sProject.getName() + "'");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
try {
List<SRevision> allRevisionsOfProject = serviceMap.getServiceInterface().getAllRevisionsOfProject(poid);
Collections.sort(allRevisionsOfProject, new SRevisionIdComparator(false));
for (SRevision sVirtualRevision : allRevisionsOfProject) {
SUser user = serviceMap.getServiceInterface().getUserByUoid(sVirtualRevision.getUserId());
SyndEntry entry = new SyndEntryImpl();
entry.setTitle("Revision " + sVirtualRevision.getOid());
entry.setLink(request.getContextPath() + "/revision.jsp?poid=" + sVirtualRevision.getOid() + "&roid=" + sVirtualRevision.getOid());
entry.setPublishedDate(sVirtualRevision.getDate());
SyndContent description = new SyndContentImpl();
description.setType("text/html");
description.setValue("<table><tr><td>User</td><td>" + user.getUsername() + "</td></tr><tr><td>Comment</td><td>" + sVirtualRevision.getComment()
+ "</td></tr></table>");
entry.setDescription(description);
entries.add(entry);
}
} catch (ServiceException e) {
LOGGER.error("", e);
}
feed.setEntries(entries);
SyndFeedOutput output = new SyndFeedOutput();
output.output(feed, response.getWriter());
}
示例5: writeCheckoutsFeed
import com.rometools.rome.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private void writeCheckoutsFeed(HttpServletRequest request, HttpServletResponse response, ServiceMap serviceMap) throws ServiceException, IOException, FeedException, PublicInterfaceNotFoundException {
long poid = Long.parseLong(request.getParameter("poid"));
SProject sProject = serviceMap.getServiceInterface().getProjectByPoid(poid);
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType(FEED_TYPE);
feed.setTitle("BIMserver.org checkouts feed for project '" + sProject.getName() + "'");
feed.setLink(request.getContextPath());
feed.setDescription("This feed represents all the checkouts of project '" + sProject.getName() + "'");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
try {
List<SCheckout> allCheckoutsOfProject = serviceMap.getServiceInterface().getAllCheckoutsOfProjectAndSubProjects(poid);
for (SCheckout sCheckout : allCheckoutsOfProject) {
SRevision revision = serviceMap.getServiceInterface().getRevision(sCheckout.getRevision().getOid());
SProject project = serviceMap.getServiceInterface().getProjectByPoid(sCheckout.getProjectId());
SUser user = serviceMap.getServiceInterface().getUserByUoid(sCheckout.getUserId());
SyndEntry entry = new SyndEntryImpl();
entry.setTitle("Checkout on " + project.getName() + ", revision " + revision.getId());
entry.setLink(request.getContextPath() + "/project.jsp?poid=" + sProject.getOid());
entry.setPublishedDate(sCheckout.getDate());
SyndContent description = new SyndContentImpl();
description.setType("text/plain");
description
.setValue("<table><tr><td>User</td><td>" + user.getUsername() + "</td></tr><tr><td>Revision</td><td>" + sCheckout.getRevision().getOid() + "</td></tr></table>");
entry.setDescription(description);
entries.add(entry);
}
} catch (UserException e) {
LOGGER.error("", e);
}
feed.setEntries(entries);
SyndFeedOutput output = new SyndFeedOutput();
output.output(feed, response.getWriter());
}
示例6: testGenerate
import com.rometools.rome.feed.synd.SyndEntryImpl; //导入依赖的package包/类
public void testGenerate() throws IOException, FeedException {
final SyndFeed feed = getSyndFeed("thr/threading-main.xml");
List<SyndEntry> entries = feed.getEntries();
// create a new "root" entry that the next entry will reference to
SyndEntry newRootEntry = new SyndEntryImpl();
newRootEntry.setTitle("New, 2nd root entry");
newRootEntry.setUri("tag:example.org,2005:2");
newRootEntry.setLink("http://www.example.org/entries/2");
entries.add(newRootEntry);
// create a new reply entry that will reference the new root entry
SyndEntry newReplyEntry = new SyndEntryImpl();
newReplyEntry.setTitle("New test reply entry");
newReplyEntry.setUri("tag:example.org,2005:2,1");
ThreadingModule threadingModule = new ThreadingModuleImpl();
threadingModule.setRef("tag:example.org,2005:2");
threadingModule.setType("application/xhtml+xml");
threadingModule.setHref("http://www.example.org/entries/2");
threadingModule.setSource("http://example.org/entries/2");
newReplyEntry.getModules().add(threadingModule);
entries.add(newReplyEntry);
File outputFile = new File("target/threading-testGenerate.xml");
final SyndFeedOutput output = new SyndFeedOutput();
output.output(feed, outputFile);
// read back in and validate
final SyndFeed generatedFeed = getSyndFeed(outputFile);
SyndEntry generatedReplyEntry = generatedFeed.getEntries().get(3);
assertNotNull(generatedReplyEntry);
ThreadingModule generatedReplyThreadingModule = (ThreadingModule) generatedReplyEntry.getModule(ThreadingModule.URI);
assertEquals("tag:example.org,2005:2", generatedReplyThreadingModule.getRef());
assertEquals("application/xhtml+xml", generatedReplyThreadingModule.getType());
assertEquals("http://www.example.org/entries/2", generatedReplyThreadingModule.getHref());
assertEquals("http://example.org/entries/2", generatedReplyThreadingModule.getSource());
}
示例7: testCopiedFeedEntryCategories
import com.rometools.rome.feed.synd.SyndEntryImpl; //导入依赖的package包/类
public void testCopiedFeedEntryCategories() throws Exception {
for (final SyndEntry entry : getCachedSyndFeed().getEntries()) {
final SyndEntry copiedEntry = new SyndEntryImpl();
copiedEntry.copyFrom(entry);
checkEntryCategories(copiedEntry.getCategories());
}
}
示例8: checkSyndEntry
import com.rometools.rome.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private void checkSyndEntry(SyndEntryImpl syndEntry, OPDSEntryI entry) {
assertEquals("Entry Title", syndEntry.getTitle(), entry.getTitle().getObjs()[0]);
assertEquals("Entry Id", syndEntry.getUri(), entry.getId());
}