本文整理了Java中org.apache.abdera.model.Feed.addLink()
方法的一些代码示例,展示了Feed.addLink()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feed.addLink()
方法的具体详情如下:
包路径:org.apache.abdera.model.Feed
类名称:Feed
方法名:addLink
暂无
代码示例来源:origin: org.xcmis/xcmis-restatom
/**
* {@inheritDoc}
*/
@Override
protected void addPageLinks(String changeLogToken, Feed feed, String atomdocType, int maxItems, int skipCount,
int total, boolean hasMore, RequestContext request)
{
Map<String, String> params = new HashMap<String, String>();
params.put("repoid", getRepositoryId(request));
params.put("atomdoctype", atomdocType);
params.put(AtomCMIS.PARAM_CHANGE_LOG_TOKEN, changeLogToken);
// Only next link will be provided. Next link may be provided even
// there is no more change events yet. Client should revisit the
// feed in future to get new set of changes.
if (maxItems != CmisConstants.MAX_ITEMS)
params.put(AtomCMIS.PARAM_MAX_ITEMS, Integer.toString(maxItems));
feed.addLink(request.absoluteUrlFor("feed", params), AtomCMIS.LINK_NEXT, AtomCMIS.MEDIATYPE_ATOM_FEED, null,
null, -1);
}
代码示例来源:origin: rackerlabs/atom-hopper
private void addFeedCurrentLink(Feed hyrdatedFeed, final String baseFeedUri) {
String url = helper.isArchived() ? helper.getCurrentUrl() : baseFeedUri;
hyrdatedFeed.addLink( url, Link.REL_CURRENT);
}
代码示例来源:origin: rackerlabs/atom-hopper
private void addFeedCurrentLink(Feed hyrdatedFeed, final String baseFeedUri) {
String url = helper.isArchived() ? helper.getCurrentUrl() : baseFeedUri;
hyrdatedFeed.addLink( url, Link.REL_CURRENT);
}
代码示例来源:origin: rackerlabs/atom-hopper
private void addFeedCurrentLink(Feed hydratedFeed, final String baseFeedUri) {
String url = helper.isArchived() ? helper.getCurrentUrl() : baseFeedUri;
hydratedFeed.addLink( url, Link.REL_CURRENT);
}
代码示例来源:origin: rackerlabs/atom-hopper
private void addFeedCurrentLink(Feed hyrdatedFeed, final String baseFeedUri) {
String url = helper.isArchived() ? helper.getCurrentUrl() : baseFeedUri;
hyrdatedFeed.addLink( url, Link.REL_CURRENT);
}
代码示例来源:origin: org.xcmis/xcmis-restatom
/**
* {@inheritDoc}
*/
@Override
protected Feed createFeedBase(RequestContext request) throws ResponseContextException
{
Feed feed = super.createFeedBase(request);
// Add required links.
String id = getId(request);
feed.addLink(getChildrenLink(id, request), AtomCMIS.LINK_DOWN, AtomCMIS.MEDIATYPE_ATOM_FEED, null, null, -1);
String descendants = getDescendantsLink(id, request);
if (descendants != null)
{
feed.addLink(descendants, AtomCMIS.LINK_DOWN, AtomCMIS.MEDIATYPE_CMISTREE, null, null, -1);
}
String folderTree = getFolderTreeLink(id, request);
if (folderTree != null)
{
feed.addLink(folderTree, AtomCMIS.LINK_CMIS_FOLDERTREE, AtomCMIS.MEDIATYPE_ATOM_FEED, null, null, -1);
}
return feed;
}
代码示例来源:origin: org.mycore/mycore-sword
/**
* Creates Pagination links
*
* @param collectionIRI IRI of the collection
* @param collection name of the collection
* @param feed the feed where the link will be inserted
* @param collectionProvider {@link MCRSwordCollectionProvider} of the collection (needed to count how much objects)
* @throws SwordServerException when the {@link MCRSwordObjectIDSupplier} throws a exception.
*/
public static void addPaginationLinks(IRI collectionIRI, String collection, Feed feed,
MCRSwordCollectionProvider collectionProvider) throws SwordServerException {
final int lastPage = (int) Math.ceil((double) collectionProvider.getIDSupplier().getCount()
/ (double) MCRSwordConstants.MAX_ENTRYS_PER_PAGE);
Integer currentPage = ParseLinkUtil.CollectionIRI.getPaginationFromCollectionIRI(collectionIRI);
feed.addLink(buildCollectionPaginationLinkHref(collection, 1), "first");
if (lastPage != currentPage) {
feed.addLink(buildCollectionPaginationLinkHref(collection, currentPage + 1), "next");
}
feed.addLink(buildCollectionPaginationLinkHref(collection, lastPage), "last");
}
代码示例来源: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.apache.abdera/abdera-filesystem
private void addPagingLinks(RequestContext request, Feed feed, int currentpage, int count) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("count", count);
params.put("page", currentpage + 1);
String next = paging_template.expand(params);
next = request.getResolvedUri().resolve(next).toString();
feed.addLink(next, "next");
if (currentpage > 0) {
params.put("page", currentpage - 1);
String prev = paging_template.expand(params);
prev = request.getResolvedUri().resolve(prev).toString();
feed.addLink(prev, "previous");
}
params.put("page", 0);
String current = paging_template.expand(params);
current = request.getResolvedUri().resolve(current).toString();
feed.addLink(current, "current");
}
代码示例来源:origin: net.sf.taverna.t2.activities/interaction-activity
private void addPagingLinks(final RequestContext request, final Feed feed,
final int currentpage, final int count) {
final Map<String, Object> params = new HashMap<String, Object>();
params.put("count", count);
params.put("page", currentpage + 1);
String next = paging_template.expand(params);
next = request.getResolvedUri().resolve(next).toString();
feed.addLink(next, "next");
if (currentpage > 0) {
params.put("page", currentpage - 1);
String prev = paging_template.expand(params);
prev = request.getResolvedUri().resolve(prev).toString();
feed.addLink(prev, "previous");
}
params.put("page", 0);
String current = paging_template.expand(params);
current = request.getResolvedUri().resolve(current).toString();
feed.addLink(current, "current");
}
代码示例来源:origin: rackerlabs/atom-hopper
private AdapterResponse<Feed> getFeedHead(GetFeedRequest getFeedRequest,
int pageSize) {
final Abdera abdera = getFeedRequest.getAbdera();
final String searchString = getFeedRequest.getSearchQuery() != null ? getFeedRequest.getSearchQuery() : "";
List<PersistedEntry> persistedEntries = getFeedHead(getFeedRequest.getFeedName(), pageSize, searchString);
Feed hydratedFeed = hydrateFeed(abdera, persistedEntries, getFeedRequest, pageSize);
// Set the last link in the feed head
final String baseFeedUri = decode(getFeedRequest.urlFor(
new EnumKeyedTemplateParameters<URITemplate>(URITemplate.FEED)));
if( !helper.isArchived() ) {
hydratedFeed.addLink(
new StringBuilder().append(baseFeedUri)
.append(MARKER_EQ).append(MOCK_LAST_MARKER)
.append(AND_LIMIT_EQ).append(String.valueOf(pageSize))
.append(AND_SEARCH_EQ).append(urlEncode(searchString))
.append(AND_DIRECTION_EQ_BACKWARD).toString())
.setRel(Link.REL_LAST);
}
return ResponseBuilder.found(hydratedFeed);
}
代码示例来源: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: org.apache.abdera/abdera-filesystem
public ResponseContext getFeed(RequestContext request) {
Feed feed = abdera.newFeed();
feed.setId(config.getServerConfiguration().getServerUri() + "/" + config.getFeedId());
feed.setTitle(config.getFeedTitle());
feed.addAuthor(config.getFeedAuthor());
feed.addLink(config.getFeedUri());
feed.addLink(config.getFeedUri(), "self");
feed.setUpdated(new Date());
getEntries(request, feed, root);
return ProviderHelper.returnBase(feed.getDocument(), 200, null);
}
代码示例来源:origin: net.sf.taverna.t2.activities/interaction-activity
@Override
public ResponseContext getFeed(final RequestContext request) {
final Feed feed = this.abdera.newFeed();
feed.setId(this.config.getServerConfiguration().getServerUri() + "/"
+ this.config.getFeedId());
feed.setTitle(this.config.getFeedTitle());
feed.addAuthor(this.config.getFeedAuthor());
feed.addLink(this.config.getFeedUri());
feed.addLink(this.config.getFeedUri(), "self");
feed.setUpdated(new Date());
this.getEntries(request, feed, this.root);
return ProviderHelper.returnBase(feed.getDocument(), 200, null);
}
代码示例来源: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.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));
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()));
feed.addLink(getServiceLink(request), "service", "application/atomsvc+xml", null, null, -1);
return feed;
}
内容来源于网络,如有侵权,请联系作者删除!