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.dto.atom; 014 015import static org.apache.juneau.xml.annotation.XmlFormat.*; 016 017import java.util.*; 018 019import org.apache.juneau.annotation.*; 020import org.apache.juneau.xml.annotation.*; 021 022/** 023 * Top-level ATOM feed object. 024 * 025 * <p> 026 * Represents an <c>atomFeed</c> construct in the RFC4287 specification. 027 * 028 * <h5 class='figure'>Schema</h5> 029 * <p class='bcode w800'> 030 * atomFeed = 031 * element atom:feed { 032 * atomCommonAttributes, 033 * (atomAuthor* 034 * & atomCategory* 035 * & atomContributor* 036 * & atomGenerator? 037 * & atomIcon? 038 * & atomId 039 * & atomLink* 040 * & atomLogo? 041 * & atomRights? 042 * & atomSubtitle? 043 * & atomTitle 044 * & atomUpdated 045 * & extensionElement*), 046 * atomEntry* 047 * } 048 * </p> 049 * 050 * <ul class='seealso'> 051 * <li class='link'>{@doc DtoAtom} 052 * <li class='jp'>{@doc package-summary.html#TOC} 053 * </ul> 054 */ 055@Bean(typeName="feed") 056public class Feed extends CommonEntry { 057 058 private Generator generator; // atomGenerator? 059 private Icon icon; // atomIcon? 060 private Logo logo; // atomLogo? 061 private Text subtitle; // atomSubtitle? 062 private Entry[] entries; // atomEntry* 063 064 /** 065 * Normal constructor. 066 * 067 * @param id The feed identifier. 068 * @param title The feed title. 069 * @param updated The feed updated timestamp. 070 */ 071 public Feed(Id id, Text title, Calendar updated) { 072 super(id, title, updated); 073 } 074 075 /** 076 * Normal constructor. 077 * 078 * @param id The feed identifier. 079 * @param title The feed title. 080 * @param updated The feed updated timestamp. 081 */ 082 public Feed(String id, String title, String updated) { 083 super(id, title, updated); 084 } 085 086 /** Bean constructor. */ 087 public Feed() {} 088 089 090 //----------------------------------------------------------------------------------------------------------------- 091 // Bean properties 092 //----------------------------------------------------------------------------------------------------------------- 093 094 /** 095 * Returns generator information on this feed. 096 * 097 * @return The generator information on this feed. 098 */ 099 public Generator getGenerator() { 100 return generator; 101 } 102 103 /** 104 * Sets the generator information on this feed. 105 * 106 * @param generator The generator information on this feed. 107 * @return This object (for method chaining). 108 */ 109 @Beanp("generator") 110 public Feed generator(Generator generator) { 111 this.generator = generator; 112 return this; 113 } 114 115 /** 116 * Returns the feed icon. 117 * 118 * @return The feed icon. 119 */ 120 public Icon getIcon() { 121 return icon; 122 } 123 124 /** 125 * Sets the feed icon. 126 * 127 * @param icon The feed icon. 128 * @return This object (for method chaining). 129 */ 130 @Beanp("icon") 131 public Feed icon(Icon icon) { 132 this.icon = icon; 133 return this; 134 } 135 136 /** 137 * Returns the feed logo. 138 * 139 * @return The feed logo. 140 */ 141 public Logo getLogo() { 142 return logo; 143 } 144 145 /** 146 * Sets the feed logo. 147 * 148 * @param logo The feed logo. 149 * @return This object (for method chaining). 150 */ 151 @Beanp("logo") 152 public Feed logo(Logo logo) { 153 this.logo = logo; 154 return this; 155 } 156 157 /** 158 * Returns the feed subtitle. 159 * 160 * @return The feed subtitle. 161 */ 162 @Beanp("subtitle") 163 public Text getSubTitle() { 164 return subtitle; 165 } 166 167 /** 168 * Sets the feed subtitle. 169 * 170 * @param subtitle The feed subtitle. 171 * @return This object (for method chaining). 172 */ 173 @Beanp("subtitle") 174 public Feed subtitle(Text subtitle) { 175 this.subtitle = subtitle; 176 return this; 177 } 178 179 /** 180 * Sets the feed subtitle. 181 * 182 * @param subtitle The feed subtitle. 183 * @return This object (for method chaining). 184 */ 185 public Feed subtitle(String subtitle) { 186 this.subtitle = new Text(subtitle); 187 return this; 188 } 189 190 /** 191 * Returns the entries in the feed. 192 * 193 * @return The entries in the feed. 194 */ 195 @Xml(format=COLLAPSED) 196 public Entry[] getEntries() { 197 return entries; 198 } 199 200 /** 201 * Sets the entries in the feed. 202 * 203 * @param entries The entries in the feed. 204 * @return This object (for method chaining). 205 */ 206 @Beanp("entries") 207 public Feed entries(Entry...entries) { 208 this.entries = entries; 209 return this; 210 } 211 212 213 //----------------------------------------------------------------------------------------------------------------- 214 // Overridden setters (to simplify method chaining) 215 //----------------------------------------------------------------------------------------------------------------- 216 217 @Override /* CommonEntry */ 218 public Feed authors(Person...authors) { 219 super.authors(authors); 220 return this; 221 } 222 223 @Override /* CommonEntry */ 224 public Feed categories(Category...categories) { 225 super.categories(categories); 226 return this; 227 } 228 229 @Override /* CommonEntry */ 230 public Feed contributors(Person...contributors) { 231 super.contributors(contributors); 232 return this; 233 } 234 235 @Override /* CommonEntry */ 236 public Feed id(Id id) { 237 super.id(id); 238 return this; 239 } 240 241 @Override /* CommonEntry */ 242 public Feed links(Link...links) { 243 super.links(links); 244 return this; 245 } 246 247 @Override /* CommonEntry */ 248 public Feed rights(Text rights) { 249 super.rights(rights); 250 return this; 251 } 252 253 @Override /* CommonEntry */ 254 public Feed rights(String rights) { 255 super.rights(rights); 256 return this; 257 } 258 259 @Override /* CommonEntry */ 260 public Feed title(Text title) { 261 super.title(title); 262 return this; 263 } 264 265 @Override /* CommonEntry */ 266 public Feed title(String title) { 267 super.title(title); 268 return this; 269 } 270 271 @Override /* CommonEntry */ 272 public Feed updated(Calendar updated) { 273 super.updated(updated); 274 return this; 275 } 276 277 @Override /* CommonEntry */ 278 public Feed updated(String updated) { 279 super.updated(updated); 280 return this; 281 } 282 283 @Override /* Common */ 284 public Feed base(Object base) { 285 super.base(base); 286 return this; 287 } 288 289 @Override /* Common */ 290 public Feed lang(String lang) { 291 super.lang(lang); 292 return this; 293 } 294}