Package org.apache.abdera.model

Examples of org.apache.abdera.model.IRIElement


    public Link getAlternateLink() {
        Link link = getExtension(RssConstants.QNAME_LINK);
        if (link == null)
            link = getExtension(RssConstants.QNAME_RDF_LINK);
        if (link == null) {
            IRIElement guid = getIdElement();
            if (guid != null && guid instanceof RssGuid && ((RssGuid)guid).isPermalink())
                return (Link)guid;
        }
        return link;
    }
View Full Code Here


        Link link = getEnclosureLink();
        return (link != null) ? link.getHref() : null;
    }

    public IRI getId() {
        IRIElement iri = getIdElement();
        return (iri != null) ? iri.getValue() : null;
    }
View Full Code Here

        IRIElement iri = getIdElement();
        return (iri != null) ? iri.getValue() : null;
    }

    public IRIElement getIdElement() {
        IRIElement id = getExtension(RssConstants.QNAME_GUID);
        if (id == null)
            id = getExtension(RssConstants.QNAME_DC_IDENTIFIER);
        if (id == null && this.getQName().equals(RssConstants.QNAME_RDF_ITEM))
            return this;
        return id;
View Full Code Here

        Element el = getExtension(RssConstants.QNAME_NAME);
        return (el != null) ? el.getText() : null;
    }

    public IRI getLink() {
        IRIElement iri = getExtension(RssConstants.QNAME_LINK);
        return (iri != null) ? iri.getValue() : null;
    }
View Full Code Here

        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();
        dateTime = factory.newPublished();
        dateTime.setCalendar(cal);
        assertEquals(cal, dateTime.getCalendar());
        dateTime = factory.newPublished();
        dateTime.setDate(now);
        assertEquals(now, dateTime.getDate());
        dateTime = factory.newPublished();
        assertNotNull(dateTime);
        dateTime = factory.newPublished();
        dateTime.setTime(now.getTime());
        assertEquals(now.getTime(), dateTime.getTime());
        dateTime = factory.newPublished();
        dateTime.setString(AtomDate.format(now));
        assertEquals(AtomDate.format(now), dateTime.getString());
        assertEquals(now, dateTime.getDate());
        Service service = factory.newService();
        assertNotNull(service);
        Source source = factory.newSource();
        assertNotNull(source);
        el = factory.newElement(Constants.NAME);
        assertNotNull(el);
        assertEquals(Constants.NAME, el.getQName());
        el = factory.newElement(Constants.NAME);
        el.setText("a");
        assertNotNull(el);
        assertEquals(Constants.NAME, el.getQName());
        assertEquals("a", el.getText());
        text = factory.newText(Constants.TITLE, Text.Type.TEXT);
        assertNotNull(text);
        assertEquals(Text.Type.TEXT, text.getTextType());
        text = factory.newRights();
        text.setValue("a");
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.TEXT, text.getTextType());
        text = factory.newSubtitle();
        text.setValue("a");
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.TEXT, text.getTextType());
        text = factory.newSummary();
        text.setValue("a");
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.TEXT, text.getTextType());
        text = factory.newText(Constants.TITLE, Text.Type.TEXT, null);
        text.setValue("a");
        assertEquals(Constants.TITLE, text.getQName());
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.TEXT, text.getTextType());
        text = factory.newTitle();
        text.setValue("a");
        assertEquals("a", text.getValue());
        assertEquals(Text.Type.TEXT, text.getTextType());
        content = factory.newContent(Content.Type.TEXT);
        content.setValue("a");
        assertEquals("a", content.getValue());
        assertEquals(Content.Type.TEXT, content.getContentType());
        now = new Date();
        dateTime = factory.newUpdated();
        dateTime.setValue(AtomDate.valueOf(now));
        assertEquals(now, dateTime.getDate());
        cal = Calendar.getInstance();
        dateTime = factory.newUpdated();
        dateTime.setCalendar(cal);
        assertEquals(cal, dateTime.getCalendar());
        dateTime = factory.newUpdated();
        dateTime.setDate(now);
        assertEquals(now, dateTime.getDate());
        dateTime = factory.newUpdated();
        assertNotNull(dateTime);
        dateTime = factory.newUpdated();
        dateTime.setTime(now.getTime());
        assertEquals(now.getTime(), dateTime.getTime());
        dateTime = factory.newUpdated();
        dateTime.setString(AtomDate.format(now));
        assertEquals(AtomDate.format(now), dateTime.getString());
        assertEquals(now, dateTime.getDate());
        iri = factory.newUri();
        assertNotNull(iri);
        iri = factory.newUri();
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        iri = factory.newUri();
        iri.setValue("http://example.org/foo");
        assertEquals("http://example.org/foo", iri.getValue().toString());
        Workspace workspace = factory.newWorkspace();
        assertNotNull(workspace);
        div = factory.newDiv();
        content = factory.newContent(Content.Type.XHTML);
        content.setValueElement(div);
View Full Code Here

            _removeChildren(ID, false);
        return (T)this;
    }

    public IRI getId() {
        IRIElement id = getIdElement();
        return (id != null) ? id.getValue() : null;
    }
View Full Code Here

        complete();
        if (value == null) {
            _removeChildren(ID, false);
            return null;
        }
        IRIElement id = getIdElement();
        if (id != null) {
            if (normalize)
                id.setNormalizedValue(value);
            else
                id.setValue(value);
            return id;
        } else {
            FOMFactory fomfactory = (FOMFactory)factory;
            IRIElement iri = fomfactory.newID(this);
            iri.setValue((normalize) ? IRI.normalizeString(value) : value);
            return iri;
        }
    }
View Full Code Here

        if (value == null) {
            _removeChildren(ICON, false);
            return null;
        }
        FOMFactory fomfactory = (FOMFactory)factory;
        IRIElement iri = fomfactory.newIcon(this);
        iri.setValue(value);
        return iri;
    }
View Full Code Here

        iri.setValue(value);
        return iri;
    }

    public IRI getIcon() {
        IRIElement iri = getIconElement();
        IRI uri = (iri != null) ? iri.getResolvedValue() : null;
        return (IRIHelper.isJavascriptUri(uri) || IRIHelper.isMailtoUri(uri)) ? null : uri;
    }
View Full Code Here

        if (value == null) {
            _removeChildren(LOGO, false);
            return null;
        }
        FOMFactory fomfactory = (FOMFactory)factory;
        IRIElement iri = fomfactory.newLogo(this);
        iri.setValue(value);
        return iri;
    }
View Full Code Here

TOP

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

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.