|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.gdata.data.AbstractExtension
com.google.gdata.data.ExtensionPoint
com.google.gdata.data.BaseEntry<E>
E - the entry type associated with the bound subtype.public abstract class BaseEntry<E extends BaseEntry>
The BaseEntry class is an abstract base class that defines the in-memory object model for GData entries.
It is capable of parsing the Atom XML for an <atom:entry>
element as well as any contained Extension elements. It can generate
both Atom and RSS 2.0 representations of the entry from the object
model.
The BaseEntry class implements the Kind.Adaptable interface, meaning
it is possible to create new Kind.Adaptor subtypes that defines
a custom extension model (and associated convience APIs) for a BaseEntry
subtypes that use Atom/RSS extensions to extend the content model for a
particular type of data.
An Kind.Adaptor subclass of BaseEntry should do the following:
Kind.Term annotation on the class declaration that
defines the Category term value for the GData kind handled by the
adaptor.Kind.Adaptor.declareExtensions(ExtensionProfile)
method and use it to declare the extension model for the adapted instance
within the profile passed as a parameter. This is used to auto-extend
an extension profile when kind Category tags are found during parsing of
content.ExtensionPoint methods to
store/retrieve the extension data.
atomEntry =
element atom:entry {
atomCommonAttributes,
(atomAuthor*
& atomCategory*
& atomContent?
& atomContributor*
& atomId
& atomLink*
& atomPublished?
& atomRights?
& atomSource?
& atomSummary?
& atomTitle
& atomUpdated
& extensionElement*)
Kind.Adaptor,
Kind.Adaptable| Nested Class Summary | |
|---|---|
class |
BaseEntry.AtomHandler
<atom:entry> parser. |
protected static class |
BaseEntry.EntryState
The EntryState class provides a simple structure that encapsulates the attributes of an Atom entry that should be shared with a shallow copy if the entry is adapted to a more specific BaseEntry Kind.Adaptor subtypes. |
| Nested classes/interfaces inherited from class com.google.gdata.data.ExtensionPoint |
|---|
ExtensionPoint.CumulativeBlobHandler, ExtensionPoint.ExtensionHandler |
| Nested classes/interfaces inherited from class com.google.gdata.data.AbstractExtension |
|---|
AbstractExtension.AttributesHandler |
| Field Summary | |
|---|---|
protected BaseEntry.EntryState |
state
Basic state for this entry. |
| Fields inherited from class com.google.gdata.data.ExtensionPoint |
|---|
xmlBlob |
| Fields inherited from class com.google.gdata.data.AbstractExtension |
|---|
localName, namespace |
| Constructor Summary | |
|---|---|
protected |
BaseEntry()
Constructs a new BaseEntry instance. |
protected |
BaseEntry(BaseEntry sourceEntry)
Copy constructor that initializes a new BaseEntry instance to have identical contents to another instance, using a shared reference to the same BaseEntry.EntryState. |
| Method Summary | ||
|---|---|---|
void |
addAdaptor(Kind.Adaptor adaptor)
Associates a new Kind.Adaptor with this Adaptable instance. |
|
void |
addHtmlLink(java.lang.String htmlUri,
java.lang.String lang,
java.lang.String title)
Adds a link pointing to an HTML representation. |
|
void |
delete()
Deletes this entry by sending a request to the associated GData service. |
|
void |
generateAtom(com.google.gdata.util.common.xml.XmlWriter w,
ExtensionProfile extProfile)
Generates XML in the Atom format. |
|
void |
generateRss(com.google.gdata.util.common.xml.XmlWriter w,
ExtensionProfile extProfile)
Generates XML in the RSS format. |
|
BaseEntry<?> |
getAdaptedEntry()
Locates and returns the most specific Kind.Adaptor BaseEntry
subtype for this entry. |
|
|
getAdaptor(java.lang.Class<A> adaptorClass)
Returns a Kind.Adaptor instance associated with this
Adaptable instance of the specified type, or {code null}
if none is available.. |
|
java.util.Collection<Kind.Adaptor> |
getAdaptors()
Returns the collection of Kind.Adaptor instances associated with the
this Adaptable instance. |
|
java.util.List<Person> |
getAuthors()
|
|
boolean |
getCanEdit()
|
|
java.util.Set<Category> |
getCategories()
|
|
Content |
getContent()
|
|
protected Content.ChildHandlerInfo |
getContentHandlerInfo(org.xml.sax.Attributes attrs)
Returns information about the content element processing. |
|
java.util.List<Person> |
getContributors()
|
|
DateTime |
getEdited()
|
|
Link |
getEditLink()
Retrieves the resource edit link. |
|
java.lang.String |
getEtag()
|
|
Link |
getHtmlLink()
Retrieves the first HTML link. |
|
java.lang.String |
getId()
|
|
Link |
getLink(java.lang.String rel,
java.lang.String type)
Retrieves the first link with the supplied rel and/or
type value. |
|
java.util.List<Link> |
getLinks()
|
|
java.util.List<Link> |
getLinks(java.lang.String relToMatch,
java.lang.String typeToMatch)
Return the links that match the given rel and type values. |
|
Link |
getMediaEditLink()
Retrieves the media resource edit link. |
|
java.lang.String |
getPlainTextContent()
Assumes the |
|
PubControl |
getPubControl()
Gets the app:control tag. |
|
DateTime |
getPublished()
|
|
TextConstruct |
getRights()
|
|
E |
getSelf()
Retrieves the current version of this Entry by requesting it from the associated GData service. |
|
Link |
getSelfLink()
Retrieves the resource access link. |
|
Service |
getService()
|
|
Source |
getSource()
|
|
TextConstruct |
getSummary()
|
|
TextContent |
getTextContent()
Assumes the content element's contents are text and returns them as a TextContent. |
|
TextConstruct |
getTitle()
|
|
DateTime |
getUpdated()
|
|
java.lang.String |
getVersionId()
|
|
boolean |
isDraft()
Draft status. |
|
void |
parseAtom(ExtensionProfile extProfile,
java.io.InputStream input)
Parses XML in the Atom format. |
|
void |
parseAtom(ExtensionProfile extProfile,
java.io.Reader reader)
Parses XML in the Atom format. |
|
void |
parseAtom(ExtensionProfile extProfile,
XmlParser parser)
Parses XML in the Atom format from a parser-defined content source. |
|
static BaseEntry |
readEntry(ParseSource source)
Reads an entry representation from the provided ParseSource. |
|
static
|
readEntry(ParseSource source,
java.lang.Class<T> entryClass,
ExtensionProfile extProfile)
|
|
void |
removeLinks(java.lang.String relToMatch,
java.lang.String typeToMatch)
Remove all links that match the given rel and type values. |
|
void |
setCanEdit(boolean v)
|
|
void |
setContent(Content v)
|
|
void |
setContent(TextConstruct tc)
|
|
void |
setDraft(java.lang.Boolean v)
Set draft status. |
|
void |
setEdited(DateTime v)
|
|
void |
setEtag(java.lang.String v)
|
|
void |
setId(java.lang.String v)
|
|
void |
setPubControl(PubControl value)
Sets the app:control tag, which usually contains app:draft. |
|
void |
setPublished(DateTime v)
|
|
void |
setRights(TextConstruct v)
|
|
void |
setService(Service s)
|
|
void |
setSource(Source v)
|
|
void |
setSummary(TextConstruct v)
|
|
void |
setTitle(TextConstruct v)
|
|
void |
setUpdated(DateTime v)
|
|
void |
setVersionId(java.lang.String v)
|
|
E |
update()
Updates this entry by sending the current representation to the associated GData service. |
|
protected void |
visitChildren(ExtensionVisitor ev)
Called to visit all children of this extension point. |
|
| Methods inherited from class com.google.gdata.data.AbstractExtension |
|---|
consumeAttributes, eq, generate, isImmutable, putAttributes, sameClassAs, setImmutable, throwExceptionForMissingAttribute, throwExceptionIfImmutable, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.google.gdata.data.Kind.Adaptor |
|---|
declareExtensions |
| Field Detail |
|---|
protected BaseEntry.EntryState state
| Constructor Detail |
|---|
protected BaseEntry()
protected BaseEntry(BaseEntry sourceEntry)
BaseEntry.EntryState. Kind.Adaptor subclasses
of BaseEntry can use this constructor to create adaptor
instances of an entry that share state with the original.
| Method Detail |
|---|
public java.lang.String getId()
public void setId(java.lang.String v)
public java.lang.String getVersionId()
public void setVersionId(java.lang.String v)
public java.lang.String getEtag()
public void setEtag(java.lang.String v)
public DateTime getPublished()
public void setPublished(DateTime v)
public DateTime getUpdated()
public void setUpdated(DateTime v)
public DateTime getEdited()
public void setEdited(DateTime v)
public java.util.Set<Category> getCategories()
public TextConstruct getTitle()
public void setTitle(TextConstruct v)
public TextConstruct getSummary()
public void setSummary(TextConstruct v)
public TextConstruct getRights()
public void setRights(TextConstruct v)
public Content getContent()
public void setContent(Content v)
public TextContent getTextContent()
java.lang.IllegalStateException - If the content element is not a text type.public java.lang.String getPlainTextContent()
java.lang.IllegalStateException - If the content element is not a text type.public void setContent(TextConstruct tc)
public java.util.List<Link> getLinks()
public java.util.List<Person> getAuthors()
public java.util.List<Person> getContributors()
public Source getSource()
public void setSource(Source v)
public void setDraft(java.lang.Boolean v)
v - Draft status, or null to unset.public boolean isDraft()
public PubControl getPubControl()
public void setPubControl(PubControl value)
value - PubControl the new object or nullpublic void setService(Service s)
public Service getService()
public boolean getCanEdit()
public void setCanEdit(boolean v)
public void addAdaptor(Kind.Adaptor adaptor)
Kind.AdaptableKind.Adaptor with this Adaptable instance.
addAdaptor in interface Kind.Adaptablepublic java.util.Collection<Kind.Adaptor> getAdaptors()
Kind.AdaptableKind.Adaptor instances associated with the
this Adaptable instance.
getAdaptors in interface Kind.Adaptablepublic <A extends Kind.Adaptor> A getAdaptor(java.lang.Class<A> adaptorClass)
Kind.AdaptableKind.Adaptor instance associated with this
Adaptable instance of the specified type, or {code null}
if none is available..
getAdaptor in interface Kind.Adaptable
public Link getLink(java.lang.String rel,
java.lang.String type)
rel and/or
type value.
If either parameter is null, doesn't return matches
for that parameter.
public java.util.List<Link> getLinks(java.lang.String relToMatch,
java.lang.String typeToMatch)
rel and type values.
relToMatch - rel value to match or null to match any
rel value.typeToMatch - type value to match or null to match any
type value.
public void removeLinks(java.lang.String relToMatch,
java.lang.String typeToMatch)
rel and type values.
relToMatch - rel value to match or null to match any
rel value.typeToMatch - type value to match or null to match any
type value.
public void addHtmlLink(java.lang.String htmlUri,
java.lang.String lang,
java.lang.String title)
htmlUri - Link URI.lang - Optional language code.title - Optional title.public Link getSelfLink()
public Link getEditLink()
public Link getMediaEditLink()
public Link getHtmlLink()
public E getSelf()
throws java.io.IOException,
ServiceException
java.io.IOException
ServiceException
public E update()
throws java.io.IOException,
ServiceException
ServiceException - If there is no associated GData service or the service is
unable to perform the update.
java.lang.UnsupportedOperationException - If update is not supported for the target entry.
java.io.IOException - If there is an error communicating with the GData service.
public void delete()
throws java.io.IOException,
ServiceException
ServiceException - If there is no associated GData service or the service is
unable to perform the deletion.
java.lang.UnsupportedOperationException - If deletion is not supported for the target entry.
java.io.IOException - If there is an error communicating with the GData service.
protected void visitChildren(ExtensionVisitor ev)
throws ExtensionVisitor.StoppedException
ExtensionPoint
visitChildren in class ExtensionPointev - the extension visitor.
ExtensionVisitor.StoppedException
public void generateAtom(com.google.gdata.util.common.xml.XmlWriter w,
ExtensionProfile extProfile)
throws java.io.IOException
w - Output writer.extProfile - Extension profile.
java.io.IOException
public void generateRss(com.google.gdata.util.common.xml.XmlWriter w,
ExtensionProfile extProfile)
throws java.io.IOException
w - Output writer.extProfile - Extension profile.
java.io.IOException
public static BaseEntry readEntry(ParseSource source)
throws java.io.IOException,
ParseException,
ServiceException
ParseSource.
The return type of the entry will be determined using dynamic adaptation
based upon any Kind category tag found in the input content. If
no kind tag is found an Entry instance will be returned.
java.io.IOException
ParseException
ServiceException
public static <T extends BaseEntry> T readEntry(ParseSource source,
java.lang.Class<T> entryClass,
ExtensionProfile extProfile)
throws java.io.IOException,
ParseException,
ServiceException
java.io.IOException
ParseException
ServiceException
public void parseAtom(ExtensionProfile extProfile,
java.io.InputStream input)
throws java.io.IOException,
ParseException
extProfile - Extension profile.input - XML input stream.
java.io.IOException
ParseException
public void parseAtom(ExtensionProfile extProfile,
java.io.Reader reader)
throws java.io.IOException,
ParseException
extProfile - Extension profile.reader - XML Reader. The caller is responsible for ensuring
that the character encoding is correct.
java.io.IOException
ParseException
public void parseAtom(ExtensionProfile extProfile,
XmlParser parser)
throws java.io.IOException,
ParseException
extProfile - Extension profile.parser - XML parser.
java.io.IOException
ParseException
protected Content.ChildHandlerInfo getContentHandlerInfo(org.xml.sax.Attributes attrs)
throws ParseException,
java.io.IOException
ParseException
java.io.IOException
public BaseEntry<?> getAdaptedEntry()
throws Kind.AdaptorException
Kind.Adaptor BaseEntry
subtype for this entry. If none can be found for the current class,
null will be returned.
Kind.AdaptorException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||