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