|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sage.orion.sdata.servlet.SDataResponseEntry
public class SDataResponseEntry
An Atom Entry in an SData response. This has various properties and capabilities appropriate to returning a response.
Field Summary | |
---|---|
static java.lang.String |
AUTHOR_NAME
A simple Author because the ATOM specification requires something. |
protected static java.lang.String |
AUTHOR_TAG
|
protected static java.lang.String |
EDIT_RELATIONSHIP
|
protected static java.lang.String |
ENTRY_TAG
|
protected static java.lang.String |
FEED_TAG
|
protected static java.lang.String |
FIRST_RELATIONSHIP
|
protected static java.lang.String |
HREF_ATTRIBUTE
|
protected static java.lang.String |
ID_TAG
|
protected static java.lang.String |
LAST_RELATIONSHIP
|
protected static java.lang.String |
LINK_TAG
|
protected static java.lang.String |
MIME_ATOM_XML_ENTRY
|
protected static java.lang.String |
MIME_ATOM_XML_FEED
|
protected static java.lang.String |
MIME_XML_XSD
|
protected static java.lang.String |
NEXT_RELATIONSHIP
|
protected static java.lang.String |
PREV_RELATIONSHIP
|
protected static java.lang.String |
RELATIONSHIP_ATTRIBUTE
|
protected static java.lang.String |
SELF_RELATIONSHIP
|
protected static java.lang.String |
TITLE_ATTRIBUTE
|
protected static java.lang.String |
TITLE_EDIT
|
protected static java.lang.String |
TITLE_FIRST
|
protected static java.lang.String |
TITLE_LAST
|
protected static java.lang.String |
TITLE_NEXT
|
protected static java.lang.String |
TITLE_PREV
|
protected static java.lang.String |
TITLE_SELF
|
protected static java.lang.String |
TYPE_ATTRIBUTE
|
protected static java.lang.String |
UPDATED_TAG
|
Constructor Summary | |
---|---|
SDataResponseEntry(SDataResourceElement body,
java.lang.String eTag,
java.lang.String id)
construct a response entry |
|
SDataResponseEntry(SDataResourceElement body,
java.lang.String key,
java.lang.String eTag,
boolean editable)
construct a response entry |
|
SDataResponseEntry(SDataResourceElement body,
java.lang.String key,
java.lang.String eTag,
boolean editable,
java.util.List<SDataDiagnosis> errors)
construct a response entry |
|
SDataResponseEntry(SDataResourceElement body,
java.lang.String key,
java.lang.String eTag,
boolean editable,
java.util.List<SDataDiagnosis> errors,
SDataSchema schema,
java.lang.String title)
construct a response entry |
|
SDataResponseEntry(SDataResourceElement body,
java.lang.String key,
java.lang.String eTag,
boolean editable,
java.util.List<SDataDiagnosis> errors,
SDataSchema schema,
java.lang.String title,
Category category)
construct a response entry |
|
SDataResponseEntry(SDataResourceElement body,
java.lang.String key,
java.lang.String eTag,
boolean editable,
java.util.List<SDataDiagnosis> errors,
SDataSchema schema,
java.lang.String title,
Category category,
boolean canPost,
boolean hasService)
construct a response entry |
|
SDataResponseEntry(SDataResourceElement body,
java.lang.String eTag,
java.lang.String id,
java.util.List<SDataDiagnosis> errors)
construct a response entry |
Method Summary | |
---|---|
protected void |
addCategory(org.w3c.dom.Element atomElement)
Add the category information to the given DOM element (feed or entry) |
protected static void |
addNamespaces(org.w3c.dom.Element parent)
Add the namespace attributes that are common to SDataEntry and SDataFeed |
protected void |
addSchemaEtcLinks(org.w3c.dom.Element parent,
java.lang.String urlBase,
boolean canPost,
boolean hasService)
Add the schema, post, service and template links to the given feed or entry element |
protected static void |
appendIfNotNull(org.w3c.dom.Element entry,
org.w3c.dom.Element child)
Utility to append a child only if it is defined |
protected org.w3c.dom.Element |
createElement(org.w3c.dom.Document doc,
boolean isDocumentElement,
java.lang.String resourcesURL,
java.util.List<SDataDiagnosis> errors)
create an XML Element representing this Entry. |
protected org.w3c.dom.Element |
createElement(org.w3c.dom.Document doc,
boolean isDocumentElement,
java.lang.String resourcesURL,
java.util.List<SDataDiagnosis> errors,
java.lang.String typeTag)
Creates an atom element |
protected void |
createSchemaLink(java.lang.String urlBase,
org.w3c.dom.Element atomElement)
adds the schema link to the parent provided, complete with actual schema if any |
protected static org.w3c.dom.Element |
getAtomEntryLinkElement(org.w3c.dom.Document document,
java.lang.String relationship,
java.lang.String title,
java.lang.String href)
Create an Atom entry link element |
protected static org.w3c.dom.Element |
getAtomLinkElement(org.w3c.dom.Document document,
java.lang.String type,
java.lang.String relationship,
java.lang.String title,
java.lang.String href)
Create an Atom link element for the given link-relation entry |
protected java.lang.String |
getEditLink(java.lang.String id)
gets the edit link content for the item |
protected java.lang.String |
getID(java.lang.String resourcesURL)
Get the ID used for the ID, self and edit links |
protected java.lang.String |
getKey()
returns the value that represents the key for the entry. |
protected static org.w3c.dom.Element |
getLinkRelationElement(org.w3c.dom.Document document,
java.lang.String relationship,
java.lang.String type,
java.lang.String title,
java.lang.String href)
Create an Atom link element for the given link-relation entry |
SDataResourceElement |
getPayload()
get the payload of the SDataResponseEntry |
static SDataResponseEntry |
newIntermediateEntry(Category category,
java.lang.String id,
java.lang.String title,
java.lang.String content)
factory to create an intermediate URL entry |
void |
setPayload(SDataResourceElement payload)
set the payload of the SDataResponseEntry |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String TITLE_EDIT
protected static final java.lang.String TITLE_SELF
protected static final java.lang.String TITLE_FIRST
protected static final java.lang.String TITLE_LAST
protected static final java.lang.String TITLE_PREV
protected static final java.lang.String TITLE_NEXT
protected static final java.lang.String MIME_XML_XSD
protected static final java.lang.String MIME_ATOM_XML_FEED
protected static final java.lang.String MIME_ATOM_XML_ENTRY
protected static final java.lang.String SELF_RELATIONSHIP
protected static final java.lang.String EDIT_RELATIONSHIP
protected static final java.lang.String FIRST_RELATIONSHIP
protected static final java.lang.String LAST_RELATIONSHIP
protected static final java.lang.String PREV_RELATIONSHIP
protected static final java.lang.String NEXT_RELATIONSHIP
protected static final java.lang.String LINK_TAG
protected static final java.lang.String RELATIONSHIP_ATTRIBUTE
protected static final java.lang.String TITLE_ATTRIBUTE
protected static final java.lang.String TYPE_ATTRIBUTE
protected static final java.lang.String HREF_ATTRIBUTE
protected static final java.lang.String ENTRY_TAG
protected static final java.lang.String FEED_TAG
protected static final java.lang.String ID_TAG
protected static final java.lang.String AUTHOR_TAG
protected static final java.lang.String UPDATED_TAG
public static final java.lang.String AUTHOR_NAME
Constructor Detail |
---|
public SDataResponseEntry(SDataResourceElement body, java.lang.String eTag, java.lang.String id)
body
- the body of the entryeTag
- the eTag of the entry or nullid
- the id of the entry or nullpublic SDataResponseEntry(SDataResourceElement body, java.lang.String key, java.lang.String eTag, boolean editable)
body
- the body of the entrykey
- the key of the entry (used to form links) or nulleTag
- the eTag of the entry or nulleditable
- the entry is or is not editablepublic SDataResponseEntry(SDataResourceElement body, java.lang.String eTag, java.lang.String id, java.util.List<SDataDiagnosis> errors)
body
- the body of the entryeTag
- the eTag of the entry or nullid
- the id of the entry or nullerrors
- the list of errorspublic SDataResponseEntry(SDataResourceElement body, java.lang.String key, java.lang.String eTag, boolean editable, java.util.List<SDataDiagnosis> errors)
body
- the body of the entrykey
- the key of the entry (used to form links) or nulleTag
- the eTag of the entry or nulleditable
- the entry is or is not editableerrors
- the list of errorspublic SDataResponseEntry(SDataResourceElement body, java.lang.String key, java.lang.String eTag, boolean editable, java.util.List<SDataDiagnosis> errors, SDataSchema schema, java.lang.String title)
body
- the body of the entrykey
- the key of the entry (used to form links) or nulleTag
- the eTag of the entry or nulleditable
- the entry is or is not editableerrors
- the list of errorsschema
- a potential in-lined schematitle
- the title for the entrypublic SDataResponseEntry(SDataResourceElement body, java.lang.String key, java.lang.String eTag, boolean editable, java.util.List<SDataDiagnosis> errors, SDataSchema schema, java.lang.String title, Category category)
body
- the body of the entrykey
- the key of the entry (used to form links) or nulleTag
- the eTag of the entry or nulleditable
- the entry is or is not editableerrors
- the list of errorsschema
- a potential in-lined schematitle
- the title for the entrycategory
- the category of the entrypublic SDataResponseEntry(SDataResourceElement body, java.lang.String key, java.lang.String eTag, boolean editable, java.util.List<SDataDiagnosis> errors, SDataSchema schema, java.lang.String title, Category category, boolean canPost, boolean hasService)
body
- the body of the entrykey
- the key of the entry (used to form links) or nulleTag
- the eTag of the entry or nulleditable
- the entry is or is not editableerrors
- the list of errorsschema
- a potential in-lined schematitle
- the title for the entrycategory
- the category of the entrycanPost
- true if and only if the entry supports post (and so the post and
template links will be included if the entry is not inside a
feed)hasService
- true if and only if the entry supports services (and so the
service link will be included if the entry is not inside a feed)Method Detail |
---|
protected org.w3c.dom.Element createElement(org.w3c.dom.Document doc, boolean isDocumentElement, java.lang.String resourcesURL, java.util.List<SDataDiagnosis> errors)
doc
- the Document in which to create the elementisDocumentElement
- true if this element is the document top level element, in which
case it will have the namespace attributes. If false then the
namespace attributes should be added to the feed above this
element.resourcesURL
- The base URL to be used in creating links, ids etc. This
includes all elements up to and including the resource kind but
does not include subresources etc.errors
- The list of errors
protected java.lang.String getEditLink(java.lang.String id)
id
- the id of the item, which is generally useful as the base of the
link
protected java.lang.String getID(java.lang.String resourcesURL)
resourcesURL
- the base resources URL, already encoded for transportprotected static org.w3c.dom.Element getAtomEntryLinkElement(org.w3c.dom.Document document, java.lang.String relationship, java.lang.String title, java.lang.String href)
document
- the document to act as container for the elementrelationship
- the text of the relationshiptitle
- the title of the linkhref
- the href entry of the link
protected java.lang.String getKey()
This is returned in the form that the application has encoded (e.g. handling of separator characters for multi-part keys); no transport encoding has been performed.
public static SDataResponseEntry newIntermediateEntry(Category category, java.lang.String id, java.lang.String title, java.lang.String content)
category
- the category of the entryid
- the id of the entry (also used for the self link). This must
already be encoded for transporttitle
- the title for the entrycontent
- the content of the entry
public SDataResourceElement getPayload()
SDataResponseEntry
SDataResponseEntry
public void setPayload(SDataResourceElement payload)
SDataResponseEntry
payload
- the payload of the SDataResponseEntry
protected static void appendIfNotNull(org.w3c.dom.Element entry, org.w3c.dom.Element child)
entry
- entrychild
- childprotected static org.w3c.dom.Element getLinkRelationElement(org.w3c.dom.Document document, java.lang.String relationship, java.lang.String type, java.lang.String title, java.lang.String href)
document
- the document which will own the entryrelationship
- the relationship; one of schema, template, post and servicetype
- the type of the result? depends on relationshiptitle
- titlehref
- href
protected static org.w3c.dom.Element getAtomLinkElement(org.w3c.dom.Document document, java.lang.String type, java.lang.String relationship, java.lang.String title, java.lang.String href)
document
- the document which will own the entryrelationship
- the relationship; one of schema, template, post and servicetype
- the type of the result? depends on relationshiptitle
- titlehref
- href
protected void addSchemaEtcLinks(org.w3c.dom.Element parent, java.lang.String urlBase, boolean canPost, boolean hasService)
parent
- the entry or feed element to which the links are attachedurlBase
- the URL that is used as the base text for the links. It should
already be in RFC3987 IRI format.canPost
- true if and only if the entry or feed supports post (and so the
post and template links are included)hasService
- true if and only if the entry or feed has services (and so the
service link is included)protected final void createSchemaLink(java.lang.String urlBase, org.w3c.dom.Element atomElement)
urlBase
- the base string to use in forming the hrefatomElement
- the parent element that is the feed or entryprotected org.w3c.dom.Element createElement(org.w3c.dom.Document doc, boolean isDocumentElement, java.lang.String resourcesURL, java.util.List<SDataDiagnosis> errors, java.lang.String typeTag)
doc
- documentisDocumentElement
- whether document is document elementresourcesURL
- resources URLerrors
- errorstypeTag
- type tag ( i.e. feed or entry)
protected static final void addNamespaces(org.w3c.dom.Element parent)
parent
- the element to which to add the attributesprotected final void addCategory(org.w3c.dom.Element atomElement)
atomElement
- the parent element that is the feed or entry
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |