• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Feed类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.abdera.model.Feed的典型用法代码示例。如果您正苦于以下问题:Java Feed类的具体用法?Java Feed怎么用?Java Feed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Feed类属于org.apache.abdera.model包,在下文中一共展示了Feed类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getDocument

import org.apache.abdera.model.Feed; //导入依赖的package包/类
private Document<Feed> getDocument() throws IOException, ParseException {
    if (document == null) {
        if (ObjectHelper.isEmpty(endpoint.getUsername()) || ObjectHelper.isEmpty(endpoint.getPassword())) {
            document = AtomUtils.parseDocument(endpoint.getFeedUri());
        } else {
            document = AtomUtils.parseDocument(endpoint.getFeedUri(), endpoint.getUsername(), endpoint.getPassword());
        }
        Feed root = document.getRoot();
        if (endpoint.isSortEntries()) {
            sortEntries(root);
        }
        list = root.getEntries();
        entryIndex = list.size() - 1;
    }
    return document;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:AtomEntryPollingConsumer.java


示例2: testNoSplitEntries

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Test
public void testNoSplitEntries() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);
    mock.assertIsSatisfied();

    Exchange exchange = mock.getExchanges().get(0);
    Message in = exchange.getIn();
    assertNotNull(in);
    assertTrue(in.getBody() instanceof List);
    assertTrue(in.getHeader(AtomConstants.ATOM_FEED) instanceof Feed);

    Feed feed = in.getHeader(AtomConstants.ATOM_FEED, Feed.class);
    assertEquals("James Strachan", feed.getAuthor().getName());

    List<?> entries = in.getBody(List.class);
    assertEquals(7, entries.size());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:AtomPollingConsumerTest.java


