Package org.apache.wink.common.model.atom

Examples of org.apache.wink.common.model.atom.AtomEntry


        @GET
        @Path("atomentry")
        @Produces("application/json")
        public AtomEntry getAtomEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            return entry;
        }
View Full Code Here


        @GET
        @Path("atomentryelement")
        @Produces("application/json")
        public JAXBElement<AtomEntry> getAtomEntryElement() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            org.apache.wink.common.model.atom.ObjectFactory of =
                new org.apache.wink.common.model.atom.ObjectFactory();
            return of.createEntry(entry);
        }
View Full Code Here

        @GET
        @Path("atomsyndentry")
        @Produces("application/json")
        public SyndEntry getSyndEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            return entry.toSynd(new SyndEntry());
        }
View Full Code Here

    }

    public void testAtomPUTBlogComment() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI + "/blogs/0/entries/1/comments/0");
        AtomEntry entry = resource.accept("application/atom+xml").get(AtomEntry.class);
        AtomPerson author = entry.getAuthors().get(0);
        author.setName(author.getName() + "Updated");
        author.setEmail(author.getEmail() + "Updated");
        AtomText title = entry.getTitle();
        title.setValue(title.getValue() + "Updated");
        AtomContent content = entry.getContent();
        content.setValue(content.getValue() + "Updated");

        resource = client.resource(BASE_URI + "/blogs/0/entries/1/comments/0");
        AtomEntry updated =
            resource.accept("application/atom+xml").contentType("application/atom+xml")
                .put(AtomEntry.class, entry);
        assertNotNull(updated.getAuthors());
        assertEquals(1, updated.getAuthors().size());
        author = updated.getAuthors().get(0);
        assertNotNull(author);
        assertNotNull(author);
        assertEquals("Wink CoderUpdated", author.getName());
        assertEquals("winkcoder@mybusiness.comUpdated", author.getEmail());
        assertEquals("Great!Updated", entry.getTitle().getValue());
View Full Code Here

        setContent(comment.getContent().getValue());
        return toAtomEntry();
    }
   
    public AtomEntry toAtomEntry() {
        AtomEntry entry = new AtomEntry();
        AtomContent content = new AtomContent();
        content.setValue(this.content);
        content.setType("text");
        entry.setContent(content);
        entry.getAuthors().add(this.author.toAtomPerson());
        entry.setTitle(new AtomText(this.title));
        return entry;
    }
View Full Code Here

        @GET
        @Path("atomentries/collection")
        @Produces("application/json")
        public List<AtomEntry> getAtomEntriesCollection() throws IOException {
            List<AtomEntry> entries = new ArrayList<AtomEntry>();
            AtomEntry entry1 = AtomEntry.unmarshal(new StringReader(ENTRY_STR_1));
            AtomEntry entry2 = AtomEntry.unmarshal(new StringReader(ENTRY_STR_2));
            entries.add(entry1);
            entries.add(entry2);
            return entries;
        }
View Full Code Here

        @GET
        @Path("atomentryelements/collection")
        @Produces("application/json")
        public List<JAXBElement<AtomEntry>> getAtomEntryElementCollection() throws IOException {
            List<JAXBElement<AtomEntry>> entries = new ArrayList<JAXBElement<AtomEntry>>();
            AtomEntry entry1 = AtomEntry.unmarshal(new StringReader(ENTRY_STR_1));
            AtomEntry entry2 = AtomEntry.unmarshal(new StringReader(ENTRY_STR_2));
            org.apache.wink.common.model.atom.ObjectFactory of =
                new org.apache.wink.common.model.atom.ObjectFactory();
            entries.add(of.createEntry(entry1));
            entries.add(of.createEntry(entry2));
            return entries;
View Full Code Here

        @GET
        @Path("atomentry")
        @Produces("application/json")
        public AtomEntry getAtomEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY_STR));
            return entry;
        }
View Full Code Here

        @GET
        @Path("atomentryelement")
        @Produces("application/json")
        public JAXBElement<AtomEntry> getAtomEntryElement() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY_STR));
            org.apache.wink.common.model.atom.ObjectFactory of =
                new org.apache.wink.common.model.atom.ObjectFactory();
            return of.createEntry(entry);
        }
View Full Code Here

        @GET
        @Path("atomsyndentry")
        @Produces("application/json")
        public SyndEntry getSyndEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY_STR));
            return entry.toSynd(new SyndEntry());
        }
View Full Code Here

TOP

Related Classes of org.apache.wink.common.model.atom.AtomEntry

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.