Package org.apache.abdera.factory

Examples of org.apache.abdera.factory.Factory.newContent()


        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);
View Full Code Here


        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();
View Full Code Here

        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);
        assertNotNull(content);
        assertEquals(Content.Type.XHTML, content.getContentType());
        assertNotNull(content.getValueElement());
        assertEquals(div, content.getValueElement());
View Full Code Here

        content.setValueElement(div);
        assertNotNull(content);
        assertEquals(Content.Type.XHTML, content.getContentType());
        assertNotNull(content.getValueElement());
        assertEquals(div, content.getValueElement());
        content = factory.newContent(new MimeType("application/xml"));
        content.setValueElement(div);
        assertNotNull(content);
        assertEquals(Content.Type.XML, content.getContentType());
        assertNotNull(content.getValueElement());
        assertEquals(div, content.getValueElement());
View Full Code Here

       
       
        StringWriter writer = new StringWriter();
        jc.createMarshaller().marshal(b, writer);
       
        e.setContentElement(factory.newContent());
        e.getContentElement().setContentType(Content.Type.XML);
        e.getContentElement().setValue(writer.toString());
       
        return e;
    }  
View Full Code Here

        JAXBContext jc = jaxbProvider.getJAXBContext(cls, cls);
       
        StringWriter writer = new StringWriter();
        jc.createMarshaller().marshal(o, writer);
       
        e.setContentElement(factory.newContent());
        e.getContentElement().setContentType(Content.Type.XML);
        e.getContentElement().setValue(writer.toString());
       
    }
   
View Full Code Here

        JAXBContext jc = jaxbProvider.getJAXBContext(cls, cls);
       
        StringWriter writer = new StringWriter();
        jc.createMarshaller().marshal(o, writer);
       
        e.setContentElement(factory.newContent());
        e.getContentElement().setContentType(Content.Type.XML);
        e.getContentElement().setValue(writer.toString());
       
    }
   
View Full Code Here

        childExtension.addSimpleExtension(VALUE, String.valueOf(p.getVersionNumber()));
       
        childExtension = extension.addExtension(CHECKIN_COMMENT);
        childExtension.addSimpleExtension(VALUE, p.getCheckinComment());      
       
        org.apache.abdera.model.Content content = factory.newContent();
        content.setSrc(UriBuilder.fromUri(baseURL).path("binary").build().toString());
        content.setMimeType("application/octet-stream");
        content.setContentType(Type.MEDIA);
        e.setContentElement(content);
View Full Code Here

        childExtension = extension.addExtension(CATEGORIES);
        for (CategoryItem c : categories) {
            childExtension.addSimpleExtension(VALUE, c.getName());
        }

        org.apache.abdera.model.Content content = factory.newContent();
        content.setSrc(UriBuilder.fromUri(baseURL).path("binary").build().toString());
        content.setMimeType("application/octet-stream");
        content.setContentType(Type.MEDIA);
        e.setContentElement(content);
View Full Code Here

        childExtension.addSimpleExtension(VALUE, p.getUUID());

        childExtension = extension.addExtension(STATE);
        childExtension.addSimpleExtension(VALUE, p.getState() == null ? "" : p.getState().getName());

        org.apache.abdera.model.Content content = factory.newContent();
        content.setSrc(UriBuilder.fromUri(baseURL).path("binary").build().toString());
        content.setMimeType("application/octet-stream");
        content.setContentType(Type.MEDIA);
        e.setContentElement(content);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.