public class Entry extends Element implements IEntry
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*)
Modifier and Type | Field and Description |
---|---|
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
|
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 and Description |
---|
Entry()
Constructs a new Entry instance, using default metadata.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
addElement, addElement, addElement, clear, createElement, createElement, equals, getAttributeCount, getAttributeIterator, getAttributeIterator, getAttributeValue, getAttributeValue, getDefaultKey, getElement, getElement, getElementCount, getElementId, getElementIterator, getElementIterator, getElementKey, getElements, getElements, getElementSet, getElementSet, getElementValue, getElementValue, getTextValue, getTextValue, hasAttribute, hasAttribute, hasElement, hasElement, hashCode, hasTextValue, isLocked, lock, removeAttribute, removeAttribute, removeAttributeValue, removeAttributeValue, removeElement, removeElement, removeElement, removeElement, replaceElement, resolve, resolve, setAttributeValue, setAttributeValue, setElement, setElement, setElement, setTextValue, toString, visit
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
public static void registerMetadata(MetadataRegistry registry)
public java.lang.String getId()
IAtom
public void setId(java.lang.String v)
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.public void setEtag(java.lang.String v)
GdAttributes.ETAG
value for this entry. A value of null
indicates the value is unknown.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.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.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.public void setEdited(DateTime v)
IEntry
public java.util.Set<Category> getCategories()
IAtom
getCategories
in interface IAtom
public void addCategory(Category v)
public void clearCategories()
public TextContent getTitle()
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
public void addLink(Link v)
public Link addLink(java.lang.String rel, java.lang.String type, java.lang.String href)
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.
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.