org.apache.abdera.factory.Factory.newFeed()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.apache.abdera.factory.Factory.newFeed()方法的一些代码示例,展示了Factory.newFeed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Factory.newFeed()方法的具体详情如下:
包路径:org.apache.abdera.factory.Factory
类名称:Factory
方法名:newFeed

Factory.newFeed介绍

[英]Create a new Feed element. A new Document containing the Feed will be created automatically
[中]创建一个新的提要元素。将自动创建包含提要的新文档

代码示例

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

/**
 * Create a new Feed instance.  This is a convenience shortcut for
 * <code>abdera.getFactory().newFeed()</code>
 * @return A newly created feed element
 */
public Feed newFeed() {
 return getFactory().newFeed();
}

代码示例来源:origin: org.apache.abdera/abdera-core

/**
 * Create a new Feed instance. This is a convenience shortcut for <code>abdera.getFactory().newFeed()</code>
 * 
 * @return A newly created feed element
 */
public Feed newFeed() {
  return getFactory().newFeed();
}

代码示例来源:origin: apache/cxf

protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass)
  throws Exception {
  Feed feed = factory.newFeed();
  boolean writerUsed = buildFeed(feed, o, pojoClass);
  if (feed.getEntries().size() > 0) {
    return feed;
  }
  String methodName = getCollectionMethod(o.getClass(), true);
  Object collection = null;
  Method m = null;
  try {
    m = o.getClass().getMethod(methodName, new Class[]{});
    collection = m.invoke(o, new Object[]{});
  } catch (Exception ex) {
    reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex);
  }
  setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(),
             m.getGenericReturnType(), writerUsed);
  return feed;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-extension-providers

protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass)
  throws Exception {
  Feed feed = factory.newFeed();
  boolean writerUsed = buildFeed(feed, o, pojoClass);
  if (feed.getEntries().size() > 0) {
    return feed;
  }
  String methodName = getCollectionMethod(o.getClass(), true);
  Object collection = null;
  Method m = null;
  try {
    m = o.getClass().getMethod(methodName, new Class[]{});
    collection = m.invoke(o, new Object[]{});
  } catch (Exception ex) {
    reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex);
  }
  setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(),
             m.getGenericReturnType(), writerUsed);
  return feed;
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass) 
  throws Exception {
  
  Feed feed = factory.newFeed();
  
  boolean writerUsed = buildFeed(feed, o, pojoClass);
  
  if (feed.getEntries().size() > 0) {
    return feed;
  }
  
  String methodName = getCollectionMethod(o.getClass(), true);
  Object collection = null;
  Method m = null;
  try {
    m = o.getClass().getMethod(methodName, new Class[]{});
    collection = m.invoke(o, new Object[]{});
  } catch (Exception ex) {
    reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex);
  }
  
  setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(), 
             m.getGenericReturnType(), writerUsed);
  return feed;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-management-web

