001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.examples.core.dto.atom;
014
015import org.apache.juneau.dto.atom.Feed;
016
017import static org.apache.juneau.dto.atom.AtomBuilder.*;
018import static org.apache.juneau.dto.atom.AtomBuilder.content;
019import static org.apache.juneau.dto.atom.AtomBuilder.person;
020
021/**
022 * Atom feed example.
023 *
024 * <ul class='seealso'>
025 *    <li class='extlink'>{@source}
026 * </ul>
027 */
028public class AtomFeed {
029
030   /**
031    * @return A sample Atom feed.
032    */
033   public static Feed getAtomFeed(){
034
035      Feed feed =
036         feed("tag:juneau.apache.org", "Juneau ATOM specification", "2016-01-02T03:04:05Z")
037         .subtitle(text("html").text("Describes <em>stuff</em> about Juneau"))
038         .links(
039            link("alternate", "text/html", "http://juneau.apache.org").hreflang("en"),
040            link("self", "application/atom+xml", "http://juneau.apache.org/feed.atom")
041         )
042         .generator(
043            generator("Juneau").uri("http://juneau.apache.org").version("1.0")
044         )
045         .entries(
046            entry("tag:juneau.sample.com,2013:1.2345", "Juneau ATOM specification snapshot", "2016-01-02T03:04:05Z")
047            .links(
048               link("alternate", "text/html", "http://juneau.apache.org/juneau.atom"),
049               link("enclosure", "audio/mpeg", "http://juneau.apache.org/audio/juneau_podcast.mp3").
050               length(1337)
051            )
052            .published("2016-01-02T03:04:05Z")
053            .authors(
054               person("Jane Smith").
055               uri("http://juneau.apache.org").
056               email("janesmith@apache.org")
057            )
058            .contributors(
059               person("John Smith")
060            )
061            .content(
062               content("xhtml")
063               .lang("en")
064               .base("http://www.apache.org/")
065               .text("<div><p><i>[Update: Juneau supports ATOM.]</i></p></div>")
066            )
067         );
068
069      return feed;
070
071   }
072}