Updating ROME to use generics
This commit is contained in:
parent
7cd1761fbd
commit
218fb2d6c9
61 changed files with 496 additions and 487 deletions
|
@ -26,6 +26,8 @@ import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent class of the RSS (Channel) and Atom (Feed) feed beans.
|
* Parent class of the RSS (Channel) and Atom (Feed) feed beans.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -44,7 +46,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
|
||||||
private String _feedType;
|
private String _feedType;
|
||||||
private String _encoding;
|
private String _encoding;
|
||||||
private List<Module> _modules;
|
private List<Module> _modules;
|
||||||
private List _foreignMarkup;
|
private List<Element> _foreignMarkup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor, for bean cloning purposes only.
|
* Default constructor, for bean cloning purposes only.
|
||||||
|
@ -94,7 +96,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// can't use foreign markup in equals, due to JDOM equals impl
|
// can't use foreign markup in equals, due to JDOM equals impl
|
||||||
Object fm = getForeignMarkup();
|
List<Element> fm = getForeignMarkup();
|
||||||
setForeignMarkup(((WireFeed)other).getForeignMarkup());
|
setForeignMarkup(((WireFeed)other).getForeignMarkup());
|
||||||
boolean ret = _objBean.equals(other);
|
boolean ret = _objBean.equals(other);
|
||||||
// restore foreign markup
|
// restore foreign markup
|
||||||
|
@ -214,8 +216,8 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
|
||||||
* @return Opaque object to discourage use
|
* @return Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Object getForeignMarkup() {
|
public List<Element> getForeignMarkup() {
|
||||||
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList()) : _foreignMarkup;
|
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList<Element>()) : _foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,7 +226,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
|
||||||
* @param foreignMarkup Opaque object to discourage use
|
* @param foreignMarkup Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setForeignMarkup(Object foreignMarkup) {
|
public void setForeignMarkup(List<Element> foreignMarkup) {
|
||||||
_foreignMarkup = (List)foreignMarkup;
|
_foreignMarkup = (List<Element>)foreignMarkup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,18 +16,19 @@
|
||||||
*/
|
*/
|
||||||
package com.sun.syndication.feed.atom;
|
package com.sun.syndication.feed.atom;
|
||||||
|
|
||||||
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.io.Serializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean for entry elements of Atom feeds.
|
* Bean for entry elements of Atom feeds.
|
||||||
|
@ -47,7 +48,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
private List<Category> _categories;
|
private List<Category> _categories;
|
||||||
private List<Content> _contents;
|
private List<Content> _contents;
|
||||||
private List<Person> _contributors;
|
private List<Person> _contributors;
|
||||||
private List<Link> _foreignMarkup;
|
private List<Element> _foreignMarkup;
|
||||||
private List<Module> _modules;
|
private List<Module> _modules;
|
||||||
private List<Link> _otherLinks;
|
private List<Link> _otherLinks;
|
||||||
private ObjectBean _objBean;
|
private ObjectBean _objBean;
|
||||||
|
@ -80,7 +81,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
* @return a list of Link elements with the entry alternate links, an empty list if none.
|
* @return a list of Link elements with the entry alternate links, an empty list if none.
|
||||||
*/
|
*/
|
||||||
public List<Link> getAlternateLinks() {
|
public List<Link> getAlternateLinks() {
|
||||||
return (_alternateLinks == null) ? (_alternateLinks = new ArrayList()) : _alternateLinks;
|
return (_alternateLinks == null) ? (_alternateLinks = new ArrayList<Link>()) : _alternateLinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +110,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
* @param categories The categories to set.
|
* @param categories The categories to set.
|
||||||
* @since Atom 1.0
|
* @since Atom 1.0
|
||||||
*/
|
*/
|
||||||
public void setCategories(List categories) {
|
public void setCategories(List<Category> categories) {
|
||||||
_categories = categories;
|
_categories = categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,8 +120,8 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
* @return Returns the categories.
|
* @return Returns the categories.
|
||||||
* @since Atom 1.0
|
* @since Atom 1.0
|
||||||
*/
|
*/
|
||||||
public List getCategories() {
|
public List<Category> getCategories() {
|
||||||
return (_categories == null) ? (_categories = new ArrayList()) : _categories;
|
return (_categories == null) ? (_categories = new ArrayList<Category>()) : _categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +130,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
* @param contents the list of Content elements with the entry contents to set,
|
* @param contents the list of Content elements with the entry contents to set,
|
||||||
* an empty list or <b>null</b> if none.
|
* an empty list or <b>null</b> if none.
|
||||||
*/
|
*/
|
||||||
public void setContents(List contents) {
|
public void setContents(List<Content> contents) {
|
||||||
_contents = contents;
|
_contents = contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +163,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List<Person> getContributors() {
|
public List<Person> getContributors() {
|
||||||
return (_contributors == null) ? (_contributors = new ArrayList()) : _contributors;
|
return (_contributors == null) ? (_contributors = new ArrayList<Person>()) : _contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -189,8 +190,8 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
* @param foreignMarkup Opaque object to discourage use
|
* @param foreignMarkup Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setForeignMarkup(Object foreignMarkup) {
|
public void setForeignMarkup(List<Element> foreignMarkup) {
|
||||||
_foreignMarkup = (List) foreignMarkup;
|
_foreignMarkup = (List<Element>) foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,8 +200,8 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
* @return list of Opaque object to discourage use
|
* @return list of Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Object getForeignMarkup() {
|
public List<Element> getForeignMarkup() {
|
||||||
return (_foreignMarkup == null) ? (_foreignMarkup = new ArrayList()) : _foreignMarkup;
|
return (_foreignMarkup == null) ? (_foreignMarkup = new ArrayList<Element>()) : _foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -248,7 +249,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
*/
|
*/
|
||||||
public boolean isMediaEntry() {
|
public boolean isMediaEntry() {
|
||||||
boolean mediaEntry = false;
|
boolean mediaEntry = false;
|
||||||
List links = getOtherLinks();
|
List<Link> links = getOtherLinks();
|
||||||
|
|
||||||
for (Iterator<Link> it = links.iterator(); it.hasNext();) {
|
for (Iterator<Link> it = links.iterator(); it.hasNext();) {
|
||||||
Link link = it.next();
|
Link link = it.next();
|
||||||
|
@ -298,7 +299,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
* an empty list or <b>null</b> if none.
|
* an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setModules(List modules) {
|
public void setModules(List<Module> modules) {
|
||||||
_modules = modules;
|
_modules = modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,8 +310,8 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
* an emtpy list if none.
|
* an emtpy list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getModules() {
|
public List<Module> getModules() {
|
||||||
return (_modules == null) ? (_modules = new ArrayList()) : _modules;
|
return (_modules == null) ? (_modules = new ArrayList<Module>()) : _modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -527,7 +528,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// can't use foreign markup in equals, due to JDOM equals impl
|
// can't use foreign markup in equals, due to JDOM equals impl
|
||||||
Object fm = getForeignMarkup();
|
List<Element> fm = getForeignMarkup();
|
||||||
setForeignMarkup(((Entry) other).getForeignMarkup());
|
setForeignMarkup(((Entry) other).getForeignMarkup());
|
||||||
|
|
||||||
boolean ret = _objBean.equals(other);
|
boolean ret = _objBean.equals(other);
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class Feed extends WireFeed {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*/
|
*/
|
||||||
public List<Link> getOtherLinks() {
|
public List<Link> getOtherLinks() {
|
||||||
return (_otherLinks==null) ? (_otherLinks=new ArrayList()) : _otherLinks;
|
return (_otherLinks==null) ? (_otherLinks=new ArrayList<Link>()) : _otherLinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,7 +346,7 @@ public class Feed extends WireFeed {
|
||||||
* an empty list or <b>null</b> if none.
|
* an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setEntries(List entries) {
|
public void setEntries(List<Entry> entries) {
|
||||||
_entries = entries;
|
_entries = entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,8 +390,8 @@ public class Feed extends WireFeed {
|
||||||
* @return Returns the categories.
|
* @return Returns the categories.
|
||||||
* @since Atom 1.0
|
* @since Atom 1.0
|
||||||
*/
|
*/
|
||||||
public List getCategories() {
|
public List<Category> getCategories() {
|
||||||
return (_categories==null) ? (_categories=new ArrayList()) : _categories;
|
return (_categories==null) ? (_categories=new ArrayList<Category>()) : _categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class Person implements Cloneable,Serializable, Extendable
|
||||||
private String _uri; // since Atom 1.0 (was called url)
|
private String _uri; // since Atom 1.0 (was called url)
|
||||||
private String _uriResolved;
|
private String _uriResolved;
|
||||||
private String _email;
|
private String _email;
|
||||||
private List _modules;
|
private List<Module> _modules;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. All properties are set to <b>null</b>.
|
* Default constructor. All properties are set to <b>null</b>.
|
||||||
|
@ -192,8 +192,8 @@ public class Person implements Cloneable,Serializable, Extendable
|
||||||
* an emtpy list if none.
|
* an emtpy list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getModules() {
|
public List<Module> getModules() {
|
||||||
return (_modules==null) ? (_modules=new ArrayList()) : _modules;
|
return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -203,7 +203,7 @@ public class Person implements Cloneable,Serializable, Extendable
|
||||||
* an empty list or <b>null</b> if none.
|
* an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setModules(List modules) {
|
public void setModules(List<Module> modules) {
|
||||||
_modules = modules;
|
_modules = modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
/**
|
/**
|
||||||
* Properties to be ignored when cloning.
|
* Properties to be ignored when cloning.
|
||||||
*/
|
*/
|
||||||
private static final Set IGNORE_PROPERTIES = new HashSet();
|
private static final Set<String> IGNORE_PROPERTIES = new HashSet<String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unmodifiable Set containing the convenience properties of this class.
|
* Unmodifiable Set containing the convenience properties of this class.
|
||||||
|
@ -60,7 +60,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* properties can be ignored as the will be copied as part of the module
|
* properties can be ignored as the will be copied as part of the module
|
||||||
* cloning.
|
* cloning.
|
||||||
*/
|
*/
|
||||||
public static final Set CONVENIENCE_PROPERTIES = Collections.unmodifiableSet(IGNORE_PROPERTIES);
|
public static final Set<String> CONVENIENCE_PROPERTIES = Collections.unmodifiableSet(IGNORE_PROPERTIES);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
IGNORE_PROPERTIES.add("title");
|
IGNORE_PROPERTIES.add("title");
|
||||||
|
@ -97,8 +97,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getTitles() {
|
public List<String> getTitles() {
|
||||||
return (_title == null) ? (_title = new ArrayList()) : _title;
|
return (_title == null) ? (_title = new ArrayList<String>()) : _title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* titles to set, an empty list or <b>null</b> if none.
|
* titles to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setTitles(List titles) {
|
public void setTitles(List<String> titles) {
|
||||||
_title = titles;
|
_title = titles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
_title = new ArrayList();
|
_title = new ArrayList<String>();
|
||||||
_title.add(title);
|
_title.add(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,8 +141,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getCreators() {
|
public List<String> getCreators() {
|
||||||
return (_creator == null) ? (_creator = new ArrayList()) : _creator;
|
return (_creator == null) ? (_creator = new ArrayList<String>()) : _creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,7 +152,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* creators to set, an empty list or <b>null</b> if none.
|
* creators to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setCreators(List creators) {
|
public void setCreators(List<String> creators) {
|
||||||
_creator = creators;
|
_creator = creators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setCreator(String creator) {
|
public void setCreator(String creator) {
|
||||||
_creator = new ArrayList();
|
_creator = new ArrayList<String>();
|
||||||
_creator.add(creator);
|
_creator.add(creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,8 +185,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getSubjects() {
|
public List<DCSubject> getSubjects() {
|
||||||
return (_subject == null) ? (_subject = new ArrayList()) : _subject;
|
return (_subject == null) ? (_subject = new ArrayList<DCSubject>()) : _subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,7 +196,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* module subjects to set, an empty list or <b>null</b> if none.
|
* module subjects to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setSubjects(List subjects) {
|
public void setSubjects(List<DCSubject> subjects) {
|
||||||
_subject = subjects;
|
_subject = subjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setSubject(DCSubject subject) {
|
public void setSubject(DCSubject subject) {
|
||||||
_subject = new ArrayList();
|
_subject = new ArrayList<DCSubject>();
|
||||||
_subject.add(subject);
|
_subject.add(subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,8 +230,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* description, an empty list if none.
|
* description, an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getDescriptions() {
|
public List<String> getDescriptions() {
|
||||||
return (_description == null) ? (_description = new ArrayList()) : _description;
|
return (_description == null) ? (_description = new ArrayList<String>()) : _description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,7 +241,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* module descriptions to set, an empty list or <b>null</b> if none.
|
* module descriptions to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setDescriptions(List descriptions) {
|
public void setDescriptions(List<String> descriptions) {
|
||||||
_description = descriptions;
|
_description = descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
_description = new ArrayList();
|
_description = new ArrayList<String>();
|
||||||
_description.add(description);
|
_description.add(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getPublishers() {
|
public List<String> getPublishers() {
|
||||||
return (_publisher == null) ? (_publisher = new ArrayList()) : _publisher;
|
return (_publisher == null) ? (_publisher = new ArrayList<String>()) : _publisher;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,7 +286,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* publishers to set, an empty list or <b>null</b> if none.
|
* publishers to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setPublishers(List publishers) {
|
public void setPublishers(List<String> publishers) {
|
||||||
_publisher = publishers;
|
_publisher = publishers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setPublisher(String publisher) {
|
public void setPublisher(String publisher) {
|
||||||
_publisher = new ArrayList();
|
_publisher = new ArrayList<String>();
|
||||||
_publisher.add(publisher);
|
_publisher.add(publisher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,8 +320,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getContributors() {
|
public List<String> getContributors() {
|
||||||
return (_contributors == null) ? (_contributors = new ArrayList()) : _contributors;
|
return (_contributors == null) ? (_contributors = new ArrayList<String>()) : _contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -331,7 +331,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* module contributors to set, an empty list or <b>null</b> if none.
|
* module contributors to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setContributors(List contributors) {
|
public void setContributors(List<String> contributors) {
|
||||||
_contributors = contributors;
|
_contributors = contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setContributor(String contributor) {
|
public void setContributor(String contributor) {
|
||||||
_contributors = new ArrayList();
|
_contributors = new ArrayList<String>();
|
||||||
_contributors.add(contributor);
|
_contributors.add(contributor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List<Date> getDates() {
|
public List<Date> getDates() {
|
||||||
return (_date == null) ? (_date = new ArrayList()) : _date;
|
return (_date == null) ? (_date = new ArrayList<Date>()) : _date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -398,7 +398,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setDate(Date date) {
|
public void setDate(Date date) {
|
||||||
_date = new ArrayList();
|
_date = new ArrayList<Date>();
|
||||||
_date.add(date);
|
_date.add(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,8 +409,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getTypes() {
|
public List<String> getTypes() {
|
||||||
return (_type == null) ? (_type = new ArrayList()) : _type;
|
return (_type == null) ? (_type = new ArrayList<String>()) : _type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -420,7 +420,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* to set, an empty list or <b>null</b> if none.
|
* to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setTypes(List types) {
|
public void setTypes(List<String> types) {
|
||||||
_type = types;
|
_type = types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
_type = new ArrayList();
|
_type = new ArrayList<String>();
|
||||||
_type.add(type);
|
_type.add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,8 +454,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getFormats() {
|
public List<String> getFormats() {
|
||||||
return (_format == null) ? (_format = new ArrayList()) : _format;
|
return (_format == null) ? (_format = new ArrayList<String>()) : _format;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -465,7 +465,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* formats to set, an empty list or <b>null</b> if none.
|
* formats to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setFormats(List formats) {
|
public void setFormats(List<String> formats) {
|
||||||
_format = formats;
|
_format = formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setFormat(String format) {
|
public void setFormat(String format) {
|
||||||
_format = new ArrayList();
|
_format = new ArrayList<String>();
|
||||||
_format.add(format);
|
_format.add(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,8 +499,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getIdentifiers() {
|
public List<String> getIdentifiers() {
|
||||||
return (_identifier == null) ? (_identifier = new ArrayList()) : _identifier;
|
return (_identifier == null) ? (_identifier = new ArrayList<String>()) : _identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -510,7 +510,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* identifiers to set, an empty list or <b>null</b> if none.
|
* identifiers to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setIdentifiers(List identifiers) {
|
public void setIdentifiers(List<String> identifiers) {
|
||||||
_identifier = identifiers;
|
_identifier = identifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setIdentifier(String identifier) {
|
public void setIdentifier(String identifier) {
|
||||||
_identifier = new ArrayList();
|
_identifier = new ArrayList<String>();
|
||||||
_identifier.add(identifier);
|
_identifier.add(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,8 +544,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getSources() {
|
public List<String> getSources() {
|
||||||
return (_source == null) ? (_source = new ArrayList()) : _source;
|
return (_source == null) ? (_source = new ArrayList<String>()) : _source;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -555,7 +555,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* sources to set, an empty list or <b>null</b> if none.
|
* sources to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setSources(List sources) {
|
public void setSources(List<String> sources) {
|
||||||
_source = sources;
|
_source = sources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setSource(String source) {
|
public void setSource(String source) {
|
||||||
_source = new ArrayList();
|
_source = new ArrayList<String>();
|
||||||
_source.add(source);
|
_source.add(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,8 +589,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getLanguages() {
|
public List<String> getLanguages() {
|
||||||
return (_language == null) ? (_language = new ArrayList()) : _language;
|
return (_language == null) ? (_language = new ArrayList<String>()) : _language;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -600,7 +600,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* languages to set, an empty list or <b>null</b> if none.
|
* languages to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setLanguages(List languages) {
|
public void setLanguages(List<String> languages) {
|
||||||
_language = languages;
|
_language = languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setLanguage(String language) {
|
public void setLanguage(String language) {
|
||||||
_language = new ArrayList();
|
_language = new ArrayList<String>();
|
||||||
_language.add(language);
|
_language.add(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,8 +633,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getRelations() {
|
public List<String> getRelations() {
|
||||||
return (_relation == null) ? (_relation = new ArrayList()) : _relation;
|
return (_relation == null) ? (_relation = new ArrayList<String>()) : _relation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -644,7 +644,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* relations to set, an empty list or <b>null</b> if none.
|
* relations to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setRelations(List relations) {
|
public void setRelations(List<String> relations) {
|
||||||
_relation = relations;
|
_relation = relations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,7 +667,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setRelation(String relation) {
|
public void setRelation(String relation) {
|
||||||
_relation = new ArrayList();
|
_relation = new ArrayList<String>();
|
||||||
_relation.add(relation);
|
_relation.add(relation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,8 +678,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getCoverages() {
|
public List<String> getCoverages() {
|
||||||
return (_coverage == null) ? (_coverage = new ArrayList()) : _coverage;
|
return (_coverage == null) ? (_coverage = new ArrayList<String>()) : _coverage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -689,7 +689,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* coverages to set, an empty list or <b>null</b> if none.
|
* coverages to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setCoverages(List coverages) {
|
public void setCoverages(List<String> coverages) {
|
||||||
_coverage = coverages;
|
_coverage = coverages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setCoverage(String coverage) {
|
public void setCoverage(String coverage) {
|
||||||
_coverage = new ArrayList();
|
_coverage = new ArrayList<String>();
|
||||||
_coverage.add(coverage);
|
_coverage.add(coverage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,8 +723,8 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getRightsList() {
|
public List<String> getRightsList() {
|
||||||
return (_rights == null) ? (_rights = new ArrayList()) : _rights;
|
return (_rights == null) ? (_rights = new ArrayList<String>()) : _rights;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -734,7 +734,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
* rights to set, an empty list or <b>null</b> if none.
|
* rights to set, an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setRightsList(List rights) {
|
public void setRightsList(List<String> rights) {
|
||||||
_rights = rights;
|
_rights = rights;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,7 +757,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setRights(String rights) {
|
public void setRights(String rights) {
|
||||||
_rights = new ArrayList();
|
_rights = new ArrayList<String>();
|
||||||
_rights.add(rights);
|
_rights.add(rights);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class Channel extends WireFeed {
|
||||||
private String _link;
|
private String _link;
|
||||||
private String _uri;
|
private String _uri;
|
||||||
private Image _image;
|
private Image _image;
|
||||||
private List _items;
|
private List<Item> _items;
|
||||||
private TextInput _textInput;
|
private TextInput _textInput;
|
||||||
private String _language;
|
private String _language;
|
||||||
private String _rating;
|
private String _rating;
|
||||||
|
@ -403,7 +403,7 @@ public class Channel extends WireFeed {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List<Integer> getSkipHours() {
|
public List<Integer> getSkipHours() {
|
||||||
return (_skipHours!=null) ? _skipHours : new ArrayList();
|
return (_skipHours!=null) ? _skipHours : new ArrayList<Integer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,8 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean for items of RSS feeds.
|
* Bean for items of RSS feeds.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -54,7 +56,7 @@ public class Item implements Cloneable, Serializable, Extendable {
|
||||||
private Date _pubDate;
|
private Date _pubDate;
|
||||||
private Date _expirationDate;
|
private Date _expirationDate;
|
||||||
private List<Module> _modules;
|
private List<Module> _modules;
|
||||||
private List _foreignMarkup;
|
private List<Element> _foreignMarkup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. All properties are set to <b>null</b>.
|
* Default constructor. All properties are set to <b>null</b>.
|
||||||
|
@ -90,7 +92,7 @@ public class Item implements Cloneable, Serializable, Extendable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// can't use foreign markup in equals, due to JDOM equals impl
|
// can't use foreign markup in equals, due to JDOM equals impl
|
||||||
Object fm = getForeignMarkup();
|
List<Element> fm = getForeignMarkup();
|
||||||
setForeignMarkup(((Item)other).getForeignMarkup());
|
setForeignMarkup(((Item)other).getForeignMarkup());
|
||||||
boolean ret = _objBean.equals(other);
|
boolean ret = _objBean.equals(other);
|
||||||
// restore foreign markup
|
// restore foreign markup
|
||||||
|
@ -269,7 +271,7 @@ public class Item implements Cloneable, Serializable, Extendable {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getCategories() {
|
public List<Category> getCategories() {
|
||||||
return (_categories==null) ? (_categories=new ArrayList<Category>()) : _categories;
|
return (_categories==null) ? (_categories=new ArrayList<Category>()) : _categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,8 +425,8 @@ public class Item implements Cloneable, Serializable, Extendable {
|
||||||
* @return Opaque object to discourage use
|
* @return Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Object getForeignMarkup() {
|
public List<Element> getForeignMarkup() {
|
||||||
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList()) : _foreignMarkup;
|
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList<Element>()) : _foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -433,8 +435,8 @@ public class Item implements Cloneable, Serializable, Extendable {
|
||||||
* @param foreignMarkup Opaque object to discourage use
|
* @param foreignMarkup Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setForeignMarkup(Object foreignMarkup) {
|
public void setForeignMarkup(List<Element> foreignMarkup) {
|
||||||
_foreignMarkup = (List)foreignMarkup;
|
_foreignMarkup = (List<Element>)foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ class SyndCategoryListFacade extends AbstractList<SyndCategory> {
|
||||||
public static List<DCSubject> convertElementsSyndCategoryToSubject(List<SyndCategory> cList) {
|
public static List<DCSubject> convertElementsSyndCategoryToSubject(List<SyndCategory> cList) {
|
||||||
List<DCSubject> sList = null;
|
List<DCSubject> sList = null;
|
||||||
if (cList!=null) {
|
if (cList!=null) {
|
||||||
sList = new ArrayList();
|
sList = new ArrayList<DCSubject>();
|
||||||
for (int i=0;i<cList.size();i++) {
|
for (int i=0;i<cList.size();i++) {
|
||||||
SyndCategoryImpl sCat = (SyndCategoryImpl) cList.get(i);
|
SyndCategoryImpl sCat = (SyndCategoryImpl) cList.get(i);
|
||||||
DCSubject subject = null;
|
DCSubject subject = null;
|
||||||
|
|
|
@ -19,6 +19,8 @@ package com.sun.syndication.feed.synd;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
import com.sun.syndication.feed.CopyFrom;
|
import com.sun.syndication.feed.CopyFrom;
|
||||||
import com.sun.syndication.feed.module.Extendable;
|
import com.sun.syndication.feed.module.Extendable;
|
||||||
import com.sun.syndication.feed.module.Module;
|
import com.sun.syndication.feed.module.Module;
|
||||||
|
@ -362,7 +364,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
|
||||||
* @return Opaque object to discourage use
|
* @return Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Object getForeignMarkup();
|
public List<Element> getForeignMarkup();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets foreign markup found at channel level.
|
* Sets foreign markup found at channel level.
|
||||||
|
@ -370,7 +372,7 @@ public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
|
||||||
* @param foreignMarkup Opaque object to discourage use
|
* @param foreignMarkup Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setForeignMarkup(Object foreignMarkup);
|
public void setForeignMarkup(List<Element> foreignMarkup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a deep clone of the object.
|
* Creates a deep clone of the object.
|
||||||
|
|
|
@ -26,6 +26,8 @@ import com.sun.syndication.feed.impl.CopyFromHelper;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean for entries of SyndFeedImpl feeds.
|
* Bean for entries of SyndFeedImpl feeds.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -46,13 +48,13 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
|
||||||
private List<SyndPerson> _authors;
|
private List<SyndPerson> _authors;
|
||||||
private List<SyndPerson> _contributors;
|
private List<SyndPerson> _contributors;
|
||||||
private SyndFeed _source;
|
private SyndFeed _source;
|
||||||
private List _foreignMarkup;
|
private List<Element> _foreignMarkup;
|
||||||
private Object wireEntry; // com.sun.syndication.feed.atom.Entry or com.sun.syndication.feed.rss.Item
|
private Object wireEntry; // com.sun.syndication.feed.atom.Entry or com.sun.syndication.feed.rss.Item
|
||||||
|
|
||||||
// ISSUE: some converters assume this is never null
|
// ISSUE: some converters assume this is never null
|
||||||
private List _categories = new ArrayList();
|
private List<SyndCategory> _categories = new ArrayList<SyndCategory>();
|
||||||
|
|
||||||
private static final Set IGNORE_PROPERTIES = new HashSet();
|
private static final Set<String> IGNORE_PROPERTIES = new HashSet<String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unmodifiable Set containing the convenience properties of this class.
|
* Unmodifiable Set containing the convenience properties of this class.
|
||||||
|
@ -60,7 +62,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
|
||||||
* Convenience properties are mapped to Modules, for cloning the convenience properties
|
* Convenience properties are mapped to Modules, for cloning the convenience properties
|
||||||
* can be ignored as the will be copied as part of the module cloning.
|
* can be ignored as the will be copied as part of the module cloning.
|
||||||
*/
|
*/
|
||||||
public static final Set CONVENIENCE_PROPERTIES = Collections.unmodifiableSet(IGNORE_PROPERTIES);
|
public static final Set<String> CONVENIENCE_PROPERTIES = Collections.unmodifiableSet(IGNORE_PROPERTIES);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
IGNORE_PROPERTIES.add("publishedDate");
|
IGNORE_PROPERTIES.add("publishedDate");
|
||||||
|
@ -119,7 +121,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// can't use foreign markup in equals, due to JDOM equals impl
|
// can't use foreign markup in equals, due to JDOM equals impl
|
||||||
Object fm = getForeignMarkup();
|
List<Element> fm = getForeignMarkup();
|
||||||
setForeignMarkup(((SyndEntryImpl)other).getForeignMarkup());
|
setForeignMarkup(((SyndEntryImpl)other).getForeignMarkup());
|
||||||
boolean ret = _objBean.equals(other);
|
boolean ret = _objBean.equals(other);
|
||||||
// restore foreign markup
|
// restore foreign markup
|
||||||
|
@ -448,7 +450,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
|
||||||
* <p>
|
* <p>
|
||||||
* @param links The links to set.
|
* @param links The links to set.
|
||||||
*/
|
*/
|
||||||
public void setLinks(List links) {
|
public void setLinks(List<SyndLink> links) {
|
||||||
_links = links;
|
_links = links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,14 +472,14 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
|
||||||
_updatedDate = new Date(updatedDate.getTime());
|
_updatedDate = new Date(updatedDate.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getAuthors() {
|
public List<SyndPerson> getAuthors() {
|
||||||
return (_authors==null) ? (_authors=new ArrayList()) : _authors;
|
return (_authors==null) ? (_authors=new ArrayList<SyndPerson>()) : _authors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.sun.syndication.feed.synd.SyndEntry#setAuthors(java.util.List)
|
* @see com.sun.syndication.feed.synd.SyndEntry#setAuthors(java.util.List)
|
||||||
*/
|
*/
|
||||||
public void setAuthors(List authors) {
|
public void setAuthors(List<SyndPerson> authors) {
|
||||||
_authors = authors;
|
_authors = authors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,14 +527,14 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getContributors() {
|
public List<SyndPerson> getContributors() {
|
||||||
return (_contributors==null) ? (_contributors=new ArrayList()) : _contributors;
|
return (_contributors==null) ? (_contributors=new ArrayList<SyndPerson>()) : _contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.sun.syndication.feed.synd.SyndEntry#setContributors(java.util.List)
|
* @see com.sun.syndication.feed.synd.SyndEntry#setContributors(java.util.List)
|
||||||
*/
|
*/
|
||||||
public void setContributors(List contributors) {
|
public void setContributors(List<SyndPerson> contributors) {
|
||||||
_contributors = contributors;
|
_contributors = contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,8 +553,8 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Object getForeignMarkup() {
|
public List<Element> getForeignMarkup() {
|
||||||
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList()) : _foreignMarkup;
|
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList<Element>()) : _foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -562,8 +564,8 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setForeignMarkup(Object foreignMarkup) {
|
public void setForeignMarkup(List<Element> foreignMarkup) {
|
||||||
_foreignMarkup = (List)foreignMarkup;
|
_foreignMarkup = (List<Element>)foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getWireEntry() {
|
public Object getWireEntry() {
|
||||||
|
|
|
@ -24,6 +24,8 @@ import com.sun.syndication.feed.module.Module;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean interface for all types of feeds.
|
* Bean interface for all types of feeds.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -486,7 +488,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
|
||||||
* an empty list or <b>null</b> if none.
|
* 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.
|
* Returns foreign markup found at channel level.
|
||||||
|
@ -494,7 +496,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
|
||||||
* @return Opaque object to discourage use
|
* @return Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Object getForeignMarkup();
|
public List<Element> getForeignMarkup();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets foreign markup found at channel level.
|
* Sets foreign markup found at channel level.
|
||||||
|
@ -502,7 +504,7 @@ public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
|
||||||
* @param foreignMarkup Opaque object to discourage use
|
* @param foreignMarkup Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setForeignMarkup(Object foreignMarkup);
|
public void setForeignMarkup(List<Element> foreignMarkup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a deep clone of the object.
|
* Creates a deep clone of the object.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package com.sun.syndication.feed.synd;
|
package com.sun.syndication.feed.synd;
|
||||||
|
|
||||||
import com.sun.syndication.feed.CopyFrom;
|
import com.sun.syndication.feed.CopyFrom;
|
||||||
|
import com.sun.syndication.feed.atom.Person;
|
||||||
import com.sun.syndication.feed.impl.ObjectBean;
|
import com.sun.syndication.feed.impl.ObjectBean;
|
||||||
import com.sun.syndication.feed.impl.CopyFromHelper;
|
import com.sun.syndication.feed.impl.CopyFromHelper;
|
||||||
import com.sun.syndication.feed.WireFeed;
|
import com.sun.syndication.feed.WireFeed;
|
||||||
|
@ -28,6 +29,8 @@ import com.sun.syndication.feed.synd.impl.URINormalizer;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean for all types of feeds.
|
* Bean for all types of feeds.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -46,20 +49,20 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
private SyndContent _description;
|
private SyndContent _description;
|
||||||
private String _feedType;
|
private String _feedType;
|
||||||
private String _link;
|
private String _link;
|
||||||
private List _links;
|
private List<SyndLink> _links;
|
||||||
private SyndImage _image;
|
private SyndImage _image;
|
||||||
private List _entries;
|
private List<SyndEntry> _entries;
|
||||||
private List _modules;
|
private List<Module> _modules;
|
||||||
private List _authors;
|
private List<SyndPerson> _authors;
|
||||||
private List _contributors;
|
private List<SyndPerson> _contributors;
|
||||||
private List _foreignMarkup;
|
private List<Element> _foreignMarkup;
|
||||||
|
|
||||||
private WireFeed wireFeed = null;
|
private WireFeed wireFeed = null;
|
||||||
private boolean preserveWireFeed = false;
|
private boolean preserveWireFeed = false;
|
||||||
|
|
||||||
private static final Converters CONVERTERS = new Converters();
|
private static final Converters CONVERTERS = new Converters();
|
||||||
|
|
||||||
private static final Set IGNORE_PROPERTIES = new HashSet();
|
private static final Set<String> IGNORE_PROPERTIES = new HashSet<String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unmodifiable Set containing the convenience properties of this class.
|
* Unmodifiable Set containing the convenience properties of this class.
|
||||||
|
@ -68,7 +71,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* can be ignored as the will be copied as part of the module cloning.
|
* can be ignored as the will be copied as part of the module cloning.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final Set CONVENIENCE_PROPERTIES = Collections.unmodifiableSet(IGNORE_PROPERTIES);
|
public static final Set<String> CONVENIENCE_PROPERTIES = Collections.unmodifiableSet(IGNORE_PROPERTIES);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
IGNORE_PROPERTIES.add("publishedDate");
|
IGNORE_PROPERTIES.add("publishedDate");
|
||||||
|
@ -170,7 +173,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// can't use foreign markup in equals, due to JDOM equals impl
|
// can't use foreign markup in equals, due to JDOM equals impl
|
||||||
Object fm = getForeignMarkup();
|
List<Element> fm = getForeignMarkup();
|
||||||
setForeignMarkup(((SyndFeedImpl)other).getForeignMarkup());
|
setForeignMarkup(((SyndFeedImpl)other).getForeignMarkup());
|
||||||
boolean ret = _objBean.equals(other);
|
boolean ret = _objBean.equals(other);
|
||||||
// restore foreign markup
|
// restore foreign markup
|
||||||
|
@ -543,7 +546,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getCategories() {
|
public List<SyndCategory> getCategories() {
|
||||||
return new SyndCategoryListFacade(getDCModule().getSubjects());
|
return new SyndCategoryListFacade(getDCModule().getSubjects());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +559,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* an empty list or <b>null</b> if none.
|
* an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setCategories(List categories) {
|
public void setCategories(List<SyndCategory> categories) {
|
||||||
getDCModule().setSubjects(SyndCategoryListFacade.convertElementsSyndCategoryToSubject(categories));
|
getDCModule().setSubjects(SyndCategoryListFacade.convertElementsSyndCategoryToSubject(categories));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,8 +570,8 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getEntries() {
|
public List<SyndEntry> getEntries() {
|
||||||
return (_entries==null) ? (_entries=new ArrayList()) : _entries;
|
return (_entries==null) ? (_entries=new ArrayList<SyndEntry>()) : _entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -578,7 +581,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* an empty list or <b>null</b> if none.
|
* an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setEntries(List entries) {
|
public void setEntries(List<SyndEntry> entries) {
|
||||||
_entries = entries;
|
_entries = entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,9 +616,9 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public List getModules() {
|
public List<Module> getModules() {
|
||||||
if (_modules==null) {
|
if (_modules==null) {
|
||||||
_modules=new ArrayList();
|
_modules=new ArrayList<Module>();
|
||||||
}
|
}
|
||||||
if (ModuleUtils.getModule(_modules,DCModule.URI)==null) {
|
if (ModuleUtils.getModule(_modules,DCModule.URI)==null) {
|
||||||
_modules.add(new DCModuleImpl());
|
_modules.add(new DCModuleImpl());
|
||||||
|
@ -631,7 +634,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* an empty list or <b>null</b> if none.
|
* an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setModules(List modules) {
|
public void setModules(List<Module> modules) {
|
||||||
_modules = modules;
|
_modules = modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,8 +696,8 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* <p>
|
* <p>
|
||||||
* @return Returns the links.
|
* @return Returns the links.
|
||||||
*/
|
*/
|
||||||
public List getLinks() {
|
public List<SyndLink> getLinks() {
|
||||||
return (_links==null) ? (_links=new ArrayList()) : _links;
|
return (_links==null) ? (_links=new ArrayList<SyndLink>()) : _links;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -702,15 +705,15 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* <p>
|
* <p>
|
||||||
* @param links The links to set.
|
* @param links The links to set.
|
||||||
*/
|
*/
|
||||||
public void setLinks(List links) {
|
public void setLinks(List<SyndLink> links) {
|
||||||
_links = links;
|
_links = links;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getAuthors() {
|
public List<SyndPerson> getAuthors() {
|
||||||
return (_authors==null) ? (_authors=new ArrayList()) : _authors;
|
return (_authors==null) ? (_authors=new ArrayList<SyndPerson>()) : _authors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthors(List authors) {
|
public void setAuthors(List<SyndPerson> authors) {
|
||||||
this._authors = authors;
|
this._authors = authors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,11 +741,11 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
getDCModule().setCreator(author);
|
getDCModule().setCreator(author);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getContributors() {
|
public List<SyndPerson> getContributors() {
|
||||||
return (_contributors==null) ? (_contributors=new ArrayList()) : _contributors;
|
return (_contributors==null) ? (_contributors=new ArrayList<SyndPerson>()) : _contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContributors(List contributors) {
|
public void setContributors(List<SyndPerson> contributors) {
|
||||||
this._contributors = contributors;
|
this._contributors = contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,8 +755,8 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* @return Opaque object to discourage use
|
* @return Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Object getForeignMarkup() {
|
public List<Element> getForeignMarkup() {
|
||||||
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList()) : _foreignMarkup;
|
return (_foreignMarkup==null) ? (_foreignMarkup=new ArrayList<Element>()) : _foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -762,8 +765,8 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||||
* @param foreignMarkup Opaque object to discourage use
|
* @param foreignMarkup Opaque object to discourage use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setForeignMarkup(Object foreignMarkup) {
|
public void setForeignMarkup(List<Element> foreignMarkup) {
|
||||||
_foreignMarkup = (List)foreignMarkup;
|
_foreignMarkup = (List<Element>)foreignMarkup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPreservingWireFeed() {
|
public boolean isPreservingWireFeed() {
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class SyndPersonImpl implements Serializable, SyndPerson {
|
||||||
private String _name;
|
private String _name;
|
||||||
private String _uri;
|
private String _uri;
|
||||||
private String _email;
|
private String _email;
|
||||||
private List _modules;
|
private List<Module> _modules;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For implementations extending SyndContentImpl to be able to use the ObjectBean functionality
|
* For implementations extending SyndContentImpl to be able to use the ObjectBean functionality
|
||||||
|
@ -163,10 +163,10 @@ public class SyndPersonImpl implements Serializable, SyndPerson {
|
||||||
* @return a list of ModuleImpl elements with the person modules,
|
* @return a list of ModuleImpl elements with the person modules,
|
||||||
* an empty list if none.
|
* an empty list if none.
|
||||||
*/
|
*/
|
||||||
public List getModules()
|
public List<Module> getModules()
|
||||||
{
|
{
|
||||||
if (_modules==null) {
|
if (_modules==null) {
|
||||||
_modules=new ArrayList();
|
_modules=new ArrayList<Module>();
|
||||||
}
|
}
|
||||||
return _modules;
|
return _modules;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ public class SyndPersonImpl implements Serializable, SyndPerson {
|
||||||
* an empty list or <b>null</b> if none.
|
* an empty list or <b>null</b> if none.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setModules(List modules) {
|
public void setModules(List<Module> modules) {
|
||||||
_modules = modules;
|
_modules = modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ import java.util.List;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class ConverterForAtom03 implements Converter {
|
public class ConverterForAtom03 implements Converter {
|
||||||
|
@ -64,7 +66,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
|
|
||||||
syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules()));
|
syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules()));
|
||||||
|
|
||||||
if (((List)feed.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)feed.getForeignMarkup()).size() > 0) {
|
||||||
syndFeed.setForeignMarkup(feed.getForeignMarkup());
|
syndFeed.setForeignMarkup(feed.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
syndFeed.setLink(theLink.getHrefResolved());
|
syndFeed.setLink(theLink.getHrefResolved());
|
||||||
}
|
}
|
||||||
// lump alternate and other links together
|
// lump alternate and other links together
|
||||||
List syndLinks = new ArrayList();
|
List<SyndLink> syndLinks = new ArrayList<SyndLink>();
|
||||||
if (aFeed.getAlternateLinks() != null
|
if (aFeed.getAlternateLinks() != null
|
||||||
&& aFeed.getAlternateLinks().size() > 0) {
|
&& aFeed.getAlternateLinks().size() > 0) {
|
||||||
syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks()));
|
syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks()));
|
||||||
|
@ -98,7 +100,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List aEntries = aFeed.getEntries();
|
List<Entry> aEntries = aFeed.getEntries();
|
||||||
if (aEntries!=null) {
|
if (aEntries!=null) {
|
||||||
syndFeed.setEntries(createSyndEntries(aEntries, syndFeed.isPreservingWireFeed()));
|
syndFeed.setEntries(createSyndEntries(aEntries, syndFeed.isPreservingWireFeed()));
|
||||||
}
|
}
|
||||||
|
@ -111,7 +113,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
syndFeed.setLanguage(language);
|
syndFeed.setLanguage(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
List authors = aFeed.getAuthors();
|
List<Person> authors = aFeed.getAuthors();
|
||||||
if (authors!=null && authors.size() > 0) {
|
if (authors!=null && authors.size() > 0) {
|
||||||
syndFeed.setAuthors(createSyndPersons(authors));
|
syndFeed.setAuthors(createSyndPersons(authors));
|
||||||
}
|
}
|
||||||
|
@ -128,9 +130,9 @@ public class ConverterForAtom03 implements Converter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createSyndLinks(List aLinks) {
|
protected List<SyndLink> createSyndLinks(List<Link> aLinks) {
|
||||||
ArrayList sLinks = new ArrayList();
|
ArrayList<SyndLink> sLinks = new ArrayList<SyndLink>();
|
||||||
for (Iterator iter = aLinks.iterator(); iter.hasNext();) {
|
for (Iterator<Link> iter = aLinks.iterator(); iter.hasNext();) {
|
||||||
Link link = (Link)iter.next();
|
Link link = (Link)iter.next();
|
||||||
if (!link.getRel().equals("enclosure")) {
|
if (!link.getRel().equals("enclosure")) {
|
||||||
SyndLink sLink = createSyndLink(link);
|
SyndLink sLink = createSyndLink(link);
|
||||||
|
@ -149,8 +151,8 @@ public class ConverterForAtom03 implements Converter {
|
||||||
return syndLink;
|
return syndLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createSyndEntries(List atomEntries, boolean preserveWireItems) {
|
protected List<SyndEntry> createSyndEntries(List<Entry> atomEntries, boolean preserveWireItems) {
|
||||||
List syndEntries = new ArrayList();
|
List<SyndEntry> syndEntries = new ArrayList<SyndEntry>();
|
||||||
for (int i=0;i<atomEntries.size();i++) {
|
for (int i=0;i<atomEntries.size();i++) {
|
||||||
syndEntries.add(createSyndEntry((Entry) atomEntries.get(i), preserveWireItems));
|
syndEntries.add(createSyndEntry((Entry) atomEntries.get(i), preserveWireItems));
|
||||||
}
|
}
|
||||||
|
@ -165,8 +167,8 @@ public class ConverterForAtom03 implements Converter {
|
||||||
|
|
||||||
syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));
|
syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));
|
||||||
|
|
||||||
if (((List)entry.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)entry.getForeignMarkup()).size() > 0) {
|
||||||
syndEntry.setForeignMarkup((List)entry.getForeignMarkup());
|
syndEntry.setForeignMarkup((List<Element>)entry.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
syndEntry.setTitle(entry.getTitle());
|
syndEntry.setTitle(entry.getTitle());
|
||||||
|
@ -179,10 +181,10 @@ public class ConverterForAtom03 implements Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create synd enclosures from enclosure links
|
// Create synd enclosures from enclosure links
|
||||||
List syndEnclosures = new ArrayList();
|
List<SyndEnclosure> syndEnclosures = new ArrayList<SyndEnclosure>();
|
||||||
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) {
|
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) {
|
||||||
List oLinks = entry.getOtherLinks();
|
List<Link> oLinks = entry.getOtherLinks();
|
||||||
for (Iterator iter = oLinks.iterator(); iter.hasNext(); ) {
|
for (Iterator<Link> iter = oLinks.iterator(); iter.hasNext(); ) {
|
||||||
Link thisLink = (Link)iter.next();
|
Link thisLink = (Link)iter.next();
|
||||||
if ("enclosure".equals(thisLink.getRel()))
|
if ("enclosure".equals(thisLink.getRel()))
|
||||||
syndEnclosures.add(createSyndEnclosure(entry, thisLink));
|
syndEnclosures.add(createSyndEnclosure(entry, thisLink));
|
||||||
|
@ -191,7 +193,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
syndEntry.setEnclosures(syndEnclosures);
|
syndEntry.setEnclosures(syndEnclosures);
|
||||||
|
|
||||||
// lump alternate and other links together
|
// lump alternate and other links together
|
||||||
List syndLinks = new ArrayList();
|
List<SyndLink> syndLinks = new ArrayList<SyndLink>();
|
||||||
if (entry.getAlternateLinks() != null
|
if (entry.getAlternateLinks() != null
|
||||||
&& entry.getAlternateLinks().size() > 0) {
|
&& entry.getAlternateLinks().size() > 0) {
|
||||||
syndLinks.addAll(createSyndLinks(entry.getAlternateLinks()));
|
syndLinks.addAll(createSyndLinks(entry.getAlternateLinks()));
|
||||||
|
@ -213,7 +215,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
|
|
||||||
Content content = entry.getSummary();
|
Content content = entry.getSummary();
|
||||||
if (content==null) {
|
if (content==null) {
|
||||||
List contents = entry.getContents();
|
List<Content> contents = entry.getContents();
|
||||||
if (contents!=null && contents.size()>0) {
|
if (contents!=null && contents.size()>0) {
|
||||||
content = (Content) contents.get(0);
|
content = (Content) contents.get(0);
|
||||||
}
|
}
|
||||||
|
@ -225,9 +227,9 @@ public class ConverterForAtom03 implements Converter {
|
||||||
syndEntry.setDescription(sContent);
|
syndEntry.setDescription(sContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
List contents = entry.getContents();
|
List<Content> contents = entry.getContents();
|
||||||
if (contents.size()>0) {
|
if (contents.size()>0) {
|
||||||
List sContents = new ArrayList();
|
List<SyndContent> sContents = new ArrayList<SyndContent>();
|
||||||
for (int i=0;i<contents.size();i++) {
|
for (int i=0;i<contents.size();i++) {
|
||||||
content = (Content) contents.get(i);
|
content = (Content) contents.get(i);
|
||||||
SyndContent sContent = new SyndContentImpl();
|
SyndContent sContent = new SyndContentImpl();
|
||||||
|
@ -239,7 +241,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
syndEntry.setContents(sContents);
|
syndEntry.setContents(sContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
List authors = entry.getAuthors();
|
List<Person> authors = entry.getAuthors();
|
||||||
if (authors!=null && authors.size() > 0) {
|
if (authors!=null && authors.size() > 0) {
|
||||||
syndEntry.setAuthors(createSyndPersons(authors));
|
syndEntry.setAuthors(createSyndPersons(authors));
|
||||||
SyndPerson person0 = (SyndPerson)syndEntry.getAuthors().get(0);
|
SyndPerson person0 = (SyndPerson)syndEntry.getAuthors().get(0);
|
||||||
|
@ -292,11 +294,11 @@ public class ConverterForAtom03 implements Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// separate SyndEntry's links collection into alternate and other links
|
// separate SyndEntry's links collection into alternate and other links
|
||||||
List alternateLinks = new ArrayList();
|
List<Link> alternateLinks = new ArrayList<Link>();
|
||||||
List otherLinks = new ArrayList();
|
List<Link> otherLinks = new ArrayList<Link>();
|
||||||
List slinks = syndFeed.getLinks();
|
List<SyndLink> slinks = syndFeed.getLinks();
|
||||||
if (slinks != null) {
|
if (slinks != null) {
|
||||||
for (Iterator iter=slinks.iterator(); iter.hasNext();) {
|
for (Iterator<SyndLink> iter=slinks.iterator(); iter.hasNext();) {
|
||||||
SyndLink syndLink = (SyndLink)iter.next();
|
SyndLink syndLink = (SyndLink)iter.next();
|
||||||
Link link = createAtomLink(syndLink);
|
Link link = createAtomLink(syndLink);
|
||||||
if (link.getRel() == null ||
|
if (link.getRel() == null ||
|
||||||
|
@ -328,7 +330,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
|
|
||||||
aFeed.setLanguage(syndFeed.getLanguage());
|
aFeed.setLanguage(syndFeed.getLanguage());
|
||||||
|
|
||||||
List authors = syndFeed.getAuthors();
|
List<SyndPerson> authors = syndFeed.getAuthors();
|
||||||
if (authors!=null && authors.size() > 0) {
|
if (authors!=null && authors.size() > 0) {
|
||||||
aFeed.setAuthors(createAtomPersons(authors));
|
aFeed.setAuthors(createAtomPersons(authors));
|
||||||
}
|
}
|
||||||
|
@ -337,7 +339,7 @@ public class ConverterForAtom03 implements Converter {
|
||||||
|
|
||||||
aFeed.setModified(syndFeed.getPublishedDate());
|
aFeed.setModified(syndFeed.getPublishedDate());
|
||||||
|
|
||||||
List sEntries = syndFeed.getEntries();
|
List<SyndEntry> sEntries = syndFeed.getEntries();
|
||||||
if (sEntries!=null) {
|
if (sEntries!=null) {
|
||||||
aFeed.setEntries(createAtomEntries(sEntries));
|
aFeed.setEntries(createAtomEntries(sEntries));
|
||||||
}
|
}
|
||||||
|
@ -345,9 +347,9 @@ public class ConverterForAtom03 implements Converter {
|
||||||
return aFeed;
|
return aFeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List createAtomPersons(List sPersons) {
|
protected static List<Person> createAtomPersons(List<SyndPerson> sPersons) {
|
||||||
List persons = new ArrayList();
|
List<Person> persons = new ArrayList<Person>();
|
||||||
for (Iterator iter = sPersons.iterator(); iter.hasNext(); ) {
|
for (Iterator<SyndPerson> iter = sPersons.iterator(); iter.hasNext(); ) {
|
||||||
SyndPerson sPerson = (SyndPerson)iter.next();
|
SyndPerson sPerson = (SyndPerson)iter.next();
|
||||||
Person person = new Person();
|
Person person = new Person();
|
||||||
person.setName(sPerson.getName());
|
person.setName(sPerson.getName());
|
||||||
|
@ -359,9 +361,9 @@ public class ConverterForAtom03 implements Converter {
|
||||||
return persons;
|
return persons;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List createSyndPersons(List aPersons) {
|
protected static List<SyndPerson> createSyndPersons(List<Person> aPersons) {
|
||||||
List persons = new ArrayList();
|
List<SyndPerson> persons = new ArrayList<SyndPerson>();
|
||||||
for (Iterator iter = aPersons.iterator(); iter.hasNext(); ) {
|
for (Iterator<Person> iter = aPersons.iterator(); iter.hasNext(); ) {
|
||||||
Person aPerson = (Person)iter.next();
|
Person aPerson = (Person)iter.next();
|
||||||
SyndPerson person = new SyndPersonImpl();
|
SyndPerson person = new SyndPersonImpl();
|
||||||
person.setName(aPerson.getName());
|
person.setName(aPerson.getName());
|
||||||
|
@ -373,8 +375,8 @@ public class ConverterForAtom03 implements Converter {
|
||||||
return persons;
|
return persons;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createAtomEntries(List syndEntries) {
|
protected List<Entry> createAtomEntries(List<SyndEntry> syndEntries) {
|
||||||
List atomEntries = new ArrayList();
|
List<Entry> atomEntries = new ArrayList<Entry>();
|
||||||
for (int i=0;i<syndEntries.size();i++) {
|
for (int i=0;i<syndEntries.size();i++) {
|
||||||
atomEntries.add(createAtomEntry((SyndEntry)syndEntries.get(i)));
|
atomEntries.add(createAtomEntry((SyndEntry)syndEntries.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -403,11 +405,11 @@ public class ConverterForAtom03 implements Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// separate SyndEntry's links collection into alternate and other links
|
// separate SyndEntry's links collection into alternate and other links
|
||||||
List alternateLinks = new ArrayList();
|
List<Link> alternateLinks = new ArrayList<Link>();
|
||||||
List otherLinks = new ArrayList();
|
List<Link> otherLinks = new ArrayList<Link>();
|
||||||
List slinks = sEntry.getLinks();
|
List<SyndLink> slinks = sEntry.getLinks();
|
||||||
if (slinks != null) {
|
if (slinks != null) {
|
||||||
for (Iterator iter=slinks.iterator(); iter.hasNext();) {
|
for (Iterator<SyndLink> iter=slinks.iterator(); iter.hasNext();) {
|
||||||
SyndLink syndLink = (SyndLink)iter.next();
|
SyndLink syndLink = (SyndLink)iter.next();
|
||||||
Link link = createAtomLink(syndLink);
|
Link link = createAtomLink(syndLink);
|
||||||
if (link.getRel() == null ||
|
if (link.getRel() == null ||
|
||||||
|
@ -427,9 +429,9 @@ public class ConverterForAtom03 implements Converter {
|
||||||
alternateLinks.add(link);
|
alternateLinks.add(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
List sEnclosures = sEntry.getEnclosures();
|
List<SyndEnclosure> sEnclosures = sEntry.getEnclosures();
|
||||||
if (sEnclosures != null) {
|
if (sEnclosures != null) {
|
||||||
for (Iterator iter=sEnclosures.iterator(); iter.hasNext();) {
|
for (Iterator<SyndEnclosure> iter=sEnclosures.iterator(); iter.hasNext();) {
|
||||||
SyndEnclosure syndEnclosure = (SyndEnclosure) iter.next();
|
SyndEnclosure syndEnclosure = (SyndEnclosure) iter.next();
|
||||||
Link link = createAtomEnclosure(syndEnclosure);
|
Link link = createAtomEnclosure(syndEnclosure);
|
||||||
otherLinks.add(link);
|
otherLinks.add(link);
|
||||||
|
@ -449,9 +451,9 @@ public class ConverterForAtom03 implements Converter {
|
||||||
aEntry.setSummary(content);
|
aEntry.setSummary(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
List contents = sEntry.getContents();
|
List<SyndContent> contents = sEntry.getContents();
|
||||||
if (contents.size()>0) {
|
if (contents.size()>0) {
|
||||||
List aContents = new ArrayList();
|
List<Content> aContents = new ArrayList<Content>();
|
||||||
for (int i=0;i<contents.size();i++) {
|
for (int i=0;i<contents.size();i++) {
|
||||||
sContent = (SyndContentImpl) contents.get(i);
|
sContent = (SyndContentImpl) contents.get(i);
|
||||||
Content content = new Content();
|
Content content = new Content();
|
||||||
|
@ -464,13 +466,13 @@ public class ConverterForAtom03 implements Converter {
|
||||||
aEntry.setContents(aContents);
|
aEntry.setContents(aContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
List sAuthors = sEntry.getAuthors();
|
List<SyndPerson> sAuthors = sEntry.getAuthors();
|
||||||
if (sAuthors!=null && sAuthors.size() > 0) {
|
if (sAuthors!=null && sAuthors.size() > 0) {
|
||||||
aEntry.setAuthors(createAtomPersons(sAuthors));
|
aEntry.setAuthors(createAtomPersons(sAuthors));
|
||||||
} else if (sEntry.getAuthor() != null) {
|
} else if (sEntry.getAuthor() != null) {
|
||||||
Person person = new Person();
|
Person person = new Person();
|
||||||
person.setName(sEntry.getAuthor());
|
person.setName(sEntry.getAuthor());
|
||||||
List authors = new ArrayList();
|
List<Person> authors = new ArrayList<Person>();
|
||||||
authors.add(person);
|
authors.add(person);
|
||||||
aEntry.setAuthors(authors);
|
aEntry.setAuthors(authors);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
import com.sun.syndication.feed.WireFeed;
|
import com.sun.syndication.feed.WireFeed;
|
||||||
import com.sun.syndication.feed.atom.Category;
|
import com.sun.syndication.feed.atom.Category;
|
||||||
import com.sun.syndication.feed.atom.Content;
|
import com.sun.syndication.feed.atom.Content;
|
||||||
|
@ -67,8 +69,8 @@ public class ConverterForAtom10 implements Converter {
|
||||||
|
|
||||||
syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules()));
|
syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules()));
|
||||||
|
|
||||||
if (((List)feed.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)feed.getForeignMarkup()).size() > 0) {
|
||||||
syndFeed.setForeignMarkup((List)feed.getForeignMarkup());
|
syndFeed.setForeignMarkup((List<Element>)feed.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
syndFeed.setEncoding(aFeed.getEncoding());
|
syndFeed.setEncoding(aFeed.getEncoding());
|
||||||
|
@ -98,7 +100,7 @@ public class ConverterForAtom10 implements Converter {
|
||||||
syndFeed.setLink(theLink.getHrefResolved());
|
syndFeed.setLink(theLink.getHrefResolved());
|
||||||
}
|
}
|
||||||
// lump alternate and other links together
|
// lump alternate and other links together
|
||||||
List syndLinks = new ArrayList();
|
List<SyndLink> syndLinks = new ArrayList<SyndLink>();
|
||||||
if (aFeed.getAlternateLinks() != null
|
if (aFeed.getAlternateLinks() != null
|
||||||
&& aFeed.getAlternateLinks().size() > 0) {
|
&& aFeed.getAlternateLinks().size() > 0) {
|
||||||
syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks()));
|
syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks()));
|
||||||
|
@ -109,7 +111,7 @@ public class ConverterForAtom10 implements Converter {
|
||||||
}
|
}
|
||||||
syndFeed.setLinks(syndLinks);
|
syndFeed.setLinks(syndLinks);
|
||||||
|
|
||||||
List aEntries = aFeed.getEntries();
|
List<Entry> aEntries = aFeed.getEntries();
|
||||||
if (aEntries!=null) {
|
if (aEntries!=null) {
|
||||||
syndFeed.setEntries(createSyndEntries(aFeed, aEntries, syndFeed.isPreservingWireFeed()));
|
syndFeed.setEntries(createSyndEntries(aFeed, aEntries, syndFeed.isPreservingWireFeed()));
|
||||||
}
|
}
|
||||||
|
@ -117,12 +119,12 @@ public class ConverterForAtom10 implements Converter {
|
||||||
// Core Atom language/author/copyright/modified elements have precedence
|
// Core Atom language/author/copyright/modified elements have precedence
|
||||||
// over DC equivalent info.
|
// over DC equivalent info.
|
||||||
|
|
||||||
List authors = aFeed.getAuthors();
|
List<Person> authors = aFeed.getAuthors();
|
||||||
if (authors!=null && authors.size() > 0) {
|
if (authors!=null && authors.size() > 0) {
|
||||||
syndFeed.setAuthors(ConverterForAtom03.createSyndPersons(authors));
|
syndFeed.setAuthors(ConverterForAtom03.createSyndPersons(authors));
|
||||||
}
|
}
|
||||||
|
|
||||||
List contributors = aFeed.getContributors();
|
List<Person> contributors = aFeed.getContributors();
|
||||||
if (contributors!=null && contributors.size() > 0) {
|
if (contributors!=null && contributors.size() > 0) {
|
||||||
syndFeed.setContributors(ConverterForAtom03.createSyndPersons(contributors));
|
syndFeed.setContributors(ConverterForAtom03.createSyndPersons(contributors));
|
||||||
}
|
}
|
||||||
|
@ -139,9 +141,9 @@ public class ConverterForAtom10 implements Converter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createSyndLinks(List aLinks) {
|
protected List<SyndLink> createSyndLinks(List<Link> aLinks) {
|
||||||
ArrayList sLinks = new ArrayList();
|
ArrayList<SyndLink> sLinks = new ArrayList<SyndLink>();
|
||||||
for (Iterator iter = aLinks.iterator(); iter.hasNext();) {
|
for (Iterator<Link> iter = aLinks.iterator(); iter.hasNext();) {
|
||||||
Link link = (Link)iter.next();
|
Link link = (Link)iter.next();
|
||||||
SyndLink sLink = createSyndLink(link);
|
SyndLink sLink = createSyndLink(link);
|
||||||
sLinks.add(sLink);
|
sLinks.add(sLink);
|
||||||
|
@ -149,8 +151,8 @@ public class ConverterForAtom10 implements Converter {
|
||||||
return sLinks;
|
return sLinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createSyndEntries(Feed feed, List atomEntries, boolean preserveWireItems) {
|
protected List<SyndEntry> createSyndEntries(Feed feed, List<Entry> atomEntries, boolean preserveWireItems) {
|
||||||
List syndEntries = new ArrayList();
|
List<SyndEntry> syndEntries = new ArrayList<SyndEntry>();
|
||||||
for (int i=0;i<atomEntries.size();i++) {
|
for (int i=0;i<atomEntries.size();i++) {
|
||||||
syndEntries.add(createSyndEntry(feed, (Entry) atomEntries.get(i), preserveWireItems));
|
syndEntries.add(createSyndEntry(feed, (Entry) atomEntries.get(i), preserveWireItems));
|
||||||
}
|
}
|
||||||
|
@ -164,8 +166,8 @@ public class ConverterForAtom10 implements Converter {
|
||||||
}
|
}
|
||||||
syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));
|
syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));
|
||||||
|
|
||||||
if (((List)entry.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)entry.getForeignMarkup()).size() > 0) {
|
||||||
syndEntry.setForeignMarkup((List)entry.getForeignMarkup());
|
syndEntry.setForeignMarkup((List<Element>)entry.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
Content eTitle = entry.getTitleEx();
|
Content eTitle = entry.getTitleEx();
|
||||||
|
@ -178,24 +180,24 @@ public class ConverterForAtom10 implements Converter {
|
||||||
syndEntry.setDescription(createSyndContent(summary));
|
syndEntry.setDescription(createSyndContent(summary));
|
||||||
}
|
}
|
||||||
|
|
||||||
List contents = entry.getContents();
|
List<Content> contents = entry.getContents();
|
||||||
if (contents != null && contents.size() > 0) {
|
if (contents != null && contents.size() > 0) {
|
||||||
List sContents = new ArrayList();
|
List<SyndContent> sContents = new ArrayList<SyndContent>();
|
||||||
for (Iterator iter=contents.iterator(); iter.hasNext();) {
|
for (Iterator<Content> iter=contents.iterator(); iter.hasNext();) {
|
||||||
Content content = (Content)iter.next();
|
Content content = (Content)iter.next();
|
||||||
sContents.add(createSyndContent(content));
|
sContents.add(createSyndContent(content));
|
||||||
}
|
}
|
||||||
syndEntry.setContents(sContents);
|
syndEntry.setContents(sContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
List authors = entry.getAuthors();
|
List<Person> authors = entry.getAuthors();
|
||||||
if (authors!=null && authors.size() > 0) {
|
if (authors!=null && authors.size() > 0) {
|
||||||
syndEntry.setAuthors(ConverterForAtom03.createSyndPersons(authors));
|
syndEntry.setAuthors(ConverterForAtom03.createSyndPersons(authors));
|
||||||
SyndPerson person0 = (SyndPerson)syndEntry.getAuthors().get(0);
|
SyndPerson person0 = (SyndPerson)syndEntry.getAuthors().get(0);
|
||||||
syndEntry.setAuthor(person0.getName());
|
syndEntry.setAuthor(person0.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
List contributors = entry.getContributors();
|
List<Person> contributors = entry.getContributors();
|
||||||
if (contributors!=null && contributors.size() > 0) {
|
if (contributors!=null && contributors.size() > 0) {
|
||||||
syndEntry.setContributors(ConverterForAtom03.createSyndPersons(contributors));
|
syndEntry.setContributors(ConverterForAtom03.createSyndPersons(contributors));
|
||||||
}
|
}
|
||||||
|
@ -210,10 +212,10 @@ public class ConverterForAtom10 implements Converter {
|
||||||
syndEntry.setUpdatedDate(date);
|
syndEntry.setUpdatedDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
List categories = entry.getCategories();
|
List<Category> categories = entry.getCategories();
|
||||||
if (categories!=null) {
|
if (categories!=null) {
|
||||||
List syndCategories = new ArrayList();
|
List<SyndCategory> syndCategories = new ArrayList<SyndCategory>();
|
||||||
for (Iterator iter=categories.iterator(); iter.hasNext();) {
|
for (Iterator<Category> iter=categories.iterator(); iter.hasNext();) {
|
||||||
Category c = (Category)iter.next();
|
Category c = (Category)iter.next();
|
||||||
SyndCategory syndCategory = new SyndCategoryImpl();
|
SyndCategory syndCategory = new SyndCategoryImpl();
|
||||||
syndCategory.setName(c.getTerm());
|
syndCategory.setName(c.getTerm());
|
||||||
|
@ -233,10 +235,10 @@ public class ConverterForAtom10 implements Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create synd enclosures from enclosure links
|
// Create synd enclosures from enclosure links
|
||||||
List syndEnclosures = new ArrayList();
|
List<SyndEnclosure> syndEnclosures = new ArrayList<SyndEnclosure>();
|
||||||
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) {
|
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) {
|
||||||
List oLinks = entry.getOtherLinks();
|
List<Link> oLinks = entry.getOtherLinks();
|
||||||
for (Iterator iter = oLinks.iterator(); iter.hasNext(); ) {
|
for (Iterator<Link> iter = oLinks.iterator(); iter.hasNext(); ) {
|
||||||
Link thisLink = (Link)iter.next();
|
Link thisLink = (Link)iter.next();
|
||||||
if ("enclosure".equals(thisLink.getRel()))
|
if ("enclosure".equals(thisLink.getRel()))
|
||||||
syndEnclosures.add(
|
syndEnclosures.add(
|
||||||
|
@ -246,7 +248,7 @@ public class ConverterForAtom10 implements Converter {
|
||||||
syndEntry.setEnclosures(syndEnclosures);
|
syndEntry.setEnclosures(syndEnclosures);
|
||||||
|
|
||||||
// lump alternate and other links together
|
// lump alternate and other links together
|
||||||
List syndLinks = new ArrayList();
|
List<SyndLink> syndLinks = new ArrayList<SyndLink>();
|
||||||
if (entry.getAlternateLinks() != null
|
if (entry.getAlternateLinks() != null
|
||||||
&& entry.getAlternateLinks().size() > 0) {
|
&& entry.getAlternateLinks().size() > 0) {
|
||||||
syndLinks.addAll(createSyndLinks(entry.getAlternateLinks()));
|
syndLinks.addAll(createSyndLinks(entry.getAlternateLinks()));
|
||||||
|
@ -341,11 +343,11 @@ public class ConverterForAtom10 implements Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// separate SyndEntry's links collection into alternate and other links
|
// separate SyndEntry's links collection into alternate and other links
|
||||||
List alternateLinks = new ArrayList();
|
List<Link> alternateLinks = new ArrayList<Link>();
|
||||||
List otherLinks = new ArrayList();
|
List<Link> otherLinks = new ArrayList<Link>();
|
||||||
List slinks = syndFeed.getLinks();
|
List<SyndLink> slinks = syndFeed.getLinks();
|
||||||
if (slinks != null) {
|
if (slinks != null) {
|
||||||
for (Iterator iter=slinks.iterator(); iter.hasNext();) {
|
for (Iterator<SyndLink> iter=slinks.iterator(); iter.hasNext();) {
|
||||||
SyndLink syndLink = (SyndLink)iter.next();
|
SyndLink syndLink = (SyndLink)iter.next();
|
||||||
Link link = createAtomLink(syndLink);
|
Link link = createAtomLink(syndLink);
|
||||||
if (link.getRel() == null ||
|
if (link.getRel() == null ||
|
||||||
|
@ -367,10 +369,10 @@ public class ConverterForAtom10 implements Converter {
|
||||||
if (alternateLinks.size() > 0) aFeed.setAlternateLinks(alternateLinks);
|
if (alternateLinks.size() > 0) aFeed.setAlternateLinks(alternateLinks);
|
||||||
if (otherLinks.size() > 0) aFeed.setOtherLinks(otherLinks);
|
if (otherLinks.size() > 0) aFeed.setOtherLinks(otherLinks);
|
||||||
|
|
||||||
List sCats = syndFeed.getCategories();
|
List<SyndCategory> sCats = syndFeed.getCategories();
|
||||||
List aCats = new ArrayList();
|
List<Category> aCats = new ArrayList<Category>();
|
||||||
if (sCats != null) {
|
if (sCats != null) {
|
||||||
for (Iterator iter=sCats.iterator(); iter.hasNext();) {
|
for (Iterator<SyndCategory> iter=sCats.iterator(); iter.hasNext();) {
|
||||||
SyndCategory sCat = (SyndCategory)iter.next();
|
SyndCategory sCat = (SyndCategory)iter.next();
|
||||||
Category aCat = new Category();
|
Category aCat = new Category();
|
||||||
aCat.setTerm(sCat.getName());
|
aCat.setTerm(sCat.getName());
|
||||||
|
@ -381,12 +383,12 @@ public class ConverterForAtom10 implements Converter {
|
||||||
}
|
}
|
||||||
if (aCats.size() > 0) aFeed.setCategories(aCats);
|
if (aCats.size() > 0) aFeed.setCategories(aCats);
|
||||||
|
|
||||||
List authors = syndFeed.getAuthors();
|
List<SyndPerson> authors = syndFeed.getAuthors();
|
||||||
if (authors!=null && authors.size() > 0) {
|
if (authors!=null && authors.size() > 0) {
|
||||||
aFeed.setAuthors(ConverterForAtom03.createAtomPersons(authors));
|
aFeed.setAuthors(ConverterForAtom03.createAtomPersons(authors));
|
||||||
}
|
}
|
||||||
|
|
||||||
List contributors = syndFeed.getContributors();
|
List<SyndPerson> contributors = syndFeed.getContributors();
|
||||||
if (contributors!=null && contributors.size() > 0) {
|
if (contributors!=null && contributors.size() > 0) {
|
||||||
aFeed.setContributors(ConverterForAtom03.createAtomPersons(contributors));
|
aFeed.setContributors(ConverterForAtom03.createAtomPersons(contributors));
|
||||||
}
|
}
|
||||||
|
@ -395,12 +397,12 @@ public class ConverterForAtom10 implements Converter {
|
||||||
|
|
||||||
aFeed.setUpdated(syndFeed.getPublishedDate());
|
aFeed.setUpdated(syndFeed.getPublishedDate());
|
||||||
|
|
||||||
List sEntries = syndFeed.getEntries();
|
List<SyndEntry> sEntries = syndFeed.getEntries();
|
||||||
if (sEntries!=null) {
|
if (sEntries!=null) {
|
||||||
aFeed.setEntries(createAtomEntries(sEntries));
|
aFeed.setEntries(createAtomEntries(sEntries));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((List)syndFeed.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)syndFeed.getForeignMarkup()).size() > 0) {
|
||||||
aFeed.setForeignMarkup(syndFeed.getForeignMarkup());
|
aFeed.setForeignMarkup(syndFeed.getForeignMarkup());
|
||||||
}
|
}
|
||||||
return aFeed;
|
return aFeed;
|
||||||
|
@ -413,8 +415,8 @@ public class ConverterForAtom10 implements Converter {
|
||||||
return sContent;
|
return sContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createAtomEntries(List syndEntries) {
|
protected List<Entry> createAtomEntries(List<SyndEntry> syndEntries) {
|
||||||
List atomEntries = new ArrayList();
|
List<Entry> atomEntries = new ArrayList<Entry>();
|
||||||
for (int i=0;i<syndEntries.size();i++) {
|
for (int i=0;i<syndEntries.size();i++) {
|
||||||
atomEntries.add(createAtomEntry((SyndEntry)syndEntries.get(i)));
|
atomEntries.add(createAtomEntry((SyndEntry)syndEntries.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -428,8 +430,8 @@ public class ConverterForAtom10 implements Converter {
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createAtomContents(List syndContents) {
|
protected List<Content> createAtomContents(List<SyndContent> syndContents) {
|
||||||
List atomContents = new ArrayList();
|
List<Content> atomContents = new ArrayList<Content>();
|
||||||
for (int i=0;i<syndContents.size();i++) {
|
for (int i=0;i<syndContents.size();i++) {
|
||||||
atomContents.add(createAtomContent((SyndContent)syndContents.get(i)));
|
atomContents.add(createAtomContent((SyndContent)syndContents.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -459,13 +461,13 @@ public class ConverterForAtom10 implements Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// separate SyndEntry's links collection into alternate and other links
|
// separate SyndEntry's links collection into alternate and other links
|
||||||
List alternateLinks = new ArrayList();
|
List<Link> alternateLinks = new ArrayList<Link>();
|
||||||
List otherLinks = new ArrayList();
|
List<Link> otherLinks = new ArrayList<Link>();
|
||||||
List slinks = sEntry.getLinks();
|
List<SyndLink> slinks = sEntry.getLinks();
|
||||||
List enclosures = sEntry.getEnclosures();
|
List<SyndEnclosure> enclosures = sEntry.getEnclosures();
|
||||||
boolean linkRelEnclosureExists = false;
|
boolean linkRelEnclosureExists = false;
|
||||||
if (slinks != null) {
|
if (slinks != null) {
|
||||||
for (Iterator iter=slinks.iterator(); iter.hasNext();) {
|
for (Iterator<SyndLink> iter=slinks.iterator(); iter.hasNext();) {
|
||||||
SyndLink syndLink = (SyndLink)iter.next();
|
SyndLink syndLink = (SyndLink)iter.next();
|
||||||
Link link = createAtomLink(syndLink);
|
Link link = createAtomLink(syndLink);
|
||||||
// Set this flag if there's a link of rel = enclosure so that
|
// Set this flag if there's a link of rel = enclosure so that
|
||||||
|
@ -494,7 +496,7 @@ public class ConverterForAtom10 implements Converter {
|
||||||
// add SyndEnclosures as links with rel="enclosure" ONLY if
|
// add SyndEnclosures as links with rel="enclosure" ONLY if
|
||||||
// there are no SyndEntry.getLinks() with rel="enclosure"
|
// there are no SyndEntry.getLinks() with rel="enclosure"
|
||||||
if (enclosures != null && linkRelEnclosureExists == false) {
|
if (enclosures != null && linkRelEnclosureExists == false) {
|
||||||
for (Iterator iter=enclosures.iterator(); iter.hasNext();) {
|
for (Iterator<SyndEnclosure> iter=enclosures.iterator(); iter.hasNext();) {
|
||||||
SyndEnclosure syndEncl = (SyndEnclosure)iter.next();
|
SyndEnclosure syndEncl = (SyndEnclosure)iter.next();
|
||||||
Link link = createAtomEnclosure(syndEncl);
|
Link link = createAtomEnclosure(syndEncl);
|
||||||
otherLinks.add(link);
|
otherLinks.add(link);
|
||||||
|
@ -503,10 +505,10 @@ public class ConverterForAtom10 implements Converter {
|
||||||
if (alternateLinks.size() > 0) aEntry.setAlternateLinks(alternateLinks);
|
if (alternateLinks.size() > 0) aEntry.setAlternateLinks(alternateLinks);
|
||||||
if (otherLinks.size() > 0) aEntry.setOtherLinks(otherLinks);
|
if (otherLinks.size() > 0) aEntry.setOtherLinks(otherLinks);
|
||||||
|
|
||||||
List sCats = sEntry.getCategories();
|
List<SyndCategory> sCats = sEntry.getCategories();
|
||||||
List aCats = new ArrayList();
|
List<Category> aCats = new ArrayList<Category>();
|
||||||
if (sCats != null) {
|
if (sCats != null) {
|
||||||
for (Iterator iter=sCats.iterator(); iter.hasNext();) {
|
for (Iterator<SyndCategory> iter=sCats.iterator(); iter.hasNext();) {
|
||||||
SyndCategory sCat = (SyndCategory)iter.next();
|
SyndCategory sCat = (SyndCategory)iter.next();
|
||||||
Category aCat = new Category();
|
Category aCat = new Category();
|
||||||
aCat.setTerm(sCat.getName());
|
aCat.setTerm(sCat.getName());
|
||||||
|
@ -517,7 +519,7 @@ public class ConverterForAtom10 implements Converter {
|
||||||
}
|
}
|
||||||
if (aCats.size() > 0) aEntry.setCategories(aCats);
|
if (aCats.size() > 0) aEntry.setCategories(aCats);
|
||||||
|
|
||||||
List syndContents = sEntry.getContents();
|
List<SyndContent> syndContents = sEntry.getContents();
|
||||||
aEntry.setContents(createAtomContents(syndContents));
|
aEntry.setContents(createAtomContents(syndContents));
|
||||||
|
|
||||||
List authors = sEntry.getAuthors();
|
List authors = sEntry.getAuthors();
|
||||||
|
@ -531,7 +533,7 @@ public class ConverterForAtom10 implements Converter {
|
||||||
aEntry.setAuthors(authors);
|
aEntry.setAuthors(authors);
|
||||||
}
|
}
|
||||||
|
|
||||||
List contributors = sEntry.getContributors();
|
List<SyndPerson> contributors = sEntry.getContributors();
|
||||||
if (contributors!=null && contributors.size() > 0) {
|
if (contributors!=null && contributors.size() > 0) {
|
||||||
aEntry.setContributors(ConverterForAtom03.createAtomPersons(contributors));
|
aEntry.setContributors(ConverterForAtom03.createAtomPersons(contributors));
|
||||||
}
|
}
|
||||||
|
@ -547,8 +549,8 @@ public class ConverterForAtom10 implements Converter {
|
||||||
aEntry.setUpdated(sEntry.getPublishedDate());
|
aEntry.setUpdated(sEntry.getPublishedDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((List)sEntry.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)sEntry.getForeignMarkup()).size() > 0) {
|
||||||
aEntry.setForeignMarkup((List)sEntry.getForeignMarkup());
|
aEntry.setForeignMarkup((List<Element>)sEntry.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
SyndFeed sSource = sEntry.getSource();
|
SyndFeed sSource = sEntry.getSource();
|
||||||
|
|
|
@ -26,6 +26,8 @@ import com.sun.syndication.feed.synd.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class ConverterForRSS090 implements Converter {
|
public class ConverterForRSS090 implements Converter {
|
||||||
|
@ -45,7 +47,7 @@ public class ConverterForRSS090 implements Converter {
|
||||||
|
|
||||||
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
|
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
|
||||||
syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
|
syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
|
||||||
if (((List)feed.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)feed.getForeignMarkup()).size() > 0) {
|
||||||
syndFeed.setForeignMarkup(feed.getForeignMarkup());
|
syndFeed.setForeignMarkup(feed.getForeignMarkup());
|
||||||
}
|
}
|
||||||
syndFeed.setEncoding(feed.getEncoding());
|
syndFeed.setEncoding(feed.getEncoding());
|
||||||
|
@ -59,7 +61,7 @@ public class ConverterForRSS090 implements Converter {
|
||||||
syndFeed.setImage(createSyndImage(image));
|
syndFeed.setImage(createSyndImage(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
List items = channel.getItems();
|
List<Item> items = channel.getItems();
|
||||||
if (items!=null) {
|
if (items!=null) {
|
||||||
syndFeed.setEntries(createSyndEntries(items, syndFeed.isPreservingWireFeed()));
|
syndFeed.setEntries(createSyndEntries(items, syndFeed.isPreservingWireFeed()));
|
||||||
}
|
}
|
||||||
|
@ -73,8 +75,8 @@ public class ConverterForRSS090 implements Converter {
|
||||||
return syndImage;
|
return syndImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createSyndEntries(List rssItems, boolean preserveWireItems) {
|
protected List<SyndEntry> createSyndEntries(List<Item> rssItems, boolean preserveWireItems) {
|
||||||
List syndEntries = new ArrayList();
|
List<SyndEntry> syndEntries = new ArrayList<SyndEntry>();
|
||||||
for (int i=0;i<rssItems.size();i++) {
|
for (int i=0;i<rssItems.size();i++) {
|
||||||
syndEntries.add(createSyndEntry((Item) rssItems.get(i), preserveWireItems));
|
syndEntries.add(createSyndEntry((Item) rssItems.get(i), preserveWireItems));
|
||||||
}
|
}
|
||||||
|
@ -89,7 +91,7 @@ public class ConverterForRSS090 implements Converter {
|
||||||
|
|
||||||
syndEntry.setModules(ModuleUtils.cloneModules(item.getModules()));
|
syndEntry.setModules(ModuleUtils.cloneModules(item.getModules()));
|
||||||
|
|
||||||
if (((List)item.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)item.getForeignMarkup()).size() > 0) {
|
||||||
syndEntry.setForeignMarkup(item.getForeignMarkup());
|
syndEntry.setForeignMarkup(item.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,12 +126,12 @@ public class ConverterForRSS090 implements Converter {
|
||||||
channel.setImage(createRSSImage(sImage));
|
channel.setImage(createRSSImage(sImage));
|
||||||
}
|
}
|
||||||
|
|
||||||
List sEntries = syndFeed.getEntries();
|
List<SyndEntry> sEntries = syndFeed.getEntries();
|
||||||
if (sEntries!=null) {
|
if (sEntries!=null) {
|
||||||
channel.setItems(createRSSItems(sEntries));
|
channel.setItems(createRSSItems(sEntries));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((List)syndFeed.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)syndFeed.getForeignMarkup()).size() > 0) {
|
||||||
channel.setForeignMarkup(syndFeed.getForeignMarkup());
|
channel.setForeignMarkup(syndFeed.getForeignMarkup());
|
||||||
}
|
}
|
||||||
return channel;
|
return channel;
|
||||||
|
@ -143,8 +145,8 @@ public class ConverterForRSS090 implements Converter {
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createRSSItems(List sEntries) {
|
protected List<Item> createRSSItems(List<SyndEntry> sEntries) {
|
||||||
List list = new ArrayList();
|
List<Item> list = new ArrayList<Item>();
|
||||||
for (int i=0;i<sEntries.size();i++) {
|
for (int i=0;i<sEntries.size();i++) {
|
||||||
list.add(createRSSItem((SyndEntry)sEntries.get(i)));
|
list.add(createRSSItem((SyndEntry)sEntries.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -156,7 +158,7 @@ public class ConverterForRSS090 implements Converter {
|
||||||
item.setModules(ModuleUtils.cloneModules(sEntry.getModules()));
|
item.setModules(ModuleUtils.cloneModules(sEntry.getModules()));
|
||||||
item.setTitle(sEntry.getTitle());
|
item.setTitle(sEntry.getTitle());
|
||||||
item.setLink(sEntry.getLink());
|
item.setLink(sEntry.getLink());
|
||||||
if (((List)sEntry.getForeignMarkup()).size() > 0) {
|
if (((List<Element>)sEntry.getForeignMarkup()).size() > 0) {
|
||||||
item.setForeignMarkup(sEntry.getForeignMarkup());
|
item.setForeignMarkup(sEntry.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,10 +66,10 @@ public class ConverterForRSS091Userland extends ConverterForRSS090 {
|
||||||
String author = channel.getManagingEditor();
|
String author = channel.getManagingEditor();
|
||||||
|
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
List creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();
|
List<String> creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();
|
||||||
|
|
||||||
if (!creators.contains(author)) {
|
if (!creators.contains(author)) {
|
||||||
Set s = new HashSet(); // using a set to remove duplicates
|
Set<String> s = new HashSet<String>(); // using a set to remove duplicates
|
||||||
s.addAll(creators); // DC creators
|
s.addAll(creators); // DC creators
|
||||||
s.add(author); // feed native author
|
s.add(author); // feed native author
|
||||||
creators.clear();
|
creators.clear();
|
||||||
|
@ -107,7 +107,7 @@ public class ConverterForRSS091Userland extends ConverterForRSS090 {
|
||||||
item.setDescription(createItemDescription(sContent));
|
item.setDescription(createItemDescription(sContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
List contents = sEntry.getContents();
|
List<SyndContent> contents = sEntry.getContents();
|
||||||
|
|
||||||
if ((contents != null) && (contents.size() > 0)) {
|
if ((contents != null) && (contents.size() > 0)) {
|
||||||
SyndContent syndContent = (SyndContent) contents.get(0);
|
SyndContent syndContent = (SyndContent) contents.get(0);
|
||||||
|
@ -159,7 +159,7 @@ public class ConverterForRSS091Userland extends ConverterForRSS090 {
|
||||||
content.setType(cont.getType());
|
content.setType(cont.getType());
|
||||||
content.setValue(cont.getValue());
|
content.setValue(cont.getValue());
|
||||||
|
|
||||||
List syndContents = new ArrayList();
|
List<SyndContent> syndContents = new ArrayList<SyndContent>();
|
||||||
syndContents.add(content);
|
syndContents.add(content);
|
||||||
syndEntry.setContents(syndContents);
|
syndEntry.setContents(syndContents);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,22 +45,22 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
|
||||||
@Override
|
@Override
|
||||||
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
|
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
|
||||||
SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
|
SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
|
||||||
List cats = item.getCategories();
|
List<Category> cats = item.getCategories();
|
||||||
if (cats.size()>0) {
|
if (cats.size()>0) {
|
||||||
Set s = new LinkedHashSet(); // using a set to remove duplicates and use a LinkedHashSet to try to retain the document order
|
Set<SyndCategory> s = new LinkedHashSet<SyndCategory>(); // using a set to remove duplicates and use a LinkedHashSet to try to retain the document order
|
||||||
s.addAll(createSyndCategories(cats)); // feed native categories (as syndcat)
|
s.addAll(createSyndCategories(cats)); // feed native categories (as syndcat)
|
||||||
s.addAll(syndEntry.getCategories()); // DC subjects (as syndcat)
|
s.addAll(syndEntry.getCategories()); // DC subjects (as syndcat)
|
||||||
syndEntry.setCategories(new ArrayList(s)); //c
|
syndEntry.setCategories(new ArrayList<SyndCategory>(s)); //c
|
||||||
}
|
}
|
||||||
List enclosures = item.getEnclosures();
|
List<Enclosure> enclosures = item.getEnclosures();
|
||||||
if (enclosures.size()>0) {
|
if (enclosures.size()>0) {
|
||||||
syndEntry.setEnclosures(createSyndEnclosures(enclosures));
|
syndEntry.setEnclosures(createSyndEnclosures(enclosures));
|
||||||
}
|
}
|
||||||
return syndEntry;
|
return syndEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createSyndCategories(List rssCats) {
|
protected List<SyndCategory> createSyndCategories(List<Category> rssCats) {
|
||||||
List syndCats = new ArrayList();
|
List<SyndCategory> syndCats = new ArrayList<SyndCategory>();
|
||||||
for (int i=0;i<rssCats.size();i++) {
|
for (int i=0;i<rssCats.size();i++) {
|
||||||
Category rssCat = (Category) rssCats.get(i);
|
Category rssCat = (Category) rssCats.get(i);
|
||||||
SyndCategory sCat = new SyndCategoryImpl();
|
SyndCategory sCat = new SyndCategoryImpl();
|
||||||
|
@ -71,8 +71,8 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
|
||||||
return syndCats;
|
return syndCats;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createSyndEnclosures(List enclosures) {
|
protected List<SyndEnclosure> createSyndEnclosures(List<Enclosure> enclosures) {
|
||||||
List sEnclosures = new ArrayList();
|
List<SyndEnclosure> sEnclosures = new ArrayList<SyndEnclosure>();
|
||||||
for (int i=0;i<enclosures.size();i++) {
|
for (int i=0;i<enclosures.size();i++) {
|
||||||
Enclosure enc = (Enclosure) enclosures.get(i);
|
Enclosure enc = (Enclosure) enclosures.get(i);
|
||||||
SyndEnclosure sEnc = new SyndEnclosureImpl();
|
SyndEnclosure sEnc = new SyndEnclosureImpl();
|
||||||
|
@ -88,19 +88,19 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
|
||||||
protected Item createRSSItem(SyndEntry sEntry) {
|
protected Item createRSSItem(SyndEntry sEntry) {
|
||||||
Item item = super.createRSSItem(sEntry);
|
Item item = super.createRSSItem(sEntry);
|
||||||
|
|
||||||
List sCats = sEntry.getCategories(); //c
|
List<SyndCategory> sCats = sEntry.getCategories(); //c
|
||||||
if (sCats.size()>0) {
|
if (sCats.size()>0) {
|
||||||
item.setCategories(createRSSCategories(sCats));
|
item.setCategories(createRSSCategories(sCats));
|
||||||
}
|
}
|
||||||
List sEnclosures = sEntry.getEnclosures();
|
List<SyndEnclosure> sEnclosures = sEntry.getEnclosures();
|
||||||
if (sEnclosures.size()>0) {
|
if (sEnclosures.size()>0) {
|
||||||
item.setEnclosures(createEnclosures(sEnclosures));
|
item.setEnclosures(createEnclosures(sEnclosures));
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createRSSCategories(List sCats) {
|
protected List<Category> createRSSCategories(List<SyndCategory> sCats) {
|
||||||
List cats = new ArrayList();
|
List<Category> cats = new ArrayList<Category>();
|
||||||
for (int i=0;i<sCats.size();i++) {
|
for (int i=0;i<sCats.size();i++) {
|
||||||
SyndCategory sCat = (SyndCategory) sCats.get(i);
|
SyndCategory sCat = (SyndCategory) sCats.get(i);
|
||||||
Category cat = new Category();
|
Category cat = new Category();
|
||||||
|
@ -111,8 +111,8 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List createEnclosures(List sEnclosures) {
|
protected List<Enclosure> createEnclosures(List<SyndEnclosure> sEnclosures) {
|
||||||
List enclosures = new ArrayList();
|
List<Enclosure> enclosures = new ArrayList<Enclosure>();
|
||||||
for (int i=0;i<sEnclosures.size();i++) {
|
for (int i=0;i<sEnclosures.size();i++) {
|
||||||
SyndEnclosure sEnc = (SyndEnclosure) sEnclosures.get(i);
|
SyndEnclosure sEnc = (SyndEnclosure) sEnclosures.get(i);
|
||||||
Enclosure enc = new Enclosure();
|
Enclosure enc = new Enclosure();
|
||||||
|
|
|
@ -18,9 +18,11 @@ package com.sun.syndication.feed.synd.impl;
|
||||||
|
|
||||||
import com.sun.syndication.feed.WireFeed;
|
import com.sun.syndication.feed.WireFeed;
|
||||||
import com.sun.syndication.feed.module.DCModule;
|
import com.sun.syndication.feed.module.DCModule;
|
||||||
|
import com.sun.syndication.feed.rss.Category;
|
||||||
import com.sun.syndication.feed.rss.Channel;
|
import com.sun.syndication.feed.rss.Channel;
|
||||||
import com.sun.syndication.feed.rss.Guid;
|
import com.sun.syndication.feed.rss.Guid;
|
||||||
import com.sun.syndication.feed.rss.Item;
|
import com.sun.syndication.feed.rss.Item;
|
||||||
|
import com.sun.syndication.feed.synd.SyndCategory;
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
import com.sun.syndication.feed.synd.SyndEntry;
|
||||||
import com.sun.syndication.feed.synd.SyndFeed;
|
import com.sun.syndication.feed.synd.SyndFeed;
|
||||||
import com.sun.syndication.feed.synd.SyndLink;
|
import com.sun.syndication.feed.synd.SyndLink;
|
||||||
|
@ -48,12 +50,12 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
|
||||||
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
|
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
|
||||||
Channel channel = (Channel) feed;
|
Channel channel = (Channel) feed;
|
||||||
super.copyInto(channel,syndFeed);
|
super.copyInto(channel,syndFeed);
|
||||||
List cats = channel.getCategories(); //c
|
List<Category> cats = channel.getCategories(); //c
|
||||||
if (cats.size()>0) {
|
if (cats.size()>0) {
|
||||||
Set s = new HashSet(); // using a set to remove duplicates
|
Set<SyndCategory> s = new HashSet<SyndCategory>(); // using a set to remove duplicates
|
||||||
s.addAll(createSyndCategories(cats)); // feed native categories (as syndcat)
|
s.addAll(createSyndCategories(cats)); // feed native categories (as syndcat)
|
||||||
s.addAll(syndFeed.getCategories()); // DC subjects (as syndcat)
|
s.addAll(syndFeed.getCategories()); // DC subjects (as syndcat)
|
||||||
syndFeed.setCategories(new ArrayList(s));
|
syndFeed.setCategories(new ArrayList<SyndCategory>(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,9 +66,9 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
|
||||||
// adding native feed author to DC creators list
|
// adding native feed author to DC creators list
|
||||||
String author = item.getAuthor();
|
String author = item.getAuthor();
|
||||||
if (author!=null) {
|
if (author!=null) {
|
||||||
List creators = ((DCModule)syndEntry.getModule(DCModule.URI)).getCreators();
|
List<String> creators = ((DCModule)syndEntry.getModule(DCModule.URI)).getCreators();
|
||||||
if (!creators.contains(author)) {
|
if (!creators.contains(author)) {
|
||||||
Set s = new HashSet(); // using a set to remove duplicates
|
Set<String> s = new HashSet<String>(); // using a set to remove duplicates
|
||||||
s.addAll(creators); // DC creators
|
s.addAll(creators); // DC creators
|
||||||
s.add(author); // feed native author
|
s.add(author); // feed native author
|
||||||
creators.clear();
|
creators.clear();
|
||||||
|
@ -97,7 +99,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
|
||||||
@Override
|
@Override
|
||||||
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
|
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
|
||||||
Channel channel = (Channel) super.createRealFeed(type,syndFeed);
|
Channel channel = (Channel) super.createRealFeed(type,syndFeed);
|
||||||
List cats = syndFeed.getCategories(); //c
|
List<SyndCategory> cats = syndFeed.getCategories(); //c
|
||||||
if (cats.size()>0) {
|
if (cats.size()>0) {
|
||||||
channel.setCategories(createRSSCategories(cats));
|
channel.setCategories(createRSSCategories(cats));
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class ConverterForRSS10 extends ConverterForRSS090 {
|
||||||
SyndContent contContent = new SyndContentImpl();
|
SyndContent contContent = new SyndContentImpl();
|
||||||
contContent.setType(cont.getType());
|
contContent.setType(cont.getType());
|
||||||
contContent.setValue(cont.getValue());
|
contContent.setValue(cont.getValue());
|
||||||
List contents = new ArrayList();
|
List<SyndContent> contents = new ArrayList<SyndContent>();
|
||||||
contents.add(contContent);
|
contents.add(contContent);
|
||||||
syndEntry.setContents(contents);
|
syndEntry.setContents(contents);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ public class ConverterForRSS10 extends ConverterForRSS090 {
|
||||||
if (desc!=null) {
|
if (desc!=null) {
|
||||||
item.setDescription(createItemDescription(desc));
|
item.setDescription(createItemDescription(desc));
|
||||||
}
|
}
|
||||||
List contents = sEntry.getContents();
|
List<SyndContent> contents = sEntry.getContents();
|
||||||
if (contents!=null && contents.size() > 0) {
|
if (contents!=null && contents.size() > 0) {
|
||||||
item.setContent(createItemContent((SyndContent)contents.get(0)));
|
item.setContent(createItemContent((SyndContent)contents.get(0)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package com.sun.syndication.io;
|
package com.sun.syndication.io;
|
||||||
|
|
||||||
import com.sun.syndication.feed.module.Module;
|
import com.sun.syndication.feed.module.Module;
|
||||||
import com.sun.syndication.feed.WireFeed;
|
|
||||||
import org.jdom2.Element;
|
import org.jdom2.Element;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -90,11 +90,11 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
populateFeedHeader(feed,eFeed);
|
populateFeedHeader(feed,eFeed);
|
||||||
checkFeedHeaderConstraints(eFeed);
|
checkFeedHeaderConstraints(eFeed);
|
||||||
generateFeedModules(feed.getModules(),eFeed);
|
generateFeedModules(feed.getModules(),eFeed);
|
||||||
generateForeignMarkup(eFeed, (List)feed.getForeignMarkup());
|
generateForeignMarkup(eFeed, (List<Element>)feed.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addEntries(Feed feed,Element parent) throws FeedException {
|
protected void addEntries(Feed feed,Element parent) throws FeedException {
|
||||||
List items = feed.getEntries();
|
List<Entry> items = feed.getEntries();
|
||||||
for (int i=0;i<items.size();i++) {
|
for (int i=0;i<items.size();i++) {
|
||||||
addEntry((Entry)items.get(i),parent);
|
addEntry((Entry)items.get(i),parent);
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
eFeed.addContent(titleElement);
|
eFeed.addContent(titleElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
List links = feed.getAlternateLinks();
|
List<Link> links = feed.getAlternateLinks();
|
||||||
for (int i = 0; i < links.size(); i++) {
|
for (int i = 0; i < links.size(); i++) {
|
||||||
eFeed.addContent(generateLinkElement((Link)links.get(i)));
|
eFeed.addContent(generateLinkElement((Link)links.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
eFeed.addContent(authorElement);
|
eFeed.addContent(authorElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
List contributors = feed.getContributors();
|
List<Person> contributors = feed.getContributors();
|
||||||
for (int i = 0; i < contributors.size(); i++) {
|
for (int i = 0; i < contributors.size(); i++) {
|
||||||
Element contributorElement = new Element("contributor", getFeedNamespace());
|
Element contributorElement = new Element("contributor", getFeedNamespace());
|
||||||
fillPersonElement(contributorElement, (Person)contributors.get(i));
|
fillPersonElement(contributorElement, (Person)contributors.get(i));
|
||||||
|
@ -175,7 +175,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
fillContentElement(titleElement, entry.getTitleEx());
|
fillContentElement(titleElement, entry.getTitleEx());
|
||||||
eEntry.addContent(titleElement);
|
eEntry.addContent(titleElement);
|
||||||
}
|
}
|
||||||
List links = entry.getAlternateLinks();
|
List<Link> links = entry.getAlternateLinks();
|
||||||
for (int i = 0; i < links.size(); i++) {
|
for (int i = 0; i < links.size(); i++) {
|
||||||
eEntry.addContent(generateLinkElement((Link)links.get(i)));
|
eEntry.addContent(generateLinkElement((Link)links.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
eEntry.addContent(authorElement);
|
eEntry.addContent(authorElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
List contributors = entry.getContributors();
|
List<Person> contributors = entry.getContributors();
|
||||||
for (int i = 0; i < contributors.size(); i++) {
|
for (int i = 0; i < contributors.size(); i++) {
|
||||||
Element contributorElement = new Element("contributor", getFeedNamespace());
|
Element contributorElement = new Element("contributor", getFeedNamespace());
|
||||||
fillPersonElement(contributorElement, (Person)contributors.get(i));
|
fillPersonElement(contributorElement, (Person)contributors.get(i));
|
||||||
|
@ -225,14 +225,14 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
eEntry.addContent(summaryElement);
|
eEntry.addContent(summaryElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
List contents = entry.getContents();
|
List<Content> contents = entry.getContents();
|
||||||
for (int i = 0; i < contents.size(); i++) {
|
for (int i = 0; i < contents.size(); i++) {
|
||||||
Element contentElement = new Element("content", getFeedNamespace());
|
Element contentElement = new Element("content", getFeedNamespace());
|
||||||
fillContentElement(contentElement, (Content)contents.get(i));
|
fillContentElement(contentElement, (Content)contents.get(i));
|
||||||
eEntry.addContent(contentElement);
|
eEntry.addContent(contentElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
generateForeignMarkup(eEntry, (List)entry.getForeignMarkup());
|
generateForeignMarkup(eEntry, (List<Element>)entry.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkFeedHeaderConstraints(Element eFeed) throws FeedException {
|
protected void checkFeedHeaderConstraints(Element eFeed) throws FeedException {
|
||||||
|
@ -329,7 +329,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
throw new FeedException("Invalid XML",ex);
|
throw new FeedException("Invalid XML",ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
List children = tmpDoc.getRootElement().removeContent();
|
List<org.jdom2.Content> children = tmpDoc.getRootElement().removeContent();
|
||||||
contentElement.addContent(children);
|
contentElement.addContent(children);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,13 +76,13 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
feed.setTitleEx(parseContent(e));
|
feed.setTitleEx(parseContent(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
List eList = eFeed.getChildren("link",getAtomNamespace());
|
List<Element> eList = eFeed.getChildren("link",getAtomNamespace());
|
||||||
feed.setAlternateLinks(parseAlternateLinks(eList));
|
feed.setAlternateLinks(parseAlternateLinks(eList));
|
||||||
feed.setOtherLinks(parseOtherLinks(eList));
|
feed.setOtherLinks(parseOtherLinks(eList));
|
||||||
|
|
||||||
e = eFeed.getChild("author",getAtomNamespace());
|
e = eFeed.getChild("author",getAtomNamespace());
|
||||||
if (e!=null) {
|
if (e!=null) {
|
||||||
List authors = new ArrayList();
|
List<Person> authors = new ArrayList<Person>();
|
||||||
authors.add(parsePerson(e));
|
authors.add(parsePerson(e));
|
||||||
feed.setAuthors(authors);
|
feed.setAuthors(authors);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
feed.setEntries(parseEntries(eList));
|
feed.setEntries(parseEntries(eList));
|
||||||
}
|
}
|
||||||
|
|
||||||
List foreignMarkup =
|
List<Element> foreignMarkup =
|
||||||
extractForeignMarkup(eFeed, feed, getAtomNamespace());
|
extractForeignMarkup(eFeed, feed, getAtomNamespace());
|
||||||
if (foreignMarkup.size() > 0) {
|
if (foreignMarkup.size() > 0) {
|
||||||
feed.setForeignMarkup(foreignMarkup);
|
feed.setForeignMarkup(foreignMarkup);
|
||||||
|
@ -165,8 +165,8 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List(Elements) -> List(Link)
|
// List(Elements) -> List(Link)
|
||||||
private List parseLinks(List eLinks,boolean alternate) {
|
private List<Link> parseLinks(List<Element> eLinks,boolean alternate) {
|
||||||
List links = new ArrayList();
|
List<Link> links = new ArrayList<Link>();
|
||||||
for (int i=0;i<eLinks.size();i++) {
|
for (int i=0;i<eLinks.size();i++) {
|
||||||
Element eLink = (Element) eLinks.get(i);
|
Element eLink = (Element) eLinks.get(i);
|
||||||
String rel = getAttributeValue(eLink, "rel");
|
String rel = getAttributeValue(eLink, "rel");
|
||||||
|
@ -185,12 +185,12 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List(Elements) -> List(Link)
|
// List(Elements) -> List(Link)
|
||||||
private List parseAlternateLinks(List eLinks) {
|
private List<Link> parseAlternateLinks(List<Element> eLinks) {
|
||||||
return parseLinks(eLinks,true);
|
return parseLinks(eLinks,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// List(Elements) -> List(Link)
|
// List(Elements) -> List(Link)
|
||||||
private List parseOtherLinks(List eLinks) {
|
private List<Link> parseOtherLinks(List<Element> eLinks) {
|
||||||
return parseLinks(eLinks,false);
|
return parseLinks(eLinks,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,8 +212,8 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List(Elements) -> List(Persons)
|
// List(Elements) -> List(Persons)
|
||||||
private List parsePersons(List ePersons) {
|
private List<Person> parsePersons(List<Element> ePersons) {
|
||||||
List persons = new ArrayList();
|
List<Person> persons = new ArrayList<Person>();
|
||||||
for (int i=0;i<ePersons.size();i++) {
|
for (int i=0;i<ePersons.size();i++) {
|
||||||
persons.add(parsePerson((Element)ePersons.get(i)));
|
persons.add(parsePerson((Element)ePersons.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -239,8 +239,8 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
else
|
else
|
||||||
if (mode.equals(Content.XML)) {
|
if (mode.equals(Content.XML)) {
|
||||||
XMLOutputter outputter = new XMLOutputter();
|
XMLOutputter outputter = new XMLOutputter();
|
||||||
List eContent = e.getContent();
|
List<org.jdom2.Content> eContent = e.getContent();
|
||||||
Iterator i = eContent.iterator();
|
Iterator<org.jdom2.Content> i = eContent.iterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
org.jdom2.Content c = (org.jdom2.Content) i.next();
|
org.jdom2.Content c = (org.jdom2.Content) i.next();
|
||||||
if (c instanceof Element) {
|
if (c instanceof Element) {
|
||||||
|
@ -261,8 +261,8 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List(Elements) -> List(Entries)
|
// List(Elements) -> List(Entries)
|
||||||
private List parseEntries(List eEntries) {
|
private List<Entry> parseEntries(List<Element> eEntries) {
|
||||||
List entries = new ArrayList();
|
List<Entry> entries = new ArrayList<Entry>();
|
||||||
for (int i=0;i<eEntries.size();i++) {
|
for (int i=0;i<eEntries.size();i++) {
|
||||||
entries.add(parseEntry((Element)eEntries.get(i)));
|
entries.add(parseEntry((Element)eEntries.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -277,13 +277,13 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
entry.setTitleEx(parseContent(e));
|
entry.setTitleEx(parseContent(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
List eList = eEntry.getChildren("link",getAtomNamespace());
|
List<Element> eList = eEntry.getChildren("link",getAtomNamespace());
|
||||||
entry.setAlternateLinks(parseAlternateLinks(eList));
|
entry.setAlternateLinks(parseAlternateLinks(eList));
|
||||||
entry.setOtherLinks(parseOtherLinks(eList));
|
entry.setOtherLinks(parseOtherLinks(eList));
|
||||||
|
|
||||||
e = eEntry.getChild("author",getAtomNamespace());
|
e = eEntry.getChild("author",getAtomNamespace());
|
||||||
if (e!=null) {
|
if (e!=null) {
|
||||||
List authors = new ArrayList();
|
List<Person> authors = new ArrayList<Person>();
|
||||||
authors.add(parsePerson(e));
|
authors.add(parsePerson(e));
|
||||||
entry.setAuthors(authors);
|
entry.setAuthors(authors);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
|
|
||||||
eList = eEntry.getChildren("content",getAtomNamespace());
|
eList = eEntry.getChildren("content",getAtomNamespace());
|
||||||
if (eList.size()>0) {
|
if (eList.size()>0) {
|
||||||
List content = new ArrayList();
|
List<Content> content = new ArrayList<Content>();
|
||||||
for (int i=0;i<eList.size();i++) {
|
for (int i=0;i<eList.size();i++) {
|
||||||
content.add(parseContent((Element)eList.get(i)));
|
content.add(parseContent((Element)eList.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ public class Atom03Parser extends BaseWireFeedParser {
|
||||||
|
|
||||||
entry.setModules(parseItemModules(eEntry));
|
entry.setModules(parseItemModules(eEntry));
|
||||||
|
|
||||||
List foreignMarkup =
|
List<Element> foreignMarkup =
|
||||||
extractForeignMarkup(eEntry, entry, getAtomNamespace());
|
extractForeignMarkup(eEntry, entry, getAtomNamespace());
|
||||||
if (foreignMarkup.size() > 0) {
|
if (foreignMarkup.size() > 0) {
|
||||||
entry.setForeignMarkup(foreignMarkup);
|
entry.setForeignMarkup(foreignMarkup);
|
||||||
|
|
|
@ -105,13 +105,13 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
protected void addFeed(Feed feed,Element parent) throws FeedException {
|
protected void addFeed(Feed feed,Element parent) throws FeedException {
|
||||||
Element eFeed = parent;
|
Element eFeed = parent;
|
||||||
populateFeedHeader(feed,eFeed);
|
populateFeedHeader(feed,eFeed);
|
||||||
generateForeignMarkup(eFeed, (List)feed.getForeignMarkup());
|
generateForeignMarkup(eFeed, (List<Element>)feed.getForeignMarkup());
|
||||||
checkFeedHeaderConstraints(eFeed);
|
checkFeedHeaderConstraints(eFeed);
|
||||||
generateFeedModules(feed.getModules(),eFeed);
|
generateFeedModules(feed.getModules(),eFeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addEntries(Feed feed,Element parent) throws FeedException {
|
protected void addEntries(Feed feed,Element parent) throws FeedException {
|
||||||
List items = feed.getEntries();
|
List<Entry> items = feed.getEntries();
|
||||||
for (int i=0;i<items.size();i++) {
|
for (int i=0;i<items.size();i++) {
|
||||||
addEntry((Entry)items.get(i),parent);
|
addEntry((Entry)items.get(i),parent);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
eEntry.setAttribute("base", entry.getXmlBase(), Namespace.XML_NAMESPACE);
|
eEntry.setAttribute("base", entry.getXmlBase(), Namespace.XML_NAMESPACE);
|
||||||
}
|
}
|
||||||
populateEntry(entry,eEntry);
|
populateEntry(entry,eEntry);
|
||||||
generateForeignMarkup(eEntry, (List)entry.getForeignMarkup());
|
generateForeignMarkup(eEntry, (List<Element>)entry.getForeignMarkup());
|
||||||
checkEntryConstraints(eEntry);
|
checkEntryConstraints(eEntry);
|
||||||
generateItemModules(entry.getModules(),eEntry);
|
generateItemModules(entry.getModules(),eEntry);
|
||||||
parent.addContent(eEntry);
|
parent.addContent(eEntry);
|
||||||
|
@ -137,7 +137,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
eFeed.addContent(titleElement);
|
eFeed.addContent(titleElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
List links = feed.getAlternateLinks();
|
List<Link> links = feed.getAlternateLinks();
|
||||||
if (links != null) for (int i = 0; i < links.size(); i++) {
|
if (links != null) for (int i = 0; i < links.size(); i++) {
|
||||||
eFeed.addContent(generateLinkElement((Link)links.get(i)));
|
eFeed.addContent(generateLinkElement((Link)links.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -146,12 +146,12 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
eFeed.addContent(generateLinkElement((Link)links.get(j)));
|
eFeed.addContent(generateLinkElement((Link)links.get(j)));
|
||||||
}
|
}
|
||||||
|
|
||||||
List cats = feed.getCategories();
|
List<Category> cats = feed.getCategories();
|
||||||
if (cats != null) for (Iterator iter=cats.iterator(); iter.hasNext();) {
|
if (cats != null) for (Iterator<Category> iter=cats.iterator(); iter.hasNext();) {
|
||||||
eFeed.addContent(generateCategoryElement((Category)iter.next()));
|
eFeed.addContent(generateCategoryElement((Category)iter.next()));
|
||||||
}
|
}
|
||||||
|
|
||||||
List authors = feed.getAuthors();
|
List<Person> authors = feed.getAuthors();
|
||||||
if (authors != null && authors.size() > 0) {
|
if (authors != null && authors.size() > 0) {
|
||||||
for (int i = 0; i < authors.size(); i++) {
|
for (int i = 0; i < authors.size(); i++) {
|
||||||
Element authorElement = new Element("author", getFeedNamespace());
|
Element authorElement = new Element("author", getFeedNamespace());
|
||||||
|
@ -160,7 +160,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List contributors = feed.getContributors();
|
List<Person> contributors = feed.getContributors();
|
||||||
if (contributors != null && contributors.size() > 0) {
|
if (contributors != null && contributors.size() > 0) {
|
||||||
for (int i = 0; i < contributors.size(); i++) {
|
for (int i = 0; i < contributors.size(); i++) {
|
||||||
Element contributorElement = new Element("contributor", getFeedNamespace());
|
Element contributorElement = new Element("contributor", getFeedNamespace());
|
||||||
|
@ -208,7 +208,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
fillContentElement(titleElement, entry.getTitleEx());
|
fillContentElement(titleElement, entry.getTitleEx());
|
||||||
eEntry.addContent(titleElement);
|
eEntry.addContent(titleElement);
|
||||||
}
|
}
|
||||||
List links = entry.getAlternateLinks();
|
List<Link> links = entry.getAlternateLinks();
|
||||||
if (links != null) {
|
if (links != null) {
|
||||||
for (int i = 0; i < links.size(); i++) {
|
for (int i = 0; i < links.size(); i++) {
|
||||||
eEntry.addContent(generateLinkElement((Link)links.get(i)));
|
eEntry.addContent(generateLinkElement((Link)links.get(i)));
|
||||||
|
@ -221,14 +221,14 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List cats = entry.getCategories();
|
List<Category> cats = entry.getCategories();
|
||||||
if (cats != null) {
|
if (cats != null) {
|
||||||
for (int i = 0; i < cats.size(); i++) {
|
for (int i = 0; i < cats.size(); i++) {
|
||||||
eEntry.addContent(generateCategoryElement((Category)cats.get(i)));
|
eEntry.addContent(generateCategoryElement((Category)cats.get(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List authors = entry.getAuthors();
|
List<Person> authors = entry.getAuthors();
|
||||||
if (authors != null && authors.size() > 0) {
|
if (authors != null && authors.size() > 0) {
|
||||||
for (int i = 0; i < authors.size(); i++) {
|
for (int i = 0; i < authors.size(); i++) {
|
||||||
Element authorElement = new Element("author", getFeedNamespace());
|
Element authorElement = new Element("author", getFeedNamespace());
|
||||||
|
@ -237,7 +237,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List contributors = entry.getContributors();
|
List<Person> contributors = entry.getContributors();
|
||||||
if (contributors != null && contributors.size() > 0) {
|
if (contributors != null && contributors.size() > 0) {
|
||||||
for (int i = 0; i < contributors.size(); i++) {
|
for (int i = 0; i < contributors.size(); i++) {
|
||||||
Element contributorElement = new Element("contributor", getFeedNamespace());
|
Element contributorElement = new Element("contributor", getFeedNamespace());
|
||||||
|
@ -409,7 +409,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new FeedException("Invalid XML",ex);
|
throw new FeedException("Invalid XML",ex);
|
||||||
}
|
}
|
||||||
List children = tmpDoc.getRootElement().removeContent();
|
List<org.jdom2.Content> children = tmpDoc.getRootElement().removeContent();
|
||||||
contentElement.addContent(children);
|
contentElement.addContent(children);
|
||||||
} else {
|
} else {
|
||||||
// must be type html, text or some other non-XML format
|
// must be type html, text or some other non-XML format
|
||||||
|
@ -453,7 +453,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
|
||||||
throws IllegalArgumentException, FeedException, IOException {
|
throws IllegalArgumentException, FeedException, IOException {
|
||||||
|
|
||||||
// Build a feed containing only the entry
|
// Build a feed containing only the entry
|
||||||
List entries = new ArrayList();
|
List<Entry> entries = new ArrayList<Entry>();
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
Feed feed1 = new Feed();
|
Feed feed1 = new Feed();
|
||||||
feed1.setFeedType("atom_1.0");
|
feed1.setFeedType("atom_1.0");
|
||||||
|
|
|
@ -117,12 +117,12 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
|
|
||||||
feed.setModules(parseFeedModules(eFeed));
|
feed.setModules(parseFeedModules(eFeed));
|
||||||
|
|
||||||
List eList = eFeed.getChildren("entry",getAtomNamespace());
|
List<Element> eList = eFeed.getChildren("entry",getAtomNamespace());
|
||||||
if (eList.size()>0) {
|
if (eList.size()>0) {
|
||||||
feed.setEntries(parseEntries(feed, baseURI, eList));
|
feed.setEntries(parseEntries(feed, baseURI, eList));
|
||||||
}
|
}
|
||||||
|
|
||||||
List foreignMarkup =
|
List<Element> foreignMarkup =
|
||||||
extractForeignMarkup(eFeed, feed, getAtomNamespace());
|
extractForeignMarkup(eFeed, feed, getAtomNamespace());
|
||||||
if (foreignMarkup.size() > 0) {
|
if (foreignMarkup.size() > 0) {
|
||||||
feed.setForeignMarkup(foreignMarkup);
|
feed.setForeignMarkup(foreignMarkup);
|
||||||
|
@ -142,11 +142,11 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
feed.setTitleEx(c);
|
feed.setTitleEx(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
List eList = eFeed.getChildren("link",getAtomNamespace());
|
List<Element> eList = eFeed.getChildren("link",getAtomNamespace());
|
||||||
feed.setAlternateLinks(parseAlternateLinks(feed, null, baseURI, eList));
|
feed.setAlternateLinks(parseAlternateLinks(feed, null, baseURI, eList));
|
||||||
feed.setOtherLinks(parseOtherLinks(feed, null, baseURI, eList));
|
feed.setOtherLinks(parseOtherLinks(feed, null, baseURI, eList));
|
||||||
|
|
||||||
List cList = eFeed.getChildren("category",getAtomNamespace());
|
List<Element> cList = eFeed.getChildren("category",getAtomNamespace());
|
||||||
feed.setCategories(parseCategories(baseURI, cList));
|
feed.setCategories(parseCategories(baseURI, cList));
|
||||||
|
|
||||||
eList = eFeed.getChildren("author", getAtomNamespace());
|
eList = eFeed.getChildren("author", getAtomNamespace());
|
||||||
|
@ -246,8 +246,8 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List(Elements) -> List(Link)
|
// List(Elements) -> List(Link)
|
||||||
private List parseAlternateLinks(Feed feed, Entry entry, String baseURI, List eLinks) {
|
private List<Link> parseAlternateLinks(Feed feed, Entry entry, String baseURI, List<Element> eLinks) {
|
||||||
List links = new ArrayList();
|
List<Link> links = new ArrayList<Link>();
|
||||||
for (int i=0;i<eLinks.size();i++) {
|
for (int i=0;i<eLinks.size();i++) {
|
||||||
Element eLink = (Element) eLinks.get(i);
|
Element eLink = (Element) eLinks.get(i);
|
||||||
Link link = parseLink(feed, entry, baseURI, eLink);
|
Link link = parseLink(feed, entry, baseURI, eLink);
|
||||||
|
@ -260,8 +260,8 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
return (links.size()>0) ? links : null;
|
return (links.size()>0) ? links : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List parseOtherLinks(Feed feed, Entry entry, String baseURI, List eLinks) {
|
private List<Link> parseOtherLinks(Feed feed, Entry entry, String baseURI, List<Element> eLinks) {
|
||||||
List links = new ArrayList();
|
List<Link> links = new ArrayList<Link>();
|
||||||
for (int i=0;i<eLinks.size();i++) {
|
for (int i=0;i<eLinks.size();i++) {
|
||||||
Element eLink = (Element) eLinks.get(i);
|
Element eLink = (Element) eLinks.get(i);
|
||||||
Link link = parseLink(feed, entry, baseURI, eLink);
|
Link link = parseLink(feed, entry, baseURI, eLink);
|
||||||
|
@ -294,8 +294,8 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List(Elements) -> List(Persons)
|
// List(Elements) -> List(Persons)
|
||||||
private List parsePersons(String baseURI, List ePersons) {
|
private List<Person> parsePersons(String baseURI, List<Element> ePersons) {
|
||||||
List persons = new ArrayList();
|
List<Person> persons = new ArrayList<Person>();
|
||||||
for (int i=0;i<ePersons.size();i++) {
|
for (int i=0;i<ePersons.size();i++) {
|
||||||
persons.add(parsePerson(baseURI, (Element)ePersons.get(i)));
|
persons.add(parsePerson(baseURI, (Element)ePersons.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -320,8 +320,8 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
if (type.equals(Content.XHTML) || (type.indexOf("/xml")) != -1 || (type.indexOf("+xml")) != -1) {
|
if (type.equals(Content.XHTML) || (type.indexOf("/xml")) != -1 || (type.indexOf("+xml")) != -1) {
|
||||||
// XHTML content needs special handling
|
// XHTML content needs special handling
|
||||||
XMLOutputter outputter = new XMLOutputter();
|
XMLOutputter outputter = new XMLOutputter();
|
||||||
List eContent = e.getContent();
|
List<org.jdom2.Content> eContent = e.getContent();
|
||||||
Iterator i = eContent.iterator();
|
Iterator<org.jdom2.Content> i = eContent.iterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
org.jdom2.Content c = (org.jdom2.Content) i.next();
|
org.jdom2.Content c = (org.jdom2.Content) i.next();
|
||||||
if (c instanceof Element) {
|
if (c instanceof Element) {
|
||||||
|
@ -340,8 +340,8 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List(Elements) -> List(Entries)
|
// List(Elements) -> List(Entries)
|
||||||
protected List parseEntries(Feed feed, String baseURI, List eEntries) {
|
protected List<Entry> parseEntries(Feed feed, String baseURI, List<Element> eEntries) {
|
||||||
List entries = new ArrayList();
|
List<Entry> entries = new ArrayList<Entry>();
|
||||||
for (int i=0;i<eEntries.size();i++) {
|
for (int i=0;i<eEntries.size();i++) {
|
||||||
entries.add(parseEntry(feed, (Element)eEntries.get(i), baseURI));
|
entries.add(parseEntry(feed, (Element)eEntries.get(i), baseURI));
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
entry.setTitleEx(c);
|
entry.setTitleEx(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
List eList = eEntry.getChildren("link",getAtomNamespace());
|
List<Element> eList = eEntry.getChildren("link",getAtomNamespace());
|
||||||
entry.setAlternateLinks(parseAlternateLinks(feed, entry, baseURI, eList));
|
entry.setAlternateLinks(parseAlternateLinks(feed, entry, baseURI, eList));
|
||||||
entry.setOtherLinks(parseOtherLinks(feed, entry, baseURI, eList));
|
entry.setOtherLinks(parseOtherLinks(feed, entry, baseURI, eList));
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
|
|
||||||
e = eEntry.getChild("content",getAtomNamespace());
|
e = eEntry.getChild("content",getAtomNamespace());
|
||||||
if (e!=null) {
|
if (e!=null) {
|
||||||
List contents = new ArrayList();
|
List<Content> contents = new ArrayList<Content>();
|
||||||
contents.add(parseContent(e));
|
contents.add(parseContent(e));
|
||||||
entry.setContents(contents);
|
entry.setContents(contents);
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
entry.setRights(e.getText());
|
entry.setRights(e.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
List cList = eEntry.getChildren("category",getAtomNamespace());
|
List<Element> cList = eEntry.getChildren("category",getAtomNamespace());
|
||||||
entry.setCategories(parseCategories(baseURI, cList));
|
entry.setCategories(parseCategories(baseURI, cList));
|
||||||
|
|
||||||
// TODO: SHOULD handle Atom entry source element
|
// TODO: SHOULD handle Atom entry source element
|
||||||
|
@ -421,7 +421,7 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
|
|
||||||
entry.setModules(parseItemModules(eEntry));
|
entry.setModules(parseItemModules(eEntry));
|
||||||
|
|
||||||
List foreignMarkup =
|
List<Element> foreignMarkup =
|
||||||
extractForeignMarkup(eEntry, entry, getAtomNamespace());
|
extractForeignMarkup(eEntry, entry, getAtomNamespace());
|
||||||
if (foreignMarkup.size() > 0) {
|
if (foreignMarkup.size() > 0) {
|
||||||
entry.setForeignMarkup(foreignMarkup);
|
entry.setForeignMarkup(foreignMarkup);
|
||||||
|
@ -429,8 +429,8 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List parseCategories(String baseURI, List eCategories) {
|
private List<Category> parseCategories(String baseURI, List<Element> eCategories) {
|
||||||
List cats = new ArrayList();
|
List<Category> cats = new ArrayList<Category>();
|
||||||
for (int i=0;i<eCategories.size();i++) {
|
for (int i=0;i<eCategories.size();i++) {
|
||||||
Element eCategory = (Element) eCategories.get(i);
|
Element eCategory = (Element) eCategories.get(i);
|
||||||
cats.add(parseCategory(baseURI, eCategory));
|
cats.add(parseCategory(baseURI, eCategory));
|
||||||
|
@ -561,9 +561,9 @@ public class Atom10Parser extends BaseWireFeedParser {
|
||||||
*/
|
*/
|
||||||
private String findAtomLink(Element parent, String rel) {
|
private String findAtomLink(Element parent, String rel) {
|
||||||
String ret = null;
|
String ret = null;
|
||||||
List linksList = parent.getChildren("link", ATOM_10_NS);
|
List<Element> linksList = parent.getChildren("link", ATOM_10_NS);
|
||||||
if (linksList != null) {
|
if (linksList != null) {
|
||||||
for (Iterator links = linksList.iterator(); links.hasNext(); ) {
|
for (Iterator<Element> links = linksList.iterator(); links.hasNext(); ) {
|
||||||
Element link = (Element)links.next();
|
Element link = (Element)links.next();
|
||||||
Attribute relAtt = getAttribute(link, "rel");
|
Attribute relAtt = getAttribute(link, "rel");
|
||||||
Attribute hrefAtt = getAttribute(link, "href");
|
Attribute hrefAtt = getAttribute(link, "href");
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.sun.syndication.io.impl;
|
||||||
|
|
||||||
import com.sun.syndication.feed.WireFeed;
|
import com.sun.syndication.feed.WireFeed;
|
||||||
import com.sun.syndication.feed.module.Extendable;
|
import com.sun.syndication.feed.module.Extendable;
|
||||||
|
import com.sun.syndication.feed.module.Module;
|
||||||
import com.sun.syndication.io.WireFeedParser;
|
import com.sun.syndication.io.WireFeedParser;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -60,21 +61,21 @@ public abstract class BaseWireFeedParser implements WireFeedParser {
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List parseFeedModules(Element feedElement) {
|
protected List<Module> parseFeedModules(Element feedElement) {
|
||||||
return _feedModuleParsers.parseModules(feedElement);
|
return _feedModuleParsers.parseModules(feedElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List parseItemModules(Element itemElement) {
|
protected List<Module> parseItemModules(Element itemElement) {
|
||||||
return _itemModuleParsers.parseModules(itemElement);
|
return _itemModuleParsers.parseModules(itemElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List parsePersonModules(Element itemElement) {
|
protected List<Module> parsePersonModules(Element itemElement) {
|
||||||
return _personModuleParsers.parseModules(itemElement);
|
return _personModuleParsers.parseModules(itemElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List extractForeignMarkup(Element e, Extendable ext, Namespace basens) {
|
protected List<Element> extractForeignMarkup(Element e, Extendable ext, Namespace basens) {
|
||||||
ArrayList foreignMarkup = new ArrayList();
|
ArrayList<Element> foreignMarkup = new ArrayList<Element>();
|
||||||
Iterator children = e.getChildren().iterator();
|
Iterator<Element> children = e.getChildren().iterator();
|
||||||
while (children.hasNext()) {
|
while (children.hasNext()) {
|
||||||
Element elem = (Element)children.next();
|
Element elem = (Element)children.next();
|
||||||
if (
|
if (
|
||||||
|
@ -89,7 +90,7 @@ public abstract class BaseWireFeedParser implements WireFeedParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now we can detach the foreign markup elements
|
// Now we can detach the foreign markup elements
|
||||||
Iterator fm = foreignMarkup.iterator();
|
Iterator<Element> fm = foreignMarkup.iterator();
|
||||||
while (fm.hasNext()) {
|
while (fm.hasNext()) {
|
||||||
Element elem = (Element)fm.next();
|
Element elem = (Element)fm.next();
|
||||||
elem.detach();
|
elem.detach();
|
||||||
|
|
|
@ -50,10 +50,10 @@ public class DCModuleGenerator implements ModuleGenerator {
|
||||||
private static final Namespace TAXO_NS = Namespace.getNamespace("taxo", TAXO_URI);
|
private static final Namespace TAXO_NS = Namespace.getNamespace("taxo", TAXO_URI);
|
||||||
private static final Namespace RDF_NS = Namespace.getNamespace("rdf", RDF_URI);
|
private static final Namespace RDF_NS = Namespace.getNamespace("rdf", RDF_URI);
|
||||||
|
|
||||||
private static final Set NAMESPACES;
|
private static final Set<Namespace> NAMESPACES;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Set nss = new HashSet();
|
Set<Namespace> nss = new HashSet<Namespace>();
|
||||||
nss.add(DC_NS);
|
nss.add(DC_NS);
|
||||||
nss.add(TAXO_NS);
|
nss.add(TAXO_NS);
|
||||||
nss.add(RDF_NS);
|
nss.add(RDF_NS);
|
||||||
|
@ -87,7 +87,7 @@ public class DCModuleGenerator implements ModuleGenerator {
|
||||||
*
|
*
|
||||||
* @return a set with all the URIs this module generator uses.
|
* @return a set with all the URIs this module generator uses.
|
||||||
*/
|
*/
|
||||||
public final Set getNamespaces() {
|
public final Set<Namespace> getNamespaces() {
|
||||||
return NAMESPACES;
|
return NAMESPACES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class DCModuleGenerator implements ModuleGenerator {
|
||||||
if (dcModule.getCreator() != null) {
|
if (dcModule.getCreator() != null) {
|
||||||
element.addContent(generateSimpleElementList("creator", dcModule.getCreators()));
|
element.addContent(generateSimpleElementList("creator", dcModule.getCreators()));
|
||||||
}
|
}
|
||||||
List subjects = dcModule.getSubjects();
|
List<DCSubject> subjects = dcModule.getSubjects();
|
||||||
for (int i = 0; i < subjects.size(); i++) {
|
for (int i = 0; i < subjects.size(); i++) {
|
||||||
element.addContent(generateSubjectElement((DCSubject) subjects.get(i)));
|
element.addContent(generateSubjectElement((DCSubject) subjects.get(i)));
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class DCModuleGenerator implements ModuleGenerator {
|
||||||
element.addContent(generateSimpleElementList("contributor", dcModule.getContributors()));
|
element.addContent(generateSimpleElementList("contributor", dcModule.getContributors()));
|
||||||
}
|
}
|
||||||
if (dcModule.getDate() != null) {
|
if (dcModule.getDate() != null) {
|
||||||
for (Iterator i = dcModule.getDates().iterator(); i.hasNext();) {
|
for (Iterator<Date> i = dcModule.getDates().iterator(); i.hasNext();) {
|
||||||
element.addContent(generateSimpleElement("date",
|
element.addContent(generateSimpleElement("date",
|
||||||
DateParser.formatW3CDateTime((Date) i.next())));
|
DateParser.formatW3CDateTime((Date) i.next())));
|
||||||
}
|
}
|
||||||
|
@ -201,9 +201,9 @@ public class DCModuleGenerator implements ModuleGenerator {
|
||||||
* @param value the list of values for the elements.
|
* @param value the list of values for the elements.
|
||||||
* @return a list of Elements created.
|
* @return a list of Elements created.
|
||||||
*/
|
*/
|
||||||
protected final List generateSimpleElementList(String name, List value) {
|
protected final List<Element> generateSimpleElementList(String name, List<String> value) {
|
||||||
List elements = new ArrayList();
|
List<Element> elements = new ArrayList<Element>();
|
||||||
for (Iterator i = value.iterator(); i.hasNext();) {
|
for (Iterator<String> i = value.iterator(); i.hasNext();) {
|
||||||
elements.add(generateSimpleElement(name, (String) i.next()));
|
elements.add(generateSimpleElement(name, (String) i.next()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@ import com.sun.syndication.feed.module.Module;
|
||||||
import com.sun.syndication.feed.module.DCModule;
|
import com.sun.syndication.feed.module.DCModule;
|
||||||
import com.sun.syndication.feed.module.DCSubject;
|
import com.sun.syndication.feed.module.DCSubject;
|
||||||
import com.sun.syndication.io.ModuleParser;
|
import com.sun.syndication.io.ModuleParser;
|
||||||
import com.sun.syndication.io.WireFeedParser;
|
|
||||||
import org.jdom2.Attribute;
|
import org.jdom2.Attribute;
|
||||||
import org.jdom2.Element;
|
import org.jdom2.Element;
|
||||||
import org.jdom2.Namespace;
|
import org.jdom2.Namespace;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class DCModuleParser implements ModuleParser {
|
||||||
boolean foundSomething = false;
|
boolean foundSomething = false;
|
||||||
DCModule dcm = new DCModuleImpl();
|
DCModule dcm = new DCModuleImpl();
|
||||||
|
|
||||||
List eList = dcRoot.getChildren("title", getDCNamespace());
|
List<Element> eList = dcRoot.getChildren("title", getDCNamespace());
|
||||||
if (eList.size() > 0) {
|
if (eList.size() > 0) {
|
||||||
foundSomething = true;
|
foundSomething = true;
|
||||||
dcm.setTitles(parseElementList(eList));
|
dcm.setTitles(parseElementList(eList));
|
||||||
|
@ -172,15 +172,15 @@ public class DCModuleParser implements ModuleParser {
|
||||||
* @param eList the element list to parse.
|
* @param eList the element list to parse.
|
||||||
* @return a list of subjects parsed from the elements.
|
* @return a list of subjects parsed from the elements.
|
||||||
*/
|
*/
|
||||||
protected final List parseSubjects(List eList) {
|
protected final List<DCSubject> parseSubjects(List<Element> eList) {
|
||||||
List subjects = new ArrayList();
|
List<DCSubject> subjects = new ArrayList<DCSubject>();
|
||||||
for (Iterator i = eList.iterator(); i.hasNext();) {
|
for (Iterator<Element> i = eList.iterator(); i.hasNext();) {
|
||||||
Element eSubject = (Element) i.next();
|
Element eSubject = (Element) i.next();
|
||||||
Element eDesc = eSubject.getChild("Description", getRDFNamespace());
|
Element eDesc = eSubject.getChild("Description", getRDFNamespace());
|
||||||
if (eDesc != null) {
|
if (eDesc != null) {
|
||||||
String taxonomy = getTaxonomy(eDesc);
|
String taxonomy = getTaxonomy(eDesc);
|
||||||
List eValues = eDesc.getChildren("value", getRDFNamespace());
|
List<Element> eValues = eDesc.getChildren("value", getRDFNamespace());
|
||||||
for (Iterator v = eValues.iterator(); v.hasNext();) {
|
for (Iterator<Element> v = eValues.iterator(); v.hasNext();) {
|
||||||
Element eValue = (Element) v.next();
|
Element eValue = (Element) v.next();
|
||||||
DCSubject subject = new DCSubjectImpl();
|
DCSubject subject = new DCSubjectImpl();
|
||||||
subject.setTaxonomyUri(taxonomy);
|
subject.setTaxonomyUri(taxonomy);
|
||||||
|
@ -203,9 +203,9 @@ public class DCModuleParser implements ModuleParser {
|
||||||
* @param eList the list of elements to parse.
|
* @param eList the list of elements to parse.
|
||||||
* @return the list of strings
|
* @return the list of strings
|
||||||
*/
|
*/
|
||||||
protected final List parseElementList(List eList) {
|
protected final List<String> parseElementList(List<Element> eList) {
|
||||||
List values= new ArrayList();
|
List<String> values= new ArrayList<String>();
|
||||||
for (Iterator i = eList.iterator(); i.hasNext();) {
|
for (Iterator<Element> i = eList.iterator(); i.hasNext();) {
|
||||||
Element e = (Element) i.next();
|
Element e = (Element) i.next();
|
||||||
values.add(e.getText());
|
values.add(e.getText());
|
||||||
}
|
}
|
||||||
|
@ -219,9 +219,9 @@ public class DCModuleParser implements ModuleParser {
|
||||||
* @param eList the list of elements to parse.
|
* @param eList the list of elements to parse.
|
||||||
* @return the list of dates.
|
* @return the list of dates.
|
||||||
*/
|
*/
|
||||||
protected final List parseElementListDate(List eList) {
|
protected final List<Date> parseElementListDate(List<Element> eList) {
|
||||||
List values = new ArrayList();
|
List<Date> values = new ArrayList<Date>();
|
||||||
for (Iterator i = eList.iterator(); i.hasNext();) {
|
for (Iterator<Element> i = eList.iterator(); i.hasNext();) {
|
||||||
Element e = (Element) i.next();
|
Element e = (Element) i.next();
|
||||||
values.add(DateParser.parseDate(e.getText()));
|
values.add(DateParser.parseDate(e.getText()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,9 @@ public class ModuleParsers extends PluginManager {
|
||||||
return getKeys();
|
return getKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List parseModules(Element root) {
|
public List<Module> parseModules(Element root) {
|
||||||
List parsers = getPlugins();
|
List<ModuleParser> parsers = getPlugins();
|
||||||
List modules = null;
|
List<Module> modules = null;
|
||||||
for (int i=0;i<parsers.size();i++) {
|
for (int i=0;i<parsers.size();i++) {
|
||||||
ModuleParser parser = (ModuleParser) parsers.get(i);
|
ModuleParser parser = (ModuleParser) parsers.get(i);
|
||||||
String namespaceUri = parser.getNamespaceUri();
|
String namespaceUri = parser.getNamespaceUri();
|
||||||
|
@ -51,7 +51,7 @@ public class ModuleParsers extends PluginManager {
|
||||||
Module module = parser.parse(root);
|
Module module = parser.parse(root);
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
if (modules == null) {
|
if (modules == null) {
|
||||||
modules = new ArrayList();
|
modules = new ArrayList<Module>();
|
||||||
}
|
}
|
||||||
modules.add(module);
|
modules.add(module);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class ModuleParsers extends PluginManager {
|
||||||
// boolean hasElements = namespace.equals(root.getNamespace());
|
// boolean hasElements = namespace.equals(root.getNamespace());
|
||||||
|
|
||||||
if (!hasElements) {
|
if (!hasElements) {
|
||||||
List children = root.getChildren();
|
List<Element> children = root.getChildren();
|
||||||
for (int i=0;!hasElements && i < children.size();i++) {
|
for (int i=0;!hasElements && i < children.size();i++) {
|
||||||
Element child = (Element) children.get(i);
|
Element child = (Element) children.get(i);
|
||||||
hasElements = namespace.equals(child.getNamespace());
|
hasElements = namespace.equals(child.getNamespace());
|
||||||
|
|
|
@ -27,8 +27,8 @@ public class PropertiesLoader {
|
||||||
private static final String EXTRA_PLUGIN_FILE = "rome.properties";
|
private static final String EXTRA_PLUGIN_FILE = "rome.properties";
|
||||||
|
|
||||||
|
|
||||||
private static Map clMap =
|
private static Map<ClassLoader, PropertiesLoader> clMap =
|
||||||
new WeakHashMap();
|
new WeakHashMap<ClassLoader, PropertiesLoader>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,7 @@ public class PropertiesLoader {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private PropertiesLoader(String masterFileLocation,String extraFileLocation) throws IOException {
|
private PropertiesLoader(String masterFileLocation,String extraFileLocation) throws IOException {
|
||||||
List propertiesList = new ArrayList();
|
List<Properties> propertiesList = new ArrayList<Properties>();
|
||||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -82,7 +82,7 @@ public class PropertiesLoader {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
Enumeration urls = classLoader.getResources(extraFileLocation);
|
Enumeration<URL> urls = classLoader.getResources(extraFileLocation);
|
||||||
while (urls.hasMoreElements()) {
|
while (urls.hasMoreElements()) {
|
||||||
URL url = (URL) urls.nextElement();
|
URL url = (URL) urls.nextElement();
|
||||||
Properties p = new Properties();
|
Properties p = new Properties();
|
||||||
|
@ -115,7 +115,7 @@ public class PropertiesLoader {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public String[] getTokenizedProperty(String key,String separator) {
|
public String[] getTokenizedProperty(String key,String separator) {
|
||||||
List entriesList = new ArrayList();
|
List<String> entriesList = new ArrayList<String>();
|
||||||
for (int i=0;i<_properties.length;i++) {
|
for (int i=0;i<_properties.length;i++) {
|
||||||
String values = _properties[i].getProperty(key);
|
String values = _properties[i].getProperty(key);
|
||||||
if (values!=null) {
|
if (values!=null) {
|
||||||
|
@ -140,7 +140,7 @@ public class PropertiesLoader {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public String[] getProperty(String key) {
|
public String[] getProperty(String key) {
|
||||||
List entriesList = new ArrayList();
|
List<String> entriesList = new ArrayList<String>();
|
||||||
for (int i=0;i<_properties.length;i++) {
|
for (int i=0;i<_properties.length;i++) {
|
||||||
String values = _properties[i].getProperty(key);
|
String values = _properties[i].getProperty(key);
|
||||||
if (values!=null) {
|
if (values!=null) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class RSS090Generator extends BaseWireFeedGenerator {
|
||||||
addImage(channel,parent);
|
addImage(channel,parent);
|
||||||
addTextInput(channel,parent);
|
addTextInput(channel,parent);
|
||||||
addItems(channel,parent);
|
addItems(channel,parent);
|
||||||
generateForeignMarkup(parent, (List)channel.getForeignMarkup());
|
generateForeignMarkup(parent, (List<Element>)channel.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addChannel(Channel channel,Element parent) throws FeedException {
|
protected void addChannel(Channel channel,Element parent) throws FeedException {
|
||||||
|
@ -204,7 +204,7 @@ public class RSS090Generator extends BaseWireFeedGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addItems(Channel channel,Element parent) throws FeedException {
|
protected void addItems(Channel channel,Element parent) throws FeedException {
|
||||||
List items = channel.getItems();
|
List<Item> items = channel.getItems();
|
||||||
for (int i=0;i<items.size();i++) {
|
for (int i=0;i<items.size();i++) {
|
||||||
addItem((Item)items.get(i),parent, i);
|
addItem((Item)items.get(i),parent, i);
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ public class RSS090Generator extends BaseWireFeedGenerator {
|
||||||
if (link!=null) {
|
if (link!=null) {
|
||||||
eItem.addContent(generateSimpleElement("link",link));
|
eItem.addContent(generateSimpleElement("link",link));
|
||||||
}
|
}
|
||||||
generateForeignMarkup(eItem, (List)item.getForeignMarkup());
|
generateForeignMarkup(eItem, (List<Element>)item.getForeignMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Element generateSimpleElement(String name, String value) {
|
protected Element generateSimpleElement(String name, String value) {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package com.sun.syndication.io.impl;
|
package com.sun.syndication.io.impl;
|
||||||
|
|
||||||
import com.sun.syndication.feed.WireFeed;
|
import com.sun.syndication.feed.WireFeed;
|
||||||
|
import com.sun.syndication.feed.module.Module;
|
||||||
import com.sun.syndication.feed.rss.Channel;
|
import com.sun.syndication.feed.rss.Channel;
|
||||||
import com.sun.syndication.feed.rss.Image;
|
import com.sun.syndication.feed.rss.Image;
|
||||||
import com.sun.syndication.feed.rss.Item;
|
import com.sun.syndication.feed.rss.Item;
|
||||||
|
@ -57,7 +58,7 @@ public class RSS090Parser extends BaseWireFeedParser {
|
||||||
|
|
||||||
Element rssRoot = document.getRootElement();
|
Element rssRoot = document.getRootElement();
|
||||||
Namespace defaultNS = rssRoot.getNamespace();
|
Namespace defaultNS = rssRoot.getNamespace();
|
||||||
List additionalNSs = rssRoot.getAdditionalNamespaces();
|
List<Namespace> additionalNSs = rssRoot.getAdditionalNamespaces();
|
||||||
|
|
||||||
ok = defaultNS!=null && defaultNS.equals(getRDFNamespace());
|
ok = defaultNS!=null && defaultNS.equals(getRDFNamespace());
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
@ -165,9 +166,9 @@ public class RSS090Parser extends BaseWireFeedParser {
|
||||||
// effectively putting the sharing channel module inside the RSS tag
|
// effectively putting the sharing channel module inside the RSS tag
|
||||||
// and not inside the channel itself. So we also need to look for
|
// and not inside the channel itself. So we also need to look for
|
||||||
// channel modules from the root RSS element.
|
// channel modules from the root RSS element.
|
||||||
List allFeedModules = new ArrayList();
|
List<Module> allFeedModules = new ArrayList<Module>();
|
||||||
List rootModules = parseFeedModules(rssRoot);
|
List<Module> rootModules = parseFeedModules(rssRoot);
|
||||||
List channelModules = parseFeedModules(eChannel);
|
List<Module> channelModules = parseFeedModules(eChannel);
|
||||||
if (rootModules != null) {
|
if (rootModules != null) {
|
||||||
allFeedModules.addAll(rootModules);
|
allFeedModules.addAll(rootModules);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +178,7 @@ public class RSS090Parser extends BaseWireFeedParser {
|
||||||
channel.setModules(allFeedModules);
|
channel.setModules(allFeedModules);
|
||||||
channel.setItems(parseItems(rssRoot));
|
channel.setItems(parseItems(rssRoot));
|
||||||
|
|
||||||
List foreignMarkup =
|
List<Element> foreignMarkup =
|
||||||
extractForeignMarkup(eChannel, channel, getRSSNamespace());
|
extractForeignMarkup(eChannel, channel, getRSSNamespace());
|
||||||
if (foreignMarkup.size() > 0) {
|
if (foreignMarkup.size() > 0) {
|
||||||
channel.setForeignMarkup(foreignMarkup);
|
channel.setForeignMarkup(foreignMarkup);
|
||||||
|
@ -191,7 +192,7 @@ public class RSS090Parser extends BaseWireFeedParser {
|
||||||
* And RSS0.91, RSS0.02, RSS0.93, RSS0.94 and RSS2.0 have the item elements under the 'channel' element.
|
* And RSS0.91, RSS0.02, RSS0.93, RSS0.94 and RSS2.0 have the item elements under the 'channel' element.
|
||||||
* <p/>
|
* <p/>
|
||||||
*/
|
*/
|
||||||
protected List getItems(Element rssRoot) {
|
protected List<Element> getItems(Element rssRoot) {
|
||||||
return rssRoot.getChildren("item",getRSSNamespace());
|
return rssRoot.getChildren("item",getRSSNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,11 +255,11 @@ public class RSS090Parser extends BaseWireFeedParser {
|
||||||
* @param rssRoot the root element of the RSS document to parse for all items information.
|
* @param rssRoot the root element of the RSS document to parse for all items information.
|
||||||
* @return a list with all the parsed RSSItem beans.
|
* @return a list with all the parsed RSSItem beans.
|
||||||
*/
|
*/
|
||||||
protected List parseItems(Element rssRoot) {
|
protected List<Item> parseItems(Element rssRoot) {
|
||||||
Collection eItems = getItems(rssRoot);
|
Collection<Element> eItems = getItems(rssRoot);
|
||||||
|
|
||||||
List items = new ArrayList();
|
List<Item> items = new ArrayList<Item>();
|
||||||
for (Iterator i=eItems.iterator();i.hasNext();) {
|
for (Iterator<Element> i=eItems.iterator();i.hasNext();) {
|
||||||
Element eItem = (Element) i.next();
|
Element eItem = (Element) i.next();
|
||||||
items.add(parseItem(rssRoot,eItem));
|
items.add(parseItem(rssRoot,eItem));
|
||||||
}
|
}
|
||||||
|
@ -289,12 +290,12 @@ public class RSS090Parser extends BaseWireFeedParser {
|
||||||
|
|
||||||
item.setModules(parseItemModules(eItem));
|
item.setModules(parseItemModules(eItem));
|
||||||
|
|
||||||
List foreignMarkup =
|
List<Element> foreignMarkup =
|
||||||
extractForeignMarkup(eItem, item, getRSSNamespace());
|
extractForeignMarkup(eItem, item, getRSSNamespace());
|
||||||
//content:encoded elements are treated special, without a module, they have to be removed from the foreign
|
//content:encoded elements are treated special, without a module, they have to be removed from the foreign
|
||||||
//markup to avoid duplication in case of read/write. Note that this fix will break if a content module is
|
//markup to avoid duplication in case of read/write. Note that this fix will break if a content module is
|
||||||
//used
|
//used
|
||||||
Iterator iterator = foreignMarkup.iterator();
|
Iterator<Element> iterator = foreignMarkup.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Element ie = (Element)iterator.next();
|
Element ie = (Element)iterator.next();
|
||||||
if (getContentNamespace().equals(ie.getNamespace()) && ie.getName().equals("encoded")) {
|
if (getContentNamespace().equals(ie.getNamespace()) && ie.getName().equals("encoded")) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class RSS091UserlandGenerator extends RSS090Generator {
|
||||||
Element skipHours = eChannel.getChild("skipHours");
|
Element skipHours = eChannel.getChild("skipHours");
|
||||||
|
|
||||||
if (skipHours != null) {
|
if (skipHours != null) {
|
||||||
List hours = skipHours.getChildren();
|
List<Element> hours = skipHours.getChildren();
|
||||||
|
|
||||||
for (int i = 0; i < hours.size(); i++) {
|
for (int i = 0; i < hours.size(); i++) {
|
||||||
Element hour = (Element) hours.get(i);
|
Element hour = (Element) hours.get(i);
|
||||||
|
@ -154,7 +154,7 @@ public class RSS091UserlandGenerator extends RSS090Generator {
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Element generateSkipDaysElement(List days) {
|
protected Element generateSkipDaysElement(List<String> days) {
|
||||||
Element skipDaysElement = new Element("skipDays");
|
Element skipDaysElement = new Element("skipDays");
|
||||||
|
|
||||||
for (int i = 0; i < days.size(); i++) {
|
for (int i = 0; i < days.size(); i++) {
|
||||||
|
@ -164,7 +164,7 @@ public class RSS091UserlandGenerator extends RSS090Generator {
|
||||||
return skipDaysElement;
|
return skipDaysElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Element generateSkipHoursElement(List hours) {
|
protected Element generateSkipHoursElement(List<Integer> hours) {
|
||||||
Element skipHoursElement = new Element("skipHours", getFeedNamespace());
|
Element skipHoursElement = new Element("skipHours", getFeedNamespace());
|
||||||
|
|
||||||
for (int i = 0; i < hours.size(); i++) {
|
for (int i = 0; i < hours.size(); i++) {
|
||||||
|
@ -225,13 +225,13 @@ public class RSS091UserlandGenerator extends RSS090Generator {
|
||||||
eChannel.addContent(generateSimpleElement("webMaster", webMaster));
|
eChannel.addContent(generateSimpleElement("webMaster", webMaster));
|
||||||
}
|
}
|
||||||
|
|
||||||
List skipHours = channel.getSkipHours();
|
List<Integer> skipHours = channel.getSkipHours();
|
||||||
|
|
||||||
if ((skipHours != null) && (skipHours.size() > 0)) {
|
if ((skipHours != null) && (skipHours.size() > 0)) {
|
||||||
eChannel.addContent(generateSkipHoursElement(skipHours));
|
eChannel.addContent(generateSkipHoursElement(skipHours));
|
||||||
}
|
}
|
||||||
|
|
||||||
List skipDays = channel.getSkipDays();
|
List<String> skipDays = channel.getSkipDays();
|
||||||
|
|
||||||
if ((skipDays != null) && (skipDays.size() > 0)) {
|
if ((skipDays != null) && (skipDays.size() > 0)) {
|
||||||
eChannel.addContent(generateSkipDaysElement(skipDays));
|
eChannel.addContent(generateSkipDaysElement(skipDays));
|
||||||
|
|
|
@ -123,8 +123,8 @@ public class RSS091UserlandParser extends RSS090Parser {
|
||||||
}
|
}
|
||||||
e = eChannel.getChild("skipHours");
|
e = eChannel.getChild("skipHours");
|
||||||
if (e!=null) {
|
if (e!=null) {
|
||||||
List skipHours = new ArrayList();
|
List<Integer> skipHours = new ArrayList<Integer>();
|
||||||
List eHours = e.getChildren("hour",getRSSNamespace());
|
List<Element> eHours = e.getChildren("hour",getRSSNamespace());
|
||||||
for (int i=0;i<eHours.size();i++) {
|
for (int i=0;i<eHours.size();i++) {
|
||||||
Element eHour = (Element) eHours.get(i);
|
Element eHour = (Element) eHours.get(i);
|
||||||
skipHours.add(new Integer(eHour.getText().trim()));
|
skipHours.add(new Integer(eHour.getText().trim()));
|
||||||
|
@ -134,8 +134,8 @@ public class RSS091UserlandParser extends RSS090Parser {
|
||||||
|
|
||||||
e = eChannel.getChild("skipDays");
|
e = eChannel.getChild("skipDays");
|
||||||
if (e!=null) {
|
if (e!=null) {
|
||||||
List skipDays = new ArrayList();
|
List<String> skipDays = new ArrayList<String>();
|
||||||
List eDays = e.getChildren("day",getRSSNamespace());
|
List<Element> eDays = e.getChildren("day",getRSSNamespace());
|
||||||
for (int i=0;i<eDays.size();i++) {
|
for (int i=0;i<eDays.size();i++) {
|
||||||
Element eDay = (Element) eDays.get(i);
|
Element eDay = (Element) eDays.get(i);
|
||||||
skipDays.add(eDay.getText().trim());
|
skipDays.add(eDay.getText().trim());
|
||||||
|
@ -185,9 +185,10 @@ public class RSS091UserlandParser extends RSS090Parser {
|
||||||
/**
|
/**
|
||||||
* It looks for the 'item' elements under the 'channel' elemment.
|
* It looks for the 'item' elements under the 'channel' elemment.
|
||||||
*/
|
*/
|
||||||
protected List getItems(Element rssRoot) {
|
protected List<Element> getItems(Element rssRoot) {
|
||||||
Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
|
Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
|
||||||
return (eChannel!=null) ? eChannel.getChildren("item",getRSSNamespace()) : Collections.EMPTY_LIST;
|
List<Element> emptyList = Collections.emptyList();
|
||||||
|
return (eChannel!=null) ? eChannel.getChildren("item",getRSSNamespace()) : emptyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class RSS092Generator extends RSS091UserlandGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Another one to thanks DW for
|
// Another one to thanks DW for
|
||||||
protected int getNumberOfEnclosures(List enclosures) {
|
protected int getNumberOfEnclosures(List<Enclosure> enclosures) {
|
||||||
return (enclosures.size()>0) ? 1 : 0;
|
return (enclosures.size()>0) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,12 +89,12 @@ public class RSS092Generator extends RSS091UserlandGenerator {
|
||||||
eItem.addContent(generateSourceElement(source));
|
eItem.addContent(generateSourceElement(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
List enclosures = item.getEnclosures();
|
List<Enclosure> enclosures = item.getEnclosures();
|
||||||
for(int i = 0; i < getNumberOfEnclosures(enclosures); i++) {
|
for(int i = 0; i < getNumberOfEnclosures(enclosures); i++) {
|
||||||
eItem.addContent(generateEnclosure((Enclosure)enclosures.get(i)));
|
eItem.addContent(generateEnclosure((Enclosure)enclosures.get(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
List categories = item.getCategories();
|
List<Category> categories = item.getCategories();
|
||||||
for(int i = 0; i < categories.size(); i++) {
|
for(int i = 0; i < categories.size(); i++) {
|
||||||
eItem.addContent(generateCategoryElement((Category)categories.get(i)));
|
eItem.addContent(generateCategoryElement((Category)categories.get(i)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,9 @@ public class RSS092Parser extends RSS091UserlandParser {
|
||||||
|
|
||||||
// 0.92 allows one enclosure occurrence, 0.93 multiple
|
// 0.92 allows one enclosure occurrence, 0.93 multiple
|
||||||
// just saving to write some code.
|
// just saving to write some code.
|
||||||
List eEnclosures = eItem.getChildren("enclosure");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
|
List<Element> eEnclosures = eItem.getChildren("enclosure");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
|
||||||
if (eEnclosures.size()>0) {
|
if (eEnclosures.size()>0) {
|
||||||
List enclosures = new ArrayList();
|
List<Enclosure> enclosures = new ArrayList<Enclosure>();
|
||||||
for (int i=0;i<eEnclosures.size();i++) {
|
for (int i=0;i<eEnclosures.size();i++) {
|
||||||
e = (Element) eEnclosures.get(i);
|
e = (Element) eEnclosures.get(i);
|
||||||
|
|
||||||
|
@ -114,16 +114,16 @@ public class RSS092Parser extends RSS091UserlandParser {
|
||||||
item.setEnclosures(enclosures);
|
item.setEnclosures(enclosures);
|
||||||
}
|
}
|
||||||
|
|
||||||
List eCats = eItem.getChildren("category");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
|
List<Element> eCats = eItem.getChildren("category");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
|
||||||
item.setCategories(parseCategories(eCats));
|
item.setCategories(parseCategories(eCats));
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List parseCategories(List eCats) {
|
protected List<Category> parseCategories(List<Element> eCats) {
|
||||||
List cats = null;
|
List<Category> cats = null;
|
||||||
if (eCats.size()>0) {
|
if (eCats.size()>0) {
|
||||||
cats = new ArrayList();
|
cats = new ArrayList<Category>();
|
||||||
for (int i=0;i<eCats.size();i++) {
|
for (int i=0;i<eCats.size();i++) {
|
||||||
Category cat = new Category();
|
Category cat = new Category();
|
||||||
Element e = (Element) eCats.get(i);
|
Element e = (Element) eCats.get(i);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package com.sun.syndication.io.impl;
|
package com.sun.syndication.io.impl;
|
||||||
|
|
||||||
|
import com.sun.syndication.feed.rss.Enclosure;
|
||||||
import com.sun.syndication.feed.rss.Item;
|
import com.sun.syndication.feed.rss.Item;
|
||||||
import org.jdom2.Element;
|
import org.jdom2.Element;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public class RSS093Generator extends RSS092Generator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Another one to thanks DW for
|
// Another one to thanks DW for
|
||||||
protected int getNumberOfEnclosures(List enclosures) {
|
protected int getNumberOfEnclosures(List<Enclosure> enclosures) {
|
||||||
return enclosures.size();
|
return enclosures.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RSS094Parser extends RSS093Parser {
|
||||||
Channel channel = (Channel) super.parseChannel(rssRoot);
|
Channel channel = (Channel) super.parseChannel(rssRoot);
|
||||||
Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
|
Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
|
||||||
|
|
||||||
List eCats = eChannel.getChildren("category",getRSSNamespace());
|
List<Element> eCats = eChannel.getChildren("category",getRSSNamespace());
|
||||||
channel.setCategories(parseCategories(eCats));
|
channel.setCategories(parseCategories(eCats));
|
||||||
|
|
||||||
Element eTtl = eChannel.getChild("ttl",getRSSNamespace());
|
Element eTtl = eChannel.getChild("ttl",getRSSNamespace());
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class RSS10Generator extends RSS090Generator {
|
||||||
if (channel.getUri() != null) {
|
if (channel.getUri() != null) {
|
||||||
eChannel.setAttribute("about", channel.getUri(), getRDFNamespace());
|
eChannel.setAttribute("about", channel.getUri(), getRDFNamespace());
|
||||||
}
|
}
|
||||||
List items = channel.getItems();
|
List<Item> items = channel.getItems();
|
||||||
if (items.size()>0) {
|
if (items.size()>0) {
|
||||||
Element eItems = new Element("items",getFeedNamespace());
|
Element eItems = new Element("items",getFeedNamespace());
|
||||||
Element eSeq = new Element("Seq",getRDFNamespace());
|
Element eSeq = new Element("Seq",getRDFNamespace());
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class RSS10Parser extends RSS090Parser {
|
||||||
|
|
||||||
Element rssRoot = document.getRootElement();
|
Element rssRoot = document.getRootElement();
|
||||||
Namespace defaultNS = rssRoot.getNamespace();
|
Namespace defaultNS = rssRoot.getNamespace();
|
||||||
List additionalNSs = rssRoot.getAdditionalNamespaces();
|
List<Namespace> additionalNSs = rssRoot.getAdditionalNamespaces();
|
||||||
|
|
||||||
ok = defaultNS!=null && defaultNS.equals(getRDFNamespace());
|
ok = defaultNS!=null && defaultNS.equals(getRDFNamespace());
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class RSS20Generator extends RSS094Generator {
|
||||||
eChannel.addContent(generateSimpleElement("ttl", String.valueOf(ttl)));
|
eChannel.addContent(generateSimpleElement("ttl", String.valueOf(ttl)));
|
||||||
}
|
}
|
||||||
|
|
||||||
List categories = channel.getCategories();
|
List<Category> categories = channel.getCategories();
|
||||||
for(int i = 0; i < categories.size(); i++) {
|
for(int i = 0; i < categories.size(); i++) {
|
||||||
eChannel.addContent(generateCategoryElement((Category)categories.get(i)));
|
eChannel.addContent(generateCategoryElement((Category)categories.get(i)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ public class SyModuleGenerator implements ModuleGenerator {
|
||||||
private static final String SY_URI = "http://purl.org/rss/1.0/modules/syndication/";
|
private static final String SY_URI = "http://purl.org/rss/1.0/modules/syndication/";
|
||||||
private static final Namespace SY_NS = Namespace.getNamespace("sy", SY_URI);
|
private static final Namespace SY_NS = Namespace.getNamespace("sy", SY_URI);
|
||||||
|
|
||||||
private static final Set NAMESPACES;
|
private static final Set<Namespace> NAMESPACES;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Set nss = new HashSet();
|
Set<Namespace> nss = new HashSet<Namespace>();
|
||||||
nss.add(SY_NS);
|
nss.add(SY_NS);
|
||||||
NAMESPACES = Collections.unmodifiableSet(nss);
|
NAMESPACES = Collections.unmodifiableSet(nss);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class SyModuleGenerator implements ModuleGenerator {
|
||||||
*
|
*
|
||||||
* @return a set with all the URIs (JDOM Namespace elements) this module generator uses.
|
* @return a set with all the URIs (JDOM Namespace elements) this module generator uses.
|
||||||
*/
|
*/
|
||||||
public Set getNamespaces() {
|
public Set<Namespace> getNamespaces() {
|
||||||
return NAMESPACES;
|
return NAMESPACES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@ public class XmlFixerReader extends Reader {
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map CODED_ENTITIES = new HashMap();
|
private static Map<String, String> CODED_ENTITIES = new HashMap<String, String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// note: refer to Character entity references in HTML 4
|
// note: refer to Character entity references in HTML 4
|
||||||
|
|
|
@ -95,7 +95,7 @@ public abstract class SyndFeedTest extends FeedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEntries() throws Exception {
|
public void testEntries() throws Exception {
|
||||||
List entrylist = getCachedSyndFeed().getEntries();
|
List<SyndEntry> entrylist = getCachedSyndFeed().getEntries();
|
||||||
assertEquals(2, entrylist.size());
|
assertEquals(2, entrylist.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ public abstract class SyndFeedTest extends FeedTest {
|
||||||
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
|
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
|
||||||
<cloud domain="rpc.sys.com" port="80" path="/RPC2" registerProcedure="pingMe" protocol="soap"/>
|
<cloud domain="rpc.sys.com" port="80" path="/RPC2" registerProcedure="pingMe" protocol="soap"/>
|
||||||
<ttl>60</ttl>
|
<ttl>60</ttl>
|
||||||
<rating>(PICS-1.1 Òhttp://www.classify.org/safesurf/Ó l r (SS~~000 1))</rating>
|
<rating>(PICS-1.1 <EFBFBD>http://www.classify.org/safesurf/<EFBFBD> l r (SS~~000 1))</rating>
|
||||||
|
|
||||||
<skiphours>
|
<skiphours>
|
||||||
<hour>0</hour>
|
<hour>0</hour>
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class TestSyndFeedAtom03 extends SyndFeedTest {
|
||||||
|
|
||||||
|
|
||||||
protected void _testEntry(int i) throws Exception {
|
protected void _testEntry(int i) throws Exception {
|
||||||
List items = getCachedSyndFeed().getEntries();
|
List<SyndEntry> items = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
assertProperty(entry.getTitle(),"feed.entry["+i+"].title");
|
assertProperty(entry.getTitle(),"feed.entry["+i+"].title");
|
||||||
assertProperty(entry.getLink(),"feed.entry["+i+"].link^href");
|
assertProperty(entry.getLink(),"feed.entry["+i+"].link^href");
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class TestSyndFeedAtom03DCSyModules extends TestSyndFeedAtom03 {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _testEntryDCModule(int i) throws Exception {
|
protected void _testEntryDCModule(int i) throws Exception {
|
||||||
List entries = getCachedSyndFeed().getEntries();
|
List<SyndEntry> entries = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) entries.get(i);
|
SyndEntry entry = (SyndEntry) entries.get(i);
|
||||||
DCModule dc = (DCModule) entry.getModule(DCModule.URI);
|
DCModule dc = (DCModule) entry.getModule(DCModule.URI);
|
||||||
_testDCModule(dc,"feed.entry["+i+"].",true,i);
|
_testDCModule(dc,"feed.entry["+i+"].",true,i);
|
||||||
|
|
|
@ -7,8 +7,9 @@ package com.sun.syndication.unittest;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jdom2.Element;
|
||||||
|
|
||||||
import com.sun.syndication.feed.atom.Entry;
|
import com.sun.syndication.feed.atom.Entry;
|
||||||
import com.sun.syndication.feed.rss.Item;
|
|
||||||
import com.sun.syndication.feed.synd.SyndContent;
|
import com.sun.syndication.feed.synd.SyndContent;
|
||||||
import com.sun.syndication.feed.synd.SyndEnclosure;
|
import com.sun.syndication.feed.synd.SyndEnclosure;
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
import com.sun.syndication.feed.synd.SyndEntry;
|
||||||
|
@ -39,7 +40,7 @@ public class TestSyndFeedAtom10 extends TestSyndFeedAtom03 {
|
||||||
assertProperty(getCachedSyndFeed().getTitleEx().getValue(),"feed.title");
|
assertProperty(getCachedSyndFeed().getTitleEx().getValue(),"feed.title");
|
||||||
assertEquals("html", getCachedSyndFeed().getTitleEx().getType());
|
assertEquals("html", getCachedSyndFeed().getTitleEx().getType());
|
||||||
|
|
||||||
List altLinks = getCachedSyndFeed().getLinks();
|
List<SyndLink> altLinks = getCachedSyndFeed().getLinks();
|
||||||
assertEquals(3, altLinks.size());
|
assertEquals(3, altLinks.size());
|
||||||
|
|
||||||
assertEquals("http://example.com/blog", ((SyndLink)altLinks.get(0)).getHref());
|
assertEquals("http://example.com/blog", ((SyndLink)altLinks.get(0)).getHref());
|
||||||
|
@ -62,7 +63,7 @@ public class TestSyndFeedAtom10 extends TestSyndFeedAtom03 {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testForeignMarkup() throws Exception {
|
public void testForeignMarkup() throws Exception {
|
||||||
assertEquals(1, ((List)getCachedSyndFeed().getForeignMarkup()).size());
|
assertEquals(1, ((List<Element>)getCachedSyndFeed().getForeignMarkup()).size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPublishedDate() throws Exception {
|
public void testPublishedDate() throws Exception {
|
||||||
|
@ -72,7 +73,7 @@ public class TestSyndFeedAtom10 extends TestSyndFeedAtom03 {
|
||||||
|
|
||||||
|
|
||||||
protected void _testEntry(int i) throws Exception {
|
protected void _testEntry(int i) throws Exception {
|
||||||
List items = getCachedSyndFeed().getEntries();
|
List<SyndEntry> items = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
|
|
||||||
assertProperty(entry.getTitle(),"feed.entry["+i+"].title");
|
assertProperty(entry.getTitle(),"feed.entry["+i+"].title");
|
||||||
|
@ -86,10 +87,10 @@ public class TestSyndFeedAtom10 extends TestSyndFeedAtom03 {
|
||||||
assertEquals(entry.getPublishedDate(),d);
|
assertEquals(entry.getPublishedDate(),d);
|
||||||
assertProperty(entry.getDescription().getValue(),"feed.entry["+i+"].summary");
|
assertProperty(entry.getDescription().getValue(),"feed.entry["+i+"].summary");
|
||||||
assertProperty(((SyndContent)entry.getContents().get(0)).getValue(),"feed.entry["+i+"].content[0]");
|
assertProperty(((SyndContent)entry.getContents().get(0)).getValue(),"feed.entry["+i+"].content[0]");
|
||||||
assertEquals(1, ((List)entry.getForeignMarkup()).size());
|
assertEquals(1, ((List<Element>)entry.getForeignMarkup()).size());
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
List links = entry.getLinks();
|
List<SyndLink> links = entry.getLinks();
|
||||||
assertEquals(4, links.size());
|
assertEquals(4, links.size());
|
||||||
|
|
||||||
assertEquals("http://example.com/blog/entry1", ((SyndLink)links.get(0)).getHref());
|
assertEquals("http://example.com/blog/entry1", ((SyndLink)links.get(0)).getHref());
|
||||||
|
|
|
@ -4,10 +4,6 @@ import com.sun.syndication.feed.synd.SyndEntry;
|
||||||
import com.sun.syndication.feed.synd.SyndFeed;
|
import com.sun.syndication.feed.synd.SyndFeed;
|
||||||
import com.sun.syndication.io.impl.Atom10Parser;
|
import com.sun.syndication.io.impl.Atom10Parser;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TestSyndFeedAtom10Bray extends FeedTest {
|
public class TestSyndFeedAtom10Bray extends FeedTest {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
|
|
|
@ -4,8 +4,6 @@ import com.sun.syndication.feed.synd.SyndEntry;
|
||||||
import com.sun.syndication.feed.synd.SyndFeed;
|
import com.sun.syndication.feed.synd.SyndFeed;
|
||||||
import com.sun.syndication.io.impl.Atom10Parser;
|
import com.sun.syndication.io.impl.Atom10Parser;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TestSyndFeedAtom10b extends FeedTest {
|
public class TestSyndFeedAtom10b extends FeedTest {
|
||||||
|
@ -26,9 +24,8 @@ public class TestSyndFeedAtom10b extends FeedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testXmlBaseConformance() throws Exception {
|
public void testXmlBaseConformance() throws Exception {
|
||||||
List errors = new ArrayList();
|
|
||||||
SyndFeed feed = getSyndFeed(false);
|
SyndFeed feed = getSyndFeed(false);
|
||||||
List entries = feed.getEntries();
|
List<SyndEntry> entries = feed.getEntries();
|
||||||
for (int index = 0; index < entries.size(); index++) {
|
for (int index = 0; index < entries.size(); index++) {
|
||||||
SyndEntry entry = (SyndEntry) entries.get(index);
|
SyndEntry entry = (SyndEntry) entries.get(index);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
package com.sun.syndication.unittest;
|
package com.sun.syndication.unittest;
|
||||||
|
|
||||||
import com.sun.syndication.feed.synd.SyndLink;
|
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
|
||||||
import com.sun.syndication.feed.synd.SyndEnclosure;
|
|
||||||
import com.sun.syndication.feed.synd.SyndContent;
|
|
||||||
import com.sun.syndication.feed.atom.Feed;
|
import com.sun.syndication.feed.atom.Feed;
|
||||||
import com.sun.syndication.feed.atom.Link;
|
import com.sun.syndication.feed.atom.Link;
|
||||||
import com.sun.syndication.io.impl.DateParser;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class TestSyndFeedAtom10prefix extends FeedTest {
|
public class TestSyndFeedAtom10prefix extends FeedTest {
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class TestSyndFeedRSS090 extends SyndFeedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _testItem(int i) throws Exception {
|
protected void _testItem(int i) throws Exception {
|
||||||
List items = getCachedSyndFeed().getEntries();
|
List<SyndEntry> items = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
assertProperty(entry.getTitle(),"item["+i+"].title");
|
assertProperty(entry.getTitle(),"item["+i+"].title");
|
||||||
assertProperty(entry.getLink(),"item["+i+"].link");
|
assertProperty(entry.getLink(),"item["+i+"].link");
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class TestSyndFeedRSS091N extends SyndFeedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _testItem(int i) throws Exception {
|
protected void _testItem(int i) throws Exception {
|
||||||
List items = getCachedSyndFeed().getEntries();
|
List<SyndEntry> items = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
assertProperty(entry.getTitle(),"channel.item["+i+"].title");
|
assertProperty(entry.getTitle(),"channel.item["+i+"].title");
|
||||||
assertProperty(entry.getLink(),"channel.item["+i+"].link");
|
assertProperty(entry.getLink(),"channel.item["+i+"].link");
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class TestSyndFeedRSS092 extends TestSyndFeedRSS091N {
|
||||||
|
|
||||||
protected void _testItem(int i) throws Exception {
|
protected void _testItem(int i) throws Exception {
|
||||||
super._testItem(i);
|
super._testItem(i);
|
||||||
List items = getCachedSyndFeed().getEntries();
|
List<SyndEntry> items = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
|
|
||||||
assertProperty(entry.getTitle(),"channel.item["+i+"].title");
|
assertProperty(entry.getTitle(),"channel.item["+i+"].title");
|
||||||
|
@ -42,9 +42,9 @@ public class TestSyndFeedRSS092 extends TestSyndFeedRSS091N {
|
||||||
_testEnclosures(entry.getEnclosures(),"channel.item["+i+"]");
|
_testEnclosures(entry.getEnclosures(),"channel.item["+i+"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _testCategories(List cats,String prefix) throws Exception {
|
protected void _testCategories(List<SyndCategory> cats,String prefix) throws Exception {
|
||||||
Set s1 = new HashSet();
|
Set<String> s1 = new HashSet<String>();
|
||||||
Set s2 = new HashSet();
|
Set<String> s2 = new HashSet<String>();
|
||||||
for (int i=0;i<cats.size();i++) {
|
for (int i=0;i<cats.size();i++) {
|
||||||
SyndCategory cat = (SyndCategory) cats.get(i);
|
SyndCategory cat = (SyndCategory) cats.get(i);
|
||||||
s1.add(cat.getTaxonomyUri()+" "+cat.getName());
|
s1.add(cat.getTaxonomyUri()+" "+cat.getName());
|
||||||
|
@ -53,9 +53,9 @@ public class TestSyndFeedRSS092 extends TestSyndFeedRSS091N {
|
||||||
assertTrue(s1.equals(s2));
|
assertTrue(s1.equals(s2));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _testEnclosures(List encs,String prefix) throws Exception {
|
protected void _testEnclosures(List<SyndEnclosure> encs,String prefix) throws Exception {
|
||||||
Set s1 = new HashSet();
|
Set<String> s1 = new HashSet<String>();
|
||||||
Set s2 = new HashSet();
|
Set<String> s2 = new HashSet<String>();
|
||||||
for (int i=0;i<encs.size();i++) {
|
for (int i=0;i<encs.size();i++) {
|
||||||
SyndEnclosure enc = (SyndEnclosure) encs.get(i);
|
SyndEnclosure enc = (SyndEnclosure) encs.get(i);
|
||||||
s1.add(enc.getUrl()+" "+enc.getType()+" "+enc.getLength());
|
s1.add(enc.getUrl()+" "+enc.getType()+" "+enc.getLength());
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
package com.sun.syndication.unittest;
|
package com.sun.syndication.unittest;
|
||||||
|
|
||||||
import com.sun.syndication.feed.synd.SyndCategory;
|
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
|
||||||
import com.sun.syndication.feed.synd.SyndEnclosure;
|
import com.sun.syndication.feed.synd.SyndEnclosure;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -19,9 +17,9 @@ public class TestSyndFeedRSS092Alt extends TestSyndFeedRSS092 {
|
||||||
super(feedType,feedFileName);
|
super(feedType,feedFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _testEnclosures(List encs,String prefix) throws Exception {
|
protected void _testEnclosures(List<SyndEnclosure> encs,String prefix) throws Exception {
|
||||||
Set s1 = new HashSet();
|
Set<String> s1 = new HashSet<String>();
|
||||||
Set s2 = new HashSet();
|
Set<String> s2 = new HashSet<String>();
|
||||||
for (int i=0;i<encs.size();i++) {
|
for (int i=0;i<encs.size();i++) {
|
||||||
SyndEnclosure enc = (SyndEnclosure) encs.get(i);
|
SyndEnclosure enc = (SyndEnclosure) encs.get(i);
|
||||||
s1.add(enc.getUrl()+" "+enc.getType()+" "+enc.getLength());
|
s1.add(enc.getUrl()+" "+enc.getType()+" "+enc.getLength());
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class TestSyndFeedRSS093 extends TestSyndFeedRSS092 {
|
||||||
|
|
||||||
protected void _testItem(int i) throws Exception {
|
protected void _testItem(int i) throws Exception {
|
||||||
super._testItem(i);
|
super._testItem(i);
|
||||||
List items = getCachedSyndFeed().getEntries();
|
List<SyndEntry> items = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
Date d = DateParser.parseRFC822("Mon, 0"+(i+1)+" Jan 2001 00:00:00 GMT");
|
Date d = DateParser.parseRFC822("Mon, 0"+(i+1)+" Jan 2001 00:00:00 GMT");
|
||||||
assertEquals(entry.getPublishedDate(),d);
|
assertEquals(entry.getPublishedDate(),d);
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class TestSyndFeedRSS094 extends TestSyndFeedRSS093 {
|
||||||
protected void _testItem(int i) throws Exception {
|
protected void _testItem(int i) throws Exception {
|
||||||
super._testItem(i);
|
super._testItem(i);
|
||||||
|
|
||||||
List items = getCachedSyndFeed()
|
List<SyndEntry> items = getCachedSyndFeed()
|
||||||
.getEntries();
|
.getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class TestSyndFeedRSS10 extends TestSyndFeedRSS090 {
|
||||||
|
|
||||||
protected void _testItem(int i) throws Exception {
|
protected void _testItem(int i) throws Exception {
|
||||||
super._testItem(i);
|
super._testItem(i);
|
||||||
List items = getCachedSyndFeed().getEntries();
|
List<SyndEntry> items = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
assertProperty(entry.getDescription().getValue(),"item["+i+"].description");
|
assertProperty(entry.getDescription().getValue(),"item["+i+"].description");
|
||||||
assertProperty(((SyndContent)entry.getContents().get(0)).getValue(), "item["+i+"].content");
|
assertProperty(((SyndContent)entry.getContents().get(0)).getValue(), "item["+i+"].content");
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class TestSyndFeedRSS10DCMulti extends TestSyndFeedRSS10 {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _testItemDCModule(int i) throws Exception {
|
protected void _testItemDCModule(int i) throws Exception {
|
||||||
List entries = getCachedSyndFeed().getEntries();
|
List<SyndEntry> entries = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) entries.get(i);
|
SyndEntry entry = (SyndEntry) entries.get(i);
|
||||||
DCModule dc = (DCModule) entry.getModule(DCModule.URI);
|
DCModule dc = (DCModule) entry.getModule(DCModule.URI);
|
||||||
_testDCModule(dc, "item[" + i + "].");
|
_testDCModule(dc, "item[" + i + "].");
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class TestSyndFeedRSS10DCSyModules extends TestSyndFeedRSS10 {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _testItemDCModule(int i) throws Exception {
|
protected void _testItemDCModule(int i) throws Exception {
|
||||||
List entries = getCachedSyndFeed().getEntries();
|
List<SyndEntry> entries = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) entries.get(i);
|
SyndEntry entry = (SyndEntry) entries.get(i);
|
||||||
DCModule dc = (DCModule) entry.getModule(DCModule.URI);
|
DCModule dc = (DCModule) entry.getModule(DCModule.URI);
|
||||||
_testDCModule(dc,"item["+i+"].");
|
_testDCModule(dc,"item["+i+"].");
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class TestSyndFeedRSS20 extends TestSyndFeedRSS094 {
|
||||||
|
|
||||||
protected void _testItem(int i) throws Exception {
|
protected void _testItem(int i) throws Exception {
|
||||||
super._testItem(i);
|
super._testItem(i);
|
||||||
List items = getCachedSyndFeed().getEntries();
|
List<SyndEntry> items = getCachedSyndFeed().getEntries();
|
||||||
SyndEntry entry = (SyndEntry) items.get(i);
|
SyndEntry entry = (SyndEntry) items.get(i);
|
||||||
assertProperty(((SyndContent)entry.getContents().get(0)).getValue(), "channel.item["+i+"].content");
|
assertProperty(((SyndContent)entry.getContents().get(0)).getValue(), "channel.item["+i+"].content");
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ public class TestXmlReader extends TestCase {
|
||||||
private static final int[] UTF_16LE_BOM_BYTES = {0xFF,0XFE};
|
private static final int[] UTF_16LE_BOM_BYTES = {0xFF,0XFE};
|
||||||
private static final int[] UTF_8_BOM_BYTES = {0xEF,0xBB,0xBF};
|
private static final int[] UTF_8_BOM_BYTES = {0xEF,0xBB,0xBF};
|
||||||
|
|
||||||
private static final Map BOMs = new HashMap();
|
private static final Map<String, int[]> BOMs = new HashMap<String, int[]>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BOMs.put("no-bom",NO_BOM_BYTES);
|
BOMs.put("no-bom",NO_BOM_BYTES);
|
||||||
|
@ -271,7 +271,7 @@ public class TestXmlReader extends TestCase {
|
||||||
private static final MessageFormat INFO = new MessageFormat(
|
private static final MessageFormat INFO = new MessageFormat(
|
||||||
"\nBOM : {0}\nDoc : {1}\nStream Enc : {2}\nProlog Enc : {3}\n");
|
"\nBOM : {0}\nDoc : {1}\nStream Enc : {2}\nProlog Enc : {3}\n");
|
||||||
|
|
||||||
private static final Map XMLs = new HashMap();
|
private static final Map<String, MessageFormat> XMLs = new HashMap<String, MessageFormat>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
XMLs.put(XML1, XML);
|
XMLs.put(XML1, XML);
|
||||||
|
|
Loading…
Reference in a new issue