本文整理了Java中org.apache.abdera.model.Feed.addEntry()
方法的一些代码示例,展示了Feed.addEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feed.addEntry()
方法的具体详情如下:
包路径:org.apache.abdera.model.Feed
类名称:Feed
方法名:addEntry
[英]Adds a new Entry to the end of the Feeds collection of entries
[中]将新条目添加到条目提要集合的末尾
代码示例来源:origin: apache/cxf
protected void setFeedFromCollection(Factory factory,
Feed feed,
Object wrapper,
Class<?> wrapperCls,
Object collection,
Class<?> collectionCls,
Type collectionType,
boolean writerUsed) throws Exception {
//CHECKSTYLE:ON
Object[] arr = collectionCls.isArray() ? (Object[])collection : ((Collection<?>)collection).toArray();
Class<?> memberClass = InjectionUtils.getActualType(collectionType);
for (Object o : arr) {
Entry entry = createEntryFromObject(factory, o, memberClass);
feed.addEntry(entry);
}
if (!writerUsed) {
setFeedProperties(factory, feed, wrapper, wrapperCls, collection, collectionCls, collectionType);
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-rs-extension-providers
protected void setFeedFromCollection(Factory factory,
Feed feed,
Object wrapper,
Class<?> wrapperCls,
Object collection,
Class<?> collectionCls,
Type collectionType,
boolean writerUsed) throws Exception {
//CHECKSTYLE:ON
Object[] arr = collectionCls.isArray() ? (Object[])collection : ((Collection<?>)collection).toArray();
Class<?> memberClass = InjectionUtils.getActualType(collectionType);
for (Object o : arr) {
Entry entry = createEntryFromObject(factory, o, memberClass);
feed.addEntry(entry);
}
if (!writerUsed) {
setFeedProperties(factory, feed, wrapper, wrapperCls, collection, collectionCls, collectionType);
}
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
protected void setFeedFromCollection(Factory factory,
Feed feed,
Object wrapper,
Class<?> wrapperCls,
Object collection,
Class<?> collectionCls,
Type collectionType,
boolean writerUsed) throws Exception {
//CHECKSTYLE:ON
Object[] arr = collectionCls.isArray() ? (Object[])collection : ((Collection<?>)collection).toArray();
Class<?> memberClass = InjectionUtils.getActualType(collectionType);
for (Object o : arr) {
Entry entry = createEntryFromObject(factory, o, memberClass);
feed.addEntry(entry);
}
if (!writerUsed) {
setFeedProperties(factory, feed, wrapper, wrapperCls, collection, collectionCls, collectionType);
}
}
代码示例来源: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.apache.abdera/abdera-filesystem
private void getEntries(RequestContext request, Feed feed, File root) {
File[] files = root.listFiles();
Arrays.sort(files, sorter);
int length = ProviderHelper.getPageSize(request, "count", 25);
int offset = ProviderHelper.getOffset(request, "page", length);
String _page = request.getParameter("page");
int page = (_page != null) ? Integer.parseInt(_page) : 0;
addPagingLinks(request, feed, page, length);
if (offset > files.length)
return;
for (int n = offset; n < offset + length && n < files.length; n++) {
File file = files[n];
Entry entry = getEntry(file);
feed.addEntry((Entry)entry.clone());
}
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-ingest-deposit
feed.addEntry(getEntry(event));
代码示例来源:origin: net.sf.taverna.t2.activities/interaction-activity
private void getEntries(final RequestContext request, final Feed feed,
final File root) {
final File[] files = root.listFiles();
Arrays.sort(files, sorter);
final int length = ProviderHelper.getPageSize(request, "count", 25);
final int offset = ProviderHelper.getOffset(request, "page", length);
final String _page = request.getParameter("page");
final int page = (_page != null) ? Integer.parseInt(_page) : 0;
this.addPagingLinks(request, feed, page, length);
if (offset > files.length) {
return;
}
for (int n = offset; (n < (offset + length)) && (n < files.length); n++) {
final File file = files[n];
try {
final Entry entry = this.getEntry(file);
feed.addEntry((Entry) entry.clone());
} catch (final Exception e) {
// Do nothing
}
}
}
代码示例来源:origin: DSpace/DSpace
public InputStream disseminate(Context context, Item item)
throws DSpaceSwordException, SwordError, SwordServerException {
try {
Abdera abdera = new Abdera();
Feed feed = abdera.newFeed();
this.addMetadata(feed, item);
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles) {
if (Constants.CONTENT_BUNDLE_NAME.equals(bundle.getName())) {
List<Bitstream> bitstreams = bundle
.getBitstreams();
for (Bitstream bitstream : bitstreams) {
Entry entry = feed.addEntry();
this.populateEntry(context, entry,
bitstream);
}
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
feed.writeTo(baos);
return new ByteArrayInputStream(baos.toByteArray());
} catch (IOException e) {
throw new DSpaceSwordException(e);
}
}
代码示例来源:origin: rackerlabs/atom-hopper
@Override
public AdapterResponse<Feed> getFeed(GetFeedRequest getFeedRequest) {
final Feed feed = getFeedRequest.getAbdera().newFeed();
feed.setTitle("A Feed");
feed.addLink(getFeedRequest.urlFor(
new EnumKeyedTemplateParameters<URITemplate>(URITemplate.FEED))).setRel("self");
for (AtomEntry ae : liveFeed.values()) {
feed.addEntry(ae.getEntry());
}
return ResponseBuilder.found(feed);
}
代码示例来源:origin: org.apache.abdera/abdera-server
/**
* Adds the selected entries to the Feed document. By default, this will set the feed's atom:updated element to the
* current date and time
*/
protected void addFeedDetails(Feed feed, RequestContext request) throws ResponseContextException {
feed.setUpdated(new Date());
Iterable<T> entries = getEntries(request);
if (entries != null) {
for (T entryObj : entries) {
Entry e = feed.addEntry();
IRI feedIri = new IRI(getFeedIriForEntry(entryObj, request));
addEntryDetails(request, e, feedIri, entryObj);
if (isMediaEntry(entryObj)) {
addMediaContent(feedIri, e, entryObj, request);
} else {
addContent(e, entryObj, request);
}
}
}
}
代码示例来源:origin: org.xcmis/xcmis-restatom
Entry e = feed.addEntry();
IRI feedIri = new IRI(getFeedIriForEntry(one, request));
addEntryDetails(request, e, feedIri, one);
代码示例来源: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.kie.uberfire/kie-uberfire-social-activities-backend
public static String generate( List<SocialActivitiesEvent> eventTimeline, String type ) {
Abdera abdera = new Abdera();
Feed feed = abdera.newFeed();
feed.setId( "tag:org.uberfire,2014:/"+ type );
feed.setTitle( "Social Activities Feed" );
feed.setUpdated( new Date() );
feed.addAuthor( "Red Hat JBoss" );
for ( SocialActivitiesEvent event : eventTimeline ) {
Entry entry = feed.addEntry();
entry.setTitle( event.getType() );
entry.setSummary( event.getSocialUser().getUserName() + " " + event.toString() );
entry.setUpdated( event.getTimestamp() );
entry.setPublished( event.getTimestamp() );
}
return feed.toString();
}
}
代码示例来源:origin: org.uberfire/uberfire-social-activities-backend
public static String generate(List<SocialActivitiesEvent> eventTimeline,
String type) {
Abdera abdera = new Abdera();
Feed feed = abdera.newFeed();
feed.setId("tag:org.uberfire,2014:/" + type);
feed.setTitle("Social Activities Feed");
feed.setUpdated(new Date());
feed.addAuthor("Red Hat JBoss");
for (SocialActivitiesEvent event : eventTimeline) {
Entry entry = feed.addEntry();
entry.setTitle(event.getType());
entry.setSummary(event.getSocialUser().getUserName() + " " + event.toString());
entry.setUpdated(event.getTimestamp());
entry.setPublished(event.getTimestamp());
}
return feed.toString();
}
}
代码示例来源:origin: kiegroup/appformer
public static String generate(List<SocialActivitiesEvent> eventTimeline,
String type) {
Abdera abdera = new Abdera();
Feed feed = abdera.newFeed();
feed.setId("tag:org.uberfire,2014:/" + type);
feed.setTitle("Social Activities Feed");
feed.setUpdated(new Date());
feed.addAuthor("Red Hat JBoss");
for (SocialActivitiesEvent event : eventTimeline) {
Entry entry = feed.addEntry();
entry.setTitle(event.getType());
entry.setSummary(event.getSocialUser().getUserName() + " " + event.toString());
entry.setUpdated(event.getTimestamp());
entry.setPublished(event.getTimestamp());
}
return feed.toString();
}
}
代码示例来源:origin: DSpace/DSpace
private Feed itemListToFeed(SwordContext sc, List<Item> items,
SwordConfiguration swordConfig)
throws DSpaceSwordException {
SwordConfigurationDSpace config = (SwordConfigurationDSpace) swordConfig;
SwordUrlManager urlManager = config.getUrlManager(
sc.getContext(), config);
Abdera abdera = new Abdera();
Feed feed = abdera.newFeed();
for (Item item : items) {
Entry entry = feed.addEntry();
entry.setId(urlManager.getEditIRI(item).toString());
String title = this.stringMetadata(item, ConfigurationManager
.getProperty("swordv2-server", "title.field"));
title = title == null ? "Untitled" : title;
entry.setTitle(title);
entry.addLink(
urlManager.getContentUrl(item).toString(), "edit-media");
}
return feed;
}
代码示例来源:origin: fcrepo3/fcrepo
private void addAtomManagedDatastream(Feed feed, String contentLocation) throws Exception {
String dsId = "DS";
Entry dsEntry = feed.addEntry();
dsEntry.setId(feed.getId().toString() + "/" + dsId);
Entry dsvEntry = feed.addEntry();
dsvEntry.setId(dsEntry.getId().toString() + "/" + feed.getUpdatedString());
dsEntry.setTitle(feed.getTitle());
dsEntry.setUpdated(feed.getUpdated());
dsEntry.addLink(dsvEntry.getId().toString(), Link.REL_ALTERNATE);
dsEntry.addCategory(MODEL.STATE.uri, "A", null);
dsEntry.addCategory(MODEL.CONTROL_GROUP.uri, "M", null);
dsEntry.addCategory(MODEL.VERSIONABLE.uri, "true", null);
dsvEntry.setTitle(feed.getTitle());
dsvEntry.setUpdated(feed.getUpdated());
ThreadHelper.addInReplyTo(dsvEntry, dsEntry.getId());
dsvEntry.setSummary("summary");
dsvEntry.setContent(new IRI(contentLocation), "text/plain");
}
代码示例来源: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;
}
}
内容来源于网络,如有侵权,请联系作者删除!