|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.model.Element
com.google.gdata.model.atom.Entry
public class Entry
The Entry class is a base class that defines the in-memory object model for GData entries.
Entry subclasses should expose convenience APIs to retrieve and set
attributes or subelements, with implementations that delegate to
Element
methods to store/retrieve the appropriate data.
Here is the Relax-NG schema that represents an Atom 1.0 entry:
atomEntry = element atom:entry { atomCommonAttributes, (atomAuthor* & atomCategory* & atomContent? & atomContributor* & atomId & atomLink* & atomPublished? & atomRights? & atomSource? & atomSummary? & atomTitle & atomUpdated & extensionElement*)
Nested Class Summary | |
---|---|
protected static class |
Entry.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 Entry subtype. |
Field Summary | |
---|---|
static ElementKey<java.lang.String,Element> |
ID
The atom:id child element |
static ElementKey<java.lang.Void,Entry> |
KEY
The key for this element. |
static ElementKey<DateTime,Element> |
PUBLISHED
The atom:published child element |
static ElementKey<java.lang.String,TextContent> |
RIGHTS
The atom:rights child element |
protected Entry.EntryState |
state
Basic state for this entry. |
static ElementKey<java.lang.String,TextContent> |
SUMMARY
The atom:summary child element. |
static ElementKey<java.lang.String,TextContent> |
TITLE
The atom:title child element |
static ElementKey<DateTime,Element> |
UPDATED
The atom:updated child element |
Constructor Summary | |
---|---|
|
Entry()
Constructs a new Entry instance, using default metadata. |
protected |
Entry(ElementKey<?,? extends Entry> key)
Constructs a new Entry instance, using the given key. |
protected |
Entry(ElementKey<?,? extends Entry> key,
Entry source)
Copy constructor that initializes a new Entry instance to have identical contents to another instance, using a shared reference to the same Entry.EntryState . |
Method Summary | |
---|---|
void |
addAuthor(Person v)
|
void |
addCategory(Category v)
|
void |
addContributor(Person v)
|
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 v)
|
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 |
clearAuthors()
|
void |
clearCategories()
|
void |
clearContributors()
|
void |
delete()
Deletes this entry by sending a request to the associated GData service. |
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. |
java.util.List<Person> |
getContributors()
|
Control |
getControl()
Gets the app:control tag. |
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()
Returns the GdAttributes.ETAG value for this feed. |
Link |
getHtmlLink()
Retrieves the first HTML link. |
java.lang.String |
getId()
Get the unique id for this resource. |
java.lang.String |
getKind()
Returns the GdAttributes.KIND value for this entry. |
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 |
DateTime |
getPublished()
Get a DateTime instance representing the time that this entry was
created. |
Link |
getResumableEditMediaLink()
Retrieves the media resource resumable edit link. |
TextContent |
getRights()
|
java.lang.String |
getSelectedFields()
Returns the GdAttributes.FIELDS value for this entry. |
Entry |
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()
|
TextContent |
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. |
TextContent |
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 |
hasControl()
Returns whether it has the Atom publication control status. |
boolean |
isDraft()
Draft status. |
protected Element |
narrow(ElementMetadata<?,?> metadata,
ValidationContext vc)
Narrows this entry using categories with an appropriate kind value. |
static void |
registerMetadata(MetadataRegistry registry)
Registers the metadata for this element. |
boolean |
removeAuthor(Person v)
|
void |
removeContent()
Removes any content element. |
boolean |
removeContributor(Person v)
|
boolean |
removeLink(Link link)
|
void |
removeLinks()
Removes all links from the this resource. |
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)
|
Entry |
setControl(Control value)
Sets the app:control tag, which usually contains app:draft. |
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 GdAttributes.ETAG value for this entry. |
void |
setId(java.lang.String v)
Sets the unique id for this resource. |
void |
setKind(java.lang.String v)
Sets the GdAttributes.KIND value for this entry. |
void |
setPublished(DateTime v)
Sets the date of publishing for this entry. |
void |
setRights(TextContent v)
|
void |
setSelectedFields(java.lang.String v)
Sets the GdAttributes.FIELDS value for this entry. |
void |
setService(Service s)
Sets the service that this resource is being used with. |
void |
setSource(Source v)
|
void |
setSummary(TextContent v)
|
void |
setTitle(TextContent v)
|
void |
setUpdated(DateTime v)
Sets the last time this resource was updated. |
void |
setVersionId(java.lang.String v)
Sets the versionId. |
Entry |
update()
Updates this entry by sending the current representation to the associated GData service. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ElementKey<java.lang.Void,Entry> KEY
public static final ElementKey<java.lang.String,Element> ID
public static final ElementKey<DateTime,Element> UPDATED
public static final ElementKey<DateTime,Element> PUBLISHED
public static final ElementKey<java.lang.String,TextContent> TITLE
public static final ElementKey<java.lang.String,TextContent> RIGHTS
public static final ElementKey<java.lang.String,TextContent> SUMMARY
protected Entry.EntryState state
Constructor Detail |
---|
public Entry()
protected Entry(ElementKey<?,? extends Entry> key)
protected Entry(ElementKey<?,? extends Entry> key, Entry source)
Entry.EntryState
. Subclasses of Entry
can use this constructor to
create adaptor instances of an entry that share state with the original.
key
- the element key to use for this entry.source
- to copy data fromMethod Detail |
---|
public static void registerMetadata(MetadataRegistry registry)
public java.lang.String getId()
IAtom
getId
in interface IAtom
public void setId(java.lang.String v)
IAtom
setId
in interface IAtom
public java.lang.String getVersionId()
IAtom
This 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 IAtom
public void setVersionId(java.lang.String v)
IAtom
IAtom.getVersionId()
for a description of what
the versionId is used for.
setVersionId
in interface IAtom
public java.lang.String getEtag()
GdAttributes.ETAG
value for this feed. A value of
null
indicates the value is unknown.
getEtag
in interface IAtom
public void setEtag(java.lang.String v)
GdAttributes.ETAG
value for this entry. A value of null
indicates the value is unknown.
setEtag
in interface IAtom
public java.lang.String getKind()
GdAttributes.KIND
value for this entry. The kind
attribute may be null if this feed does not have a kind.
getKind
in interface IAtom
public void setKind(java.lang.String v)
GdAttributes.KIND
value for this entry. The kind may be
set to null to remove the attribute value.
setKind
in interface IAtom
public java.lang.String getSelectedFields()
GdAttributes.FIELDS
value for this entry. The fields
attribute may be null if this entry contains a full representation.
getSelectedFields
in interface IEntry
public void setSelectedFields(java.lang.String v)
GdAttributes.FIELDS
value for this entry. The fields
attribute may be set to null to remove the attribute value.
setSelectedFields
in interface IEntry
public DateTime getPublished()
IEntry
DateTime
instance representing the time that this entry was
created. Represents the atom:published element.
getPublished
in interface IEntry
public void setPublished(DateTime v)
IEntry
setPublished
in interface IEntry
public DateTime getUpdated()
IAtom
DateTime
instance representing the last time this resource
was updated. Represents the atom:updated element.
getUpdated
in interface IAtom
public void setUpdated(DateTime v)
IAtom
setUpdated
in interface IAtom
public DateTime getEdited()
IEntry
DateTime
instance representing the last time this entry was
edited. Represents the app:edited element.
getEdited
in interface IEntry
public void setEdited(DateTime v)
IEntry
setEdited
in interface IEntry
public java.util.Set<Category> getCategories()
IAtom
getCategories
in interface IAtom
public void addCategory(Category v)
public void clearCategories()
public TextContent getTitle()
IAtom
getTitle
in interface IAtom
public void setTitle(TextContent v)
public TextContent getSummary()
IEntry
getSummary
in interface IEntry
public void setSummary(TextContent v)
public TextContent getRights()
public void setRights(TextContent v)
public Content getContent()
IEntry
getContent
in interface IEntry
public void setContent(Content v)
public void removeContent()
setContent((Content) null);
, but
without the ugly cast.
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 java.util.List<Link> getLinks()
IAtom
getLinks
in interface IAtom
public void addLink(Link v)
public Link addLink(java.lang.String rel, java.lang.String type, java.lang.String href)
IAtom
addLink
in interface IAtom
public boolean removeLink(Link link)
public void removeLinks()
IAtom
removeLinks
in interface IAtom
public java.util.List<Person> getAuthors()
IAtom
getAuthors
in interface IAtom
public void addAuthor(Person v)
public boolean removeAuthor(Person v)
public void clearAuthors()
public java.util.List<Person> getContributors()
public void addContributor(Person v)
public boolean removeContributor(Person v)
public void clearContributors()
public Source getSource()
public void setSource(Source v)
public void setDraft(java.lang.Boolean v)
v
- Draft status, or null to clear.public boolean isDraft()
public Control getControl()
public Entry setControl(Control value)
value
- Control the new object or nullpublic boolean hasControl()
public void setService(Service s)
IAtom
setService
in interface IAtom
public Service getService()
public boolean getCanEdit()
IEntry
true
if the entry can be modified by a client.
getCanEdit
in interface IEntry
public void setCanEdit(boolean v)
IEntry
setCanEdit
in interface IEntry
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
rel
- link relationtype
- link type
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 IAtom
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()
getSelfLink
in interface IAtom
public Link getEditLink()
getEditLink
in interface IEntry
public Link getMediaEditLink()
getMediaEditLink
in interface IEntry
public Link getResumableEditMediaLink()
getResumableEditMediaLink
in interface IEntry
public Link getHtmlLink()
public Entry getSelf() throws java.io.IOException, ServiceException
java.io.IOException
- on IO error during retrieval from the service.
ServiceException
- if there is a problem retrieving the element.public Entry 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 Element narrow(ElementMetadata<?,?> metadata, ValidationContext vc)
narrow
in class Element
metadata
- the element metadata to narrow to.vc
- validation context
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |