Initial Checking from J.N

This commit is contained in:
kebernet 2011-04-01 05:09:11 +00:00
parent 05ae793dc7
commit f0c39ed946
52 changed files with 1156 additions and 850 deletions

View file

@ -1,4 +1,6 @@
Copyright 2004 Sun Microsystems, Inc.
Copyright 2011 The ROME Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View file

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.rometools</groupId>
<artifactId>rome</artifactId>
<name>ROME, RSS and atOM utilitiEs for Java</name>
<version>1.5-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>All Roads Lead to ROME. ROME is a set of Atom/RSS Java utilities that make it
easy to work in Java with most syndication formats. Today it accepts all flavors of RSS
@ -105,8 +104,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.4</source>
<target>1.4</target>
<source>1.5</source>
<target>1.5</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,7 +20,7 @@ package com.sun.syndication.feed;
/**
* @author Alejandro Abdelnur
*/
public interface CopyFrom {
public interface CopyFrom<T> {
/**
* Returns the interface the copyFrom works on.
@ -29,7 +30,7 @@ public interface CopyFrom {
* <p>
* @return the interface the copyFrom works on.
*/
public Class getInterface();
public Class<? extends CopyFrom> getInterface();
/**
* Copies all the properties of the given bean into this one.
@ -42,6 +43,6 @@ public interface CopyFrom {
* @param obj the instance to copy properties from.
*
*/
public void copyFrom(Object obj);
public void copyFrom(CopyFrom obj);
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -42,7 +43,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
private ObjectBean _objBean;
private String _feedType;
private String _encoding;
private List _modules;
private List<Module> _modules;
private List _foreignMarkup;
/**
@ -72,6 +73,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -83,10 +85,14 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (!(other instanceof WireFeed)){
return false;
}
// can't use foreign markup in equals, due to JDOM equals impl
Object fm = getForeignMarkup();
setForeignMarkup(((WireFeed)other).getForeignMarkup());
@ -104,6 +110,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -114,6 +121,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}
@ -175,8 +183,8 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
* an empty list if none.
*
*/
public List getModules() {
return (_modules==null) ? (_modules=new ArrayList()) : _modules;
public List<Module> getModules() {
return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
}
/**
@ -186,7 +194,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
* an empty list or <b>null</b> if none.
*
*/
public void setModules(List modules) {
public void setModules(List<Module> modules) {
_modules = modules;
}

View file

@ -50,6 +50,7 @@ public class Category implements Cloneable, Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -61,7 +62,11 @@ public class Category implements Cloneable, Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Category)){
return false;
}
return _objBean.equals(other);
}
@ -73,6 +78,7 @@ public class Category implements Cloneable, Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -83,6 +89,7 @@ public class Category implements Cloneable, Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -55,7 +55,7 @@ public class Content implements Cloneable,Serializable {
public static final String ESCAPED = "escaped";
private String _mode;
private static final Set MODES = new HashSet();
private static final Set<String> MODES = new HashSet<String>();
static {
MODES.add(XML);
MODES.add(BASE64);
@ -79,6 +79,7 @@ public class Content implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -90,7 +91,11 @@ public class Content implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Content)){
return false;
}
return _objBean.equals(other);
}
@ -102,6 +107,7 @@ public class Content implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -112,6 +118,7 @@ public class Content implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,6 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
*
* Copyright 2011 ROME Team
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -16,16 +16,18 @@
*/
package com.sun.syndication.feed.atom;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.module.impl.ModuleUtils;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.module.Extendable;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.module.impl.ModuleUtils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
/**
* Bean for entry elements of Atom feeds.
@ -34,29 +36,24 @@ import java.util.Iterator;
* @author Dave Johnson (updated for Atom 1.0)
*/
public class Entry implements Cloneable, Serializable, Extendable {
private ObjectBean _objBean;
private String _xmlBase;
private List _authors;
private List _contributors;
private List _categories;
private List _contents;
private String _id;
private Date _published; // AKA issued
private String _rights;
private Feed _source;
private Content _summary;
private Content _title;
private Date _updated; // AKA modified
private List _alternateLinks;
private List _otherLinks;
private List _foreignMarkup;
private List _modules;
private Date _created; // Atom 0.3 only
private Date _published; // AKA issued
private Date _updated; // AKA modified
private Feed _source;
private List<Link> _alternateLinks;
private List<Person> _authors;
private List<Category> _categories;
private List<Content> _contents;
private List<Person> _contributors;
private List<Link> _foreignMarkup;
private List<Module> _modules;
private List<Link> _otherLinks;
private ObjectBean _objBean;
private String _id;
private String _rights;
private String _xmlBase;
/**
* Default constructor. All properties are set to <b>null</b>.
@ -68,98 +65,13 @@ public class Entry implements Cloneable, Serializable, Extendable {
}
/**
* Creates a deep 'bean' clone of the object.
* Sets the entry alternate links.
* <p>
* @return a clone of the object.
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
* @param alternateLinks the list of Link elements with the entry alternate links to set,
* an empty list or <b>null</b> if none.
*/
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
/**
* Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
* <p>
* @param other he reference object with which to compare.
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
public boolean equals(Object other) {
if (other == null) {
return false;
}
// can't use foreign markup in equals, due to JDOM equals impl
Object fm = getForeignMarkup();
setForeignMarkup(((Entry)other).getForeignMarkup());
boolean ret = _objBean.equals(other);
// restore foreign markup
setForeignMarkup(fm);
return ret;
}
/**
* Returns a hashcode value for the object.
* <p>
* It follows the contract defined by the Object hashCode() method.
* <p>
* @return the hashcode of the bean object.
*
*/
public int hashCode() {
return _objBean.hashCode();
}
/**
* Returns the String representation for the object.
* <p>
* @return String representation for the object.
*
*/
public String toString() {
return _objBean.toString();
}
/**
* Returns the entry title.
* <p>
* @return the entry title, <b>null</b> if none.
*
*/
public String getTitle() {
if (_title != null) return _title.getValue();
return null;
}
/**
* Sets the entry title.
* <p>
* @param title the entry title, <b>null</b> if none.
*
*/
public void setTitle(String title) {
if (_title == null) _title = new Content();
_title.setValue(title);
}
/**
* Returns the entry title as a text construct.
* <p>
* @return the entry title, <b>null</b> if none.
*
*/
public Content getTitleEx() {
return _title;
}
/**
* Sets the entry title as a text construct.
* <p>
* @param title the entry title, <b>null</b> if none.
*
*/
public void setTitleEx(Content title) {
_title = title;
public void setAlternateLinks(List<Link> alternateLinks) {
_alternateLinks = alternateLinks;
}
/**
@ -167,184 +79,48 @@ public class Entry implements Cloneable, Serializable, Extendable {
* <p>
* @return a list of Link elements with the entry alternate links, an empty list if none.
*/
public List getAlternateLinks() {
public List<Link> getAlternateLinks() {
return (_alternateLinks == null) ? (_alternateLinks = new ArrayList()) : _alternateLinks;
}
/**
* Sets the entry alternate links.
* <p>
* @param alternateLinks the list of Link elements with the entry alternate links to set,
* an empty list or <b>null</b> if none.
*/
public void setAlternateLinks(List alternateLinks) {
_alternateLinks = alternateLinks;
}
/**
* Returns the entry non-alternate links.
* <p>
* @return the list of Link elements with the entry non-alternate links to set,
* an empty list if none.
*/
public List getOtherLinks() {
return (_otherLinks==null) ? (_otherLinks=new ArrayList()) : _otherLinks;
}
/**
* Sets the entry non-alternate links.
* <p>
* @param otherLinks the list Link elements with the entry non-alternate links to set,
* an empty list or <b>null</b> if none.
*/
public void setOtherLinks(List otherLinks) {
_otherLinks = otherLinks;
}
/**
* Returns the entry author.
* <p>
* @return the entry author, <b>null</b> if none.
*
*/
public List getAuthors() {
return (_authors==null) ? (_authors=new ArrayList()) : _authors;
}
/**
* Sets the author of the entry.
* <p>
* @param authors the author of the entry, <b>null</b> if none.
*
*/
public void setAuthors(List authors) {
public void setAuthors(List<Person> authors) {
_authors = authors;
}
/**
* Returns the entry contributors.
* Returns the entry author.
* <p>
* @return a list of Person elements with the entry contributors,
* an empty list if none.
* @return the entry author, <b>null</b> if none.
*
*/
public List getContributors() {
return (_contributors==null) ? (_contributors=new ArrayList()) : _contributors;
public List<Person> getAuthors() {
return (_authors == null) ? (_authors = new ArrayList<Person>()) : _authors;
}
/**
* Sets the entry contributors.
* Set the categories
* <p>
* @param contributors the list of Person elements with the entry contributors to set,
* an empty list or <b>null</b> if none.
*
* @param categories The categories to set.
* @since Atom 1.0
*/
public void setContributors(List contributors) {
_contributors = contributors;
public void setCategories(List categories) {
_categories = categories;
}
/**
* Returns the entry ID.
* Returns the categories
* <p>
* @return the entry ID, <b>null</b> if none.
*
* @return Returns the categories.
* @since Atom 1.0
*/
public String getId() {
return _id;
}
/**
* Sets the entry ID.
* <p>
* @param id the entry ID, <b>null</b> if none.
*
*/
public void setId(String id) {
_id = id;
}
/**
* Returns the entry modified date (Atom 0.3, maps to {@link #getUpdated()}).
* <p>
* @return the entry modified date, <b>null</b> if none.
*/
public Date getModified() {
return _updated;
}
/**
* Sets the entry modified date (Atom 0.3, maps to {@link #setUpdated(java.util.Date)}).
* <p>
* @param modified the entry modified date, <b>null</b> if none.
*/
public void setModified(Date modified) {
_updated = modified;
}
/**
* Returns the entry issued date (Atom 0.3, maps to {@link #getPublished()}).
* <p>
* @return the entry issued date, <b>null</b> if none.
*/
public Date getIssued() {
return _published;
}
/**
* Sets the entry issued date (Atom 0.3, maps to {@link #setPublished(java.util.Date)}).
* <p>
* @param issued the entry issued date, <b>null</b> if none.
*/
public void setIssued(Date issued) {
_published = issued;
}
/**
* Returns the entry created date (Atom 0.3 only)
* <p>
* @return the entry created date, <b>null</b> if none.
*/
public Date getCreated() {
return _created;
}
/**
* Sets the entry created date (Atom 0.3 only)
* <p>
* @param created the entry created date, <b>null</b> if none.
*/
public void setCreated(Date created) {
_created = created;
}
/**
* Returns the entry summary.
* <p>
* @return the entry summary, <b>null</b> if none.
*
*/
public Content getSummary() {
return _summary;
}
/**
* Sets the entry summary.
* <p>
* @param summary the entry summary, <b>null</b> if none.
*
*/
public void setSummary(Content summary) {
_summary = summary;
}
/**
* Returns the entry contents.
* <p>
* @return a list of Content elements with the entry contents,
* an empty list if none.
*/
public List getContents() {
return (_contents==null) ? (_contents=new ArrayList()) : _contents;
public List getCategories() {
return (_categories == null) ? (_categories = new ArrayList()) : _categories;
}
/**
@ -358,14 +134,161 @@ public class Entry implements Cloneable, Serializable, Extendable {
}
/**
* Returns the entry modules.
* Returns the entry contents.
* <p>
* @return a list of ModuleImpl elements with the entry modules,
* an emtpy list if none.
* @return a list of Content elements with the entry contents,
* an empty list if none.
*/
public List<Content> getContents() {
return (_contents == null) ? (_contents = new ArrayList<Content>()) : _contents;
}
/**
* Sets the entry contributors.
* <p>
* @param contributors the list of Person elements with the entry contributors to set,
* an empty list or <b>null</b> if none.
*
*/
public List getModules() {
return (_modules==null) ? (_modules=new ArrayList()) : _modules;
public void setContributors(List<Person> contributors) {
_contributors = contributors;
}
/**
* Returns the entry contributors.
* <p>
* @return a list of Person elements with the entry contributors,
* an empty list if none.
*
*/
public List<Person> getContributors() {
return (_contributors == null) ? (_contributors = new ArrayList()) : _contributors;
}
/**
* Sets the entry created date (Atom 0.3 only)
* <p>
* @param created the entry created date, <b>null</b> if none.
*/
public void setCreated(Date created) {
_created = new Date(created.getTime());
}
/**
* Returns the entry created date (Atom 0.3 only)
* <p>
* @return the entry created date, <b>null</b> if none.
*/
public Date getCreated() {
return _created == null ? null : new Date(_created.getTime());
}
/**
* Sets foreign markup found at entry level.
* <p>
* @param foreignMarkup Opaque object to discourage use
*
*/
public void setForeignMarkup(Object foreignMarkup) {
_foreignMarkup = (List) foreignMarkup;
}
/**
* Returns foreign markup found at entry level.
* <p>
* @return list of Opaque object to discourage use
*
*/
public Object getForeignMarkup() {
return (_foreignMarkup == null) ? (_foreignMarkup = new ArrayList()) : _foreignMarkup;
}
/**
* Sets the entry ID.
* <p>
* @param id the entry ID, <b>null</b> if none.
*
*/
public void setId(String id) {
_id = id;
}
/**
* Returns the entry ID.
* <p>
* @return the entry ID, <b>null</b> if none.
*
*/
public String getId() {
return _id;
}
/**
* Sets the entry issued date (Atom 0.3, maps to {@link #setPublished(java.util.Date)}).
* <p>
* @param issued the entry issued date, <b>null</b> if none.
*/
public void setIssued(Date issued) {
_published = new Date(issued.getTime());
}
/**
* Returns the entry issued date (Atom 0.3, maps to {@link #getPublished()}).
* <p>
* @return the entry issued date, <b>null</b> if none.
*/
public Date getIssued() {
return new Date(_published.getTime());
}
/**
* Returns true if entry is a media entry, i.e. has rel="edit-media".
*
* @return true if entry is a media entry
*/
public boolean isMediaEntry() {
boolean mediaEntry = false;
List links = getOtherLinks();
for (Iterator it = links.iterator(); it.hasNext();) {
Link link = (Link) it.next();
if ("edit-media".equals(link.getRel())) {
mediaEntry = true;
break;
}
}
return mediaEntry;
}
/**
* Sets the entry modified date (Atom 0.3, maps to {@link #setUpdated(java.util.Date)}).
* <p>
* @param modified the entry modified date, <b>null</b> if none.
*/
public void setModified(Date modified) {
_updated = new Date(modified.getTime());
}
/**
* Returns the entry modified date (Atom 0.3, maps to {@link #getUpdated()}).
* <p>
* @return the entry modified date, <b>null</b> if none.
*/
public Date getModified() {
return new Date(_updated.getTime());
}
/**
* Returns the module identified by a given URI.
* <p>
* @param uri the URI of the ModuleImpl.
* @return The module with the given URI, <b>null</b> if none.
*/
public Module getModule(String uri) {
return ModuleUtils.getModule(_modules, uri);
}
/**
@ -380,23 +303,34 @@ public class Entry implements Cloneable, Serializable, Extendable {
}
/**
* Returns the module identified by a given URI.
* Returns the entry modules.
* <p>
* @param uri the URI of the ModuleImpl.
* @return The module with the given URI, <b>null</b> if none.
* @return a list of ModuleImpl elements with the entry modules,
* an emtpy list if none.
*
*/
public Module getModule(String uri) {
return ModuleUtils.getModule(_modules,uri);
public List getModules() {
return (_modules == null) ? (_modules = new ArrayList()) : _modules;
}
/**
* Returns the published
* Sets the entry non-alternate links.
* <p>
* @return Returns the published.
* @since Atom 1.0
* @param otherLinks the list Link elements with the entry non-alternate links to set,
* an empty list or <b>null</b> if none.
*/
public Date getPublished() {
return _published;
public void setOtherLinks(List<Link> otherLinks) {
_otherLinks = otherLinks;
}
/**
* Returns the entry non-alternate links.
* <p>
* @return the list of Link elements with the entry non-alternate links to set,
* an empty list if none.
*/
public List<Link> getOtherLinks() {
return (_otherLinks == null) ? (_otherLinks = new ArrayList<Link>()) : _otherLinks;
}
/**
@ -406,17 +340,17 @@ public class Entry implements Cloneable, Serializable, Extendable {
* @since Atom 1.0
*/
public void setPublished(Date published) {
_published = published;
_published = new Date(published.getTime());
}
/**
* Returns the rights
* Returns the published
* <p>
* @return Returns the rights.
* @return Returns the published.
* @since Atom 1.0
*/
public String getRights() {
return _rights;
public Date getPublished() {
return _published == null ? null : new Date(_published.getTime());
}
/**
@ -430,12 +364,13 @@ public class Entry implements Cloneable, Serializable, Extendable {
}
/**
* Returns the source
* Returns the rights
* <p>
* @return Returns the source.
* @return Returns the rights.
* @since Atom 1.0
*/
public Feed getSource() {
return _source;
public String getRights() {
return _rights;
}
/**
@ -448,13 +383,80 @@ public class Entry implements Cloneable, Serializable, Extendable {
}
/**
* Returns the updated
* Returns the source
* <p>
* @return Returns the updated.
* @since Atom 1.0
* @return Returns the source.
*/
public Date getUpdated() {
return _updated;
public Feed getSource() {
return _source;
}
/**
* Sets the entry summary.
* <p>
* @param summary the entry summary, <b>null</b> if none.
*
*/
public void setSummary(Content summary) {
_summary = summary;
}
/**
* Returns the entry summary.
* <p>
* @return the entry summary, <b>null</b> if none.
*
*/
public Content getSummary() {
return _summary;
}
/**
* Sets the entry title.
* <p>
* @param title the entry title, <b>null</b> if none.
*
*/
public void setTitle(String title) {
if (_title == null) {
_title = new Content();
}
_title.setValue(title);
}
/**
* Returns the entry title.
* <p>
* @return the entry title, <b>null</b> if none.
*
*/
public String getTitle() {
if (_title != null) {
return _title.getValue();
}
return null;
}
/**
* Sets the entry title as a text construct.
* <p>
* @param title the entry title, <b>null</b> if none.
*
*/
public void setTitleEx(Content title) {
_title = title;
}
/**
* Returns the entry title as a text construct.
* <p>
* @return the entry title, <b>null</b> if none.
*
*/
public Content getTitleEx() {
return _title;
}
/**
@ -464,28 +466,27 @@ public class Entry implements Cloneable, Serializable, Extendable {
* @since Atom 1.0
*/
public void setUpdated(Date updated) {
_updated = updated;
_updated = new Date(updated.getTime());
}
/**
* Returns the categories
* Returns the updated
* <p>
* @return Returns the categories.
* @return Returns the updated.
* @since Atom 1.0
*/
public List getCategories() {
return (_categories==null) ? (_categories=new ArrayList()) : _categories;
public Date getUpdated() {
return new Date(_updated.getTime());
}
/**
* Set the categories
* Set the xmlBase
* <p>
* @param categories The categories to set.
* @param xmlBase The xmlBase to set.
* @since Atom 1.0
*/
public void setCategories(List categories) {
_categories = categories;
public void setXmlBase(String xmlBase) {
_xmlBase = xmlBase;
}
/**
@ -499,52 +500,64 @@ public class Entry implements Cloneable, Serializable, Extendable {
}
/**
* Set the xmlBase
* Creates a deep 'bean' clone of the object.
* <p>
* @param xmlBase The xmlBase to set.
* @since Atom 1.0
*/
public void setXmlBase(String xmlBase) {
_xmlBase = xmlBase;
}
/**
* Returns foreign markup found at entry level.
* <p>
* @return list of Opaque object to discourage use
* @return a clone of the object.
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
public Object getForeignMarkup() {
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList()) : _foreignMarkup;
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
/**
* Sets foreign markup found at entry level.
* Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
* <p>
* @param foreignMarkup Opaque object to discourage use
* @param other he reference object with which to compare.
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
public void setForeignMarkup(Object foreignMarkup) {
_foreignMarkup = (List)foreignMarkup;
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
}
if(!(other instanceof Entry)){
return false;
}
// can't use foreign markup in equals, due to JDOM equals impl
Object fm = getForeignMarkup();
setForeignMarkup(((Entry) other).getForeignMarkup());
boolean ret = _objBean.equals(other);
// restore foreign markup
setForeignMarkup(fm);
return ret;
}
/**
* Returns true if entry is a media entry, i.e. has rel="edit-media".
* Returns a hashcode value for the object.
* <p>
* It follows the contract defined by the Object hashCode() method.
* <p>
* @return the hashcode of the bean object.
*
* @return true if entry is a media entry
*/
public boolean isMediaEntry() {
boolean mediaEntry = false;
List links = getOtherLinks();
for (Iterator it = links.iterator(); it.hasNext();) {
Link link = (Link) it.next();
if ("edit-media".equals(link.getRel())) {
mediaEntry = true;
break;
}
}
return mediaEntry;
@Override
public int hashCode() {
return _objBean.hashCode();
}
/**
* Returns the String representation for the object.
* <p>
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}
}

View file

@ -35,9 +35,9 @@ import java.util.List;
public class Feed extends WireFeed {
private String _xmlBase;
private List _categories;
private List _authors;
private List _contributors;
private List<Category> _categories;
private List<Person> _authors;
private List<Person> _contributors;
private Generator _generator;
private String _icon;
private String _id;
@ -46,11 +46,11 @@ public class Feed extends WireFeed {
private Content _subtitle; // AKA tagline
private Content _title;
private Date _updated; // AKA modified
private List _alternateLinks;
private List _otherLinks;
private List _entries;
private List<Link> _alternateLinks;
private List<Link> _otherLinks;
private List<Entry> _entries;
private List _modules;
private List<Module> _modules;
private Content _info; // Atom 0.3 only
private String _language; // Atom 0.3 only
@ -140,8 +140,8 @@ public class Feed extends WireFeed {
* @return a list of Link elements with the feed alternate links,
* an empty list if none.
*/
public List getAlternateLinks() {
return (_alternateLinks==null) ? (_alternateLinks=new ArrayList()) : _alternateLinks;
public List<Link> getAlternateLinks() {
return (_alternateLinks==null) ? (_alternateLinks=new ArrayList<Link>()) : _alternateLinks;
}
/**
@ -150,7 +150,7 @@ public class Feed extends WireFeed {
* @param alternateLinks the list of Link elements with the feed alternate links to set,
* an empty list or <b>null</b> if none.
*/
public void setAlternateLinks(List alternateLinks) {
public void setAlternateLinks(List<Link> alternateLinks) {
_alternateLinks = alternateLinks;
}
@ -160,7 +160,7 @@ public class Feed extends WireFeed {
* @return a list of Link elements with the feed other links (non-alternate ones),
* an empty list if none.
*/
public List getOtherLinks() {
public List<Link> getOtherLinks() {
return (_otherLinks==null) ? (_otherLinks=new ArrayList()) : _otherLinks;
}
@ -170,7 +170,7 @@ public class Feed extends WireFeed {
* @param otherLinks the list of Link elements with the feed other links (non-alternate ones) to set,
* an empty list or <b>null</b> if none.
*/
public void setOtherLinks(List otherLinks) {
public void setOtherLinks(List<Link> otherLinks) {
_otherLinks = otherLinks;
}
@ -180,8 +180,8 @@ public class Feed extends WireFeed {
* @return the feed author, <b>null</b> if none.
*
*/
public List getAuthors() {
return (_authors==null) ? (_authors=new ArrayList()) : _authors;
public List<Person> getAuthors() {
return (_authors==null) ? (_authors=new ArrayList<Person>()) : _authors;
}
/**
@ -190,7 +190,7 @@ public class Feed extends WireFeed {
* @param authors the feed author to set, <b>null</b> if none.
*
*/
public void setAuthors(List authors) {
public void setAuthors(List<Person> authors) {
_authors = authors;
}
@ -201,8 +201,8 @@ public class Feed extends WireFeed {
* an empty list if none.
*
*/
public List getContributors() {
return (_contributors==null) ? (_contributors=new ArrayList()) : _contributors;
public List<Person> getContributors() {
return (_contributors==null) ? (_contributors=new ArrayList<Person>()) : _contributors;
}
/**
@ -212,7 +212,7 @@ public class Feed extends WireFeed {
* an empty list or <b>null</b> if none.
*
*/
public void setContributors(List contributors) {
public void setContributors(List<Person> contributors) {
_contributors = contributors;
}
@ -335,8 +335,8 @@ public class Feed extends WireFeed {
* an empty list if none.
*
*/
public List getEntries() {
return (_entries==null) ? (_entries=new ArrayList()) : _entries;
public List<Entry> getEntries() {
return (_entries==null) ? (_entries=new ArrayList<Entry>()) : _entries;
}
/**
@ -357,8 +357,8 @@ public class Feed extends WireFeed {
* an empty list if none.
*
*/
public List getModules() {
return (_modules==null) ? (_modules=new ArrayList()) : _modules;
public List<Module> getModules() {
return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
}
/**
@ -368,7 +368,8 @@ public class Feed extends WireFeed {
* an empty list or <b>null</b> if none.
*
*/
public void setModules(List modules) {
@Override
public void setModules(List<Module> modules) {
_modules = modules;
}
@ -378,6 +379,7 @@ public class Feed extends WireFeed {
* @param uri the URI of the ModuleImpl.
* @return The module with the given URI, <b>null</b> if none.
*/
@Override
public Module getModule(String uri) {
return ModuleUtils.getModule(_modules,uri);
}
@ -398,7 +400,7 @@ public class Feed extends WireFeed {
* @param categories The categories to set.
* @since Atom 1.0
*/
public void setCategories(List categories) {
public void setCategories(List<Category> categories) {
_categories = categories;
}

View file

@ -16,7 +16,6 @@
*/
package com.sun.syndication.feed.atom;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.impl.ObjectBean;
import java.io.Serializable;
@ -49,6 +48,7 @@ public class Generator implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -60,7 +60,11 @@ public class Generator implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Generator)){
return false;
}
return _objBean.equals(other);
}
@ -72,6 +76,7 @@ public class Generator implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -82,6 +87,7 @@ public class Generator implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -54,6 +54,7 @@ public class Link implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -65,6 +66,7 @@ public class Link implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
return _objBean.equals(other);
}
@ -77,6 +79,7 @@ public class Link implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -87,6 +90,7 @@ public class Link implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -58,6 +58,7 @@ public class Person implements Cloneable,Serializable, Extendable
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -69,6 +70,7 @@ public class Person implements Cloneable,Serializable, Extendable
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
return _objBean.equals(other);
}
@ -81,6 +83,7 @@ public class Person implements Cloneable,Serializable, Extendable
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -91,6 +94,7 @@ public class Person implements Cloneable,Serializable, Extendable
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -43,7 +43,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getTitles();
List<String> getTitles();
/**
* Sets the DublinCore module titles.
@ -52,7 +52,7 @@ public interface DCModule extends Module,CopyFrom {
* to set, an empty list or <b>null</b> if none.
*
*/
void setTitles(List titles);
void setTitles(List<String> titles);
/**
* Gets the DublinCore module title. Convenience method that can be used
@ -78,7 +78,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getCreators();
List<String> getCreators();
/**
* Sets the DublinCore module creators.
@ -87,7 +87,7 @@ public interface DCModule extends Module,CopyFrom {
* creators to set, an empty list or <b>null</b> if none.
*
*/
void setCreators(List creators);
void setCreators(List<String> creators);
/**
* Gets the DublinCore module creator. Convenience method that can be used
@ -113,7 +113,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getSubjects();
List<DCSubject> getSubjects();
/**
* Sets the DublinCore module subjects.
@ -122,7 +122,7 @@ public interface DCModule extends Module,CopyFrom {
* module subjects to set, an empty list or <b>null</b> if none.
*
*/
void setSubjects(List subjects);
void setSubjects(List<DCSubject> subjects);
/**
* Gets the DublinCore module subject. Convenience method that can be used
@ -148,7 +148,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getDescriptions();
List<String> getDescriptions();
/**
* Sets the DublinCore module descriptions.
@ -157,7 +157,7 @@ public interface DCModule extends Module,CopyFrom {
* module descriptions to set, an empty list or <b>null</b> if none.
*
*/
void setDescriptions(List descriptions);
void setDescriptions(List<String> descriptions);
/**
* Gets the DublinCore module description. Convenience method that can be
@ -183,7 +183,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getPublishers();
List<String> getPublishers();
/**
* Sets the DublinCore module publishers.
@ -192,7 +192,7 @@ public interface DCModule extends Module,CopyFrom {
* publishers to set, an empty list or <b>null</b> if none.
*
*/
void setPublishers(List publishers);
void setPublishers(List<String> publishers);
/**
* Gets the DublinCore module publisher. Convenience method that can be
@ -218,7 +218,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getContributors();
List<String> getContributors();
/**
* Sets the DublinCore module contributors.
@ -227,7 +227,7 @@ public interface DCModule extends Module,CopyFrom {
* contributors to set, an empty list or <b>null</b> if none.
*
*/
void setContributors(List contributors);
void setContributors(List<String> contributors);
/**
* Gets the DublinCore module contributor. Convenience method that can be
@ -253,7 +253,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getDates();
List<Date> getDates();
/**
* Sets the DublinCore module dates.
@ -262,7 +262,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list or <b>null</b> if none.
*
*/
void setDates(List dates);
void setDates(List<Date> dates);
/**
* Gets the DublinCore module date. Convenience method that can be used to
@ -288,7 +288,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getTypes();
List<String> getTypes();
/**
* Sets the DublinCore module types.
@ -297,7 +297,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list or <b>null</b> if none.
*
*/
void setTypes(List types);
void setTypes(List<String> types);
/**
* Gets the DublinCore module type. Convenience method that can be used
@ -323,7 +323,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getFormats();
List<String> getFormats();
/**
* Sets the DublinCore module formats.
@ -332,7 +332,7 @@ public interface DCModule extends Module,CopyFrom {
* formats to set, an empty list or <b>null</b> if none.
*
*/
void setFormats(List formats);
void setFormats(List<String> formats);
/**
* Gets the DublinCore module format. Convenience method that can be used
@ -358,7 +358,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getIdentifiers();
List<String> getIdentifiers();
/**
* Sets the DublinCore module identifiers.
@ -367,7 +367,7 @@ public interface DCModule extends Module,CopyFrom {
* identifiers to set, an empty list or <b>null</b> if none.
*
*/
void setIdentifiers(List identifiers);
void setIdentifiers(List<String> identifiers);
/**
* Gets the DublinCore module identifier. Convenience method that can be
@ -393,7 +393,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getSources();
List<String> getSources();
/**
* Sets the DublinCore module sources.
@ -402,7 +402,7 @@ public interface DCModule extends Module,CopyFrom {
* sources to set, an empty list or <b>null</b> if none.
*
*/
void setSources(List sources);
void setSources(List<String> sources);
/**
* Gets the DublinCore module subject. Convenience method that can be used
@ -428,7 +428,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getLanguages();
List<String> getLanguages();
/**
* Sets the DublinCore module languages.
@ -437,7 +437,7 @@ public interface DCModule extends Module,CopyFrom {
* languages to set, an empty list or <b>null</b> if none.
*
*/
void setLanguages(List languages);
void setLanguages(List<String> languages);
/**
* Gets the DublinCore module language. Convenience method that can be used
@ -463,7 +463,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getRelations();
List<String> getRelations();
/**
* Sets the DublinCore module relations.
@ -472,7 +472,7 @@ public interface DCModule extends Module,CopyFrom {
* relations to set, an empty list or <b>null</b> if none.
*
*/
void setRelations(List relations);
void setRelations(List<String> relations);
/**
* Gets the DublinCore module relation. Convenience method that can be used
@ -498,7 +498,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getCoverages();
List<String> getCoverages();
/**
* Sets the DublinCore module coverages.
@ -507,7 +507,7 @@ public interface DCModule extends Module,CopyFrom {
* coverages to set, an empty list or <b>null</b> if none.
*
*/
void setCoverages(List coverages);
void setCoverages(List<String> coverages);
/**
* Gets the DublinCore module coverage. Convenience method that can be used
@ -533,7 +533,7 @@ public interface DCModule extends Module,CopyFrom {
* an empty list if none.
*
*/
List getRightsList();
List<String> getRightsList();
/**
* Sets the DublinCore module rightss.
@ -542,7 +542,7 @@ public interface DCModule extends Module,CopyFrom {
* rights to set, an empty list or <b>null</b> if none.
*
*/
void setRightsList(List rights);
void setRightsList(List<String> rights);
/**
* Gets the DublinCore module right. Convenience method that can be used

View file

@ -16,6 +16,7 @@
*/
package com.sun.syndication.feed.module;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.CopyFromHelper;
import com.sun.syndication.feed.impl.ObjectBean;
@ -31,21 +32,21 @@ import java.util.*;
*/
public class DCModuleImpl extends ModuleImpl implements DCModule {
private ObjectBean _objBean;
private List _title;
private List _creator;
private List _subject;
private List _description;
private List _publisher;
private List _contributors;
private List _date;
private List _type;
private List _format;
private List _identifier;
private List _source;
private List _language;
private List _relation;
private List _coverage;
private List _rights;
private List<String> _title;
private List<String> _creator;
private List<DCSubject> _subject;
private List<String> _description;
private List<String> _publisher;
private List<String> _contributors;
private List<Date> _date;
private List<String> _type;
private List<String> _format;
private List<String> _identifier;
private List<String> _source;
private List<String> _language;
private List<String> _relation;
private List<String> _coverage;
private List<String> _rights;
/**
* Properties to be ignored when cloning.
@ -364,7 +365,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
* an empty list if none.
*
*/
public List getDates() {
public List<Date> getDates() {
return (_date == null) ? (_date = new ArrayList()) : _date;
}
@ -375,7 +376,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
* to set, an empty list or <b>null</b> if none.
*
*/
public void setDates(List dates) {
public void setDates(List<Date> dates) {
_date = dates;
}
@ -800,15 +801,16 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
* @return String representation for the object.
*
*/
@Override
public final String toString() {
return _objBean.toString();
}
public final Class getInterface() {
public final Class<? extends CopyFrom> getInterface() {
return DCModule.class;
}
public final void copyFrom(Object obj) {
public final void copyFrom(CopyFrom obj) {
COPY_FROM_HELPER.copy(this,obj);
}

View file

@ -16,6 +16,7 @@
*/
package com.sun.syndication.feed.module;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.impl.CopyFromHelper;
@ -52,6 +53,7 @@ public class DCSubjectImpl implements Cloneable,Serializable, DCSubject {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -63,7 +65,11 @@ public class DCSubjectImpl implements Cloneable,Serializable, DCSubject {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof DCSubjectImpl)){
return false;
}
return _objBean.equals(other);
}
@ -75,6 +81,7 @@ public class DCSubjectImpl implements Cloneable,Serializable, DCSubject {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -85,6 +92,7 @@ public class DCSubjectImpl implements Cloneable,Serializable, DCSubject {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}
@ -133,7 +141,7 @@ public class DCSubjectImpl implements Cloneable,Serializable, DCSubject {
return DCSubject.class;
}
public void copyFrom(Object obj) {
public void copyFrom(CopyFrom obj) {
COPY_FROM_HELPER.copy(this,obj);
}

View file

@ -40,7 +40,7 @@ public interface Extendable {
* an empty list if none.
*
*/
List getModules();
List<Module> getModules();
/**
* Sets the entry modules.
@ -49,5 +49,5 @@ public interface Extendable {
* an empty list or <b>null</b> if none.
*
*/
void setModules(List modules);
void setModules(List<Module> modules);
}

View file

@ -49,6 +49,7 @@ public abstract class ModuleImpl implements Cloneable,Serializable,Module {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -60,7 +61,11 @@ public abstract class ModuleImpl implements Cloneable,Serializable,Module {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof ModuleImpl)){
return false;
}
return _objBean.equals(other);
}
@ -72,6 +77,7 @@ public abstract class ModuleImpl implements Cloneable,Serializable,Module {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -82,6 +88,7 @@ public abstract class ModuleImpl implements Cloneable,Serializable,Module {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -31,13 +31,13 @@ public interface SyModule extends Module {
* URI of the Syndication ModuleImpl (http://purl.org/rss/1.0/modules/syndication/).
*
*/
String URI = "http://purl.org/rss/1.0/modules/syndication/";
static final String URI = "http://purl.org/rss/1.0/modules/syndication/";
String HOURLY = new String("hourly");
String DAILY = new String("daily");
String WEEKLY = new String("weekly");
String MONTHLY = new String("monthly");
String YEARLY = new String("yearly");
static final String HOURLY = "hourly";
static final String DAILY = "daily";
static final String WEEKLY = "weekly";
static final String MONTHLY = "monthly";
static final String YEARLY = "yearly";
/**
* Returns the Syndication module update period.

View file

@ -16,6 +16,7 @@
*/
package com.sun.syndication.feed.module;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.CopyFromHelper;
import java.util.*;
@ -28,7 +29,7 @@ import java.util.*;
*
*/
public class SyModuleImpl extends ModuleImpl implements SyModule {
private static final Set PERIODS = new HashSet();
private static final Set<String> PERIODS = new HashSet<String>();
static {
PERIODS.add(HOURLY );
@ -102,7 +103,7 @@ public class SyModuleImpl extends ModuleImpl implements SyModule {
*
*/
public Date getUpdateBase() {
return _updateBase;
return new Date(_updateBase.getTime());
}
/**
@ -112,14 +113,14 @@ public class SyModuleImpl extends ModuleImpl implements SyModule {
*
*/
public void setUpdateBase(Date updateBase) {
_updateBase = updateBase;
_updateBase = new Date(updateBase.getTime());
}
public Class getInterface() {
public Class<? extends Module> getInterface() {
return SyModule.class;
}
public void copyFrom(Object obj) {
public void copyFrom(CopyFrom obj) {
COPY_FROM_HELPER.copy(this,obj);
}

View file

@ -25,33 +25,41 @@ import java.util.List;
*/
public class ModuleUtils {
public static List cloneModules(List modules) {
List cModules = null;
public static List<Module> cloneModules(List<Module> modules) {
List<Module> cModules = null;
if (modules!=null) {
cModules = new ArrayList();
for (int i=0;i<modules.size();i++) {
Module module = (Module) modules.get(i);
cModules = new ArrayList<Module>();
for (Module module : modules) {
try {
Object c = module.clone();
Module c = (Module) module.clone();
cModules.add(c);
}
catch (Exception ex) {
throw new RuntimeException("Cloning modules",ex);
throw new RuntimeException("Cloning modules "+module.getUri(),ex);
}
}
}
return cModules;
}
public static Module getModule(List modules,String uri) {
/**
*
*
* @since 1.5 Changed to return the first, not the last.
*
* @param modules
* @param uri
* @return
*/
public static Module getModule(List<Module> modules,String uri) {
Module module = null;
for (int i=0;module==null && modules!=null && i<modules.size();i++) {
module = (Module) modules.get(i);
if (!module.getUri().equals(uri)) {
module = null;
}
}
for (int i=0; modules!=null && i<modules.size();i++) {
module = modules.get(i);
if (module.getUri().equals(uri)) {
return module;
}
}
return null;
}
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -47,6 +48,7 @@ public class Category implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -58,7 +60,11 @@ public class Category implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Category)){
return false;
}
return _objBean.equals(other);
}
@ -80,6 +86,7 @@ public class Category implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -40,16 +41,18 @@ public class Channel extends WireFeed {
public static final String FRIDAY = "friday";
public static final String SATURDAY = "saturday";
private static final Set DAYS = new HashSet();
private static final Set<String> DAYS;
static {
DAYS.add(SUNDAY );
DAYS.add(MONDAY );
DAYS.add(TUESDAY );
DAYS.add(WEDNESDAY);
DAYS.add(THURSDAY );
DAYS.add(FRIDAY );
DAYS.add(SATURDAY );
HashSet<String> days = new HashSet<String>();
days.add(SUNDAY );
days.add(MONDAY );
days.add(TUESDAY );
days.add(WEDNESDAY);
days.add(THURSDAY );
days.add(FRIDAY );
days.add(SATURDAY );
DAYS = Collections.unmodifiableSet(days);
}
private String _title;
@ -67,13 +70,13 @@ public class Channel extends WireFeed {
private String _docs;
private String _managingEditor;
private String _webMaster;
private List _skipHours;
private List _skipDays;
private List<Integer> _skipHours;
private List<String> _skipDays;
private Cloud _cloud;
private List _categories;
private List<Category> _categories;
private String _generator;
private int _ttl = -1;
private List _modules;
private List<Module> _modules;
/**
* Default constructor, for bean cloning purposes only.
@ -197,8 +200,8 @@ public class Channel extends WireFeed {
* an empty list if none.
*
*/
public List getItems() {
return (_items==null) ? (_items=new ArrayList()) : _items;
public List<Item> getItems() {
return (_items==null) ? (_items=new ArrayList<Item>()) : _items;
}
/**
@ -208,7 +211,7 @@ public class Channel extends WireFeed {
* an empty list or <b>null</b> if none.
*
*/
public void setItems(List items) {
public void setItems(List<Item> items) {
_items = items;
}
@ -299,7 +302,7 @@ public class Channel extends WireFeed {
*
*/
public Date getPubDate() {
return _pubDate;
return _pubDate == null ? null : new Date(_pubDate.getTime());
}
/**
@ -309,7 +312,7 @@ public class Channel extends WireFeed {
*
*/
public void setPubDate(Date pubDate) {
_pubDate = pubDate;
_pubDate = pubDate == null ? null : new Date( pubDate.getTime());
}
/**
@ -319,7 +322,7 @@ public class Channel extends WireFeed {
*
*/
public Date getLastBuildDate() {
return _lastBuildDate;
return _lastBuildDate == null ? null : new Date(_lastBuildDate.getTime());
}
/**
@ -329,7 +332,7 @@ public class Channel extends WireFeed {
*
*/
public void setLastBuildDate(Date lastBuildDate) {
_lastBuildDate = lastBuildDate;
_lastBuildDate = lastBuildDate == null ? null : new Date( lastBuildDate.getTime());
}
/**
@ -399,7 +402,7 @@ public class Channel extends WireFeed {
* an empty list if none.
*
*/
public List getSkipHours() {
public List<Integer> getSkipHours() {
return (_skipHours!=null) ? _skipHours : new ArrayList();
}
@ -410,7 +413,7 @@ public class Channel extends WireFeed {
* an empty list or <b>null</b> if none.
*
*/
public void setSkipHours(List skipHours) {
public void setSkipHours(List<Integer> skipHours) {
if (skipHours!=null) {
for (int i=0;i<skipHours.size();i++) {
Integer iHour = (Integer) skipHours.get(i);
@ -435,8 +438,8 @@ public class Channel extends WireFeed {
* an empty list if none.
*
*/
public List getSkipDays() {
return (_skipDays!=null) ? _skipDays : new ArrayList();
public List<String> getSkipDays() {
return (_skipDays!=null) ? _skipDays : new ArrayList<String>();
}
/**
@ -446,7 +449,7 @@ public class Channel extends WireFeed {
* an empty list or <b>null</b> if none.
*
*/
public void setSkipDays(List skipDays) {
public void setSkipDays(List<String> skipDays) {
if (skipDays!=null) {
for (int i=0;i<skipDays.size();i++) {
String day = (String) skipDays.get(i);
@ -492,8 +495,8 @@ public class Channel extends WireFeed {
* an empty list if none.
*
*/
public List getCategories() {
return (_categories==null) ? (_categories=new ArrayList()) : _categories;
public List<Category> getCategories() {
return (_categories==null) ? (_categories=new ArrayList<Category>()) : _categories;
}
/**
@ -503,7 +506,7 @@ public class Channel extends WireFeed {
* an empty list or <b>null</b> if none.
*
*/
public void setCategories(List categories) {
public void setCategories(List<Category> categories) {
_categories = categories;
}
@ -554,8 +557,9 @@ public class Channel extends WireFeed {
* an empty list if none.
*
*/
public List getModules() {
return (_modules==null) ? (_modules=new ArrayList()) : _modules;
@Override
public List<Module> getModules() {
return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
}
/**
@ -565,7 +569,8 @@ public class Channel extends WireFeed {
* an empty list or <b>null</b> if none.
*
*/
public void setModules(List modules) {
@Override
public void setModules(List<Module> modules) {
_modules = modules;
}
@ -575,6 +580,7 @@ public class Channel extends WireFeed {
* @param uri the URI of the ModuleImpl.
* @return The module with the given URI, <b>null</b> if none.
*/
@Override
public Module getModule(String uri) {
return ModuleUtils.getModule(_modules,uri);
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -50,6 +51,7 @@ public class Cloud implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -73,6 +75,7 @@ public class Cloud implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -83,6 +86,7 @@ public class Cloud implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,6 +21,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
import java.io.Serializable;
/**
* Bean for item descriptions of RSS feeds.
* <p>
@ -27,13 +29,12 @@ import java.io.Serializable;
*
*/
public class Content implements Cloneable, Serializable {
public static final String HTML = "html";
public static final String TEXT = "text";
private ObjectBean _objBean;
private String _type;
private String _value;
public static final String HTML = "html";
public static final String TEXT = "text";
/**
* Default constructor. All properties are set to <b>null</b>.
* <p>
@ -43,60 +44,6 @@ public class Content implements Cloneable,Serializable {
_objBean = new ObjectBean(this.getClass(), this);
}
/**
* Creates a deep 'bean' clone of the object.
* <p>
* @return a clone of the object.
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
/**
* Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
* <p>
* @param other he reference object with which to compare.
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
public boolean equals(Object other) {
return _objBean.equals(other);
}
/**
* Returns a hashcode value for the object.
* <p>
* It follows the contract defined by the Object hashCode() method.
* <p>
* @return the hashcode of the bean object.
*
*/
public int hashCode() {
return _objBean.hashCode();
}
/**
* Returns the String representation for the object.
* <p>
* @return String representation for the object.
*
*/
public String toString() {
return _objBean.toString();
}
/**
* Returns the description type.
* <p>
* @return the description type, <b>null</b> if none.
*
*/
public String getType() {
return _type;
}
/**
* Sets the description type.
* <p>
@ -108,13 +55,13 @@ public class Content implements Cloneable,Serializable {
}
/**
* Returns the description value.
* Returns the description type.
* <p>
* @return the description value, <b>null</b> if none.
* @return the description type, <b>null</b> if none.
*
*/
public String getValue() {
return _value;
public String getType() {
return _type;
}
/**
@ -127,4 +74,65 @@ public class Content implements Cloneable,Serializable {
_value = value;
}
/**
* Returns the description value.
* <p>
* @return the description value, <b>null</b> if none.
*
*/
public String getValue() {
return _value;
}
/**
* Creates a deep 'bean' clone of the object.
* <p>
* @return a clone of the object.
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
/**
* Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
* <p>
* @param other he reference object with which to compare.
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if (!(other instanceof Content)) {
return false;
}
return _objBean.equals(other);
}
/**
* Returns a hashcode value for the object.
* <p>
* It follows the contract defined by the Object hashCode() method.
* <p>
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
/**
* Returns the String representation for the object.
* <p>
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -58,7 +59,11 @@ public class Description implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Description)){
return false;
}
return _objBean.equals(other);
}
@ -70,6 +75,7 @@ public class Description implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -80,6 +86,7 @@ public class Description implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -48,6 +49,7 @@ public class Enclosure implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -59,7 +61,11 @@ public class Enclosure implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Enclosure)){
return false;
}
return _objBean.equals(other);
}
@ -71,6 +77,7 @@ public class Enclosure implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -81,6 +88,7 @@ public class Enclosure implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -47,6 +48,7 @@ public class Guid implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -58,7 +60,11 @@ public class Guid implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Guid)){
return false;
}
return _objBean.equals(other);
}
@ -70,6 +76,7 @@ public class Guid implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -80,6 +87,7 @@ public class Guid implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -31,8 +31,8 @@ public class Image implements Cloneable,Serializable {
private String _title;
private String _url;
private String _link;
private int _width = -1;
private int _height = -1;
private Integer _width = -1;
private Integer _height = -1;
private String _description;
/**
@ -51,6 +51,7 @@ public class Image implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -62,7 +63,11 @@ public class Image implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Image)){
return false;
}
return _objBean.equals(other);
}
@ -74,6 +79,7 @@ public class Image implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -84,6 +90,7 @@ public class Image implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}
@ -154,7 +161,7 @@ public class Image implements Cloneable,Serializable {
* @return the image width, <b>null</b> if none.
*
*/
public int getWidth() {
public Integer getWidth() {
return _width;
}
@ -164,7 +171,7 @@ public class Image implements Cloneable,Serializable {
* @param width the image width to set, <b>null</b> if none.
*
*/
public void setWidth(int width) {
public void setWidth(Integer width) {
_width = width;
}
@ -174,7 +181,7 @@ public class Image implements Cloneable,Serializable {
* @return the image height, <b>null</b> if none.
*
*/
public int getHeight() {
public Integer getHeight() {
return _height;
}
@ -184,7 +191,7 @@ public class Image implements Cloneable,Serializable {
* @param height the image height to set, <b>null</b> if none.
*
*/
public void setHeight(int height) {
public void setHeight(Integer height) {
_height = height;
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -45,14 +46,14 @@ public class Item implements Cloneable, Serializable, Extendable {
private Description _description;
private Content _content;
private Source _source;
private List _enclosures;
private List _categories;
private List<Enclosure> _enclosures;
private List<Category> _categories;
private Guid _guid;
private String _comments;
private String _author;
private Date _pubDate;
private Date _expirationDate;
private List _modules;
private List<Module> _modules;
private List _foreignMarkup;
/**
@ -71,6 +72,7 @@ public class Item implements Cloneable, Serializable, Extendable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -82,8 +84,9 @@ public class Item implements Cloneable, Serializable, Extendable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if (other == null) {
if (other == null || !(other instanceof Item)) {
return false;
}
// can't use foreign markup in equals, due to JDOM equals impl
@ -103,6 +106,7 @@ public class Item implements Cloneable, Serializable, Extendable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -113,6 +117,7 @@ public class Item implements Cloneable, Serializable, Extendable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}
@ -242,8 +247,8 @@ public class Item implements Cloneable, Serializable, Extendable {
* an empty list if none.
*
*/
public List getEnclosures() {
return (_enclosures==null) ? (_enclosures=new ArrayList()) : _enclosures;
public List<Enclosure> getEnclosures() {
return (_enclosures==null) ? (_enclosures=new ArrayList<Enclosure>()) : _enclosures;
}
/**
@ -253,7 +258,7 @@ public class Item implements Cloneable, Serializable, Extendable {
* an empty list or <b>null</b> if none.
*
*/
public void setEnclosures(List enclosures) {
public void setEnclosures(List<Enclosure> enclosures) {
_enclosures = enclosures;
}
@ -265,7 +270,7 @@ public class Item implements Cloneable, Serializable, Extendable {
*
*/
public List getCategories() {
return (_categories==null) ? (_categories=new ArrayList()) : _categories;
return (_categories==null) ? (_categories=new ArrayList<Category>()) : _categories;
}
/**
@ -275,7 +280,7 @@ public class Item implements Cloneable, Serializable, Extendable {
* an empty list or <b>null</b> if none.
*
*/
public void setCategories(List categories) {
public void setCategories(List<Category> categories) {
_categories = categories;
}
@ -346,8 +351,8 @@ public class Item implements Cloneable, Serializable, Extendable {
* an empty list if none.
*
*/
public List getModules() {
return (_modules==null) ? (_modules=new ArrayList()) : _modules;
public List<Module> getModules() {
return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
}
/**
@ -357,7 +362,7 @@ public class Item implements Cloneable, Serializable, Extendable {
* an empty list or <b>null</b> if none.
*
*/
public void setModules(List modules) {
public void setModules(List<Module> modules) {
_modules = modules;
}
@ -379,7 +384,7 @@ public class Item implements Cloneable, Serializable, Extendable {
*
*/
public Date getPubDate() {
return _pubDate;
return _pubDate == null ? null : new Date( _pubDate.getTime());
}
/**
@ -389,7 +394,7 @@ public class Item implements Cloneable, Serializable, Extendable {
*
*/
public void setPubDate(Date pubDate) {
_pubDate = pubDate;
_pubDate = pubDate == null ? null : new Date( pubDate.getTime());
}
/**
@ -399,7 +404,7 @@ public class Item implements Cloneable, Serializable, Extendable {
*
*/
public Date getExpirationDate() {
return _expirationDate;
return _expirationDate == null ? null : new Date(_expirationDate.getTime());
}
/**
@ -409,7 +414,7 @@ public class Item implements Cloneable, Serializable, Extendable {
*
*/
public void setExpirationDate(Date expirationDate) {
_expirationDate = expirationDate;
_expirationDate = expirationDate == null ? null : new Date(expirationDate.getTime());
}
/**

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -47,6 +48,7 @@ public class Source implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -58,7 +60,11 @@ public class Source implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof Source)){
return false;
}
return _objBean.equals(other);
}
@ -70,6 +76,7 @@ public class Source implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -80,6 +87,7 @@ public class Source implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,6 +50,7 @@ public class TextInput implements Cloneable,Serializable {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -60,7 +62,11 @@ public class TextInput implements Cloneable,Serializable {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof TextInput)){
return false;
}
return _objBean.equals(other);
}
@ -72,6 +78,7 @@ public class TextInput implements Cloneable,Serializable {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -82,6 +89,7 @@ public class TextInput implements Cloneable,Serializable {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -53,6 +54,7 @@ public class SyndCategoryImpl implements Serializable,SyndCategory {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -64,7 +66,11 @@ public class SyndCategoryImpl implements Serializable,SyndCategory {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof SyndCategoryImpl)){
return false;
}
return _objBean.equals(other);
}
@ -76,6 +82,7 @@ public class SyndCategoryImpl implements Serializable,SyndCategory {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -86,6 +93,7 @@ public class SyndCategoryImpl implements Serializable,SyndCategory {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}
@ -168,14 +176,14 @@ public class SyndCategoryImpl implements Serializable,SyndCategory {
* @author Alejandro Abdelnur
*
*/
class SyndCategoryListFacade extends AbstractList {
private List _subjects;
class SyndCategoryListFacade extends AbstractList<SyndCategory> {
private List<DCSubject> _subjects;
/**
* Default constructor. Creates and empty list.
*/
public SyndCategoryListFacade() {
this(new ArrayList());
this(new ArrayList<DCSubject>());
}
/**
@ -184,7 +192,7 @@ class SyndCategoryListFacade extends AbstractList {
* @param subjects the list of subjects to create the facade.
*
*/
public SyndCategoryListFacade(List subjects) {
public SyndCategoryListFacade(List<DCSubject> subjects) {
_subjects = subjects;
}
@ -195,7 +203,7 @@ class SyndCategoryListFacade extends AbstractList {
* @return the SyndCategoryImpl in position index, <b>null</b> if none.
*
*/
public Object get(int index) {
public SyndCategory get(int index) {
return new SyndCategoryImpl((DCSubject) _subjects.get(index));
}
@ -217,7 +225,8 @@ class SyndCategoryListFacade extends AbstractList {
* @return the SyndCategoryImpl object that is being replaced, <b>null</b> if none.
*
*/
public Object set(int index,Object obj) {
@Override
public SyndCategory set(int index, SyndCategory obj) {
SyndCategoryImpl sCat = (SyndCategoryImpl) obj;
DCSubject subject = (sCat!=null) ? sCat.getSubject() : null;
subject = (DCSubject) _subjects.set(index,subject);
@ -231,7 +240,8 @@ class SyndCategoryListFacade extends AbstractList {
* @param obj the SyndCategoryImpl object to add.
*
*/
public void add(int index,Object obj) {
@Override
public void add(int index,SyndCategory obj) {
SyndCategoryImpl sCat = (SyndCategoryImpl) obj;
DCSubject subject = (sCat!=null) ? sCat.getSubject() : null;
_subjects.add(index,subject);
@ -244,7 +254,8 @@ class SyndCategoryListFacade extends AbstractList {
* @return the SyndCategoryImpl being removed from position index, <b>null</b> if none.
*
*/
public Object remove(int index) {
@Override
public SyndCategory remove(int index) {
DCSubject subject = (DCSubject) _subjects.remove(index);
return (subject!=null) ? new SyndCategoryImpl(subject) : null;
}
@ -257,8 +268,8 @@ class SyndCategoryListFacade extends AbstractList {
* @return a list with DCSubject elements corresponding to the categories in the given list.
*
*/
public static List convertElementsSyndCategoryToSubject(List cList) {
List sList = null;
public static List<DCSubject> convertElementsSyndCategoryToSubject(List<SyndCategory> cList) {
List<DCSubject> sList = null;
if (cList!=null) {
sList = new ArrayList();
for (int i=0;i<cList.size();i++) {

View file

@ -25,7 +25,7 @@ import com.sun.syndication.feed.CopyFrom;
* @author Alejandro Abdelnur
*
*/
public interface SyndContent extends Cloneable,CopyFrom {
public interface SyndContent extends Cloneable,CopyFrom<SyndContent> {
/**
* Returns the content type.
* <p>

View file

@ -16,6 +16,7 @@
*/
package com.sun.syndication.feed.synd;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.impl.CopyFromHelper;
@ -157,7 +158,7 @@ public class SyndContentImpl implements Serializable,SyndContent {
return SyndContent.class;
}
public void copyFrom(Object obj) {
public void copyFrom(CopyFrom obj) {
COPY_FROM_HELPER.copy(this,obj);
}

View file

@ -5,7 +5,7 @@ import com.sun.syndication.feed.CopyFrom;
/**
* @author Alejandro Abdelnur
*/
public interface SyndEnclosure extends Cloneable, CopyFrom {
public interface SyndEnclosure extends Cloneable, CopyFrom<SyndEnclosure> {
/**
* Returns the enclosure URL.
* <p>

View file

@ -1,5 +1,6 @@
package com.sun.syndication.feed.synd;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.impl.CopyFromHelper;
@ -130,11 +131,11 @@ public class SyndEnclosureImpl implements Serializable,SyndEnclosure {
_type = type;
}
public Class getInterface() {
public Class<? extends CopyFrom> getInterface() {
return SyndEnclosure.class;
}
public void copyFrom(Object obj) {
public void copyFrom(CopyFrom obj) {
COPY_FROM_HELPER.copy(this,obj);
}

View file

@ -22,7 +22,6 @@ import java.util.List;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.module.Extendable;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.rss.Item;
/**
* Bean interface for entries of SyndFeedImpl feeds.
@ -112,7 +111,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* @return the entry links, <b>null</b> if none.
*
*/
List getLinks();
List<SyndLink> getLinks();
/**
* Sets the entry links.
@ -120,7 +119,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* @param links the entry links to set, <b>null</b> if none.
*
*/
void setLinks(List links);
void setLinks(List<SyndLink> links);
/**
* Returns the entry description.
@ -145,7 +144,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* an empty list if none.
*
*/
List getContents();
List<SyndContent> getContents();
/**
* Sets the entry contents.
@ -154,7 +153,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* an empty list or <b>null</b> if none.
*
*/
void setContents(List contents);
void setContents(List<SyndContent> contents);
/**
* Returns the entry enclosures.
@ -163,7 +162,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* an empty list if none.
*
*/
public List getEnclosures();
public List<SyndEnclosure> getEnclosures();
/**
* Sets the entry enclosures.
@ -172,7 +171,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* an empty list or <b>null</b> if none.
*
*/
public void setEnclosures(List enclosures);
public void setEnclosures(List<SyndEnclosure> enclosures);
/**
* Returns the entry published date.
@ -220,7 +219,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* @return the feed author, <b>null</b> if none.
*
*/
List getAuthors();
List<SyndPerson> getAuthors();
/**
* Sets the entry author.
@ -232,7 +231,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* @param authors the feed author to set, <b>null</b> if none.
*
*/
void setAuthors(List authors);
void setAuthors(List<SyndPerson> authors);
/**
* Returns the name of the first entry author in the collection of authors.
@ -266,7 +265,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* @return the feed author, <b>null</b> if none.
*
*/
List getContributors();
List<SyndPerson> getContributors();
/**
* Sets the feed contributors.
@ -276,7 +275,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* @param contributors the feed contributors to set, <b>null</b> if none.
*
*/
void setContributors(List contributors);
void setContributors(List<SyndPerson> contributors);
/**
* Returns the entry categories.
@ -287,7 +286,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* an empty list if none.
*
*/
List getCategories();
List<SyndCategory> getCategories();
/**
* Sets the entry categories.
@ -298,7 +297,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* an empty list or <b>null</b> if none.
*
*/
void setCategories(List categories);
void setCategories(List<SyndCategory> categories);
/**
* Returns the entry source.
@ -346,7 +345,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* an empty list if none.
*
*/
List getModules();
List<Module> getModules();
/**
* Sets the entry modules.
@ -355,7 +354,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
* an empty list or <b>null</b> if none.
*
*/
void setModules(List modules);
void setModules(List<Module> modules);
/**
* Returns foreign markup found at channel level.
@ -382,4 +381,10 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
*/
public Object clone() throws CloneNotSupportedException;
/**
* Returns the first instance of a SyndLink with the specified relation, or null
*
*/
public SyndLink findRelatedLink(String relation);
}

View file

@ -16,6 +16,7 @@
*/
package com.sun.syndication.feed.synd;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.module.*;
import com.sun.syndication.feed.module.impl.ModuleUtils;
@ -38,12 +39,12 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
private Date _updatedDate;
private SyndContent _title;
private SyndContent _description;
private List _links;
private List _contents; // deprecated by Atom 1.0
private List _modules;
private List _enclosures;
private List _authors;
private List _contributors;
private List<SyndLink> _links;
private List<SyndContent> _contents; // deprecated by Atom 1.0
private List<Module> _modules;
private List<SyndEnclosure> _enclosures;
private List<SyndPerson> _authors;
private List<SyndPerson> _contributors;
private SyndFeed _source;
private List _foreignMarkup;
private Object wireEntry; // com.sun.syndication.feed.atom.Entry or com.sun.syndication.feed.rss.Item
@ -95,6 +96,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -106,6 +108,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
@ -132,6 +135,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -142,6 +146,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}
@ -266,8 +271,8 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* an empty list if none.
*
*/
public List getContents() {
return (_contents==null) ? (_contents=new ArrayList()) : _contents;
public List<SyndContent> getContents() {
return (_contents==null) ? (_contents=new ArrayList<SyndContent>()) : _contents;
}
/**
@ -277,7 +282,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* an empty list or <b>null</b> if none.
*
*/
public void setContents(List contents) {
public void setContents(List<SyndContent> contents) {
_contents = contents;
}
@ -288,8 +293,8 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* an empty list if none.
*
*/
public List getEnclosures() {
return (_enclosures==null) ? (_enclosures=new ArrayList()) : _enclosures;
public List<SyndEnclosure> getEnclosures() {
return (_enclosures==null) ? (_enclosures=new ArrayList<SyndEnclosure>()) : _enclosures;
}
/**
@ -299,7 +304,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* an empty list or <b>null</b> if none.
*
*/
public void setEnclosures(List enclosures) {
public void setEnclosures(List<SyndEnclosure> enclosures) {
_enclosures = enclosures;
}
@ -335,7 +340,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* an empty list if none.
*
*/
public List getCategories() {
public List<SyndCategory> getCategories() {
return _categories;
}
@ -348,7 +353,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* an empty list or <b>null</b> if none.
*
*/
public void setCategories(List categories) {
public void setCategories(List<SyndCategory> categories) {
_categories = categories;
}
@ -359,9 +364,9 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* an empty list if none.
*
*/
public List getModules() {
public List<Module> getModules() {
if (_modules==null) {
_modules=new ArrayList();
_modules=new ArrayList<Module>();
}
if (ModuleUtils.getModule(_modules,DCModule.URI)==null) {
_modules.add(new DCModuleImpl());
@ -376,7 +381,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* an empty list or <b>null</b> if none.
*
*/
public void setModules(List modules) {
public void setModules(List<Module> modules) {
_modules = modules;
}
@ -403,7 +408,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
return SyndEntry.class;
}
public void copyFrom(Object obj) {
public void copyFrom(CopyFrom obj) {
COPY_FROM_HELPER.copy(this,obj);
}
@ -434,8 +439,8 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* <p>
* @return Returns the links.
*/
public List getLinks() {
return (_links==null) ? (_links=new ArrayList()) : _links;
public List<SyndLink> getLinks() {
return (_links==null) ? (_links=new ArrayList<SyndLink>()) : _links;
}
/**
@ -453,7 +458,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* @return Returns the updatedDate.
*/
public Date getUpdatedDate() {
return _updatedDate;
return _updatedDate == null ? null : new Date(_updatedDate.getTime());
}
/**
@ -462,7 +467,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* @param updatedDate The updatedDate to set.
*/
public void setUpdatedDate(Date updatedDate) {
_updatedDate = updatedDate;
_updatedDate = new Date(updatedDate.getTime());
}
public List getAuthors() {
@ -568,4 +573,13 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
public void setWireEntry(Object wireEntry) {
this.wireEntry = wireEntry;
}
public SyndLink findRelatedLink(String relation) {
for(SyndLink l : this.getLinks()){
if(relation.equals(l.getRel())){
return l;
}
}
return null;
}
}

View file

@ -39,7 +39,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* <p>
* @return the real feed type supported.
*/
List getSupportedFeedTypes();
List<String> getSupportedFeedTypes();
/**
* Creates a real feed containing the information of the SyndFeedImpl.
@ -235,7 +235,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* @return the entry links, <b>null</b> if none.
*
*/
List getLinks();
List<SyndLink> getLinks();
/**
* Sets the entry links.
@ -243,7 +243,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* @param links the entry links to set, <b>null</b> if none.
*
*/
void setLinks(List links);
void setLinks(List<SyndLink> links);
/**
* Returns the feed description.
@ -307,7 +307,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* @return the feed authors, <b>null</b> if none.
*
*/
List getAuthors();
List<SyndPerson> getAuthors();
/**
* Sets the feed authors.
@ -319,7 +319,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* @param authors the feed authors to set, <b>null</b> if none.
*
*/
void setAuthors(List authors);
void setAuthors(List<SyndPerson> authors);
/**
* Returns the name of the first feed author in the collection of authors.
@ -354,7 +354,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* @return the feed author, <b>null</b> if none.
*
*/
public List getContributors();
public List<SyndPerson> getContributors();
/**
* Sets the feed author.
@ -364,7 +364,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* @param contributors the feed contributors to set, <b>null</b> if none.
*
*/
void setContributors(List contributors);
void setContributors(List<SyndPerson> contributors);
/**
* Returns the feed copyright.
@ -411,7 +411,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* an empty list if none.
*
*/
List getCategories();
List<SyndCategory> getCategories();
/**
* Sets the feed categories.
@ -422,16 +422,16 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* an empty list or <b>null</b> if none.
*
*/
void setCategories(List categories);
void setCategories(List<SyndCategory> categories);
/**
* Returns the feed entries.
* <p>
* @return a list of SyndEntryImpl elements with the feed entries,
* @return a list of SyndEntry elements with the feed entries,
* an empty list if none.
*
*/
List getEntries();
List<SyndEntry> getEntries();
/**
* Sets the feed entries.
@ -440,7 +440,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* an empty list or <b>null</b> if none.
*
*/
void setEntries(List entries);
void setEntries(List<SyndEntry> entries);
/**
* Returns the feed language.
@ -477,7 +477,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
* an empty list if none.
*
*/
List getModules();
List<Module> getModules();
/**
* Sets the feed modules.

View file

@ -16,6 +16,7 @@
*/
package com.sun.syndication.feed.synd;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.impl.CopyFromHelper;
import com.sun.syndication.feed.WireFeed;
@ -657,7 +658,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
return SyndFeed.class;
}
public void copyFrom(Object obj) {
public void copyFrom(CopyFrom obj) {
COPY_FROM_HELPER.copy(this,obj);
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View file

@ -16,6 +16,7 @@
*/
package com.sun.syndication.feed.synd;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.impl.CopyFromHelper;
@ -174,7 +175,7 @@ public class SyndImageImpl implements Serializable,SyndImage {
return SyndImage.class;
}
public void copyFrom(Object syndImage) {
public void copyFrom(CopyFrom syndImage) {
COPY_FROM_HELPER.copy(this,syndImage);
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -37,6 +38,7 @@ public interface SyndLink {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public abstract boolean equals(Object other);
/**
@ -47,6 +49,7 @@ public interface SyndLink {
* @return the hashcode of the bean object.
*
*/
@Override
public abstract int hashCode();
/**
@ -55,6 +58,7 @@ public interface SyndLink {
* @return String representation for the object.
*
*/
@Override
public abstract String toString();
/**

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -53,6 +54,7 @@ public class SyndLinkImpl implements Cloneable,Serializable, SyndLink {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -64,7 +66,11 @@ public class SyndLinkImpl implements Cloneable,Serializable, SyndLink {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof SyndLinkImpl)){
return false;
}
return _objBean.equals(other);
}
@ -76,6 +82,7 @@ public class SyndLinkImpl implements Cloneable,Serializable, SyndLink {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -86,6 +93,7 @@ public class SyndLinkImpl implements Cloneable,Serializable, SyndLink {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,12 +18,9 @@
package com.sun.syndication.feed.synd;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.module.DCSubjectImpl;
import com.sun.syndication.feed.module.DCSubject;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.module.impl.ModuleUtils;
import java.util.AbstractList;
import java.util.List;
import java.util.ArrayList;
import java.io.Serializable;
@ -55,6 +53,7 @@ public class SyndPersonImpl implements Serializable, SyndPerson {
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
return _objBean.clone();
}
@ -66,7 +65,11 @@ public class SyndPersonImpl implements Serializable, SyndPerson {
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if(!(other instanceof SyndPersonImpl)){
return false;
}
return _objBean.equals(other);
}
@ -78,6 +81,7 @@ public class SyndPersonImpl implements Serializable, SyndPerson {
* @return the hashcode of the bean object.
*
*/
@Override
public int hashCode() {
return _objBean.hashCode();
}
@ -88,6 +92,7 @@ public class SyndPersonImpl implements Serializable, SyndPerson {
* @return String representation for the object.
*
*/
@Override
public String toString() {
return _objBean.toString();
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2004 Sun Microsystems, Inc.
* Copyright 2011 The ROME Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View file

@ -23,6 +23,8 @@ import com.sun.syndication.feed.rss.Guid;
import com.sun.syndication.feed.rss.Item;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndLink;
import com.sun.syndication.feed.synd.SyndLinkImpl;
import com.sun.syndication.feed.synd.SyndPerson;
import java.util.ArrayList;
@ -42,6 +44,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
super(type);
}
@Override
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
Channel channel = (Channel) feed;
super.copyInto(channel,syndFeed);
@ -54,6 +57,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
}
}
@Override
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
@ -80,6 +84,12 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
else {
syndEntry.setUri(item.getLink());
}
if(item.getComments() != null){
SyndLinkImpl comments = new SyndLinkImpl();
comments.setRel("comments");
comments.setHref(item.getComments());
comments.setType("text/html");
}
return syndEntry;
}
@ -93,6 +103,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
return channel;
}
@Override
protected Item createRSSItem(SyndEntry sEntry) {
Item item = super.createRSSItem(sEntry);
if (sEntry.getAuthors()!=null && sEntry.getAuthors().size() > 0) {
@ -116,7 +127,10 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
}
}
item.setGuid(guid);
SyndLink comments = sEntry.findRelatedLink("comments");
if(comments != null && (comments.getType() == null || comments.getType().endsWith("html"))){
item.setComments(comments.getHref());
}
return item;
}

View file

@ -21,13 +21,15 @@ import com.sun.syndication.feed.rss.Description;
import com.sun.syndication.feed.rss.Image;
import com.sun.syndication.feed.rss.Item;
import com.sun.syndication.io.FeedException;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.Namespace;
import java.util.List;
import java.util.Date;
import java.util.List;
/**
* Feed Generator for RSS 0.91
@ -48,140 +50,10 @@ public class RSS091UserlandGenerator extends RSS090Generator {
_version = version;
}
protected String getVersion() {
return _version;
}
protected Namespace getFeedNamespace() {
return Namespace.NO_NAMESPACE;
}
protected Document createDocument(Element root) {
return new Document(root);
}
protected Element createRootElement(Channel channel) {
Element root = new Element("rss",getFeedNamespace());
Attribute version = new Attribute("version", getVersion());
root.setAttribute(version);
root.addNamespaceDeclaration(getContentNamespace());
generateModuleNamespaceDefs(root);
return root;
}
protected void populateFeed(Channel channel,Element parent) throws FeedException {
addChannel(channel,parent);
}
protected void addChannel(Channel channel,Element parent) throws FeedException {
super.addChannel(channel,parent);
Element eChannel = parent.getChild("channel",getFeedNamespace());
addImage(channel,eChannel);
addTextInput(channel,eChannel);
addItems(channel,eChannel);
}
protected void populateChannel(Channel channel,Element eChannel) {
super.populateChannel(channel,eChannel);
String language = channel.getLanguage();
if (language != null) {
eChannel.addContent(generateSimpleElement("language", language));
}
String rating = channel.getRating();
if (rating != null) {
eChannel.addContent(generateSimpleElement("rating", rating));
}
String copyright = channel.getCopyright();
if (copyright != null) {
eChannel.addContent(generateSimpleElement("copyright", copyright));
}
Date pubDate = channel.getPubDate();
if (pubDate != null) {
eChannel.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate)));
}
Date lastBuildDate = channel.getLastBuildDate();
if (lastBuildDate != null) {
eChannel.addContent(generateSimpleElement("lastBuildDate", DateParser.formatRFC822(lastBuildDate)));
}
String docs = channel.getDocs();
if (docs != null) {
eChannel.addContent(generateSimpleElement("docs", docs));
}
String managingEditor = channel.getManagingEditor();
if (managingEditor != null) {
eChannel.addContent(generateSimpleElement("managingEditor", managingEditor));
}
String webMaster = channel.getWebMaster();
if (webMaster != null) {
eChannel.addContent(generateSimpleElement("webMaster", webMaster));
}
List skipHours = channel.getSkipHours();
if (skipHours != null && skipHours.size()>0) {
eChannel.addContent(generateSkipHoursElement(skipHours));
}
List skipDays = channel.getSkipDays();
if (skipDays != null && skipDays.size()>0) {
eChannel.addContent(generateSkipDaysElement(skipDays));
}
}
protected Element generateSkipHoursElement(List hours) {
Element skipHoursElement = new Element("skipHours",getFeedNamespace());
for (int i = 0; i < hours.size(); i++) {
skipHoursElement.addContent(generateSimpleElement("hour", hours.get(i).toString()));
}
return skipHoursElement;
}
protected Element generateSkipDaysElement(List days) {
Element skipDaysElement = new Element("skipDays");
for (int i = 0; i < days.size(); i++) {
skipDaysElement.addContent(generateSimpleElement("day", days.get(i).toString()));
}
return skipDaysElement;
}
protected void populateImage(Image image,Element eImage) {
super.populateImage(image,eImage);
int width = image.getWidth();
if (width>-1) {
eImage.addContent(generateSimpleElement("width",String.valueOf(width)));
}
int height = image.getHeight();
if (height>-1) {
eImage.addContent(generateSimpleElement("height",String.valueOf(height)));
}
String description = image.getDescription();
if (description!=null) {
eImage.addContent(generateSimpleElement("description",description));
}
}
protected void populateItem(Item item, Element eItem, int index) {
super.populateItem(item,eItem, index);
Description description = item.getDescription();
if (description!=null) {
eItem.addContent(generateSimpleElement("description",description.getValue()));
}
if (item.getModule(getContentNamespace().getURI()) == null && item.getContent() != null) {
Element elem = new Element("encoded", getContentNamespace());
elem.addContent(item.getContent().getValue());
eItem.addContent(elem);
}
}
/**
* To be overriden by RSS 0.91 Netscape and RSS 0.94
*/
@ -189,7 +61,23 @@ public class RSS091UserlandGenerator extends RSS090Generator {
return true;
}
protected void checkChannelConstraints(Element eChannel) throws FeedException {
protected String getVersion() {
return _version;
}
protected void addChannel(Channel channel, Element parent)
throws FeedException {
super.addChannel(channel, parent);
Element eChannel = parent.getChild("channel", getFeedNamespace());
addImage(channel, eChannel);
addTextInput(channel, eChannel);
addItems(channel, eChannel);
}
protected void checkChannelConstraints(Element eChannel)
throws FeedException {
checkNotNullAndLength(eChannel, "title", 1, 100);
checkNotNullAndLength(eChannel, "description", 1, 500);
checkNotNullAndLength(eChannel, "link", 1, 500);
@ -204,18 +92,20 @@ public class RSS091UserlandGenerator extends RSS090Generator {
checkLength(eChannel, "webMaster", 1, 100);
Element skipHours = eChannel.getChild("skipHours");
if (skipHours != null) {
List hours = skipHours.getChildren();
for (int i = 0; i < hours.size(); i++) {
Element hour = (Element) hours.get(i);
int value = Integer.parseInt(hour.getText().trim());
if (isHourFormat24()) {
if (value<1 || value>24) {
if ((value < 1) || (value > 24)) {
throw new FeedException("Invalid hour value " + value + ", it must be between 1 and 24");
}
}
else {
if (value<0 || value>23) {
} else {
if ((value < 0) || (value > 23)) {
throw new FeedException("Invalid hour value " + value + ", it must be between 0 and 23");
}
}
@ -223,7 +113,8 @@ public class RSS091UserlandGenerator extends RSS090Generator {
}
}
protected void checkImageConstraints(Element eImage) throws FeedException {
protected void checkImageConstraints(Element eImage)
throws FeedException {
checkNotNullAndLength(eImage, "title", 1, 100);
checkNotNullAndLength(eImage, "url", 1, 500);
@ -233,19 +124,160 @@ public class RSS091UserlandGenerator extends RSS090Generator {
checkLength(eImage, "description", 1, 100);
}
protected void checkTextInputConstraints(Element eTextInput) throws FeedException {
checkNotNullAndLength(eTextInput,"title", 1, 100);
checkNotNullAndLength(eTextInput,"description", 1, 500);
checkNotNullAndLength(eTextInput,"name", 1, 20);
checkNotNullAndLength(eTextInput,"link", 1, 500);
}
protected void checkItemConstraints(Element eItem) throws FeedException {
protected void checkItemConstraints(Element eItem)
throws FeedException {
checkNotNullAndLength(eItem, "title", 1, 100);
checkNotNullAndLength(eItem, "link", 1, 500);
checkLength(eItem, "description", 1, 500);
}
protected void checkTextInputConstraints(Element eTextInput)
throws FeedException {
checkNotNullAndLength(eTextInput, "title", 1, 100);
checkNotNullAndLength(eTextInput, "description", 1, 500);
checkNotNullAndLength(eTextInput, "name", 1, 20);
checkNotNullAndLength(eTextInput, "link", 1, 500);
}
protected Document createDocument(Element root) {
return new Document(root);
}
protected Element createRootElement(Channel channel) {
Element root = new Element("rss", getFeedNamespace());
Attribute version = new Attribute("version", getVersion());
root.setAttribute(version);
root.addNamespaceDeclaration(getContentNamespace());
generateModuleNamespaceDefs(root);
return root;
}
protected Element generateSkipDaysElement(List days) {
Element skipDaysElement = new Element("skipDays");
for (int i = 0; i < days.size(); i++) {
skipDaysElement.addContent(generateSimpleElement("day", days.get(i).toString()));
}
return skipDaysElement;
}
protected Element generateSkipHoursElement(List hours) {
Element skipHoursElement = new Element("skipHours", getFeedNamespace());
for (int i = 0; i < hours.size(); i++) {
skipHoursElement.addContent(generateSimpleElement("hour", hours.get(i).toString()));
}
return skipHoursElement;
}
protected void populateChannel(Channel channel, Element eChannel) {
super.populateChannel(channel, eChannel);
String language = channel.getLanguage();
if (language != null) {
eChannel.addContent(generateSimpleElement("language", language));
}
String rating = channel.getRating();
if (rating != null) {
eChannel.addContent(generateSimpleElement("rating", rating));
}
String copyright = channel.getCopyright();
if (copyright != null) {
eChannel.addContent(generateSimpleElement("copyright", copyright));
}
Date pubDate = channel.getPubDate();
if (pubDate != null) {
eChannel.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate)));
}
Date lastBuildDate = channel.getLastBuildDate();
if (lastBuildDate != null) {
eChannel.addContent(generateSimpleElement("lastBuildDate", DateParser.formatRFC822(lastBuildDate)));
}
String docs = channel.getDocs();
if (docs != null) {
eChannel.addContent(generateSimpleElement("docs", docs));
}
String managingEditor = channel.getManagingEditor();
if (managingEditor != null) {
eChannel.addContent(generateSimpleElement("managingEditor", managingEditor));
}
String webMaster = channel.getWebMaster();
if (webMaster != null) {
eChannel.addContent(generateSimpleElement("webMaster", webMaster));
}
List skipHours = channel.getSkipHours();
if ((skipHours != null) && (skipHours.size() > 0)) {
eChannel.addContent(generateSkipHoursElement(skipHours));
}
List skipDays = channel.getSkipDays();
if ((skipDays != null) && (skipDays.size() > 0)) {
eChannel.addContent(generateSkipDaysElement(skipDays));
}
}
protected void populateFeed(Channel channel, Element parent)
throws FeedException {
addChannel(channel, parent);
}
protected void populateImage(Image image, Element eImage) {
super.populateImage(image, eImage);
Integer width = image.getWidth();
if (width != null) {
eImage.addContent(generateSimpleElement("width", String.valueOf(width)));
}
Integer height = image.getHeight();
if (height != null) {
eImage.addContent(generateSimpleElement("height", String.valueOf(height)));
}
String description = image.getDescription();
if (description != null) {
eImage.addContent(generateSimpleElement("description", description));
}
}
protected void populateItem(Item item, Element eItem, int index) {
super.populateItem(item, eItem, index);
Description description = item.getDescription();
if (description != null) {
eItem.addContent(generateSimpleElement("description", description.getValue()));
}
if ((item.getModule(getContentNamespace().getURI()) == null) && (item.getContent() != null)) {
Element elem = new Element("encoded", getContentNamespace());
elem.addContent(item.getContent().getValue());
eItem.addContent(elem);
}
}
}

View file

@ -14,7 +14,6 @@ import java.util.List;
*
*/
public class TestSyndFeedRSS094 extends TestSyndFeedRSS093 {
public TestSyndFeedRSS094() {
super("rss_0.94");
}
@ -31,20 +30,27 @@ public class TestSyndFeedRSS094 extends TestSyndFeedRSS093 {
_testCategories(getCachedSyndFeed().getCategories(), "channel");
}
@Override
protected void _testDescriptionType(SyndEntry entry, int i)
throws Exception {
}
@Override
protected void _testItem(int i) throws Exception {
super._testItem(i);
List items = getCachedSyndFeed().getEntries();
List items = getCachedSyndFeed()
.getEntries();
SyndEntry entry = (SyndEntry) items.get(i);
assertProperty(entry.getAuthor(), "channel.item[" + i + "].author");
}
protected void _testDescriptionType(SyndEntry entry,int i) throws Exception {
}
@Override
protected void _testUri(SyndEntry entry, int i) throws Exception {
assertProperty(entry.getUri(), "channel.item[" + i + "].guid");
}
}

View file

@ -23,9 +23,9 @@ import com.sun.syndication.unittest.SyndFeedTest;
*
* @author robert.cooper
*/
public class Issue1Test extends SyndFeedTest {
public class Issue1TestX extends SyndFeedTest {
public Issue1Test(){
public Issue1TestX(){
super("rss_2.0", "jira_issue1.xml");
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2011 robert.cooper.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* under the License.
*/
package com.sun.syndication.unittest.issues;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.unittest.TestSyndFeedRSS094;
import java.util.List;
/**
*
* @author robert.cooper
*/
public class Issue2Test extends TestSyndFeedRSS094 {
@Override
protected void _testItem(int i) throws Exception {
super._testItem(i);
List<SyndEntry> items = getCachedSyndFeed()
.getEntries();
SyndEntry entry = items.get(i);
_testComments(entry, i);
}
protected void _testComments(SyndEntry entry, int i)
throws Exception {
assertProperty(entry.findRelatedLink("comments").getHref(), "rss_0.94.channel.item[" + i + "].comments");
}
}