Methods Summary |
---|
public void | addAuthor(org.apache.lucene.gdata.gom.GOMAuthor aAuthor)
if (aAuthor != null)
this.authors.add(aAuthor);
|
public void | addCategory(org.apache.lucene.gdata.gom.GOMCategory aCategory)
if (aCategory != null)
this.categories.add(aCategory);
|
public void | addContributor(org.apache.lucene.gdata.gom.GOMContributor aContributor)
if (aContributor != null)
this.contributors.add(aContributor);
|
public void | addLink(org.apache.lucene.gdata.gom.GOMLink aLink)
if (aLink == null)
return;
this.links.add(aLink);
|
public java.util.List | getAuthors()
return this.authors;
|
public java.util.List | getCategories()
return this.categories;
|
public AtomParser | getChildParser(javax.xml.namespace.QName aName)
if (aName.getNamespaceURI().equals(GOMNamespace.ATOM_NS_URI)) {
if (aName.getLocalPart().equals(GOMId.LOCALNAME)) {
// atom:feed / atom:source elements MUST contain exactly one
// atom:id element.
if (this.id != null)
throw new GDataParseException(String.format(
AtomParser.DUPLICATE_ELEMENT, GOMId.LOCALNAME));
this.id = new GOMIdImpl();
return this.id;
}
if (aName.getLocalPart().equals(GOMTitle.LOCALNAME)) {
// atom:feed / atom:source elements MUST contain exactly one
// atom:title
// element.
if (this.title != null)
throw new GDataParseException(String.format(
AtomParser.DUPLICATE_ELEMENT, GOMTitle.LOCALNAME));
this.title = new GOMTitleImpl();
return this.title;
}
if (aName.getLocalPart().equals(GOMAuthor.LOCALNAME)) {
GOMAuthor author = new GOMAuthorImpl();
this.authors.add(author);
return author;
}
if (aName.getLocalPart().equals(GOMCategory.LOCALNAME)) {
GOMCategory category = new GOMCategoryImpl();
this.categories.add(category);
return category;
}
if (aName.getLocalPart().equals(GOMContributor.LOCALNAME)) {
GOMContributorImpl impl = new GOMContributorImpl();
this.contributors.add(impl);
return impl;
}
if (aName.getLocalPart().equals(GOMLink.LOCALNAME)) {
GOMLinkImpl impl = new GOMLinkImpl();
this.links.add(impl);
return impl;
}
if (aName.getLocalPart().equals(GOMSubtitle.LOCALNAME)) {
GOMSubtitleImpl impl = new GOMSubtitleImpl();
/*
* atom:feed elements MUST NOT contain more than one
* atom:subtitle element.
*/
if (this.subtitle != null)
throw new GDataParseException(String.format(
AtomParser.DUPLICATE_ELEMENT,
GOMSubtitle.LOCALNAME));
this.subtitle = impl;
return this.subtitle;
}
if (aName.getLocalPart().equals(GOMUpdated.LOCALNAME)) {
if (this.updated != null)
throw new GDataParseException(String.format(
AtomParser.DUPLICATE_ELEMENT,
GOMUpdated.LOCALNAME));
GOMUpdated updatedImpl = new GOMUpdatedImpl();
this.updated = updatedImpl;
return this.updated;
}
if (aName.getLocalPart().equals(GOMLogo.LOCALNAME)) {
if (this.logo != null)
throw new GDataParseException(String.format(
AtomParser.DUPLICATE_ELEMENT, GOMLogo.LOCALNAME));
this.logo = new GOMLogoImpl();
return this.logo;
}
if (aName.getLocalPart().equals(GOMIcon.LOCALNAME)) {
if (this.icon != null)
throw new GDataParseException(String.format(
AtomParser.DUPLICATE_ELEMENT, GOMIcon.LOCALNAME));
this.icon = new GOMIconImpl();
return this.icon;
}
if (aName.getLocalPart().equals(GOMGenerator.LOCALNAME)) {
if (this.generator != null)
throw new GDataParseException(String.format(
AtomParser.DUPLICATE_ELEMENT,
GOMGenerator.LOCALNAME));
this.generator = new GOMGeneratorImpl();
return this.generator;
}
if (aName.getLocalPart().equals(GOMRights.LOCALNAME)) {
if (this.rights != null)
throw new GDataParseException(String
.format(AtomParser.DUPLICATE_ELEMENT,
GOMRights.LOCALNAME));
this.rights = new GOMRightsImpl();
return this.rights;
}
}
throw new GDataParseException(String.format(
AtomParser.URECOGNIZED_ELEMENT_CHILD, this.localName, aName
.getLocalPart()));
|
public java.util.List | getContributor()
return this.contributors;
|
public org.apache.lucene.gdata.gom.GOMGenerator | getGenerator()
return this.generator;
|
public org.apache.lucene.gdata.gom.GOMIcon | getIcon()
return this.icon;
|
public org.apache.lucene.gdata.gom.GOMId | getId()
return this.id;
|
public java.util.List | getLinks()
return this.links;
|
public java.lang.String | getLocalName()
return this.localName;
|
public org.apache.lucene.gdata.gom.GOMLogo | getLogo()
return this.logo;
|
public org.apache.lucene.gdata.gom.GOMRights | getRights()
return this.rights;
|
public org.apache.lucene.gdata.gom.GOMSubtitle | getSubtitle()
return this.subtitle;
|
public org.apache.lucene.gdata.gom.GOMTitle | getTitle()
return this.title;
|
public org.apache.lucene.gdata.gom.GOMUpdated | getUpdated()
return this.updated;
|
public void | processElementValue(java.lang.String aValue)
throw new GDataParseException(String.format(
AtomParser.UNEXPECTED_ELEMENT_VALUE, this.localName));
|
public void | processEndElement()
/*
* atom:feed elements MUST contain exactly one atom:id element.
*/
if (this.id == null)
throw new GDataParseException(String.format(
MISSING_ELEMENT_CHILD, this.localName, GOMId.LOCALNAME));
/*
* atom:feed elements MUST contain exactly one atom:title element.
*/
if (this.title == null)
throw new GDataParseException(String
.format(MISSING_ELEMENT_CHILD, this.localName,
GOMTitle.LOCALNAME));
/*
* atom:feed elements MUST contain exactly one atom:updated element.
*/
if (this.updated == null)
throw new GDataParseException(String.format(
MISSING_ELEMENT_CHILD, this.localName,
GOMUpdated.LOCALNAME));
/*
* atom:feed elements MUST contain one or more atom:author elements,
* unless all of the
*/
if (this.authors.size() < 1)
throw new GDataParseException(String.format(
MISSING_ELEMENT_CHILD, this.localName,
GOMAuthor.LOCALNAME));
/*
* atom:feed elements MUST NOT contain more than one atom:link element
* with a rel attribute value of "alternate" that has the same
* combination of type and hreflang attribute values.
*/
List<GOMLink> alternateLinks = new LinkedList<GOMLink>();
for (GOMLink link : this.links) {
/*
* atom:link elements MAY have a "rel" attribute that indicates the
* link relation type. If the "rel" attribute is not present, the
* link element MUST be interpreted as if the link relation type is
* "alternate".
*/
if (link.getRel() == null
|| link.getRel().equalsIgnoreCase("alternate"))
alternateLinks.add(link);
}
/*
* atom:feed elements MUST NOT contain more than one atom:link element
* with a rel attribute value of "alternate" that has the same
* combination of type and hreflang attribute values.
*/
if (alternateLinks.size() > 1) {
for (GOMLink link : alternateLinks) {
for (GOMLink link2 : alternateLinks) {
if (link != link2)
if (AtomParserUtils.compareAlternateLinks(link, link2))
throw new GDataParseException(
String
.format(DUPLICATE_ELEMENT,
"link with rel=\"alternate\" and same href and type attributes"));
}
}
}
|
public void | setGenerator(org.apache.lucene.gdata.gom.GOMGenerator aGenerator)
this.generator = aGenerator;
|
public void | setIcon(org.apache.lucene.gdata.gom.GOMIcon aIcon)
this.icon = aIcon;
|
public void | setId(org.apache.lucene.gdata.gom.GOMId aId)
this.id = aId;
|
public void | setLogo(org.apache.lucene.gdata.gom.GOMLogo aLogo)
this.logo = aLogo;
|
public void | setRights(org.apache.lucene.gdata.gom.GOMRights aRights)
rights = aRights;
|
public void | setSubtitle(org.apache.lucene.gdata.gom.GOMSubtitle aSubtitle)
this.subtitle = aSubtitle;
|
public void | setTitle(org.apache.lucene.gdata.gom.GOMTitle aTitle)
this.title = aTitle;
|
public void | setUpdated(org.apache.lucene.gdata.gom.GOMUpdated aUpdated)
this.updated = aUpdated;
|
public void | writeAtomOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
aStreamWriter.writeStartElement(this.localName,
this.extensionAttributes);
List<GOMAttribute> xmlNamespaceAttributes = getXmlNamespaceAttributes();
for (GOMAttribute attribute : xmlNamespaceAttributes) {
aStreamWriter.writeAttribute(attribute);
}
writeInnerAtomOutput(aStreamWriter);
aStreamWriter.writeEndElement();
|
protected void | writeInnerAtomOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
if (this.id != null)
this.id.writeAtomOutput(aStreamWriter);
if (this.title != null)
this.title.writeAtomOutput(aStreamWriter);
if (this.subtitle != null)
this.subtitle.writeAtomOutput(aStreamWriter);
for (GOMAuthor authors : this.authors) {
authors.writeAtomOutput(aStreamWriter);
}
for (GOMCategory category : this.categories) {
category.writeAtomOutput(aStreamWriter);
}
for (GOMContributor contributor : this.contributors) {
contributor.writeAtomOutput(aStreamWriter);
}
for (GOMLink link : this.links) {
link.writeAtomOutput(aStreamWriter);
}
if (this.rights != null)
this.rights.writeAtomOutput(aStreamWriter);
if (this.updated != null)
this.updated.writeAtomOutput(aStreamWriter);
if (this.logo != null)
this.logo.writeAtomOutput(aStreamWriter);
if (this.icon != null)
this.icon.writeAtomOutput(aStreamWriter);
if (this.generator != null)
this.generator.writeAtomOutput(aStreamWriter);
|
public void | writeRssOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
// no rss output
|