org.apache.abdera.model.Feed.setUpdated()方法的使用及代码示例

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

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

Feed.setUpdated介绍

暂无

代码示例

代码示例来源:origin: rackerlabs/atom-hopper

@Override
  public void process(RequestContext rc, AdapterResponse<Feed> adapterResponse) {
    final Feed f = adapterResponse.getBody();

    // If there are no entries in the feed
    if (f == null || f.getEntries() == null || f.getEntries().isEmpty()) {
      return;
    }
    // Add an updated element to the feed
    final Calendar localNow = Calendar.getInstance(TimeZone.getDefault());
    localNow.setTimeInMillis(System.currentTimeMillis());
    f.setUpdated(localNow.getTime());
  }
}

代码示例来源:origin: fcrepo3/fcrepo

private Feed createAtomObject(String spid, String contentLocation) throws Exception {
  PID pid = PID.getInstance(spid);
  Date date = new Date(1);
  String title = "title";
  String author = "org.fcrepo.test.api.TestManagedDatastreams";
  Feed feed = abdera.newFeed();
  feed.setId(pid.toURI());
  feed.setTitle(title);
  feed.setUpdated(date);
  feed.addAuthor(author);
  if (contentLocation != null && contentLocation.length() > 0) {
    addAtomManagedDatastream(feed, contentLocation);
  }
  return feed;
}

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

protected Feed createFeed() throws Exception {
  Feed feed = abdera.newFeed();
  feed.setId(config.getFeedUri());
  feed.setTitle(config.getFeedTitle());
  feed.setUpdated(new Date());
  feed.addAuthor(config.getFeedAuthor());
  return feed;
}

代码示例来源: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-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

/**
* {@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: 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.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.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.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: 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.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: org.fcrepo/fcrepo-server

private void addObjectProperties(DigitalObject obj, Feed feed) throws ObjectIntegrityException {
  String state = DOTranslationUtility.getStateAttribute(obj);
  String ownerId = obj.getOwnerId();
  String label = obj.getLabel();
  Date cdate = obj.getCreateDate();
  Date mdate = obj.getLastModDate();
  feed.setId(PID.toURI(obj.getPid()));
  feed.setTitle(label == null ? "" : label);
  feed.setUpdated(mdate);
  feed.addAuthor(ownerId == null ? "" : StreamUtility.enc(ownerId));
  feed.addCategory(MODEL.STATE.uri, state, null);
  if (cdate != null) {
    feed.addCategory(MODEL.CREATED_DATE.uri, DateUtility
        .convertDateToString(cdate), null);
  }
  // TODO not sure I'm satisfied with this representation of extProperties
  for (String extProp : obj.getExtProperties().keySet()) {
    feed.addCategory(MODEL.EXT_PROPERTY.uri, extProp, obj
        .getExtProperty(extProp));
  }
}

代码示例来源:origin: fcrepo3/fcrepo

private void addObjectProperties(DigitalObject obj, Feed feed) throws ObjectIntegrityException {
  String state = DOTranslationUtility.getStateAttribute(obj);
  String ownerId = obj.getOwnerId();
  String label = obj.getLabel();
  Date cdate = obj.getCreateDate();
  Date mdate = obj.getLastModDate();
  feed.setId(PID.toURI(obj.getPid()));
  feed.setTitle(label == null ? "" : label);
  feed.setUpdated(mdate);
  feed.addAuthor(ownerId == null ? "" : StreamUtility.enc(ownerId));
  feed.addCategory(MODEL.STATE.uri, state, null);
  if (cdate != null) {
    feed.addCategory(MODEL.CREATED_DATE.uri, DateUtility
        .convertDateToString(cdate), null);
  }
  // TODO not sure I'm satisfied with this representation of extProperties
  for (String extProp : obj.getExtProperties().keySet()) {
    feed.addCategory(MODEL.EXT_PROPERTY.uri, extProp, obj
        .getExtProperty(extProp));
  }
}

代码示例来源: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;
}

相关文章