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.*;
016import static org.apache.juneau.xml.annotation.XmlFormat.*;
017
018import java.util.*;
019
020import org.apache.juneau.internal.*;
021import org.apache.juneau.xml.annotation.*;
022
023/**
024 * Parent class of {@link Entry}, {@link Feed}, and {@link Source}.
025 *
026 * <h5 class='section'>See Also:</h5><ul>
027 *    <li class='link'><a class="doclink" href="../../../../../index.html#jd.Atom">Overview &gt; juneau-dto &gt; Atom</a>
028 * </ul>
029 */
030@FluentSetters
031public class CommonEntry extends Common {
032
033   private Person[] authors;
034   private Category[] categories;
035   private Person[] contributors;
036   private Id id;
037   private Link[] links;
038   private Text rights;
039   private Text title;
040   private Calendar updated;
041
042
043   /**
044    * Normal constructor.
045    *
046    * @param id The ID of this object.
047    * @param title The title of this object.
048    * @param updated The updated timestamp of this object.
049    */
050   public CommonEntry(Id id, Text title, Calendar updated) {
051      setId(id).setTitle(title).setUpdated(updated);
052   }
053
054   /**
055    * Normal constructor.
056    *
057    * @param id The ID of this object.
058    * @param title The title of this object.
059    * @param updated The updated timestamp of this object.
060    */
061   public CommonEntry(String id, String title, String updated) {
062      setId(id).setTitle(title).setUpdated(updated);
063   }
064
065   /** Bean constructor. */
066   public CommonEntry() {}
067
068
069   //-----------------------------------------------------------------------------------------------------------------
070   // Bean properties
071   //-----------------------------------------------------------------------------------------------------------------
072
073   /**
074    * Bean property getter:  <property>authors</property>.
075    *
076    * <p>
077    * The list of authors for this object.
078    *
079    * @return The property value, or <jk>null</jk> if it is not set.
080    */
081   @Xml(format=COLLAPSED, childName="author")
082   public Person[] getAuthors() {
083      return authors;
084   }
085
086   /**
087    * Bean property setter:  <property>authors</property>.
088    *
089    * <p>
090    * The list of authors for this object.
091    *
092    * @param value
093    *    The new value for this property.
094    *    <br>Can be <jk>null</jk> to unset the property.
095    * @return This object
096    */
097   @FluentSetter
098   public CommonEntry setAuthors(Person...value) {
099      this.authors = value;
100      return this;
101   }
102
103   /**
104    * Bean property getter:  <property>categories</property>.
105    *
106    * <p>
107    * The list of categories of this object.
108    *
109    * @return The property value, or <jk>null</jk> if it is not set.
110    */
111   @Xml(format=COLLAPSED, childName="category")
112   public Category[] getCategories() {
113      return categories;
114   }
115
116   /**
117    * Bean property setter:  <property>categories</property>.
118    *
119    * <p>
120    * The list of categories of this object.
121    *
122    * @param value
123    *    The new value for this property.
124    *    <br>Can be <jk>null</jk> to unset the property.
125    * @return This object
126    */
127   @FluentSetter
128   public CommonEntry setCategories(Category...value) {
129      this.categories = value;
130      return this;
131   }
132
133   /**
134    * Bean property getter:  <property>contributors</property>.
135    *
136    * <p>
137    * The list of contributors of this object.
138    *
139    * @return The property value, or <jk>null</jk> if it is not set.
140    */
141   @Xml(format=COLLAPSED, childName="contributor")
142   public Person[] getContributors() {
143      return contributors;
144   }
145
146   /**
147    * Bean property setter:  <property>contributors</property>.
148    *
149    * <p>
150    * The list of contributors of this object.
151    *
152    * @param value
153    *    The new value for this property.
154    *    <br>Can be <jk>null</jk> to unset the property.
155    * @return This object
156    */
157   @FluentSetter
158   public CommonEntry setContributors(Person...value) {
159      this.contributors = value;
160      return this;
161   }
162
163   /**
164    * Bean property getter:  <property>id</property>.
165    *
166    * <p>
167    * The ID of this object.
168    *
169    * @return The property value, or <jk>null</jk> if it is not set.
170    */
171   public Id getId() {
172      return id;
173   }
174
175   /**
176    * Bean property setter:  <property>id</property>.
177    *
178    * <p>
179    * The ID of this object.
180    *
181    * @param value
182    *    The new value for this property.
183    *    <br>Can be <jk>null</jk> to unset the property.
184    * @return This object
185    */
186   @FluentSetter
187   public CommonEntry setId(Id value) {
188      this.id = value;
189      return this;
190   }
191
192   /**
193    * Bean property fluent setter:  <property>id</property>.
194    *
195    * <p>
196    * The ID of this object.
197    *
198    * @param value
199    *    The new value for this property.
200    *    <br>Can be <jk>null</jk> to unset the property.
201    * @return This object.
202    */
203   @FluentSetter
204   public CommonEntry setId(String value) {
205      setId(new Id(value));
206      return this;
207   }
208
209   /**
210    * Bean property getter:  <property>links</property>.
211    *
212    * <p>
213    * The list of links of this object.
214    *
215    * @return The property value, or <jk>null</jk> if it is not set.
216    */
217   @Xml(format=COLLAPSED)
218   public Link[] getLinks() {
219      return links;
220   }
221
222   /**
223    * Bean property setter:  <property>links</property>.
224    *
225    * <p>
226    * The list of links of this object.
227    *
228    * @param value
229    *    The new value for this property.
230    *    <br>Can be <jk>null</jk> to unset the property.
231    * @return This object
232    */
233   @FluentSetter
234   public CommonEntry setLinks(Link...value) {
235      this.links = value;
236      return this;
237   }
238
239   /**
240    * Bean property getter:  <property>rights</property>.
241    *
242    * <p>
243    * The rights statement of this object.
244    *
245    * @return The property value, or <jk>null</jk> if it is not set.
246    */
247   public Text getRights() {
248      return rights;
249   }
250
251   /**
252    * Bean property setter:  <property>rights</property>.
253    *
254    * <p>
255    * The rights statement of this object.
256    *
257    * @param value
258    *    The new value for this property.
259    *    <br>Can be <jk>null</jk> to unset the property.
260    * @return This object
261    */
262   @FluentSetter
263   public CommonEntry setRights(Text value) {
264      this.rights = value;
265      return this;
266   }
267
268   /**
269    * Bean property fluent setter:  <property>rights</property>.
270    *
271    * <p>
272    * The rights statement of this object.
273    *
274    * @param value
275    *    The new value for this property.
276    *    <br>Can be <jk>null</jk> to unset the property.
277    * @return This object.
278    */
279   @FluentSetter
280   public CommonEntry setRights(String value) {
281      setRights(new Text().setText(value));
282      return this;
283   }
284
285   /**
286    * Bean property getter:  <property>title</property>.
287    *
288    * <p>
289    * The title of this object.
290    *
291    * @return The property value, or <jk>null</jk> if it is not set.
292    */
293   public Text getTitle() {
294      return title;
295   }
296
297   /**
298    * Bean property setter:  <property>title</property>.
299    *
300    * <p>
301    * The title of this object.
302    *
303    * @param value
304    *    The new value for this property.
305    *    <br>Can be <jk>null</jk> to unset the property.
306    * @return This object
307    */
308   @FluentSetter
309   public CommonEntry setTitle(Text value) {
310      this.title = value;
311      return this;
312   }
313
314   /**
315    * Bean property fluent setter:  <property>title</property>.
316    *
317    * <p>
318    * The title of this object.
319    *
320    * @param value
321    *    The new value for this property.
322    *    <br>Can be <jk>null</jk> to unset the property.
323    * @return This object.
324    */
325   @FluentSetter
326   public CommonEntry setTitle(String value) {
327      setTitle(new Text().setText(value));
328      return this;
329   }
330
331   /**
332    * Bean property getter:  <property>updated</property>.
333    *
334    * <p>
335    * The update timestamp of this object.
336    *
337    * @return The property value, or <jk>null</jk> if it is not set.
338    */
339   public Calendar getUpdated() {
340      return updated;
341   }
342
343   /**
344    * Bean property setter:  <property>updated</property>.
345    *
346    * <p>
347    * The update timestamp of this object.
348    *
349    * @param value
350    *    The new value for this property.
351    *    <br>Can be <jk>null</jk> to unset the property.
352    * @return This object
353    */
354   @FluentSetter
355   public CommonEntry setUpdated(Calendar value) {
356      this.updated = value;
357      return this;
358   }
359
360   /**
361    * Bean property fluent setter:  <property>updated</property>.
362    *
363    * <p>
364    * The update timestamp of this object.
365    *
366    * @param value
367    *    The new value for this property.
368    *    <br>Can be <jk>null</jk> to unset the property.
369    * @return This object.
370    */
371   @FluentSetter
372   public CommonEntry setUpdated(String value) {
373      setUpdated(parseDateTime(value));
374      return this;
375   }
376
377   // <FluentSetters>
378
379   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
380   public CommonEntry setBase(Object value) {
381      super.setBase(value);
382      return this;
383   }
384
385   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
386   public CommonEntry setLang(String value) {
387      super.setLang(value);
388      return this;
389   }
390
391   // </FluentSetters>
392}