private Feed createFeed(Format format, List<LogRecord> records) {
  
  Feed feed = factory.newFeed();
  List<Entry> entries = createEntries(format, records);
  for (Entry entry : entries) {
    feed.addEntry(entry);
  }
  setDefaultFeedProperties(feed, records);
  return feed;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-management-web

private Feed createFeedWithSingleEntry(Format format, List<LogRecord> records) {
  
  Feed feed = factory.newFeed();
  feed.addEntry(createEntryFromList(format, records));
  setDefaultFeedProperties(feed, records);
  return feed;
}

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

@Override
protected void runTest() throws Throwable {
  Feed feed = abdera.getFactory().newFeed();
  Entry entry = feed.addEntry();
  Element addedChild = addChild(feed);
  Element child = feed.getFirstChild();
  // Entries must come after any other type of child elements
  assertThat(child).isSameAs(addedChild);
  assertThat(child.getNextSibling()).isSameAs(entry);
}

代码示例来源:origin: org.dataconservancy.dcs/dcs-ingest-deposit

Feed feed = abdera.getFactory().newFeed();
try {
  feed.setId(idBase + URLEncoder.encode(depositID, "UTF-8"));

代码示例来源:origin: org.fuzzydb.atom/org.fuzzydb.abdera.util

private Document<Feed> init_feed_doc(Abdera abdera) {
  Factory factory = abdera.getFactory();
  Feed feed = factory.newFeed();
  try {
    feed.setId("tag:example.org,2006:feed");
    feed.setTitle("Simple");
    feed.setUpdated(new Date());
    feed.addLink("");
    feed.addLink("", "self");
    feed.addAuthor("Simple");
  } catch (Exception e) {
    e.printStackTrace();
  } // FIXME: Document this exception
  return feed.getDocument();
}

代码示例来源:origin: org.xcmis/xcmis-restatom

/**
* {@inheritDoc}
*/
@Override
protected Feed createFeedBase(RequestContext request) throws ResponseContextException
{
 Factory factory = request.getAbdera().getFactory();
 Feed feed = factory.newFeed();
 feed.setId(getId(request));
 feed.setTitle(getTitle(request));
 feed.addAuthor(getAuthor(request));
 feed.setUpdated(AtomUtils.getAtomDate(Calendar.getInstance()));
 // Service link.
 feed.addLink(getServiceLink(request), AtomCMIS.LINK_SERVICE, AtomCMIS.MEDIATYPE_ATOM_SERVICE, null, null, -1);
 Map<String, String> params = new HashMap<String, String>();
 params.put("repoid", getRepositoryId(request));
 params.put("atomdoctype", "types");
 params.put("id", request.getTarget().getParameter("typeid"));
 String self = request.absoluteUrlFor(TargetType.ENTRY, params);
 feed.addLink(self, AtomCMIS.LINK_SELF, AtomCMIS.MEDIATYPE_ATOM_FEED, null, null, -1);
 return feed;
}

代码示例来源:origin: org.apache.abdera/abdera-server

/**
 * Create the base feed for the requested collection.
 */
protected Feed createFeedBase(RequestContext request) throws ResponseContextException {
  Factory factory = request.getAbdera().getFactory();
  Feed feed = factory.newFeed();
  feed.setId(getId(request));
  feed.setTitle(getTitle(request));
  feed.addLink("");
  feed.addLink("", "self");
  feed.addAuthor(getAuthor(request));
  feed.setUpdated(new Date());
  return feed;
}

代码示例来源:origin: apache/cxf

private Feed doGetBookAsFeed(@Context UriInfo uParam) {
  Factory factory = Abdera.getNewFactory();
  Feed f = factory.newFeed();
  f.setBaseUri(uParam.getAbsolutePath().toString());
  f.setTitle("Collection of Books");
  f.setId("http://www.books.com");
  f.addAuthor("BookStore Management Company");
  try {
    for (Book b : books.values()) {
      Entry e = AtomUtils.createBookEntry(factory, b);
      f.addEntry(e);
    }
  } catch (Exception ex) {
    // ignore
  }
  return f;
}

代码示例来源:origin: org.xcmis/xcmis-restatom

/**
* {@inheritDoc}
*/
@Override
protected Feed createFeedBase(RequestContext request) throws ResponseContextException
{
 Factory factory = request.getAbdera().getFactory();
 Feed feed = factory.newFeed();
 feed.setId(getId(request));
 feed.setTitle(getTitle(request));
 feed.addAuthor(getAuthor(request));
 feed.setUpdated(AtomUtils.getAtomDate(Calendar.getInstance()));
 feed.addLink(getServiceLink(request), "service", "application/atomsvc+xml", null, null, -1);
 return feed;
}

代码示例来源:origin: org.xcmis/xcmis-restatom

/**
* {@inheritDoc}
*/
@Override
protected Feed createFeedBase(RequestContext request) throws ResponseContextException
{
 Factory factory = request.getAbdera().getFactory();
 Feed feed = factory.newFeed();
 feed.setId(getId(request));
 feed.setTitle(getTitle(request));
 feed.addAuthor(getAuthor(request));
 // Updated is incorrect when pass Date.
 // Abdera uses Calendar.getInstance(TimeZone.getTimeZone("GMT"))
 // See org.apache.abdera.model.AtomDate .
 feed.setUpdated(AtomUtils.getAtomDate(Calendar.getInstance()));
 feed.addLink(getServiceLink(request), "service", "application/atomsvc+xml", null, null, -1);
 return feed;
}

代码示例来源:origin: org.xcmis/xcmis-restatom

/**
  * {@inheritDoc}
  */
  @Override
  protected Feed createFeedBase(RequestContext request) throws ResponseContextException
  {
   Factory factory = request.getAbdera().getFactory();
   Feed feed = factory.newFeed();
   feed.setId(getId(request));
   feed.setTitle(getTitle(request));
   feed.addAuthor(getAuthor(request));
   feed.setUpdated(AtomUtils.getAtomDate(Calendar.getInstance()));
   feed.addLink(getServiceLink(request), AtomCMIS.LINK_SERVICE, AtomCMIS.MEDIATYPE_ATOM_SERVICE, null, null, -1);
   return feed;
  }
}

代码示例来源:origin: org.xcmis/xcmis-restatom

/**
* {@inheritDoc}
*/
@Override
protected Feed createFeedBase(RequestContext request) throws ResponseContextException
{
 Factory factory = request.getAbdera().getFactory();
 Feed feed = factory.newFeed();
 feed.setId(getId(request));
 feed.setTitle(getTitle(request));
 feed.addAuthor(getAuthor(request));
 // Updated is incorrect when pass Date.
 // Abdera uses Calendar.getInstance(TimeZone.getTimeZone("GMT"))
 // See org.apache.abdera.model.AtomDate .
 feed.setUpdated(AtomUtils.getAtomDate(Calendar.getInstance()));
 feed.addLink(getServiceLink(request), "service", "application/atomsvc+xml", null, null, -1);
 return feed;
}

代码示例来源:origin: org.xcmis/xcmis-restatom

/**
* {@inheritDoc}
*/
@Override
protected Feed createFeedBase(RequestContext request) throws ResponseContextException
{
 Factory factory = request.getAbdera().getFactory();
 Feed feed = factory.newFeed();
 feed.setId(getId(request));
 feed.setTitle(getTitle(request));
 feed.addAuthor(getAuthor(request));
 // Updated is incorrect when pass Date.
 // Abdera uses Calendar.getInstance(TimeZone.getTimeZone("GMT"))
 // See org.apache.abdera.model.AtomDate .
 feed.setUpdated(AtomUtils.getAtomDate(Calendar.getInstance()));
 feed.addLink(getServiceLink(request), "service", "application/atomsvc+xml", null, null, -1);
 return feed;
}

代码示例来源:origin: org.xcmis/xcmis-restatom

/**
* {@inheritDoc}
*/
@Override
protected Feed createFeedBase(RequestContext request) throws ResponseContextException
{
 Factory factory = request.getAbdera().getFactory();
 Feed feed = factory.newFeed();
 feed.setId(getId(request));
 feed.setTitle(getTitle(request));
 feed.addAuthor(getAuthor(request));
 // Updated is incorrect when pass Date.
 // Abdera uses Calendar.getInstance(TimeZone.getTimeZone("GMT"))
 // See org.apache.abdera.model.AtomDate .
 feed.setUpdated(AtomUtils.getAtomDate(Calendar.getInstance())); // TODO proper date
 String service = getServiceLink(request);
 feed.addLink(service, AtomCMIS.LINK_SERVICE, AtomCMIS.MEDIATYPE_ATOM_SERVICE, null, null, -1);
 String self = getSelfLink(getId(request), request);
 feed.addLink(self, AtomCMIS.LINK_SELF, AtomCMIS.MEDIATYPE_ATOM_FEED, null, null, -1);
 String via = getObjectLink(getId(request), request);
 feed.addLink(via, AtomCMIS.LINK_VIA, AtomCMIS.MEDIATYPE_ATOM_ENTRY, null, null, -1);
 return feed;
}

代码示例来源:origin: org.apache.abdera/abdera-extensions-opensearch

private Feed createFeed(RequestContext searchRequest, Map<String, String> parameters, List<T> searchResults) {
    Factory factory = searchRequest.getAbdera().getFactory();
    Feed feed = factory.newFeed();
    feed.setId(this.getOpenSearchFeedId(searchRequest));
    feed.setTitle(this.getOpenSearchFeedTitle(searchRequest));
    feed.addAuthor(this.getOpenSearchFeedAuthor(searchRequest));
    feed.setUpdated(this.getOpenSearchFeedUpdatedDate(searchRequest));
    feed.addLink(searchRequest.getUri().toString(), "self");
    int totalResults = this.getOpenSearchFeedTotalResults(searchRequest, parameters, searchResults);
    if (totalResults > -1) {
      ((IntegerElement)feed.addExtension(OpenSearchConstants.TOTAL_RESULTS)).setValue(totalResults);
    }
    int itemsPerPage = this.getOpenSearchFeedItemsPerPage(searchRequest, parameters, searchResults);
    if (itemsPerPage > -1) {
      ((IntegerElement)feed.addExtension(OpenSearchConstants.ITEMS_PER_PAGE)).setValue(itemsPerPage);
    }
    int startIndex = this.getOpenSearchFeedStartIndex(searchRequest, parameters, searchResults);
    if (startIndex > -1) {
      ((IntegerElement)feed.addExtension(OpenSearchConstants.START_INDEX)).setValue(startIndex);
    }
    for (T entity : searchResults) {
      Entry entry = factory.newEntry();
      this.fillEntry(entry, entity);
      feed.addEntry(entry);
    }
    this.postProcess(feed, searchRequest, parameters, searchResults);
    return feed;
  }
}

相关文章