Package org.apache.abdera.model

Examples of org.apache.abdera.model.Person


        // Create a new Feed
        Factory factory = Abdera.getNewFactory();
        Feed feed = factory.newFeed();
        feed.setTitle(feedTitle);
        feed.setSubtitle(feedDescription);
        Person author = factory.newAuthor();
        author.setName(feedAuthor);
        feed.addAuthor(author);
        feed.addLink("http://tuscany.apache.org", "alternate");

        // Aggregate entries from atomFeed1, atomFeed2, rssFeed1 and rssFeed2
        List<Entry> entries = new ArrayList<Entry>();
View Full Code Here


    public Feed query(String queryString) {
        Factory factory = Abdera.getNewFactory();
        Feed feed = factory.newFeed();
        feed.setTitle(feedTitle);
        feed.setSubtitle(feedDescription);
        Person author = factory.newAuthor();
        author.setName(feedAuthor);
        feed.addAuthor(author);
        feed.addLink("http://tuscany.apache.org", "alternate");
       
        Feed allFeed = getFeed();
        if (queryString.startsWith("title=")) {
View Full Code Here

    public IRI getAlternateLinkResolvedHref(String type, String hreflang) {
        return getAlternateLinkResolvedHref();
    }

    public Person getAuthor() {
        Person person = getExtension(RssConstants.QNAME_MANAGINGEDITOR);
        if (person == null)
            person = getExtension(RssConstants.QNAME_DC_CREATOR);
        return person;
    }
View Full Code Here

            } else if (element instanceof Person) {
                jstream.startObject();
                writeLanguageFields(element, jstream);
                if (!isSameAsParentBase(element))
                    jstream.writeField("xml:base", element.getResolvedBaseUri());
                Person person = (Person)element;
                jstream.writeField("name", person.getName());
                if (person.getEmail() != null)
                    jstream.writeField("email", person.getEmail());
                if (person.getUri() != null)
                    jstream.writeField("uri", person.getUriElement().getResolvedValue());
                writeExtensions((ExtensibleElement)element, jstream);
                jstream.endObject();
            } else if (element instanceof Service) {
                jstream.startObject();
                writeLanguageFields(element, jstream);
View Full Code Here

    public IRI getAlternateLinkResolvedHref(String type, String hreflang) {
        return getAlternateLinkResolvedHref();
    }

    public Person getAuthor() {
        Person person = getExtension(RssConstants.QNAME_AUTHOR);
        if (person == null)
            person = getExtension(RssConstants.QNAME_DC_CREATOR);
        return person;
    }
View Full Code Here

        assertEquals("foo", feed.getId().toASCIIString());
        assertEquals("Copyright 2007 Foo", feed.getRights());
        assertNotNull(feed.getUpdated());
        assertEquals("en-US", feed.getLanguage());
        assertEquals(1, feed.getContributors().size());
        Person person = feed.getContributors().get(0);
        assertEquals("John Doe", person.getName());
        assertEquals("jdoe@example.org", person.getEmail());

        List<Entry> entries = feed.getEntries();
        assertEquals(2, entries.size());

        Entry entry = entries.get(0);
        assertEquals("Processing Inclusions with XSLT", entry.getTitle());
        assertEquals("http://xml.com/pub/2000/08/09/xslt/xslt.html", entry.getId().toASCIIString());
        assertEquals("http://xml.com/pub/2000/08/09/xslt/xslt.html", entry.getAlternateLinkResolvedHref()
            .toASCIIString());
        assertNotNull(entry.getSummary());
        assertEquals("testing", entry.getContent());

        person = entry.getAuthor();
        System.out.println(person.getName());
        assertEquals("Bob", person.getName());

        entry = entries.get(1);
        assertEquals("Putting RDF to Work", entry.getTitle());
        assertEquals("http://xml.com/pub/2000/08/09/rdfdb/index.html", entry.getId().toASCIIString());
        assertEquals("http://xml.com/pub/2000/08/09/rdfdb/index.html", entry.getAlternateLinkResolvedHref()
            .toASCIIString());

        assertNotNull(entry.getSummary());
        assertEquals("testing", entry.getContent());

        person = entry.getAuthor();
        assertEquals("Joe", person.getName());

    }
View Full Code Here

    }

    @Test
    public void testFactory() throws Exception {
        Factory factory = getFactory();
        Person author = factory.newAuthor();
        assertNotNull(author);
        author = factory.newAuthor();
        author.setName("a");
        author.setEmail("b");
        author.setUri("c");
        assertNotNull(author);
        assertEquals("a", author.getName());
        assertEquals("b", author.getEmail());
        assertEquals("c", author.getUri().toString());
        author = factory.newAuthor();
        author.setName("a");
        author.setEmail("b");
        author.setUri("c");
        assertNotNull(author);
        assertEquals("a", author.getName());
        assertEquals("b", author.getEmail());
        assertEquals("c", author.getUri().toString());
        Category category = factory.newCategory();
        assertNotNull(category);
        category = factory.newCategory();
        category.setScheme("a");
        category.setTerm("b");
        category.setLabel("c");
        assertNotNull(category);
        assertEquals("a", category.getScheme().toString());
        assertEquals("b", category.getTerm());
        assertEquals("c", category.getLabel());
        Collection collection = factory.newCollection();
        assertNotNull(collection);
        Content content = factory.newContent(Content.Type.TEXT);
        assertNotNull(content);
        assertEquals(Content.Type.TEXT, content.getContentType());
        content = factory.newContent(Content.Type.HTML);
        assertEquals(Content.Type.HTML, content.getContentType());
        content = factory.newContent(Content.Type.XHTML);
        assertEquals(Content.Type.XHTML, content.getContentType());
        content = factory.newContent(Content.Type.MEDIA);
        assertEquals(Content.Type.MEDIA, content.getContentType());
        content = factory.newContent(Content.Type.XML);
        assertEquals(Content.Type.XML, content.getContentType());
        content = factory.newContent(new MimeType("text/foo"));
        assertEquals(Content.Type.MEDIA, content.getContentType());
        assertEquals("text/foo", content.getMimeType().toString());
        Person contributor = factory.newContributor();
        assertNotNull(contributor);
        contributor = factory.newContributor();
        contributor.setName("a");
        contributor.setEmail("b");
        contributor.setUri("c");
        assertNotNull(contributor);
        assertEquals("a", contributor.getName());
        assertEquals("b", contributor.getEmail());
        assertEquals("c", contributor.getUri().toString());
        contributor = factory.newContributor();
        contributor.setName("a");
        contributor.setEmail("b");
        contributor.setUri("c");
        assertNotNull(contributor);
        assertEquals("a", contributor.getName());
        assertEquals("b", contributor.getEmail());
        assertEquals("c", contributor.getUri().toString());
        Control control = factory.newControl();
        assertNotNull(control);
        control = factory.newControl();
        control.setDraft(true);
        assertTrue(control.isDraft());
        Date now = new Date();
        DateTime dateTime = factory.newDateTime(Constants.UPDATED, null);
        dateTime.setValue(AtomDate.valueOf(now));
        assertEquals(now, dateTime.getDate());
        Calendar cal = Calendar.getInstance();
        dateTime = factory.newDateTime(Constants.UPDATED, null);
        dateTime.setCalendar(cal);
        assertEquals(cal, dateTime.getCalendar());
        dateTime = factory.newDateTime(Constants.UPDATED, null);
        dateTime.setDate(now);
        assertEquals(now, dateTime.getDate());
        dateTime = factory.newDateTime(Constants.UPDATED, null);
        assertNotNull(dateTime);
        dateTime = factory.newDateTime(Constants.UPDATED, null);
        dateTime.setTime(now.getTime());
        assertEquals(now.getTime(), dateTime.getTime());
        dateTime = factory.newDateTime(Constants.UPDATED, null);
        dateTime.setString(AtomDate.format(now));
        assertEquals(AtomDate.format(now), dateTime.getString());
        assertEquals(now, dateTime.getDate());
        Generator generator = factory.newDefaultGenerator();
        assertNotNull(generator);
        assertEquals(Version.APP_NAME, generator.getText());
        assertEquals(Version.VERSION, generator.getVersion());
        assertEquals(Version.URI, generator.getUri().toString());
        Div div = factory.newDiv();
        assertNotNull(div);
        Document<?> doc = factory.newDocument();
        assertNotNull(doc);
        Element el = factory.newEmail();
        assertNotNull(el);
        el = factory.newEmail();
        el.setText("a");
        assertEquals("a", el.getText());
        Entry entry = factory.newEntry();
        assertNotNull(entry);
        entry = factory.newEntry();
        assertNotNull(entry);
        Element ee = factory.newExtensionElement(new QName("urn:foo", "bar", "b"));
        assertNotNull(ee);
        assertEquals(new QName("urn:foo", "bar", "b"), ee.getQName());
        Feed feed = factory.newFeed();
        assertNotNull(feed);
        generator = factory.newGenerator();
        assertNotNull(generator);
        generator = factory.newGenerator();
        generator.setUri(Version.URI);
        generator.setVersion(Version.VERSION);
        generator.setText(Version.APP_NAME);
        assertNotNull(generator);
        assertEquals(Version.APP_NAME, generator.getText());
        assertEquals(Version.VERSION, generator.getVersion());
        assertEquals(Version.URI, generator.getUri().toString());
        content = factory.newContent(Content.Type.HTML);
        content.setValue("a");
        assertNotNull(content);
        assertEquals("a", content.getValue());
        assertEquals(Content.Type.HTML, content.getContentType());
        Text text = factory.newRights(Text.Type.HTML);
        text.setValue("a");
        assertNotNull(text);
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.HTML, text.getTextType());
        text = factory.newSubtitle(Text.Type.HTML);
        text.setValue("a");
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.HTML, text.getTextType());
        text = factory.newSummary(Text.Type.HTML);
        text.setValue("a");
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.HTML, text.getTextType());
        text = factory.newText(Constants.TITLE, Text.Type.HTML, null);
        text.setValue("a");
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.HTML, text.getTextType());
        assertEquals(Constants.TITLE, text.getQName());
        text = factory.newTitle(Text.Type.HTML);
        text.setValue("a");
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.HTML, text.getTextType());
        IRIElement iri = factory.newIcon();
        assertNotNull(iri);
        iri = factory.newIcon();
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        iri = factory.newIcon();
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        iri = factory.newID();
        assertNotNull(iri);
        iri = factory.newID();
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        iri = factory.newID();
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        iri = factory.newIRIElement(Constants.ID, null);
        assertNotNull(iri);
        iri = factory.newIRIElement(Constants.ID, null);
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        iri = factory.newIRIElement(Constants.ID, null);
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        Link link = factory.newLink();
        assertNotNull(link);
        link = factory.newLink();
        link.setHref("http://example.org/foo");
        link.setRel("a");
        link.setMimeType("text/foo");
        link.setTitle("b");
        link.setHrefLang("en");
        link.setLength(10);
        assertEquals("http://example.org/foo", link.getHref().toString());
        assertEquals("a", link.getRel());
        assertEquals("text/foo", link.getMimeType().toString());
        assertEquals("b", link.getTitle());
        assertEquals("en", link.getHrefLang());
        assertEquals(10, link.getLength());
        link = factory.newLink();
        link.setHref("http://example.org/foo");
        link.setRel("a");
        link.setMimeType("text/foo");
        link.setTitle("b");
        link.setHrefLang("en");
        link.setLength(10);
        assertEquals("http://example.org/foo", link.getHref().toString());
        assertEquals("a", link.getRel());
        assertEquals("text/foo", link.getMimeType().toString());
        assertEquals("b", link.getTitle());
        assertEquals("en", link.getHrefLang());
        assertEquals(10, link.getLength());
        iri = factory.newLogo();
        assertNotNull(iri);
        iri = factory.newLogo();
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        iri = factory.newLogo();
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        content = factory.newContent(new MimeType("text/foo"));
        content.setSrc("foo");
        assertNotNull(content);
        assertEquals("text/foo", content.getMimeType().toString());
        assertEquals("foo", content.getSrc().toString());
        content = factory.newContent(new MimeType("text/foo"));
        content.setDataHandler(new DataHandler(new ByteArrayDataSource("foo".getBytes())));
        assertEquals("Zm9v", content.getValue());
        assertEquals(Content.Type.MEDIA, content.getContentType());
        el = factory.newName();
        assertNotNull(el);
        el = factory.newName();
        el.setText("a");
        assertEquals("a", el.getText());
        Parser parser = factory.newParser();
        assertNotNull(parser);
        Person person = factory.newPerson(Constants.AUTHOR, null);
        assertNotNull(person);
        assertEquals(Constants.AUTHOR, person.getQName());
        person = factory.newPerson(Constants.AUTHOR, null);
        person.setName("a");
        person.setEmail("b");
        person.setUri("c");
        assertEquals("a", person.getName());
        assertEquals("b", person.getEmail());
        assertEquals("c", person.getUri().toString());
        person = factory.newPerson(Constants.AUTHOR, null);
        person.setName("a");
        person.setEmail("b");
        person.setUri("c");
        assertEquals("a", person.getName());
        assertEquals("b", person.getEmail());
        assertEquals("c", person.getUri().toString());
        now = new Date();
        dateTime = factory.newPublished();
        dateTime.setValue(AtomDate.valueOf(now));
        assertEquals(now, dateTime.getDate());
        cal = Calendar.getInstance();
View Full Code Here

        return "Acme Industries";
    }

    @Override
    public List<Person> getAuthors(Customer entry, RequestContext request) throws ResponseContextException {
        Person author = request.getAbdera().getFactory().newAuthor();
        author.setName("Acme Industries");
        return Arrays.asList(author);
    }
View Full Code Here

    }

    public Person addAuthor(String name) {
        complete();
        FOMFactory fomfactory = (FOMFactory)this.factory;
        Person person = fomfactory.newAuthor(this);
        person.setName(name);
        return person;
    }
View Full Code Here

    }

    public Person addAuthor(String name, String email, String uri) {
        complete();
        FOMFactory fomfactory = (FOMFactory)this.factory;
        Person person = fomfactory.newAuthor(this);
        person.setName(name);
        person.setEmail(email);
        person.setUri(uri);
        return person;
    }
View Full Code Here

TOP

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

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.