Package org.apache.abdera.model

Examples of org.apache.abdera.model.DateTime


    links = feed.getLinks(Link.REL_ALTERNATE);
    assertEquals(links.size(),1);
    links = feed.getLinks(Link.REL_RELATED);
    assertEquals(links.size(),0);
    assertNotNull(feed.getUpdatedElement());
    DateTime dte = feed.getUpdatedElement();
    AtomDate dt = dte.getValue();
    assertNotNull(dt);
    Calendar c = dt.getCalendar();
    AtomDate cdt = new AtomDate(c);
    assertEquals(dt.getTime(), cdt.getTime());
    Person person = feed.getAuthor();
    assertNotNull(person);
    assertEquals(person.getName(), "John Doe");
    assertNull(person.getEmail());
    assertNull(person.getUri());
    IRIElement id = feed.getIdElement();
    assertNotNull(id);
    assertEquals(id.getValue(), new IRI("urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"));
    List<Entry> entries = feed.getEntries();
    assertEquals(entries.size(), 1);
    for (Entry entry : entries) {
      title = entry.getTitleElement();
      assertNotNull(title);
      assertEquals(title.getTextType(), Text.Type.TEXT);
      value = title.getValue();
      assertEquals(value, "Atom-Powered Robots Run Amok");
      links = entry.getLinks();
      assertEquals(1, links.size());
      for (Link link : links) {
        assertNull(link.getRel()); // it's an alternate link
        assertEquals(link.getHref(), new IRI("http://example.org/2003/12/13/atom03"));
        assertNull(link.getHrefLang());
        assertNull(link.getMimeType());
        assertNull(link.getTitle());
        assertEquals(link.getLength(),-1);
      }
      links = entry.getLinks(Link.REL_ALTERNATE);
      assertEquals(links.size(),1);
      links = entry.getLinks(Link.REL_RELATED);
      assertEquals(links.size(),0);
      id = entry.getIdElement();
      assertNotNull(id);
      assertEquals(id.getValue(), new IRI("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"));
      assertNotNull(entry.getUpdatedElement());
      dte = entry.getUpdatedElement();
      dt = dte.getValue();
      assertNotNull(dt);
      c = dt.getCalendar();
      cdt = new AtomDate(c);
      assertEquals(dt.getTime(), cdt.getTime());
      Text summary = entry.getSummaryElement();
View Full Code Here


    Document<Feed> doc = get(uri);
    assertNotNull(doc);
    Feed feed = doc.getRoot();
    List<Entry> entries = feed.getEntries();
    for (Entry entry : entries) {
      DateTime updated = entry.getUpdatedElement();
      assertNotNull(updated);
      assertNotNull(updated.getValue());
      assertNotNull(updated.getValue().getDate());
      assertEquals(updated.getValue().getDate().getYear(), 103);
    }
  }
View Full Code Here

    else
      _removeChildren(PUBLISHED, false);
  }

  public Date getPublished() {
    DateTime dte = getPublishedElement();
    return (dte != null) ? dte.getDate() : null;
  }
View Full Code Here

  private DateTime setPublished(AtomDate value) {
    if (value == null) {
      _removeChildren(PUBLISHED, false);
      return null;
    }
    DateTime dte = getPublishedElement();
    if (dte != null) {
      dte.setValue(value);
      return dte;
    } else {
      FOMFactory fomfactory = (FOMFactory) factory;
      DateTime dt = fomfactory.newPublished(this);
      dt.setValue(value);
      return dt;
    }
  }
View Full Code Here

    else
      _removeChildren(UPDATED, false);
  }

  public Date getUpdated() {
    DateTime dte = getUpdatedElement();
    return (dte != null) ? dte.getDate() : null;
  }
View Full Code Here

  private DateTime setUpdated(AtomDate value) {
    if (value == null) {
      _removeChildren(UPDATED, false);
      return null;
    }
    DateTime dte = getUpdatedElement();
    if (dte != null) {
      dte.setValue(value);
      return dte;
    } else {
      FOMFactory fomfactory = (FOMFactory) factory;
      DateTime dt = fomfactory.newUpdated(this);
      dt.setValue(value);
      return dt;
    }
  }
View Full Code Here

    else
      _removeChildren(EDITED, false);
  }

  public Date getEdited() {
    DateTime dte = getEditedElement();
    return (dte != null) ? dte.getDate() : null;
  }
View Full Code Here

    declareNamespace(APP_NS, "app");
    if (value == null) {
      _removeChildren(EDITED, false);
      return null;
    }
    DateTime dte = getEditedElement();
    if (dte != null) {
      dte.setValue(value);
      return dte;
    } else {
      FOMFactory fomfactory = (FOMFactory) factory;
      DateTime dt = fomfactory.newEdited(this);
      dt.setValue(value);
      return dt;
    }
  }
View Full Code Here

    else
      _removeChildren(UPDATED, false);
  }

  public String getUpdatedString() {
    DateTime dte = getUpdatedElement();
    return (dte != null) ? dte.getString() : null;
  }
View Full Code Here

    DateTime dte = getUpdatedElement();
    return (dte != null) ? dte.getString() : null;
  }

  public Date getUpdated() {
    DateTime dte = getUpdatedElement();
    return (dte != null) ? dte.getDate() : null;
  }
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.DateTime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.