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

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


    }

    @Consumes
    public void setSyndEntry(SyndEntry entry, @Context Providers providers) {
        test = null;
        SyndContent content = entry.getContent();
        if (content == null) {
            return;
        }
        String value = content.getValue();
        String type = content.getType();
        if (value == null || !MediaType.APPLICATION_XML.equalsIgnoreCase(type)) {
            return;
        }
        // deserialize the defect xml
        test =
View Full Code Here


        entry.setTitle(new SyndText("My Bookmark " + bookmarkId));
        entry.setPublished(new Date());
        entry.setBase(uriInfo.getAbsolutePath().toString());

        if (content != null) {
            entry.setContent(new SyndContent(content));
        }
        return entry;
    }
View Full Code Here

     *
     * @return the content of the resource - can be text,link or XML
     */
    public String getContent() throws IOException {

        SyndContent content = syndEntry.getContent();
        if (content != null) {

            String src = content.getSrc();
            if (src != null) {
                return src;
            }

            String type = content.getType();
            // TODO: get content using type?
            String value = String.valueOf(content.getValue());
            value = value != null ? value : "";
            if (type != null && (SyndTextType.xhtml.name().equals(type) || ModelUtils
                .isTypeXml(type))) {
                return StringEscapeUtils.escapeXml(value);
            }
View Full Code Here

        value.setId(getId());
        value.setPublished(getPublished());
        value.setSummary(getSummary() != null ? getSummary().toSynd(new SyndText()) : null);
        value.setTitle(getTitle() != null ? getTitle().toSynd(new SyndText()) : null);
        value.setUpdated(getUpdated());
        value.setContent(getContent() != null ? getContent().toSynd(new SyndContent()) : null);
        value.getAuthors().addAll(getAuthorsAsSynd());
        value.getCategories().addAll(getCategoriesAsSynd());
        value.getLinks().addAll(getLinksAsSynd());
        return value;
    }
View Full Code Here

        if (messageBodyWriter != null) {
            se.setId(ID_PREFIX + UUID.randomUUID());
            se.setUpdated(new Date(System.currentTimeMillis()));
            se.setPublished(new Date(System.currentTimeMillis()));
            se.setTitle(new SyndText(localizedMessage));
            SyndContent syndContent = new SyndContent();
            syndContent.setType(MediaType.TEXT_PLAIN);
            syndContent.setValue(ExceptionHelper.stackTraceToString(t));
            se.setContent(syndContent);
            se.setSummary(new SyndText(localizedMessage));
            messageBodyWriter.writeTo(se,
                                      rawType,
                                      genType,
View Full Code Here

    public void testAtomTo() throws Exception {

        SyndEntry entry1 = new SyndEntry();
        entry1.setId("12345");
        entry1.setBase("base1");
        entry1.setContent(new SyndContent("content"));
        entry1.setLang("en");
        entry1.addAuthor(new SyndPerson("Moshe Moshe"));
        entry1.addCategory(new SyndCategory("severity", "high", null));
        entry1.addCategory(new SyndCategory("author", "Moshe Moshe", null));

        SyndEntry entry2 = new SyndEntry();
        entry2.setId("54321");
        entry2.setBase("base2");
        entry2.setContent(new SyndContent("no content"));
        entry2.setLang("iw");
        entry2.addAuthor(new SyndPerson("Yosi Yosi"));
        entry2.addCategory(new SyndCategory("severity", "low", null));
        entry2.addCategory(new SyndCategory("author", "Yosi Yosi", null));
        entry2.addCategory(new SyndCategory("control", "No Control", null));
View Full Code Here

    public void testAtomTo() throws Exception {

        SyndEntry entry1 = new SyndEntry();
        entry1.setId("12345");
        entry1.setBase("base1");
        entry1.setContent(new SyndContent("content"));
        entry1.setLang("en");
        entry1.addAuthor(new SyndPerson("Moshe Moshe"));
        entry1.addCategory(new SyndCategory("severity", "high", null));
        entry1.addCategory(new SyndCategory("author", "Moshe Moshe", null));

        SyndEntry entry2 = new SyndEntry();
        entry2.setId("54321");
        entry2.setBase("base2");
        entry2.setContent(new SyndContent("no content"));
        entry2.setLang("iw");
        entry2.addAuthor(new SyndPerson("Yosi Yosi"));
        entry2.addCategory(new SyndCategory("severity", "low", null));
        entry2.addCategory(new SyndCategory("author", "Yosi Yosi", null));
        entry2.addCategory(new SyndCategory("control", "No Control", null));
View Full Code Here

         * local providers field in this class.  The injected object may be a "proxy" to the real
         * providers, and could cause an infinite loop when ModelUtils.readValue calls back through
         * the providers.
         */
        SyndEntry returnVal = entry.toSynd(new SyndEntry());
        SyndContent content = returnVal.getContent();
        if (content != null) {
            content.setProviders(RuntimeContextTLS.getRuntimeContext().getAttribute(Providers.class));
        }
       
        return returnVal;
    }
View Full Code Here

        value.setId(getId());
        value.setPublished(getPublished());
        value.setSummary(getSummary() != null ? getSummary().toSynd(new SyndText()) : null);
        value.setTitle(getTitle() != null ? getTitle().toSynd(new SyndText()) : null);
        value.setUpdated(getUpdated());
        value.setContent(getContent() != null ? getContent().toSynd(new SyndContent()) : null);
        value.getAuthors().addAll(getAuthorsAsSynd());
        value.getCategories().addAll(getCategoriesAsSynd());
        value.getLinks().addAll(getLinksAsSynd());
        return value;
    }
View Full Code Here

        if (messageBodyWriter != null) {
            se.setId(ID_PREFIX + UUID.randomUUID());
            se.setUpdated(new Date(System.currentTimeMillis()));
            se.setPublished(new Date(System.currentTimeMillis()));
            se.setTitle(new SyndText(localizedMessage));
            SyndContent syndContent = new SyndContent();
            syndContent.setType(MediaType.TEXT_PLAIN);
            syndContent.setValue(ExceptionHelper.stackTraceToString(t));
            se.setContent(syndContent);
            se.setSummary(new SyndText(localizedMessage));
            messageBodyWriter.writeTo(se,
                                      rawType,
                                      genType,
View Full Code Here

TOP

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

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.