示例3: testFilter

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Test
public void testFilter() throws Exception {
    Document<Feed> doc = AtomUtils.parseDocument("file:src/test/data/feed.atom");
    assertNotNull(doc);

    // timestamp from the feed to use as base
    // 2007-11-13T13:35:25.014Z
    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+1:00"));
    cal.set(2007, Calendar.NOVEMBER, 13, 14, 35, 0);
    EntryFilter filter = new UpdatedDateFilter(cal.getTime());

    List<Entry> entries = doc.getRoot().getEntries();

    // must reverse backwards
    for (int i = entries.size() - 1; i > 0; i--) {
        Entry entry = entries.get(i);
        boolean valid = filter.isValidEntry(null, doc, entry);
        // only the 3 last should be true
        if (i > 3) {
            assertEquals("not valid", false, valid);
        } else {
            assertEquals("valid", true, valid);
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:UpdatedDateFilterTest.java


示例4: getFeed

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Override
@CallCounted
@RolesAllowed(USER)
public Feed getFeed(UriInfo ui) {
	Feed feed = abdera.getFactory().newFeed();
	feed.setTitle("events relating to workflow runs").setLanguage(
			feedLanguage);
	String user = support.getPrincipal().toString()
			.replaceAll("[^A-Za-z0-9]+", "");
	feed.setId(format("urn:taverna-server:%s:%s", uuid, user));
	org.joda.time.DateTime modification = null;
	for (Event e : eventSource.getEvents(support.getPrincipal())) {
		if (modification == null || e.getPublished().isAfter(modification))
			modification = e.getPublished();
		feed.addEntry(e.getEntry(abdera, feedLanguage));
	}
	if (modification == null)
		feed.setUpdated(new Date());
	else
		feed.setUpdated(modification.toDate());
	feed.addLink(ui.getAbsolutePath().toASCIIString(), "self");
	return feed;
}
 
开发者ID:apache,项目名称:incubator-taverna-server,代码行数:24,代码来源:AtomFeed.java


示例5: fetchData

import org.apache.abdera.model.Feed; //导入依赖的package包/类
/**
 * Executes the command
 * @return the feed received from the VLER DAS system
 * @throws VlerDasException if an unsuccessful response is received from the VLER DAS webservice call
 */
public Document<Feed> fetchData() throws VlerDasException {
    String pid = getPid(query.getPatientIds());
    String url = constructUrl(pid);

    ClientResponse response = doAbderaRequest(url);
    Document<Feed> vlerData = null;

    if (response.getType() == ResponseType.SUCCESS) {
        vlerData = response.getDocument();
    } else {
        LOGGER.warn("Received failed response from VLER DAS service: " + response.getStatus() + "/"
                + response.getStatusText() + ", URI=\"" + response.getUri() + "\"");
        throw new VlerDasException("Unable to fetch patient data from VLER DAS for ICN: " + pid);
    }

    return vlerData;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:23,代码来源:VlerDasDataFetchCommand.java


示例6: getVistaDataChunks

import org.apache.abdera.model.Feed; //导入依赖的package包/类
/**
 * Retrieve DoD vital data and format it into a VistaChunk to be included into the set of data returned to the system.
 *
 * @param document the document
 * @param patientIds Patient identifier bean.
 * @return The VistaDataChunk list that contains the vital data.
 */
public static List<VistaDataChunk> getVistaDataChunks(Document<Feed> document, PatientIds patientIds) {
    LOG.debug("started VlerDasVitalsMapper.getVistaDataChunks");

    List<VistaDataChunk> oaVitalChunk = new ArrayList<VistaDataChunk>();

    List<VitalSign> oaVital = transformFeed(document, patientIds);

    if ((oaVital != null) && (oaVital.size() > 0)) {

        int iNumVitals = oaVital.size();
        int iCurVitalIdx = 1;       // One based index
        for (VitalSign oVital : oaVital) {
            VistaDataChunk oVitalChunk = transformVitalChunk(oVital, patientIds, iNumVitals, iCurVitalIdx);
            if (oVitalChunk != null) {
                oaVitalChunk.add(oVitalChunk);
                iCurVitalIdx++;
            }
        }
    }

    LOG.debug("finished VlerDasVitalsMapper.getVistaDataChunks");
    return oaVitalChunk;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:31,代码来源:VlerDasVitalsMapper.java


示例7: retrieveFeed

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Feed retrieveFeed(RequestContext request) throws FeedServerAdapterException {
  SqlMapClient client = getSqlMapClient();
  String queryId = config.getFeedId() + "-get-feed";
  List<Map<String, Object>> rows;
  try {
    rows = client.queryForList(queryId, getRequestParams(request));
  } catch (SQLException e) {
    throw new FeedServerAdapterException(
        FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
  }
  Feed feed = createFeed();
  ServerConfiguration serverConfig = config.getServerConfiguration();
  if (serverConfig.getFeedNamespacePrefix() != null
      && serverConfig.getFeedNamespacePrefix().length() > 0) {
    feed.declareNS(serverConfig.getFeedNamespace(), serverConfig.getFeedNamespacePrefix());
  }
  for (Map<String, Object> row : rows) {
    createEntryFromProperties(feed, row);
  }
  return feed;
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:24,代码来源:IBatisCollectionAdapter.java


示例8: addPagingLinks

import org.apache.abdera.model.Feed; //导入依赖的package包/类
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");
}
 
开发者ID:apache,项目名称:incubator-taverna-common-activities,代码行数:20,代码来源:HackedFilesystemAdapter.java


示例9: getEntries

import org.apache.abdera.model.Feed; //导入依赖的package包/类
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
		}
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-common-activities,代码行数:23,代码来源:HackedFilesystemAdapter.java


示例10: generate

import org.apache.abdera.model.Feed; //导入依赖的package包/类
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();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:20,代码来源:AtomSocialTimelineConverter.java


示例11: getGuestFeed

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@GET
@Produces(MediaType.APPLICATION_ATOM_XML)
public Feed getGuestFeed(@Context UriInfo uriInfo) {
    Feed feed = abdera.newFeed();

    feed.setId("tag:koenighotze.org,2015:/guest");
    feed.setTitle("Guests");
    feed.setUpdated(new Date());

    final String baseUri = uriInfo.getBaseUri().toString();
    feed.addLink(baseUri + "feed", "self"); // todo self ref
    guestService.getAllGuests().stream().forEach(guest -> {
        Entry entry = feed.addEntry();
        entry.setId(guest.getId() + "");
        entry.setUpdated(from(guest.getLastUpdate().toInstant(UTC)));
        entry.setAttributeValue("Version", guest.getVersion() + "");
        entry.addLink(baseUri + "guests/" + guest.getPublicId());
    });

    return feed;
}
 
开发者ID:koenighotze,项目名称:Hotel-Reservation-Tool,代码行数:22,代码来源:GuestAtomFeed.java


示例12: the_feed_exposes_the_publicid

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Test
public void the_feed_exposes_the_publicid() {
    Guest guest = new Guest("123", "foo", "[email protected]");
    guest.setLastUpdate(now());
    when(abdera.newFeed()).thenReturn(new FOMFeed());
    when(uriInfo.getBaseUri()).thenReturn(create("http://localhost/"));
    when(guestService.getAllGuests()).thenReturn(singletonList(guest));

    GuestAtomFeed guestAtomFeed = new GuestAtomFeed(guestService, abdera);
    Feed guestFeed = guestAtomFeed.getGuestFeed(uriInfo);
    List<Entry> entries = guestFeed.getEntries();

    assertThat(entries).isNotEmpty();
    Entry entry = entries.get(0);
    assertThat(entry.getLinks().get(0).getHref().toASCIIString()).endsWith("/guests/123");
}
 
开发者ID:koenighotze,项目名称:Hotel-Reservation-Tool,代码行数:17,代码来源:GuestAtomFeedTest.java


示例13: listCollectionContents

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Override
public Feed listCollectionContents(IRI collectionIRI, AuthCredentials authCredentials, SwordConfiguration config)
    throws SwordServerException, SwordAuthException, SwordError {
    String collection = MCRSwordUtil.ParseLinkUtil.CollectionIRI.getCollectionNameFromCollectionIRI(collectionIRI);
    String path = collectionIRI.getPath();

    LOGGER.info(MessageFormat.format("List Collection: {0}", collection));

    Feed feed = new Abdera().newFeed();
    if (MCRSword.getCollectionNames().contains(collection)) {
        MCRSwordCollectionProvider collectionProvider = MCRSword.getCollection(collection);

        collectionProvider.getAuthHandler().authentication(authCredentials);
        if (collectionProvider.isVisible()) {
            Integer paginationFromIRI = MCRSwordUtil.ParseLinkUtil.CollectionIRI
                .getPaginationFromCollectionIRI(collectionIRI);
            final int start = (paginationFromIRI - 1) * MCRSwordConstants.MAX_ENTRYS_PER_PAGE;

            collectionProvider.getIDSupplier().get(start, MCRSwordConstants.MAX_ENTRYS_PER_PAGE).stream()
                .map(id -> {
                    try {
                        return collectionProvider.getMetadataProvider().provideListMetadata(id);
                    } catch (SwordError swordError) {
                        LOGGER.warn("Error while creating feed for [{}]! (Will be removed from List)", id);
                        return null;
                    }
                }).filter(Objects::nonNull)
                .forEach(feed::addEntry);

            MCRSwordUtil.BuildLinkUtil.addPaginationLinks(collectionIRI, collection, feed, collectionProvider);
        }

    } else {
        throw new SwordError(UriRegistry.ERROR_BAD_REQUEST, HttpServletResponse.SC_NOT_FOUND,
            "The collection '" + collection + "' does not exist!");
    }

    return feed;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:40,代码来源:MCRSwordCollectionManager.java


示例14: addPaginationLinks

import org.apache.abdera.model.Feed; //导入依赖的package包/类
/**
 * 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");
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:22,代码来源:MCRSwordUtil.java


示例15: createFeed

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Override
protected Object createFeed() throws IOException {
    Document<Feed> document;
    if (ObjectHelper.isEmpty(endpoint.getUsername()) || ObjectHelper.isEmpty(endpoint.getPassword())) {
        document = AtomUtils.parseDocument(endpoint.getFeedUri());
    } else {
        document = AtomUtils.parseDocument(endpoint.getFeedUri(), endpoint.getUsername(), endpoint.getPassword());
    }
    return document.getRoot();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:AtomPollingConsumer.java


示例16: parseDocument

import org.apache.abdera.model.Feed; //导入依赖的package包/类
public static Document<Feed> parseDocument(String uri, String username, String password) throws IOException {
    URL feedUrl = new URL(uri);
    HttpURLConnection httpcon = (HttpURLConnection) feedUrl.openConnection();
    String encoding = Base64.encodeBase64String(username.concat(":").concat(password).getBytes());
    httpcon.setRequestProperty("Authorization", "Basic " + encoding);
    InputStream in = httpcon.getInputStream();
    return parseInputStream(in);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:AtomUtils.java


示例17: parseInputStream

import org.apache.abdera.model.Feed; //导入依赖的package包/类
private static Document<Feed> parseInputStream(InputStream in) throws ParseException {
    Parser parser = getAtomParser();
    // set the thread context loader with the ParserClassLoader
    ClassLoader old = Thread.currentThread().getContextClassLoader();
    try {
        Thread.currentThread().setContextClassLoader(parser.getClass().getClassLoader());
        return parser.parse(in);
    } finally {
        Thread.currentThread().setContextClassLoader(old);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:AtomUtils.java


示例18: toOneLevel

import org.apache.abdera.model.Feed; //导入依赖的package包/类
private static void toOneLevel(Feed feed, ConceptTreeNode rootNode, String globalOutlineId, HashMap<String, String> noteUriToGlobalId) {
    ArrayList<ConceptTreeNode> children = rootNode.getChildren();
    if(children!=null && children.size()>0) {
        for (int i = 0; i < children.size(); i++) {
            Resource child = children.get(i).getConcept();
            ArrayList<ConceptTreeNode> childChildren = children.get(i).children;
            Entry entry = toAtomEntry(feed, new ConceptResource(child), childChildren, globalOutlineId, noteUriToGlobalId);
            feed.addEntry(entry);
            
            toOneLevel(feed,children.get(i), globalOutlineId, noteUriToGlobalId);
        }
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:14,代码来源:Atomizer.java


示例19: getFeed

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Override
@CallCounted
@PerfLogged
@RolesAllowed({ USER, SELF })
public Feed getFeed() throws FilesystemAccessException,
		NoDirectoryEntryException {
	return interactionFeed.getRunFeed(run);
}
 
开发者ID:apache,项目名称:incubator-taverna-server,代码行数:9,代码来源:InteractionFeed.java


示例20: isWriteable

import org.apache.abdera.model.Feed; //导入依赖的package包/类
@Override
public boolean isWriteable(Class<?> type, Type genericType,
		Annotation[] annotations, MediaType mediaType) {
	if (!Feed.class.isAssignableFrom(type))
		return false;
	if (!FEED.isCompatible(mediaType))
		return false;
	if (mediaType.getParameters().containsKey("type"))
		return "feed".equalsIgnoreCase(mediaType.getParameters()
				.get("type"));
	return true;
}
 
开发者ID:apache,项目名称:incubator-taverna-server,代码行数:13,代码来源:FeedHandler.java



注:本文中的org.apache.abdera.model.Feed类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LatLonPoint类代码示例发布时间:2022-05-21
下一篇:
Java DeferredCommand类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap