1 17 package com.sun.syndication.feed.rss; 18 19 import com.sun.syndication.feed.WireFeed; 20 import com.sun.syndication.feed.module.Module; 21 import com.sun.syndication.feed.module.impl.ModuleUtils; 22 23 import java.util.*; 24 25 34 public class Channel extends WireFeed { 35 public static final String SUNDAY = "sunday"; 36 public static final String MONDAY = "monday"; 37 public static final String TUESDAY = "tuesday"; 38 public static final String WEDNESDAY = "wednesday"; 39 public static final String THURSDAY = "thursday"; 40 public static final String FRIDAY = "friday"; 41 public static final String SATURDAY = "saturday"; 42 43 private static final Set DAYS = new HashSet(); 44 45 static { 46 DAYS.add(SUNDAY ); 47 DAYS.add(MONDAY ); 48 DAYS.add(TUESDAY ); 49 DAYS.add(WEDNESDAY); 50 DAYS.add(THURSDAY ); 51 DAYS.add(FRIDAY ); 52 DAYS.add(SATURDAY ); 53 } 54 55 private String _title; 56 private String _description; 57 private String _link; 58 private String _uri; 59 private Image _image; 60 private List _items; 61 private TextInput _textInput; 62 private String _language; 63 private String _rating; 64 private String _copyright; 65 private Date _pubDate; 66 private Date _lastBuildDate; 67 private String _docs; 68 private String _managingEditor; 69 private String _webMaster; 70 private List _skipHours; 71 private List _skipDays; 72 private Cloud _cloud; 73 private List _categories; 74 private String _generator; 75 private int _ttl = -1; 76 private List _modules; 77 78 82 public Channel() { 83 } 84 85 91 public Channel(String type) { 92 super(type); 93 } 94 95 101 public String getTitle() { 102 return _title; 103 } 104 105 111 public void setTitle(String title) { 112 _title = title; 113 } 114 115 121 public String getDescription() { 122 return _description; 123 } 124 125 131 public void setDescription(String description) { 132 _description = description; 133 } 134 135 141 public String getLink() { 142 return _link; 143 } 144 145 151 public void setLink(String link) { 152 _link = link; 153 } 154 155 160 public String getUri() { 161 return _uri; 162 } 163 164 169 public void setUri(String uri) { 170 _uri = uri; 171 } 172 173 179 public Image getImage() { 180 return _image; 181 } 182 183 189 public void setImage(Image image) { 190 _image = image; 191 } 192 193 200 public List getItems() { 201 return (_items==null) ? (_items=new ArrayList()) : _items; 202 } 203 204 211 public void setItems(List items) { 212 _items = items; 213 } 214 215 221 public TextInput getTextInput() { 222 return _textInput; 223 } 224 225 231 public void setTextInput(TextInput textInput) { 232 _textInput = textInput; 233 } 234 235 241 public String getLanguage() { 242 return _language; 243 } 244 245 251 public void setLanguage(String language) { 252 _language = language; 253 } 254 255 261 public String getRating() { 262 return _rating; 263 } 264 265 271 public void setRating(String rating) { 272 _rating = rating; 273 } 274 275 281 public String getCopyright() { 282 return _copyright; 283 } 284 285 291 public void setCopyright(String copyright) { 292 _copyright = copyright; 293 } 294 295 301 public Date getPubDate() { 302 return _pubDate; 303 } 304 305 311 public void setPubDate(Date pubDate) { 312 _pubDate = pubDate; 313 } 314 315 321 public Date getLastBuildDate() { 322 return _lastBuildDate; 323 } 324 325 331 public void setLastBuildDate(Date lastBuildDate) { 332 _lastBuildDate = lastBuildDate; 333 } 334 335 341 public String getDocs() { 342 return _docs; 343 } 344 345 351 public void setDocs(String docs) { 352 _docs = docs; 353 } 354 355 361 public String getManagingEditor() { 362 return _managingEditor; 363 } 364 365 371 public void setManagingEditor(String managingEditor) { 372 _managingEditor = managingEditor; 373 } 374 375 381 public String getWebMaster() { 382 return _webMaster; 383 } 384 385 391 public void setWebMaster(String webMaster) { 392 _webMaster = webMaster; 393 } 394 395 402 public List getSkipHours() { 403 return (_skipHours!=null) ? _skipHours : new ArrayList(); 404 } 405 406 413 public void setSkipHours(List skipHours) { 414 if (skipHours!=null) { 415 for (int i=0;i<skipHours.size();i++) { 416 Integer iHour = (Integer ) skipHours.get(i); 417 if (iHour!=null) { 418 int hour = iHour.intValue(); 419 if (hour<0 || hour>24) { 420 throw new IllegalArgumentException ("Invalid hour ["+hour+"]"); 421 } 422 } 423 else { 424 throw new IllegalArgumentException ("Invalid hour [null]"); 425 } 426 } 427 } 428 _skipHours = skipHours; 429 } 430 431 438 public List getSkipDays() { 439 return (_skipDays!=null) ? _skipDays : new ArrayList(); 440 } 441 442 449 public void setSkipDays(List skipDays) { 450 if (skipDays!=null) { 451 for (int i=0;i<skipDays.size();i++) { 452 String day = (String ) skipDays.get(i); 453 if (day!=null) { 454 day = day.toLowerCase(); 455 if (!DAYS.contains(day)) { 456 throw new IllegalArgumentException ("Invalid day ["+day+"]"); 457 } 458 skipDays.set(i,day); 459 } 460 else { 461 throw new IllegalArgumentException ("Invalid day [null]"); 462 } 463 } 464 } 465 _skipDays = skipDays; 466 } 467 468 474 public Cloud getCloud() { 475 return _cloud; 476 } 477 478 484 public void setCloud(Cloud cloud) { 485 _cloud = cloud; 486 } 487 488 495 public List getCategories() { 496 return (_categories==null) ? (_categories=new ArrayList()) : _categories; 497 } 498 499 506 public void setCategories(List categories) { 507 _categories = categories; 508 } 509 510 516 public String getGenerator() { 517 return _generator; 518 } 519 520 526 public void setGenerator(String generator) { 527 _generator = generator; 528 } 529 530 536 public int getTtl() { 537 return _ttl; 538 } 539 540 546 public void setTtl(int ttl) { 547 _ttl = ttl; 548 } 549 550 557 public List getModules() { 558 return (_modules==null) ? (_modules=new ArrayList()) : _modules; 559 } 560 561 568 public void setModules(List modules) { 569 _modules = modules; 570 } 571 572 578 public Module getModule(String uri) { 579 return ModuleUtils.getModule(_modules,uri); 580 } 581 582 583 } 584 | Popular Tags |