Package org.apache.wink.common.model.synd

Examples of org.apache.wink.common.model.synd.SyndEntry


        synd.addAuthor(new SyndPerson("admin"));
        synd.setUpdated(new Date());

        // set the entries
        for (User user : users) {
            SyndEntry entry = new SyndEntry();
            entry.setId(Integer.toString(user.getId()));
            entry.setPublished(new Date(System.currentTimeMillis()));
            entry.setUpdated(new Date(System.currentTimeMillis()));
            entry.setTitle(new SyndText(user.getLastName() + " " + user.getFirstName()));
            synd.addEntry(entry);
        }
        synd.setBase(uriInfo.getAbsolutePath().toString());
        return synd;
    }
View Full Code Here


    public static final String ID = "helloworld:1";

    @GET
    @Produces(MediaType.APPLICATION_ATOM_XML)
    public SyndEntry getGreeting() {
        SyndEntry synd = new SyndEntry(new SyndText("Hello World!"), ID, new Date());
        return synd;
    }
View Full Code Here

        synd.setUpdated(new Date());

        // set the entries
        for (DefectBean defect : getDefects()) {
            DefectAsset defectAsset = new DefectAsset(defect, true);
            SyndEntry entry = defectAsset.getSyndEntry(providers, uriInfo, linkBuilders);
            synd.addEntry(entry);
        }

        synd.setBase(uriInfo.getAbsolutePath().toString());
        linkBuilders.createSystemLinksBuilder().build(synd.getLinks());
View Full Code Here

        synd.setUpdated(new Date());

        // set the entries
        for (TestBean test : tests) {
            TestAsset testAsset = new TestAsset(test, true);
            SyndEntry entry = testAsset.getSyndEntry(providers, uriInfo, linkProcessor);
            synd.addEntry(entry);
        }

        synd.setBase(uriInfo.getAbsolutePath().toString());
        linkProcessor.createSystemLinksBuilder().build(synd.getLinks());
View Full Code Here

    @Produces( {MediaType.WILDCARD, MediaType.APPLICATION_JSON})
    public SyndEntry getSyndEntry(@Context Providers providers,
                                  @Context UriInfo uriInfo,
                                  @Context LinkBuilders linkBuilders) throws IOException {
        SyndEntry entry = new SyndEntry();
        entry.setId("urn:com:hp:qadefects:defect:" + defect.getId());
        entry.setTitle(new SyndText(defect.getName()));
        entry.setSummary(new SyndText(defect.getDescription()));
        entry.addAuthor(new SyndPerson(defect.getAuthor()));
        entry.addCategory(new SyndCategory("urn:com:hp:qadefects:categories:severity", defect
            .getSeverity(), null));
        entry.addCategory(new SyndCategory("urn:com:hp:qadefects:categories:status", defect
            .getStatus(), null));
        if (defect.getCreated() != null) {
            entry.setPublished(new Date(defect.getCreated().getTime()));
        }

        // serialize the defect xml
        String contentString =
            ProviderUtils.writeToString(providers, defect, MediaType.APPLICATION_XML_TYPE);
        entry.setContent(new SyndContent(contentString, MediaType.APPLICATION_XML, false));

        // set base uri if this is a standalone entry
        if (!child) {
            entry.setBase(uriInfo.getAbsolutePath().toString());
        }

        // generate system links
        linkBuilders.createSystemLinksBuilder().subResource(defect.getId()).build(entry.getLinks());
        return entry;
    }
View Full Code Here

        // here)
        Map<String, String> bookmarks = BookmarkStore.getInstance().getBookmarks();

        for (String key : bookmarks.keySet()) {

            SyndEntry entry = createEntry(key, bookmarks.get(key), uriInfo);

            // Generate system links to sub-resource
            linksBuilders.createSystemLinksBuilder().subResource(SUB_RESOURCE_PATH)
                .pathParam(BOOKMARK, key).build(entry.getLinks());

            // Add entry to Feed
            feed.addEntry(entry);
        }
View Full Code Here

        }

        String bookmarkId = BookmarkStore.getNewId();
        BookmarkStore.getInstance().putBookmark(bookmarkId, bookmark);

        SyndEntry entry = createEntry(bookmarkId, bookmark, uriInfo);

        // Generate system links to sub-resource
        linksBuilders.createSystemLinksBuilder().build(entry.getLinks());

        URI location = uriInfo.getAbsolutePathBuilder().segment(bookmarkId).build();

        return Response.created(location).entity(entry).build();
    }
View Full Code Here

        if (bookmark == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        // Create SyndEntry
        SyndEntry entry = createEntry(bookmarkId, bookmark, uriInfo);

        // Generate system links to sub-resource
        linksBuilders.createSystemLinksBuilder().relativize(true).build(entry.getLinks());

        return entry;
    }
View Full Code Here

        // update existing bookmark in the memory store with new bookmark value
        BookmarkStore.getInstance().putBookmark(bookmarkId, bookmark);

        // Create SyndEntry
        SyndEntry entry = createEntry(bookmarkId, bookmark, uriInfo);

        // Generate system links to sub-resource
        linksBuilders.createSystemLinksBuilder().build(entry.getLinks());

        return entry;
    }
View Full Code Here

        // Remove bookmark form the store
        BookmarkStore.getInstance().deleteBookmark(bookmarkId);

        // create SyndEntry and return it
        SyndEntry entry = createEntry(bookmarkId, bookmark, uriInfo);

        // Generate system links to sub-resource
        linksBuilders.createSystemLinksBuilder().build(entry.getLinks());

        return entry;
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.common.model.synd.SyndEntry

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.