http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Feed.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Feed.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Feed.java new file mode 100755 index 0000000..a52a9ca --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Feed.java @@ -0,0 +1,284 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.URI; +import java.util.*; + +import com.ibm.juno.core.annotation.*; +import com.ibm.juno.core.xml.annotation.*; + +/** + * Top-level ATOM feed object. + * <p> + * Represents an <code>atomFeed</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomFeed = + * element atom:feed { + * atomCommonAttributes, + * (atomAuthor* + * & atomCategory* + * & atomContributor* + * & atomGenerator? + * & atomIcon? + * & atomId + * & atomLink* + * & atomLogo? + * & atomRights? + * & atomSubtitle? + * & atomTitle + * & atomUpdated + * & extensionElement*), + * atomEntry* + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="feed") +@SuppressWarnings("hiding") +public class Feed extends CommonEntry { + + private Generator generator; // atomGenerator? + private Icon icon; // atomIcon? + private Logo logo; // atomLogo? + private Text subtitle; // atomSubtitle? + private List<Entry> entries; // atomEntry* + + /** + * Normal constructor. + * + * @param id The feed identifier. + * @param title The feed title. + * @param updated The feed updated timestamp. + */ + public Feed(Id id, Text title, Calendar updated) { + super(id, title, updated); + } + + /** Bean constructor. */ + public Feed() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns generator information on this feed. + * + * @return The generator information on this feed. + */ + public Generator getGenerator() { + return generator; + } + + /** + * Sets the generator information on this feed. + * + * @param generator The generator information on this feed. + * @return This object (for method chaining). + */ + public Feed setGenerator(Generator generator) { + this.generator = generator; + return this; + } + + /** + * Returns the feed icon. + * + * @return The feed icon. + */ + public Icon getIcon() { + return icon; + } + + /** + * Sets the feed icon. + * + * @param icon The feed icon. + * @return This object (for method chaining). + */ + public Feed setIcon(Icon icon) { + this.icon = icon; + return this; + } + + /** + * Returns the feed logo. + * + * @return The feed logo. + */ + public Logo getLogo() { + return logo; + } + + /** + * Sets the feed logo. + * + * @param logo The feed logo. + * @return This object (for method chaining). + */ + public Feed setLogo(Logo logo) { + this.logo = logo; + return this; + } + + /** + * Returns the feed subtitle. + * + * @return The feed subtitle. + */ + @BeanProperty(name="subtitle") + public Text getSubTitle() { + return subtitle; + } + + /** + * Sets the feed subtitle. + * + * @param subtitle The feed subtitle. + * @return This object (for method chaining). + */ + @BeanProperty(name="subtitle") + public Feed setSubTitle(Text subtitle) { + this.subtitle = subtitle; + return this; + } + + /** + * Returns the entries in the feed. + * + * @return The entries in the feed. + */ + @Xml(format=COLLAPSED) + public List<Entry> getEntries() { + return entries; + } + + /** + * Sets the entries in the feed. + * + * @param entries The entries in the feed. + * @return This object (for method chaining). + */ + public Feed setEntries(List<Entry> entries) { + this.entries = entries; + return this; + } + + /** + * Adds an entry to the list of entries in the feed. + * + * @param entries The entries to add to the list of entries in the feed.s + * @return This object (for method chaining). + */ + public Feed addEntries(Entry...entries) { + if (this.entries == null) + this.entries = new LinkedList<Entry>(); + this.entries.addAll(Arrays.asList(entries)); + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* CommonEntry */ + public Feed setAuthors(List<Person> authors) { + super.setAuthors(authors); + return this; + } + + @Override /* CommonEntry */ + public Feed addAuthors(Person...authors) { + super.addAuthors(authors); + return this; + } + + @Override /* CommonEntry */ + public Feed setCategories(List<Category> categories) { + super.setCategories(categories); + return this; + } + + @Override /* CommonEntry */ + public Feed addCategories(Category...categories) { + super.addCategories(categories); + return this; + } + + @Override /* CommonEntry */ + public Feed setContributors(List<Person> contributors) { + super.setContributors(contributors); + return this; + } + + @Override /* CommonEntry */ + public Feed addContributors(Person...contributors) { + super.addContributors(contributors); + return this; + } + + @Override /* CommonEntry */ + public Feed setId(Id id) { + super.setId(id); + return this; + } + + @Override /* CommonEntry */ + public Feed setLinks(List<Link> links) { + super.setLinks(links); + return this; + } + + @Override /* CommonEntry */ + public Feed addLinks(Link...links) { + super.addLinks(links); + return this; + } + + @Override /* CommonEntry */ + public Feed setRights(Text rights) { + super.setRights(rights); + return this; + } + + @Override /* CommonEntry */ + public Feed setTitle(Text title) { + super.setTitle(title); + return this; + } + + @Override /* CommonEntry */ + public Feed setUpdated(Calendar updated) { + super.setUpdated(updated); + return this; + } + + @Override /* Common */ + public Feed setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Feed setLang(String lang) { + super.setLang(lang); + return this; + } +}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Generator.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Generator.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Generator.class new file mode 100755 index 0000000..ef7ebcd Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Generator.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Generator.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Generator.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Generator.java new file mode 100755 index 0000000..cffc6cf --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Generator.java @@ -0,0 +1,139 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomGenerator</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomGenerator = element atom:generator { + * atomCommonAttributes, + * attribute uri { atomUri }?, + * attribute version { text }?, + * text + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="generator") +public class Generator extends Common { + + private URI uri; + private String version; + private String text; + + + /** + * Normal constructor. + * + * @param text The generator statement content. + */ + public Generator(String text) { + this.text = text; + } + + /** Bean constructor. */ + public Generator() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the URI of this generator statement. + * + * @return The URI of this generator statement. + */ + @Xml(format=ATTR) + public URI getUri() { + return uri; + } + + /** + * Sets the URI of this generator statement. + * + * @param uri The URI of this generator statement. + * @return This object (for method chaining). + */ + public Generator setUri(URI uri) { + this.uri = uri; + return this; + } + + /** + * Returns the version of this generator statement. + * + * @return The version of this generator statement. + */ + @Xml(format=ATTR) + public String getVersion() { + return version; + } + + /** + * Sets the version of this generator statement. + * + * @param version The version of this generator statement. + * @return This object (for method chaining). + */ + public Generator setVersion(String version) { + this.version = version; + return this; + } + + /** + * Returns the content of this generator statement. + * + * @return The content of this generator statement. + */ + @Xml(format=CONTENT) + public String getText() { + return text; + } + + /** + * Sets the content of this generator statement. + * + * @param text The content of this generator statement. + * @return This object (for method chaining). + */ + public Generator setText(String text) { + this.text = text; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Common */ + public Generator setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Generator setLang(String lang) { + super.setLang(lang); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Icon.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Icon.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Icon.class new file mode 100755 index 0000000..af14484 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Icon.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Icon.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Icon.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Icon.java new file mode 100755 index 0000000..abca1fb --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Icon.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomIcon</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomIcon = element atom:icon { + * atomCommonAttributes, + * (atomUri) + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="icon") +public class Icon extends Common { + + private URI uri; + + + /** + * Normal constructor. + * + * @param uri The URI of the icon. + */ + public Icon(URI uri) { + this.uri = uri; + } + + /** Bean constructor. */ + public Icon() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the URI of this icon. + * + * @return The URI of this icon. + */ + @Xml(format=CONTENT) + public URI getUri() { + return uri; + } + + /** + * Sets the URI of this icon. + * + * @param uri The URI of this icon. + * @return This object (for method chaining). + */ + public Icon setUri(URI uri) { + this.uri = uri; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Common */ + public Icon setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Icon setLang(String lang) { + super.setLang(lang); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Id.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Id.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Id.class new file mode 100755 index 0000000..5267792 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Id.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Id.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Id.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Id.java new file mode 100755 index 0000000..fc678c8 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Id.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomId</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomId = element atom:id { + * atomCommonAttributes, + * (atomUri) + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="id") +public class Id extends Common { + + private String text; + + /** + * Normal constructor. + * + * @param text The id element contents. + */ + public Id(String text) { + this.text = text; + } + + /** Bean constructor. */ + public Id() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the content of this identifier. + * + * @return The content of this identifier. + */ + @Xml(format=CONTENT) + public String getText() { + return text; + } + + /** + * Sets the content of this identifier. + * + * @param text The content of this identifier. + * @return This object (for method chaining). + */ + public Id setText(String text) { + this.text = text; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Common */ + public Id setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Id setLang(String lang) { + super.setLang(lang); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Link.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Link.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Link.class new file mode 100755 index 0000000..403e056 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Link.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Link.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Link.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Link.java new file mode 100755 index 0000000..fce86f5 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Link.java @@ -0,0 +1,222 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomLink</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomLink = + * element atom:link { + * atomCommonAttributes, + * attribute href { atomUri }, + * attribute rel { atomNCName | atomUri }?, + * attribute type { atomMediaType }?, + * attribute hreflang { atomLanguageTag }?, + * attribute title { text }?, + * attribute length { text }?, + * undefinedContent + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="link") +public class Link extends Common { + + private String href; + private String rel; + private String type; + private String hreflang; + private String title; + private Integer length; + + + /** + * Normal constructor. + * + * @param rel The rel of the link. + * @param type The type of the link. + * @param href The URI of the link. + */ + public Link(String rel, String type, String href) { + this.rel = rel; + this.type = type; + this.href = href; + } + + /** Bean constructor. */ + public Link() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the href of the target of this link. + * + * @return The href of the target of this link. + */ + @Xml(format=ATTR) + public String getHref() { + return href; + } + + /** + * Sets the href of the target of this link. + * + * @param href The href of the target of this link. + * @return This object (for method chaining). + */ + public Link setHref(String href) { + this.href = href; + return this; + } + + /** + * Returns the rel of this link. + * + * @return The rel of this link. + */ + @Xml(format=ATTR) + public String getRel() { + return rel; + } + + /** + * Sets the rel of this link. + * + * @param rel The rell of this link. + * @return This object (for method chaining). + */ + public Link setRel(String rel) { + this.rel = rel; + return this; + } + + /** + * Returns the content type of the target of this link. + * + * @return The content type of the target of this link. + */ + @Xml(format=ATTR) + public String getType() { + return type; + } + + /** + * Sets the content type of the target of this link. + * <p> + * Must be one of the following: + * <ul> + * <li><js>"text"</js> + * <li><js>"html"</js> + * <li><js>"xhtml"</js> + * <li><jk>null</jk> (defaults to <js>"text"</js>) + * </ul> + * + * @param type The content type of the target of this link. + * @return This object (for method chaining). + */ + public Link setType(String type) { + this.type = type; + return this; + } + + /** + * Returns the language of the target of this link. + * + * @return The language of the target of this link. + */ + @Xml(format=ATTR) + public String getHreflang() { + return hreflang; + } + + /** + * Sets the language of the target of this link. + * + * @param hreflang The language of the target of this link. + * @return This object (for method chaining). + */ + public Link setHreflang(String hreflang) { + this.hreflang = hreflang; + return this; + } + + /** + * Returns the title of the target of this link. + * + * @return The title of the target of this link. + */ + @Xml(format=ATTR) + public String getTitle() { + return title; + } + + /** + * Sets the title of the target of this link. + * + * @param title The title of the target of this link. + * @return This object (for method chaining). + */ + public Link setTitle(String title) { + this.title = title; + return this; + } + + /** + * Returns the length of the contents of the target of this link. + * + * @return The length of the contents of the target of this link. + */ + @Xml(format=ATTR) + public Integer getLength() { + return length; + } + + /** + * Sets the length of the contents of the target of this link. + * + * @param length The length of the contents of the target of this link. + * @return This object (for method chaining). + */ + public Link setLength(Integer length) { + this.length = length; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Common */ + public Link setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Link setLang(String lang) { + super.setLang(lang); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Logo.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Logo.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Logo.class new file mode 100755 index 0000000..1237f35 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Logo.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Logo.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Logo.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Logo.java new file mode 100755 index 0000000..8e67d16 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Logo.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomLogo</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomLogo = element atom:logo { + * atomCommonAttributes, + * (atomUri) + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="logo") +public class Logo extends Common { + + private URI uri; + + + /** + * Normal constructor. + * + * @param uri The URI of the logo. + */ + public Logo(URI uri) { + this.uri = uri; + } + + /** Bean constructor. */ + public Logo() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the URI of the logo. + * + * @return The URI of the logo. + */ + @Xml(format=CONTENT) + public URI getUri() { + return uri; + } + + /** + * Sets the URI of the logo. + * + * @param uri The URI of the logo. + * @return This object (for method chaining). + */ + public Logo setUri(URI uri) { + this.uri = uri; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Common */ + public Logo setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Logo setLang(String lang) { + super.setLang(lang); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Person.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Person.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Person.class new file mode 100755 index 0000000..65f7c15 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Person.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Person.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Person.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Person.java new file mode 100755 index 0000000..e0aecaf --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Person.java @@ -0,0 +1,131 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import java.net.*; + +/** + * Represents an <code>atomPersonConstruct</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomPersonConstruct = + * atomCommonAttributes, + * (element atom:name { text } + * & element atom:uri { atomUri }? + * & element atom:email { atomEmailAddress }? + * & extensionElement*) + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +public class Person extends Common { + + private String name; + private URI uri; + private String email; + + + /** + * Normal constructor. + * + * @param name The name of the person. + */ + public Person(String name) { + this.name = name; + } + + /** Bean constructor. */ + public Person() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the name of the person. + * + * @return The name of the person. + */ + public String getName() { + return name; + } + + /** + * Sets the name of the person. + * + * @param name The name of the person. + * @return This object (for method chaining). + */ + public Person setName(String name) { + this.name = name; + return this; + } + + /** + * Returns the URI of the person. + * + * @return The URI of the person. + */ + public URI getUri() { + return uri; + } + + /** + * Sets the URI of the person. + * + * @param uri The URI of the person. + * @return This object (for method chaining). + */ + public Person setUri(URI uri) { + this.uri = uri; + return this; + } + + /** + * Returns the email address of the person. + * + * @return The email address of the person. + */ + public String getEmail() { + return email; + } + + /** + * Sets the email address of the person. + * + * @param email The email address of the person. + * @return This object (for method chaining). + */ + public Person setEmail(String email) { + this.email = email; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Common */ + public Person setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Person setLang(String lang) { + super.setLang(lang); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Source.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Source.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Source.class new file mode 100755 index 0000000..0d8885b Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Source.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Source.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Source.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Source.java new file mode 100755 index 0000000..973e1cb --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Source.java @@ -0,0 +1,223 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import java.net.*; +import java.util.*; + +/** + * Represents an <code>atomSource</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomSource = + * element atom:source { + * atomCommonAttributes, + * (atomAuthor* + * & atomCategory* + * & atomContributor* + * & atomGenerator? + * & atomIcon? + * & atomId? + * & atomLink* + * & atomLogo? + * & atomRights? + * & atomSubtitle? + * & atomTitle? + * & atomUpdated? + * & extensionElement*) + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +public class Source extends CommonEntry { + + private Generator generator; + private Icon icon; + private Logo logo; + private Text subtitle; + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the generator info of this source. + * + * @return The generator info of this source. + */ + public Generator getGenerator() { + return generator; + } + + /** + * Sets the generator info of this source. + * + * @param generator The generator info of this source. + * @return This object (for method chaining). + */ + public Source setGenerator(Generator generator) { + this.generator = generator; + return this; + } + + /** + * Returns the icon of this source. + * + * @return The icon of this source. + */ + public Icon getIcon() { + return icon; + } + + /** + * Sets the icon of this source. + * + * @param icon The icon of this source. + * @return This object (for method chaining). + */ + public Source setIcon(Icon icon) { + this.icon = icon; + return this; + } + + /** + * Returns the logo of this source. + * + * @return The logo of this source. + */ + public Logo getLogo() { + return logo; + } + + /** + * Sets the logo of this source. + * + * @param logo The logo of this source. + * @return This object (for method chaining). + */ + public Source setLogo(Logo logo) { + this.logo = logo; + return this; + } + + /** + * Returns the subtitle of this source. + * + * @return The subtitle of this source. + */ + public Text getSubtitle() { + return subtitle; + } + + /** + * Sets the subtitle of this source. + * + * @param subtitle The subtitle of this source. + * @return This object (for method chaining). + */ + public Source setSubtitle(Text subtitle) { + this.subtitle = subtitle; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* CommonEntry */ + public Source setAuthors(List<Person> authors) { + super.setAuthors(authors); + return this; + } + + @Override /* CommonEntry */ + public Source addAuthors(Person...authors) { + super.addAuthors(authors); + return this; + } + + @Override /* CommonEntry */ + public Source setCategories(List<Category> categories) { + super.setCategories(categories); + return this; + } + + @Override /* CommonEntry */ + public Source addCategories(Category...categories) { + super.addCategories(categories); + return this; + } + + @Override /* CommonEntry */ + public Source setContributors(List<Person> contributors) { + super.setContributors(contributors); + return this; + } + + @Override /* CommonEntry */ + public Source addContributors(Person...contributors) { + super.addContributors(contributors); + return this; + } + + @Override /* CommonEntry */ + public Source setId(Id id) { + super.setId(id); + return this; + } + + @Override /* CommonEntry */ + public Source setLinks(List<Link> links) { + super.setLinks(links); + return this; + } + + @Override /* CommonEntry */ + public Source addLinks(Link...links) { + super.addLinks(links); + return this; + } + + @Override /* CommonEntry */ + public Source setRights(Text rights) { + super.setRights(rights); + return this; + } + + @Override /* CommonEntry */ + public Source setTitle(Text title) { + super.setTitle(title); + return this; + } + + @Override /* CommonEntry */ + public Source setUpdated(Calendar updated) { + super.setUpdated(updated); + return this; + } + + @Override /* Common */ + public Source setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Source setLang(String lang) { + super.setLang(lang); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text$TextContentHandler.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text$TextContentHandler.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text$TextContentHandler.class new file mode 100755 index 0000000..2f9f6d1 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text$TextContentHandler.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text.class new file mode 100755 index 0000000..1b067db Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text.java new file mode 100755 index 0000000..c884890 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/Text.java @@ -0,0 +1,179 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.atom; + +import static com.ibm.juno.core.xml.XmlUtils.*; +import static com.ibm.juno.core.xml.annotation.XmlFormat.*; + +import java.net.*; + +import javax.xml.stream.*; + +import com.ibm.juno.core.xml.*; +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents an <code>atomTextConstruct</code> construct in the RFC4287 specification. + * <p> + * <h6 class='figure'>Schema</h6> + * <p class='bcode'> + * atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct + * + * atomPlainTextConstruct = + * atomCommonAttributes, + * attribute type { "text" | "html" }?, + * text + * + * atomXHTMLTextConstruct = + * atomCommonAttributes, + * attribute type { "xhtml" }, + * xhtmlDiv + * + * xhtmlDiv = element xhtml:div { + * (attribute * { text } + * | text + * | anyXHTML)* + * } + * </p> + * <p> + * Refer to {@link com.ibm.juno.core.dto.atom} for further information about ATOM support. + * </p> + * + * @author James Bognar ([email protected]) + */ +public class Text extends Common { + + private String type; + String text; + + + /** + * Normal content. + * + * @param type The content type of this content. + * @param text The text of this content. + */ + public Text(String type, String text) { + this.type = type; + this.text = text; + } + + /** + * Normal content. + * + * @param text The text of this content. + */ + public Text(String text) { + this.text = text; + } + + /** Bean constructor. */ + public Text() {} + + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Returns the content type of this content. + * + * @return The content type of this content. + */ + @Xml(format=ATTR) + public String getType() { + return type; + } + + /** + * Sets the content type of this content. + * <p> + * Must be one of the following: + * <ul> + * <li><js>"text"</js> + * <li><js>"html"</js> + * <li><js>"xhtml"</js> + * <li><jk>null</jk> (defaults to <js>"text"</js>) + * </ul> + * + * @param type The content type of this content. + * @return This object (for method chaining). + */ + public Text setType(String type) { + this.type = type; + return this; + } + + /** + * Returns the content of this content. + * + * @return The content of this content. + */ + @Xml(format=CONTENT, contentHandler=TextContentHandler.class) + public String getText() { + return text; + } + + /** + * Sets the content of this content. + * + * @param text The content of this content. + * @return This object (for method chaining). + */ + public Text setText(String text) { + this.text = text; + return this; + } + + + //-------------------------------------------------------------------------------- + // Overridden setters (to simplify method chaining) + //-------------------------------------------------------------------------------- + + @Override /* Common */ + public Text setBase(URI base) { + super.setBase(base); + return this; + } + + @Override /* Common */ + public Text setLang(String lang) { + super.setLang(lang); + return this; + } + + /** + * Specialized content handler for correctly handling XML element content based + * on the <code>type</code> attribute of the element. + * <p> + * If the <code>type</code> attribute is <js>"xhtml"</js> the content is treated + * as XML. Otherwise, it's treated as plain text. + */ + public static class TextContentHandler implements XmlContentHandler<Text> { + + @Override /* XmlContentHandler */ + public void parse(XMLStreamReader r, Text text) throws Exception { + String type = text.type; + if (type != null && type.equals("xhtml")) + text.text = decode(readXmlContents(r).trim()); + else + text.text = decode(r.getElementText().trim()); + } + + @Override /* XmlContentHandler */ + public void serialize(XmlSerializerWriter w, Text text) throws Exception { + String type = text.type; + String content = text.text; + if (type != null && type.equals("xhtml")) + w.encodeTextInvalidChars(content); + else + w.encodeText(content); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/doc-files/Example_HTML.png ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/doc-files/Example_HTML.png b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/doc-files/Example_HTML.png new file mode 100755 index 0000000..18b3d52 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/doc-files/Example_HTML.png differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package-info.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package-info.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package-info.class new file mode 100755 index 0000000..9fcd679 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package-info.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package-info.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package-info.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package-info.java new file mode 100755 index 0000000..6724ec3 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package-info.java @@ -0,0 +1,19 @@ +/* ***************************************************************************** + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014. All Rights Reserved. + * + * Note to U.S. Government Users Restricted Rights: Use, + * duplication or disclosure restricted by GSA ADP Schedule + * Contract with IBM Corp. + *******************************************************************************/ +@XmlSchema( + prefix="atom", + xmlNs={ + @XmlNs(prefix="atom", namespaceURI="http://www.w3.org/2005/Atom/"), + @XmlNs(prefix="xml", namespaceURI="http://www.w3.org/XML/1998/namespace") + } +) +package com.ibm.juno.core.dto.atom; + +import com.ibm.juno.core.xml.annotation.*; + http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package.html ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package.html b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package.html new file mode 100755 index 0000000..9d67101 --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/atom/package.html @@ -0,0 +1,578 @@ +<!DOCTYPE HTML> +<!-- + Licensed Materials - Property of IBM + (c) Copyright IBM Corporation 2014. All Rights Reserved. + + Note to U.S. Government Users Restricted Rights: + Use, duplication or disclosure restricted by GSA ADP Schedule + Contract with IBM Corp. + --> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <style type="text/css"> + /* For viewing in Page Designer */ + @IMPORT url("../../../../../../../javadoc.css"); + + /* For viewing in REST interface */ + @IMPORT url("../htdocs/javadoc.css"); + body { + margin: 20px; + } + </style> + <script> + /* Replace all @code and @link tags. */ + window.onload = function() { + document.body.innerHTML = document.body.innerHTML.replace(/\{\@code ([^\}]+)\}/g, '<code>$1</code>'); + document.body.innerHTML = document.body.innerHTML.replace(/\{\@link (([^\}]+)\.)?([^\.\}]+)\}/g, '<code>$3</code>'); + } + </script> +</head> +<body> +<p>ATOM Data Transfer Objects</p> +<script> + function toggle(x) { + var div = x.nextSibling; + while (div != null && div.nodeType != 1) + div = div.nextSibling; + if (div != null) { + var d = div.style.display; + if (d == 'block' || d == '') { + div.style.display = 'none'; + x.className += " closed"; + } else { + div.style.display = 'block'; + x.className = x.className.replace(/(?:^|\s)closed(?!\S)/g , '' ); + } + } + } +</script> +<a id='TOC'></a><h5 class='toc'>Table of Contents</h5> +<ol class='toc'> + <li><p><a class='doclink' href='#Overview'>Overview</a></p> + <ol> + <li><p><a class='doclink' href='#Serialize'>Serializing ATOM feeds</a></p> + <ol> + <li><p><a class='doclink' href='#AtomJson'>ATOM/JSON</a></p> + <li><p><a class='doclink' href='#AtomRdfXml'>ATOM/RDF/XML</a></p> + <li><p><a class='doclink' href='#AtomHtml'>ATOM/HTML</a></p> + </ol> + <li><p><a class='doclink' href='#Parse'>Parsing ATOM feeds</a></p> + </ol> +</ol> + + +<!-- ======================================================================================================== --> +<a id="Overview"></a> +<h2 class='topic' onclick='toggle(this)'>1 - Overview</h2> +<div class='topic'> + <p> + Juno supports generation and consumption of ATOM feeds through the use of DTOs (Data Transfer Objects).<br> + It uses existing support for serializing and parsing POJOs to and from XML to define these ATOM objects. + </p> + <p> + The examples shown here are pulled from the <code>AtomFeedResource</code> class in the <code>com.ibm.juno.sample.war</code> project. + </p> + + + <!-- ======================================================================================================== --> + <a id="Serialize"></a> + <h3 class='topic' onclick='toggle(this)'>1.1 - Serializing ATOM feeds</h3> + <div class='topic'> + <p> + The Juno ATOM feed DTOs are simply beans with fluent-style setters.<br> + The following code shows a feed being created programmatically: + </p> + <p class='bcode'> + Feed feed = <jk>new</jk> Feed() + .setTitle(<jk>new</jk> Text(<js>"text"</js>, <js>"Juno ATOM specification"</js>)) + .setSubTitle(<jk>new</jk> Text(<js>"html"</js>, <js>"A <em>lot</em> of effort went into making this effortless"</js>)) + .setUpdated(<jsm>parseDateTime</jsm>(<js>"2013-05-08T12:29:29Z"</js>)) + .setId(<jk>new</jk> Id(<js>"tag:juno.sample.com,2013:1"</js>)) + .addLinks( + <jk>new</jk> Link(<js>"alternate"</js>, <js>"text/html"</js>, <js>"http://www.sample.com/"</js>).setHreflang(<js>"en"</js>), + <jk>new</jk> Link(<js>"self"</js>, <js>"application/atom+xml"</js>, <js>"http://www.sample.com/feed.atom"</js>) + ) + .setRights(<jk>new</jk> Text(<js>"Copyright (c) 2013, IBM"</js>)) + .setGenerator(<jk>new</jk> Generator(<js>"Juno"</js>).setUri(<jk>new</jk> URI(<js>"http://juno.ibm..com/"</js>)).setVersion(<js>"1.0"</js>)) + .addEntries( + <jk>new</jk> Entry() + .setTitle(<jk>new</jk> Text(<js>"Juno ATOM specification snapshot"</js>)) + .addLinks( + <jk>new</jk> Link(<js>"alternate"</js>, <js>"text/html"</js>, <js>"http://www.sample.com/2012/05/08/juno.atom"</js>), + <jk>new</jk> Link(<js>"enclosure"</js>, <js>"audio/mpeg"</js>, <js>""http://www.sample.com/audio/juno_podcast.mp3"</js>).setLength(12345) + ) + .setId(<jk>new</jk> Id(<js>"tag:juno.sample.com,2013:1.2345"</js>)) + .setUpdated(<jsm>parseDateTime</jsm>(<js>"2013-05-08T12:29:29Z"</js>)) + .setPublished(<jsm>parseDateTime</jsm>(<js>"2013-05-08T12:29:29Z"</js>)) + .addAuthors(<jk>new</jk> Person(<js>"James Bognar"</js>).setUri(<jk>new</jk> URI(<js>"http://www.sample.com/"</js>)).setEmail(<js>"[email protected]"</js>)) + .addContributors( + <jk>new</jk> Person(<js>"Barry M. Caceres"</js>) + ) + .setContent( + <jk>new</jk> Content() + .setLang(<js>"en"</js>) + .setBase(<jk>new</jk> URI(<js>"http://www.ibm.com/"</js>)) + .setType(<js>"xhtml"</js>) + .setText(<js>"<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>*lt;i>[Update: Juno supports ATOM.]</i></p></div>"</js>) + ) + ) + ; + </p> + <p> + To serialize this to ATOM, use the {@link com.ibm.juno.core.xml.XmlSerializer} class: + </p> + + <h6 class='figure'>Example with no namespaces</h6> + <p class='bcode'> + <jc>// Create a serializer with readable output, no namespaces yet.</jc> + XmlSerializer s = <jk>new</jk> XmlSerializer.SqReadable().setProperty(XmlSerializerProperties.<jsf>XML_enableNamespaces</jsf>, <jk>false</jk>); + + <jc>// Serialize to ATOM/XML</jc> + String atomXml = s.serialize(feed); + </p> + + <h6 class='figure'>Results</h6> + <p class='bcode'> + <xt><feed></xt> + <xt><id></xt> + tag:juno.sample.com,2013:1 + <xt></id></xt> + <xt><link</xt> <xa>href</xa>=<xs>'http://www.sample.com/'</xs> <xa>rel</xa>=<xs>'alternate'</xs> <xa>type</xa>=<xs>'text/html'</xs> <xa>hreflang</xa>=<xs>'en'</xs>/<xt>></xt> + <xt><link</xt> <xa>href</xa>=<xs>'http://www.sample.com/feed.atom'</xs> <xa>rel</xa>=<xs>'self'</xs> <xa>type</xa>=<xs>'application/atom+xml'</xs>/<xt>></xt> + <xt><rights></xt> + Copyright (c) 2013, IBM + <xt></rights></xt> + <xt><title</xt> <xa>type</xa>=<xs>'text'</xs>></xt> + Juno ATOM specification + <xt></title></xt> + <xt><updated></xt>2013-05-08T12:29:29Z<xt></updated></xt> + <xt><generator</xt> <xa>uri</xa>=<xs>'http://juno.ibm.com/'</xs> <xa>version</xa>=<xs>'1.0'</xs><xt>></xt> + Juno + <xt></generator></xt> + <xt><subtitle</xt> <xa>type</xa>=<xs>'html'</xs><xt>></xt> + A &lt;em&gt;lot&lt;/em&gt; of effort went into making this effortless + <xt></subtitle></xt> + <xt><entry></xt> + <xt><author></xt> + <xt><name></xt>James Bognar<xt></name></xt> + <xt><uri></xt>http://www.sample.com/<xt></uri></xt> + <xt><email></xt>[email protected]<xt></email></xt> + <xt></author></xt> + <xt><contributor></xt> + <xt><name></xt>Barry M. Caceres<xt></name></xt> + <xt></contributor></xt> + <xt><id></xt> + tag:juno.sample.com,2013:1.2345 + <xt></id></xt> + <xt><link</xt> <xa>href</xa>=<xs>'http://www.sample.com/2012/05/08/juno.atom'</xs> <xa>rel</xa>=<xs>'alternate'</xs> <xa>type</xa>=<xs>'text/html'</xs>/<xt>></xt> + <xt><link</xt> <xa>href</xa>=<xs>'http://www.sample.com/audio/juno_podcast.mp3'</xs> <xa>rel</xa>=<xs>'enclosure'</xs> <xa>type</xa>=<xs>'audio/mpeg'</xs> <xa>length</xa>=<xs>'12345'</xs>/<xt>></xt> + <xt><title></xt> + Juno ATOM specification snapshot + <xt></title></xt> + <xt><updated></xt>2013-05-08T12:29:29Z<xt></updated></xt> + <xt><content</xt> <xa>base</xa>=<xs>'http://www.ibm.com/'</xs> <xa>lang</xa>=<xs>'en'</xs> <xa>type</xa>=<xs>'xhtml'</xs><xt>></xt> + <xt><div</xt> <xa>xmlns</xa>=<xs>"http://www.w3.org/1999/xhtml"</xs><xt>><p><i></xt>[Update: Juno supports ATOM.]<xt></i></p></div></xt> + <xt></content></xt> + <xt><published></xt>2013-05-08T12:29:29Z<xt></published></xt> + <xt></entry></xt> + <xt></feed></xt> + </p> + + <p> + The following is the same, except with XML namespaces enabled: + </p> + + <h6 class='figure'>Example with namespaces</h6> + <p class='bcode'> + <jc>// Create a serializer with readable output with namespaces.</jc> + XmlSerializer s = <jk>new</jk> XmlSerializer.SqReadable(); + + <jc>// Serialize to ATOM/XML</jc> + String atomXml = s.serialize(feed); + </p> + + <h6 class='figure'>Results</h6> + <p class='bcode'> + <xt><atom:feed</xt> + <xa>xmlns</xa>=<xs>'http://www.ibm.com/2013/Juno'</xs> + <xa>xmlns:atom</xa>=<xs>'http://www.w3.org/2005/Atom/'</xs> + <xa>xmlns:xml</xa>=<xs>'http://www.w3.org/XML/1998/namespace'</xs> + <xa>xmlns:xsi</xa>=<xs>'http://www.w3.org/2001/XMLSchema-instance'</xs><xt>></xt> + <xt><atom:id></xt> + tag:juno.sample.com,2013:1 + <xt></atom:id></xt> + <xt><atom:link</xt> <xa>href</xa>=<xs>'http://www.sample.com/'</xs> <xa>rel</xa>=<xs>'alternate'</xs> <xa>type</xa>=<xs>'text/html'</xs> <xa>hreflang</xa>=<xs>'en'</xs><xt>/></xt> + <xt><atom:link</xt> <xa>href</xa>=<xs>'http://www.sample.com/feed.atom'</xs> <xa>rel</xa>=<xs>'self'</xs> <xa>type</xa>=<xs>'application/atom+xml'</xs><xt>/></xt> + <xt><atom:rights></xt> + Copyright (c) 2013, IBM + <xt></atom:rights></xt> + <xt><atom:title</xt> <xa>type</xa>=<xs>'text'</xs><xt>></xt> + Juno ATOM specification + <xt></atom:title></xt> + <xt><atom:updated></xt>2013-05-08T12:29:29Z<xt></atom:updated></xt> + <xt><atom:generator</xt> <xa>uri</xa>=<xs>'http://juno.ibm.com/'</xs> <xa>version</xa>=<xs>'1.0'</xs><xt>></xt> + Juno + <xt></atom:generator></xt> + <xt><atom:subtitle</xt> <xa>type</xa>=<xs>'html'</xs><xt>></xt> + A &lt;em&gt;lot&lt;/em&gt; of effort went into making this effortless + <xt></atom:subtitle></xt> + <xt><atom:entry></xt> + <xt><atom:author></xt> + <xt><atom:name></xt>James Bognar<xt></atom:name></xt> + <xt><atom:uri></xt>http://www.sample.com/<xt></atom:uri></xt> + <xt><atom:email></xt>[email protected]<xt></atom:email></xt> + <xt></atom:author></xt> + <xt><atom:contributor></xt> + <xt><atom:name></xt>Barry M. Caceres<xt></atom:name></xt> + <xt></atom:contributor></xt> + <xt><atom:id></xt> + tag:juno.sample.com,2013:1.2345 + <xt></atom:id></xt> + <xt><atom:link</xt> <xa>href</xa>=<xs>'http://www.sample.com/2012/05/08/juno.atom'</xs> <xa>rel</xa>=<xs>'alternate'</xs> <xa>type</xa>=<xs>'text/html'</xs><xt>/></xt> + <xt><atom:link</xt> <xa>href</xa>=<xs>'http://www.sample.com/audio/juno_podcast.mp3'</xs> <xa>rel</xa>=<xs>'enclosure'</xs> <xa>type</xa>=<xs>'audio/mpeg'</xs> <xa>length</xa>=<xs>'12345'</xs><xt>/></xt> + <xt><atom:title></xt> + Juno ATOM specification snapshot + <xt></atom:title></xt> + <xt><atom:updated></xt>2013-05-08T12:29:29Z<xt></atom:updated></xt> + <xt><atom:content</xt> <xa>xml:base</xa>=<xs>'http://www.ibm.com/'</xs> <xa>xml:lang</xa>=<xs>'en'</xs> <xa>type</xa>=<xs>'xhtml'</xs><xt>></xt> + <xt><div</xt> <xa>xmlns</xa>=<xs>"http://www.w3.org/1999/xhtml"</xs><xt>></xt><xt><p></xt><xt><i></xt>[Update: Juno supports ATOM.]<xt></i></xt><xt></p></xt><xt></div></xt> + <xt></atom:content></xt> + <xt><atom:published></xt>2013-05-08T12:29:29Z<xt></atom:published></xt> + <xt></atom:entry></xt> + <xt></atom:feed></xt> + </p> + + <p> + The following is the same, except with XML namespaces enabled and the ATOM namespace as the default namespace: + </p> + + <h6 class='figure'>Example with namespaces with ATOM as the default namespace</h6> + <p class='bcode'> + <jc>// Create a serializer with readable output with namespaces.</jc> + XmlSerializer s = <jk>new</jk> XmlSerializer.SqReadable().setProperty(XmlSerializerProperties.<jsf>XML_defaultNamespaceUri</jsf>, <js>"atom"</js>); + + <jc>// Serialize to ATOM/XML</jc> + String atomXml = s.serialize(feed); + </p> + + <h6 class='figure'>Results</h6> + <p class='bcode'> + <xt><feed</xt> + <xa>xmlns</xa>=<xs>'http://www.w3.org/2005/Atom/'</xs> + <xa>xmlns:xml</xa>=<xs>'http://www.w3.org/XML/1998/namespace'</xs> + <xa>xmlns:xsi</xa>=<xs>'http://www.w3.org/2001/XMLSchema-instance'</xs><xt>></xt> + <xt><id></xt> + tag:juno.sample.com,2013:1 + <xt></id></xt> + <xt><link</xt> <xa>href</xa>=<xs>'http://www.sample.com/'</xs> <xa>rel</xa>=<xs>'alternate'</xs> <xa>type</xa>=<xs>'text/html'</xs> <xa>hreflang</xa>=<xs>'en'</xs><xt>/></xt> + <xt><link</xt> <xa>href</xa>=<xs>'http://www.sample.com/feed.atom'</xs> <xa>rel</xa>=<xs>'self'</xs> <xa>type</xa>=<xs>'application/atom+xml'</xs><xt>/></xt> + <xt><rights></xt> + Copyright (c) 2013, IBM + <xt></rights></xt> + <xt><title</xt> <xa>type</xa>=<xs>'text'</xs><xt>></xt> + Juno ATOM specification + <xt></title></xt> + <xt><updated></xt>2013-05-08T12:29:29Z<xt></updated></xt> + <xt><generator</xt> <xa>uri</xa>=<xs>'http://juno.ibm.com/'</xs> <xa>version</xa>=<xs>'1.0'</xs><xt>></xt> + Juno + <xt></generator></xt> + <xt><subtitle</xt> <xa>type</xa>=<xs>'html'</xs><xt>></xt> + A &lt;em&gt;lot&lt;/em&gt; of effort went into making this effortless + <xt></subtitle></xt> + <xt><entry></xt> + <xt><author></xt> + <xt><name></xt>James Bognar<xt></name></xt> + <xt><uri></xt>http://www.sample.com/<xt></uri></xt> + <xt><email></xt>[email protected]<xt></email></xt> + <xt></author></xt> + <xt><contributor></xt> + <xt><name></xt>Barry M. Caceres<xt></name></xt> + <xt></contributor></xt> + <xt><id></xt> + tag:juno.sample.com,2013:1.2345 + <xt></id></xt> + <xt><link</xt> <xa>href</xa>=<xs>'http://www.sample.com/2012/05/08/juno.atom'</xs> <xa>rel</xa>=<xs>'alternate'</xs> <xa>type</xa>=<xs>'text/html'</xs><xt>/></xt> + <xt><link</xt> <xa>href</xa>=<xs>'http://www.sample.com/audio/juno_podcast.mp3'</xs> <xa>rel</xa>=<xs>'enclosure'</xs> <xa>type</xa>=<xs>'audio/mpeg'</xs> <xa>length</xa>=<xs>'12345'</xs><xt>/></xt> + <xt><title></xt> + Juno ATOM specification snapshot + <xt></title></xt> + <xt><updated></xt>2013-05-08T12:29:29Z<xt></updated></xt> + <xt><content</xt> <xa>xml:base</xa>=<xs>'http://www.ibm.com/'</xs> <xa>xml:lang</xa>=<xs>'en'</xs> <xa>type</xa>=<xs>'xhtml'</xs><xt>></xt> + <xt><div</xt> <xa>xmlns</xa>=<xs>"http://www.w3.org/1999/xhtml"</xs><xt>></xt><xt><p></xt><xt><i></xt>[Update: Juno supports ATOM.]<xt></i></xt><xt></p></xt><xt></div></xt> + <xt></content></xt> + <xt><published></xt>2013-05-08T12:29:29Z<xt></published></xt> + <xt></entry></xt> + <xt></feed></xt> + </p> + + + <!-- ======================================================================================================== --> + <a id="AtomJson"></a> + <h4 class='topic' onclick='toggle(this)'>1.1.1 - ATOM/JSON</h4> + <div class='topic'> + <p> + The {@link com.ibm.juno.core.json.JsonSerializer} class can also be used to produce ATOM in JSON format. + </p> + + <h6 class='figure'>ATOM/JSON example</h6> + <p class='bcode'> + <jc>// Get JSON serializer with readable output.</jc> + JsonSerializer s = JsonSerializer.<jsf>DEFAULT_LAX_READABLE</jsf>; + + <jc>// Serialize to ATOM/JSON</jc> + String atomJson = s.serialize(feed); + </p> + + <h6 class='figure'>Results</h6> + <p class='bcode'> + { + id: { + text: <js>'tag:juno.sample.com,2013:1'</js> + }, + links: [ + { + href: <js>'http://www.sample.com/'</js>, + rel: <js>'alternate'</js>, + type: <js>'text/html'</js>, + hreflang: <js>'en'</js> + }, + { + href: <js>'http://www.sample.com/feed.atom'</js>, + rel: <js>'self'</js>, + type: <js>'application/atom+xml'</js> + } + ], + rights: { + text: <js>'Copyright (c) 2013, IBM'</js> + }, + title: { + type: <js>'text'</js>, + text: <js>'Juno ATOM specification'</js> + }, + updated: <js>'2013-05-08T12:29:29Z'</js>, + generator: { + uri: <js>'http://juno.ibm.com/'</js>, + version: <js>'1.0'</js>, + text: <js>'Juno'</js> + }, + subtitle: { + type: <js>'html'</js>, + text: <js>'A <em>lot</em> of effort went into making this effortless'</js> + }, + entries: [ + { + authors: [ + { + name: <js>'James Bognar'</js>, + uri: <js>'http://www.sample.com/'</js>, + email: <js>'[email protected]'</js> + } + ], + contributors: [ + { + name: <js>'Barry M. Caceres'</js> + } + ], + id: { + text: <js>'tag:juno.sample.com,2013:1.2345'</js> + }, + links: [ + { + href: <js>'http://www.sample.com/2012/05/08/juno.atom'</js>, + rel: <js>'alternate'</js>, + type: <js>'text/html'</js> + }, + { + href: <js>'http://www.sample.com/audio/juno_podcast.mp3'</js>, + rel: <js>'enclosure'</js>, + type: <js>'audio/mpeg'</js>, + length: <jk>12345</jk> + } + ], + title: { + text: <js>'Juno ATOM specification snapshot'</js> + }, + updated: <js>'2013-05-08T12:29:29Z'</js>, + content: { + base: <js>'http://www.ibm.com/'</js>, + lang: <js>'en'</js>, + type: <js>'xhtml'</js>, + text: <js>'<div xmlns="http://www.w3.org/1999/xhtml"><p><i>[Update: Juno supports ATOM.]</i></p></div>'</js> + }, + published: <js>'2013-05-08T12:29:29Z'</js> + } + ] + } + </p> + </div> + + + <!-- ======================================================================================================== --> + <a id="AtomRdfXml"></a> + <h4 class='topic' onclick='toggle(this)'>1.1.2 - ATOM/RDF/XML</h4> + <div class='topic'> + <p> + The {@link com.ibm.juno.core.jena.RdfSerializer} class and subclasses can also be used to produce ATOM in various RDF formats. + </p> + + <h6 class='figure'>ATOM/RDF/XML example</h6> + <p class='bcode'> + <jc>// Get RDF/XML serializer with readable output.</jc> + RdfSerializer s = <jk>new</jk> RdfSerializer.XmlAbbrev() + .setProperty(SerializerProperties.<jsf>SERIALIZER_useIndentation</jsf>, <jk>true</jk>) + .setProperty(SerializerProperties.<jsf>SERIALIZER_quoteChar</jsf>, <js>'\''</js>) + .setProperty(RdfProperties.<jsf>RDF_rdfxml_tab</jsf>, 3); + + <jc>// Serialize to ATOM/RDF/XML</jc> + String atomRdfXml = s.serialize(feed); + </p> + + <h6 class='figure'>Results</h6> + <p class='bcode'> + <xt><rdf:RDF</xt> + <xa>xmlns:rdf</xa>=<xs>'http://www.w3.org/1999/02/22-rdf-syntax-ns#'</xs> + <xa>xmlns:j</xa>=<xs>'http://www.ibm.com/juno/'</xs> + <xa>xmlns:jp</xa>=<xs>'http://www.ibm.com/junobp/'</xs> + <xa>xmlns:atom</xa>=<xs>'http://www.w3.org/2005/Atom/'</xs> + <xa>xmlns:j.0</xa>=<xs>'http://www.w3.org/XML/1998/'</xs><xt>></xt> + <xt><rdf:Description></xt> + <xt><atom:id</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:text></xt>tag:juno.sample.com,2013:1<xt></atom:text></xt> + <xt></atom:id></xt> + <xt><atom:links></xt> + <xt><rdf:Seq></xt> + <xt><rdf:li</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:href></xt>http://www.sample.com/<xt></atom:href></xt> + <xt><atom:rel></xt>alternate<xt></atom:rel></xt> + <xt><atom:type></xt>text/html<xt></atom:type></xt> + <xt><atom:hreflang></xt>en<xt></atom:hreflang></xt> + <xt></rdf:li></xt> + <xt><rdf:li</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:href></xt>http://www.sample.com/feed.atom<xt></atom:href></xt> + <xt><atom:rel></xt>self<xt></atom:rel></xt> + <xt><atom:type></xt>application/atom+xml<xt></atom:type></xt> + <xt></rdf:li></xt> + <xt></rdf:Seq></xt> + <xt></atom:links></xt> + <xt><atom:rights</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:text></xt>Copyright (c) 2013, IBM<xt></atom:text></xt> + <xt></atom:rights></xt> + <xt><atom:title</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:type></xt>text<xt></atom:type></xt> + <xt><atom:text></xt>Juno ATOM specification<xt></atom:text></xt> + <xt></atom:title></xt> + <xt><atom:updated></xt>2013-05-08T12:29:29Z<xt></atom:updated></xt> + <xt><atom:generator</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:uri</xt> <xa>rdf:resource</xa>=<xs>'http://juno.ibm.com/'</xs><xt>/></xt> + <xt><atom:version></xt>1.0<xt></atom:version></xt> + <xt><atom:text></xt>Juno<xt></atom:text></xt> + <xt></atom:generator></xt> + <xt><atom:subtitle</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:type></xt>html<xt></atom:type></xt> + <xt><atom:text></xt>A &lt;em&gt;lot&lt;/em&gt; of effort went into making this effortless<xt></atom:text></xt> + <xt></atom:subtitle></xt> + <xt><atom:entries></xt> + <xt><rdf:Seq></xt> + <xt><rdf:li</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:authors></xt> + <xt><rdf:Seq></xt> + <xt><rdf:li</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:name></xt>James Bognar<xt></atom:name></xt> + <xt><atom:uri</xt> <xa>rdf:resource</xa>=<xs>'http://www.sample.com/'</xs><xt>/></xt> + <xt><atom:email></xt>[email protected]<xt></atom:email></xt> + <xt></rdf:li></xt> + <xt></rdf:Seq></xt> + <xt></atom:authors></xt> + <xt><atom:contributors></xt> + <xt><rdf:Seq></xt> + <xt><rdf:li</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:name></xt>Barry M. Caceres<xt></atom:name></xt> + <xt></rdf:li></xt> + <xt></rdf:Seq></xt> + <xt></atom:contributors></xt> + <xt><atom:id</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:text></xt>tag:juno.sample.com,2013:1.2345<xt></atom:text></xt> + <xt></atom:id></xt> + <xt><atom:links></xt> + <xt><rdf:Seq></xt> + <xt><rdf:li</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:href></xt>http://www.sample.com/2012/05/08/juno.atom<xt></atom:href></xt> + <xt><atom:rel></xt>alternate<xt></atom:rel></xt> + <xt><atom:type></xt>text/html<xt></atom:type></xt> + <xt></rdf:li></xt> + <xt><rdf:li</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:href></xt>http://www.sample.com/audio/juno_podcast.mp3<xt></atom:href></xt> + <xt><atom:rel></xt>enclosure<xt></atom:rel></xt> + <xt><atom:type></xt>audio/mpeg<xt></atom:type></xt> + <xt><atom:length></xt>12345<xt></atom:length></xt> + <xt></rdf:li></xt> + <xt></rdf:Seq></xt> + <xt></atom:links></xt> + <xt><atom:title</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><atom:text></xt>Juno ATOM specification snapshot<xt></atom:text></xt> + <xt></atom:title></xt> + <xt><atom:updated></xt>2013-05-08T12:29:29Z<xt></atom:updated></xt> + <xt><atom:content</xt> <xa>rdf:parseType</xa>=<xs>'Resource'</xs><xt>></xt> + <xt><j.0:namespacebase</xt> <xa>rdf:resource</xa>=<xs>'http://www.ibm.com/'</xs><xt>/></xt> + <xt><j.0:namespacelang></xt>en<xt></j.0:namespacelang></xt> + <xt><atom:type></xt>xhtml<xt></atom:type></xt> + <xt><atom:text></xt>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;&lt;i&gt;[Update: Juno supports ATOM.]&lt;/i&gt;&lt;/p&gt;&lt;/div&gt;<xt></atom:text></xt> + <xt></atom:content></xt> + <xt><atom:published></xt>2013-05-08T12:29:29Z<xt></atom:published></xt> + <xt></rdf:li></xt> + <xt></rdf:Seq></xt> + <xt></atom:entries></xt> + <xt></rdf:Description></xt> + <xt></rdf:RDF></xt> + </p> + </div> + + + <!-- ======================================================================================================== --> + <a id="AtomHtml"></a> + <h4 class='topic' onclick='toggle(this)'>1.1.3 - ATOM/HTML</h4> + <div class='topic'> + <p> + The {@link com.ibm.juno.core.html.HtmlSerializer} class can be used to produce ATOM in HTML format. + </p> + <p> + The following is the output produced by the <code>AtomFeedResource</code> in the <code>com.ibm.juno.sample.war</code> project: + </p> + + <h6 class='figure'>Example ATOM/HTML results</h6> + <img class='bordered' src='doc-files/Example_HTML.png'> + </div> + </div> + + + <!-- ======================================================================================================== --> + <a id="Parse"></a> + <h3 class='topic' onclick='toggle(this)'>1.2 - Parsing ATOM feeds</h3> + <div class='topic'> + <p> + Use the {@link com.ibm.juno.core.xml.XmlParser} to convert ATOM/XML feeds back into their original POJOs: + </p> + <p class='bcode'> + <jc>// Create a serializer with readable output with namespaces</jc> + XmlSerializer s = XmlSerializer.<jsf>DEFAULT_SQ_READABLE</jsf>; + + <jc>// Serialize to ATOM/XML</jc> + String atomXml = s.serialize(feed); + + <jc>// Get an XML parser to convert it back into a POJO</jc> + XmlParser p = XmlParser.<jsf>DEFAULT</jsf>; + + <jc>// Convert the XML back into a POJO</jc> + Feed feed2 = p.parse(atomXml, Feed.<jk>class</jk>); + </p> + <p> + ATOM Feed objects can also be constructed from the other media types using the appropriate parsers. + </p> + </div> + +</div> +<p align="center"><i><b>*** fÃn ***</b></i></p> + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/Column.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/Column.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/Column.class new file mode 100755 index 0000000..a9f814f Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/Column.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/Column.java ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/Column.java b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/Column.java new file mode 100755 index 0000000..aca9e6a --- /dev/null +++ b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/Column.java @@ -0,0 +1,154 @@ +/******************************************************************************* + * Licensed Materials - Property of IBM + * (c) Copyright IBM Corporation 2014, 2015. All Rights Reserved. + * + * The source code for this program is not published or otherwise + * divested of its trade secrets, irrespective of what has been + * deposited with the U.S. Copyright Office. + *******************************************************************************/ +package com.ibm.juno.core.dto.cognos; + +import com.ibm.juno.core.filter.*; +import com.ibm.juno.core.xml.annotation.*; + +/** + * Represents a meta-data column in a Cognos dataset. + * <p> + * When serialized to XML, creates the following construct: + * <p class='bcode'> + * <xt><item</xt> <xa>name</xa>=<xs>'name'</xs> <xa>type</xa>=<xs>'xs:String'</xs> <xa>length</xa>=<xs>'255'</xs>/> + * </p> + * + * @author James Bognar ([email protected]) + */ +@Xml(name="item") +@SuppressWarnings({"rawtypes","hiding"}) +public class Column { + + private String name, type; + private Integer length; + PojoFilter filter; + + /** Bean constructor. */ + public Column() {} + + /** + * Constructor. + * + * @param name The column name. + * @param type The column type (e.g. <js>"xs:String"</js>). + */ + public Column(String name, String type) { + this(name, type, null); + } + + /** + * Constructor. + * + * @param name The column name. + * @param type The column type (e.g. <js>"xs:String"</js>). + * @param length The column length (e.g. <code>255</code>). + */ + public Column(String name, String type, Integer length) { + this.name = name; + this.type = type; + this.length = length; + } + + /** + * Associates a POJO filter with this column. + * <p> + * Typically used to define columns that don't exist on the underlying beans being serialized. + * <p> + * For example, the <code>AddressBookResource</code> sample defined the following filter + * to define an additional <js>"numAddresses"</js> column even though no such property exists + * on the serialized beans. + * <p class='bcode'> + * Column c = <jk>new</jk> Column(<js>"numAddresses"</js>, <js>"xs:int"</js>) + * .addFilter( + * <jk>new</jk> PojoFilter<Person,Integer>() { + * <ja>@Override</ja> + * <jk>public</jk> Integer filter(Person p) { + * <jk>return</jk> p.<jf>addresses</jf>.size(); + * } + * } + * ); + * </p> + * + * @param filter The filter to associate with the column. + * @return This object (for method chaining). + */ + public Column addFilter(PojoFilter filter) { + this.filter = filter; + return this; + } + + //-------------------------------------------------------------------------------- + // Bean properties + //-------------------------------------------------------------------------------- + + /** + * Bean property getter: <property>name</property>. + * + * @return The value of the <property>name</property> property on this bean, or <jk>null</jk> if it is not set. + */ + @Xml(format=XmlFormat.ATTR) + public String getName() { + return name; + } + + /** + * Bean property setter: <property>name</property>. + * + * @param name The new value for the <property>name</property> property on this bean. + * @return This object (for method chaining). + */ + public Column setName(String name) { + this.name = name; + return this; + } + + /** + * Bean property getter: <property>type</property>. + * + * @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set. + */ + @Xml(format=XmlFormat.ATTR) + public String getType() { + return type; + } + + /** + * Bean property setter: <property>type</property>. + * + * @param type The new value for the <property>type</property> property on this bean. + * @return This object (for method chaining). + */ + public Column setType(String type) { + this.type = type; + return this; + } + + /** + * Bean property getter: <property>length</property>. + * + * @return The value of the <property>length</property> property on this bean, or <jk>null</jk> if length is not applicable for the specified type. + */ + @Xml(format=XmlFormat.ATTR) + public Integer getLength() { + return length; + } + + /** + * Bean property setter: <property>length</property>. + * + * @param length The new value for the <property>length</property> property on this bean. + * Can be <jk>null</jk> if length is not applicable for the specified type. + * @return This object (for method chaining). + */ + public Column setLength(Integer length) { + this.length = length; + return this; + } +} + http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/DataSet$Row.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/DataSet$Row.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/DataSet$Row.class new file mode 100755 index 0000000..e248dbe Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/DataSet$Row.class differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7e4f63e6/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/DataSet.class ---------------------------------------------------------------------- diff --git a/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/DataSet.class b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/DataSet.class new file mode 100755 index 0000000..521dc16 Binary files /dev/null and b/com.ibm.team.juno.releng/bin/core/com/ibm/juno/core/dto/cognos/DataSet.class differ
