|
|||||||||
| 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 convenience 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 |
addLink(Link link)
|
|
Link |
addLink(java.lang.String rel,
java.lang.String type,
java.lang.String href)
Adds a link with the given rel, type, and href. |
|
void |
delete()
Deletes this entry by sending a request to the associated GData service. |
|
void |
generate(com.google.gdata.util.common.xml.XmlWriter w,
ExtensionProfile p)
Generates an XML representation for the extension. |
|
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()
Returns the list of all authors on this resource. |
|
boolean |
getCanEdit()
Returns true if the entry can be modified by a client. |
|
java.util.Set<Category> |
getCategories()
Returns a set of categories on this resource. |
|
Content |
getContent()
Gets the content of this entry. |
|
protected Content.ChildHandlerInfo |
getContentHandlerInfo(ExtensionProfile extProfile,
org.xml.sax.Attributes attrs)
Returns information about the content element processing. |
|
java.util.List<Person> |
getContributors()
|
|
DateTime |
getEdited()
Get a DateTime instance representing the last time this entry was
edited. |
|
Link |
getEditLink()
Retrieves the resource edit link. |
|
java.lang.String |
getEtag()
Gets the value of the gd:etag attribute for this resource. |
|
XmlParser.ElementHandler |
getHandler(ExtensionProfile p,
java.lang.String namespace,
java.lang.String localName,
org.xml.sax.Attributes attrs)
The default implementation uses the AbstractExtension.AttributesHandler to handle
parsing the extension. |
|
Link |
getHtmlLink()
Retrieves the first HTML link. |
|
java.lang.String |
getId()
Get the unique id for this resource. |
|
java.lang.String |
getKind()
Returns the value of the gd:kind attribute for this resource. |
|
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()
Returns a list of atom:link elements on this resource. |
|
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()
Get a DateTime instance representing the time that this entry was
created. |
|
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()
Returns the atom:summary element of this entry. |
|
TextContent |
getTextContent()
Assumes the content element's contents are text and returns them as a TextContent. |
|
TextConstruct |
getTitle()
Returns the atom:title element of this resource. |
|
DateTime |
getUpdated()
Get a DateTime instance representing the last time this resource
was updated. |
|
java.lang.String |
getVersionId()
Version ID. |
|
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,
XmlEventSource eventSource)
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)
Reads an entry of type T using the given extension profile. |
|
void |
removeLinks()
Remove all links. |
|
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)
Sets whether the server allows this entry to be modified by the client. |
|
void |
setContent(Content v)
|
|
void |
setContent(TextConstruct tc)
|
|
void |
setDraft(java.lang.Boolean v)
Set draft status. |
|
void |
setEdited(DateTime v)
Set the last time this entry was edited using the app:edited element. |
|
void |
setEtag(java.lang.String v)
Sets the value of the gd:etag attribute for this resource. |
|
void |
setId(java.lang.String v)
Sets the unique id for this resource. |
|
void |
setKind(java.lang.String v)
Sets the value of the gd:kind attribute for this resource. |
|
void |
setPubControl(PubControl value)
Sets the app:control tag, which usually contains app:draft. |
|
void |
setPublished(DateTime v)
Sets the date of publishing for this entry. |
|
void |
setRights(TextConstruct v)
|
|
void |
setService(Service s)
Sets the service that this resource is being used with. |
|
void |
setSource(Source v)
|
|
void |
setSummary(TextConstruct v)
|
|
void |
setTitle(TextConstruct v)
|
|
void |
setUpdated(DateTime v)
Sets the last time this resource was updated. |
|
void |
setVersionId(java.lang.String v)
Sets the versionId. |
|
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, generateAttributes, getExtensionLocalName, getExtensionNamespace, 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()
IAtom
getId in interface IAtompublic void setId(java.lang.String v)
IAtom
setId in interface IAtompublic java.lang.String getVersionId()
IAtomThis property is only used for services to communicate the current version ID back to the servlet. It is NOT set when resources are parsed (either from requests or from arbitrary XML).
getVersionId in interface IAtompublic void setVersionId(java.lang.String v)
IAtomIAtom.getVersionId() for a description of what
the versionId is used for.
setVersionId in interface IAtompublic java.lang.String getEtag()
IAtom
getEtag in interface IAtompublic void setEtag(java.lang.String v)
IAtom
setEtag in interface IAtompublic java.lang.String getKind()
IAtomnull if the kind attribute is missing.
getKind in interface IAtompublic void setKind(java.lang.String v)
IAtomnull will remove the kind attribute.
setKind in interface IAtompublic DateTime getPublished()
IEntryDateTime instance representing the time that this entry was
created. Represents the atom:published element.
getPublished in interface IEntrypublic void setPublished(DateTime v)
IEntry
setPublished in interface IEntrypublic DateTime getUpdated()
IAtomDateTime instance representing the last time this resource
was updated. Represents the atom:updated element.
getUpdated in interface IAtompublic void setUpdated(DateTime v)
IAtom
setUpdated in interface IAtompublic DateTime getEdited()
IEntryDateTime instance representing the last time this entry was
edited. Represents the app:edited element.
getEdited in interface IEntrypublic void setEdited(DateTime v)
IEntry
setEdited in interface IEntrypublic java.util.Set<Category> getCategories()
IAtom
getCategories in interface IAtompublic TextConstruct getTitle()
IAtom
getTitle in interface IAtompublic void setTitle(TextConstruct v)
public TextConstruct getSummary()
IEntry
getSummary in interface IEntrypublic void setSummary(TextConstruct v)
public TextConstruct getRights()
public void setRights(TextConstruct v)
public Content getContent()
IEntry
getContent in interface IEntrypublic 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()
IAtom
getLinks in interface IAtompublic void addLink(Link link)
public Link addLink(java.lang.String rel,
java.lang.String type,
java.lang.String href)
IAtom
addLink in interface IAtompublic java.util.List<Person> getAuthors()
IAtom
getAuthors in interface IAtompublic 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)
IAtom
setService in interface IAtompublic Service getService()
public boolean getCanEdit()
IEntrytrue if the entry can be modified by a client.
getCanEdit in interface IEntrypublic void setCanEdit(boolean v)
IEntry
setCanEdit in interface IEntrypublic 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.
getLink in interface IAtom
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.
removeLinks in interface IAtomrelToMatch - 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()
removeLinks in interface IAtom
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()
getSelfLink in interface IAtompublic Link getEditLink()
getEditLink in interface IEntrypublic Link getMediaEditLink()
getMediaEditLink in interface IEntrypublic 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 generate(com.google.gdata.util.common.xml.XmlWriter w,
ExtensionProfile p)
throws java.io.IOException
Extension
generate in interface Extensiongenerate in class AbstractExtensionw - XML writerp - extension profile
java.io.IOException
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
T using the given extension profile.
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,
XmlEventSource eventSource)
throws java.io.IOException,
ParseException
extProfile - Extension profile.eventSource - XML event source.
java.io.IOException
ParseException
protected Content.ChildHandlerInfo getContentHandlerInfo(ExtensionProfile extProfile,
org.xml.sax.Attributes attrs)
throws ParseException,
java.io.IOException
ParseException
java.io.IOException
public XmlParser.ElementHandler getHandler(ExtensionProfile p,
java.lang.String namespace,
java.lang.String localName,
org.xml.sax.Attributes attrs)
AbstractExtensionAbstractExtension.AttributesHandler to handle
parsing the extension.
getHandler in interface ExtensiongetHandler in class ExtensionPointp - extension profilenamespace - extension namespacelocalName - tag name, without the namespace prefixattrs - tag attributes
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 - for subclasses to throw.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||