View Javadoc

1   /*
2    * Copyright 2004 Sun Microsystems, Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   */
17  package com.sun.syndication.feed.synd.impl;
18  
19  import com.sun.syndication.feed.WireFeed;
20  import com.sun.syndication.feed.rss.Channel;
21  import com.sun.syndication.feed.rss.Item;
22  import com.sun.syndication.feed.synd.SyndFeedI;
23  import com.sun.syndication.feed.synd.SyndEntryI;
24  
25  import java.util.List;
26  
27  /***
28   */
29  public class ConverterForRSS094 extends ConverterForRSS093 {
30  
31      public String getType() {
32          return "rss_0.94";
33      }
34  
35      public void copyInto(WireFeed feed,SyndFeedI syndFeed) {
36          Channel channel = (Channel) feed;
37          super.copyInto(channel,syndFeed);
38          List cats = channel.getCategories();
39          if (cats!=null) {
40              syndFeed.setCategories(this.createSyndCategories(cats));
41          }
42      }
43  
44      protected SyndEntryI createSyndEntry(Item item) {
45          SyndEntryI syndEntry = super.createSyndEntry(item);
46          syndEntry.setAuthor(item.getAuthor());
47          return syndEntry;
48      }
49  
50  
51      protected WireFeed createRealFeed(String type,SyndFeedI syndFeed) {
52          Channel channel = (Channel) super.createRealFeed(type,syndFeed);
53          List cats = syndFeed.getCategories();
54          if (cats!=null) {
55              channel.setCategories(createRSSCategories(cats));
56          }
57          return channel;
58      }
59  
60      protected Item createRSSItem(SyndEntryI sEntry) {
61          Item item = super.createRSSItem(sEntry);
62          item.setAuthor(sEntry.getAuthor());
63          return item;
64      }
65  
66  }