当前位置: 首页>>代码示例>>Java>>正文


Java Feed.addEntry方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: retrieveFeed

import org.apache.abdera.model.Feed; //导入方法依赖的package包/类
@Override
public Feed retrieveFeed(RequestContext request) {
  Feed feed = createFeed();
  Set<String> keys = entries.keySet();
  for (String s : keys) {
    Entry entry = retrieveEntry(request, s);
    feed.addEntry((Entry) entry.clone());
  }
  return feed;
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:11,代码来源:SampleBasicAdapter.java

示例6: getFeed

import org.apache.abdera.model.Feed; //导入方法依赖的package包/类
@Override
public Feed getFeed(Map<String, Object> attributes) throws UnsupportedOperationException {
    final String baseUri = configuration.getString(PublicApiServiceConfigurationKeys.base_uri);
    final Feed feed = createNewFeed(attributes, baseUri);

    List<Entry> entries = entryBuilder.createEntries(attributes, baseUri);
    for (Entry storedEntry : entries) {
        feed.addEntry(storedEntry);
    }

    return feed;
}
 
开发者ID:citrixsystems,项目名称:pathweaver,代码行数:13,代码来源:AtomFeedPlugin.java

示例7: listCollectionContents

import org.apache.abdera.model.Feed; //导入方法依赖的package包/类
@Override
public Feed listCollectionContents(IRI iri, AuthCredentials authCredentials, SwordConfiguration swordConfiguration) throws SwordServerException, SwordAuthException, SwordError {
    AuthenticatedUser user = swordAuth.auth(authCredentials);
    user.setRequestMetadata(new UserRequestMetadata(request));
    urlManager.processUrl(iri.toString());
    String dvAlias = urlManager.getTargetIdentifier();
    if (urlManager.getTargetType().equals("dataverse") && dvAlias != null) {

        Dataverse dv = dataverseService.findByAlias(dvAlias);

        if (dv != null) {
            if (swordAuth.hasAccessToModifyDataverse(user, dv)) {
                Abdera abdera = new Abdera();
                Feed feed = abdera.newFeed();
                feed.setTitle(dv.getName());
                /**
                 * @todo For the supplied dataverse, should we should only
                 * the datasets that are *owned* by the user? Probably not!
                 * We should be using the permission system? Show the
                 * equivalent of datasets the user is "admin" on? What
                 * permission should we check?
                 *
                 * And should we only show datasets at the current level or
                 * should we show datasets that are in sub-dataverses as
                 * well?
                 */
                List childDvObjects = dataverseService.findByOwnerId(dv.getId());
                childDvObjects.addAll(datasetService.findByOwnerId(dv.getId()));
                List<Dataset> datasets = new ArrayList<>();
                for (Object object : childDvObjects) {
                    if (object instanceof Dataset) {
                        datasets.add((Dataset) object);
                    }
                }
                String baseUrl = urlManager.getHostnamePlusBaseUrlPath(iri.toString());
                for (Dataset dataset : datasets) {
                    String editUri = baseUrl + "/edit/study/" + dataset.getGlobalId();
                    String editMediaUri = baseUrl + "/edit-media/study/" + dataset.getGlobalId();
                    Entry entry = feed.addEntry();
                    entry.setId(editUri);
                    entry.setTitle(dataset.getLatestVersion().getTitle());
                    entry.setBaseUri(new IRI(editUri));
                    entry.addLink(editMediaUri, "edit-media");
                    feed.addEntry(entry);
                }
                Boolean dvHasBeenReleased = dv.isReleased();
                feed.addSimpleExtension(new QName(UriRegistry.SWORD_STATE, "dataverseHasBeenReleased"), dvHasBeenReleased.toString());
                return feed;
            } else {
                throw new SwordError(UriRegistry.ERROR_BAD_REQUEST, "user " + user.getDisplayInfo().getTitle() + " is not authorized to list datasets in dataverse " + dv.getAlias());
            }

        } else {
            throw new SwordError(UriRegistry.ERROR_BAD_REQUEST, "Could not find dataverse: " + dvAlias);
        }
    } else {
        throw new SwordError(UriRegistry.ERROR_BAD_REQUEST, "Couldn't determine target type or identifer from URL: " + iri);
    }
}
 
开发者ID:pengchengluo,项目名称:Peking-University-Open-Research-Data-Platform,代码行数:60,代码来源:CollectionListManagerImpl.java

示例8: toAtomEntry

import org.apache.abdera.model.Feed; //导入方法依赖的package包/类
private static Entry toAtomEntry(
        Feed feed,
        ConceptResource note,
        ArrayList<ConceptTreeNode> children,
        String globalOutlineId, 
        HashMap<String, String> noteUriToGlobalId) {
    
    Entry entry = feed.addEntry();
    entry.setPublished(new Date(note.resource.metadata.getCreated()));
    entry.setUpdated(new Date(note.resource.metadata.getTimestamp()));
    String globalConceptUri = getNoteOriginUri(globalOutlineId, note, noteUriToGlobalId); 
    entry.setId(globalConceptUri);
    entry.setTitle(note.getLabel());
    entry.setSummary(note.getAnnotation());
    // children
    if(children!=null && children.size()>0) {
        for (int i = 0; i < children.size(); i++) {
            globalConceptUri = getNoteOriginUri(globalOutlineId, new ConceptResource(children.get(i).concept), noteUriToGlobalId);                 
            entry.addLink(globalConceptUri,ATOM_REL_CHILD_NOTE);                                     
        }
    }
    // attachments
    AttachmentProperty[] attachments = note.getAttachments();
    if(attachments!=null && attachments.length>0) {
        for (AttachmentProperty attachmentProperty : attachments) {
            String url=attachmentProperty.getUrl().replace(" ", "%20");
            logger.debug("Creating link from the attachment: '"+url+"' # '"+attachmentProperty.getDescription()+"'");
            entry.addLink(url,ATOM_REL_ATTACHMENT,null,attachmentProperty.getDescription(),null,0);                     
        }
    }
    // cats
    entry.addCategory(ATOM_CAT_REVISION, ""+note.resource.metadata.getRevision(), null);
    entry.addCategory(ATOM_CAT_MR_TYPES, note.resource.metadata.getType(), null);
    entry.addCategory(ATOM_CAT_VERSION, note.resource.metadata.getMindRaiderVersion(), null);            
    entry.addCategory(ATOM_CAT_ANNOTATION_TYPE, note.getAnnotationContentType(), null);
    CategoryProperty[] categories = note.getCategories();
    if(categories!=null && categories.length>0) {
        for (CategoryProperty categoryProperty : categories) {
            entry.addCategory(ATOM_CAT_TAG, categoryProperty.getCategoryValue(), categoryProperty.getCategoryCaption());                    
        }
    }
    
    return entry;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:45,代码来源:Atomizer.java

示例9: getAllCommentRssFeeds

import org.apache.abdera.model.Feed; //导入方法依赖的package包/类
@GET
@Produces(MediaType.APPLICATION_ATOM_XML)
@Path("comments")
public Feed getAllCommentRssFeeds(@Context UriInfo uriInfo) {

    Calendar cal = Calendar.getInstance();
    Date date = new Date();
    cal.setTime(date);

    Configuration conf = HibernateConfig.INSTANCE.getConnection(context);

    ServiceRegistryBuilder srb = new ServiceRegistryBuilder().applySettings(conf.getProperties());
    SessionFactory sf = conf.buildSessionFactory(srb.buildServiceRegistry());
    Session session = sf.openSession();

    Transaction tx = session.beginTransaction();

    @SuppressWarnings("unchecked")
    List<CommentaryEntity> queryResults = session.getNamedQuery("getAllCommentsOrderedByCreatedDesc").list();

    tx.commit();
    session.close();

    Feed feed = AbderaSupport.getAbdera().getFactory().newFeed();

    feed.setId("tag:localhost:8080," + cal.get(Calendar.YEAR) + ":/govdata/comments");
    feed.setTitle("GovData Kommentare zu Metadatenbeschreibungen");
    feed.setUpdated(date);
    feed.addAuthor("GovData.de");
    URI feedLink = uriInfo.getRequestUri();
    feed.addLink(feedLink.toString(), "self");

    int i = 1;
    for (CommentaryEntity comment : queryResults) {
        Entry entry = feed.addEntry();
        entry.setId("tag:localhost:8080," + cal.get(Calendar.YEAR) + ":/govdata/comments/entries" + i);
        entry.setTitle("Kommentar zu http://localhost:8080/web/guest/daten/-/details/" + comment.getMetadataname());
        entry.setPublished(comment.getCreated());
        entry.setUpdated(comment.getCreated());
        entry.addAuthor(comment.getLiferayScreenName());
        entry.addLink(feedLink.toString(), "self");

        StringBuilder sb = new StringBuilder();
        sb.append("<div>");
        sb.append("<p>").append(comment.getText()).append("</p>");
        sb.append("<p>").append("Dieser Kommentar wurde erstellt von: " + comment.getLiferayScreenName()).append("</p>");
        sb.append("</div>");

        sb.append("<div>");
        sb.append("<a href=\"http://localhost:8080/web/guest/daten/-/details/" + comment.getMetadataname()
                + "\">http://localhost:8080/web/guest/daten/-/details/" + comment.getMetadataname() + "</a>");
        sb.append("</div>");

        entry.setContentAsHtml(sb.toString());

        i++;
    }

    return feed;
}
 
开发者ID:fraunhoferfokus,项目名称:odp-rss-servlet,代码行数:61,代码来源:RSSService.java


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