com.sage.orion.sdata.servlet
Class SDataRequestEntry

java.lang.Object
  extended by com.sage.orion.sdata.servlet.SDataRequestEntry

public class SDataRequestEntry
extends java.lang.Object

The SDataRequestEntry class represents an sdata entry within a request (which is slightly different from the response form).

See Also:
SDataRequestFeed, SDataResponseEntry

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
protected SDataRequestEntry(org.w3c.dom.Element node, java.lang.String ifMatch)
          constructs an instance of the SDataRequestEntry class based on the information at and below the given node, with an if-match value as specified.
 
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, 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 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
 java.lang.String getETag()
          return the eTag specified for the entry, or null if there is none
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()
          returns the 'sdata:payload' portion of the entry, or null if there is none
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TITLE_EDIT

protected static final java.lang.String TITLE_EDIT
See Also:
Constant Field Values

TITLE_SELF

protected static final java.lang.String TITLE_SELF
See Also:
Constant Field Values

TITLE_FIRST

protected static final java.lang.String TITLE_FIRST
See Also:
Constant Field Values

TITLE_LAST

protected static final java.lang.String TITLE_LAST
See Also:
Constant Field Values

TITLE_PREV

protected static final java.lang.String TITLE_PREV
See Also:
Constant Field Values

TITLE_NEXT

protected static final java.lang.String TITLE_NEXT
See Also:
Constant Field Values

MIME_XML_XSD

protected static final java.lang.String MIME_XML_XSD
See Also:
Constant Field Values

MIME_ATOM_XML_FEED

protected static final java.lang.String MIME_ATOM_XML_FEED
See Also:
Constant Field Values

MIME_ATOM_XML_ENTRY

protected static final java.lang.String MIME_ATOM_XML_ENTRY
See Also:
Constant Field Values

SELF_RELATIONSHIP

protected static final java.lang.String SELF_RELATIONSHIP
See Also:
Constant Field Values

EDIT_RELATIONSHIP

protected static final java.lang.String EDIT_RELATIONSHIP
See Also:
Constant Field Values

FIRST_RELATIONSHIP

protected static final java.lang.String FIRST_RELATIONSHIP
See Also:
Constant Field Values

LAST_RELATIONSHIP

protected static final java.lang.String LAST_RELATIONSHIP
See Also:
Constant Field Values

PREV_RELATIONSHIP

protected static final java.lang.String PREV_RELATIONSHIP
See Also:
Constant Field Values

NEXT_RELATIONSHIP

protected static final java.lang.String NEXT_RELATIONSHIP
See Also:
Constant Field Values

LINK_TAG

protected static final java.lang.String LINK_TAG
See Also:
Constant Field Values

RELATIONSHIP_ATTRIBUTE

protected static final java.lang.String RELATIONSHIP_ATTRIBUTE
See Also:
Constant Field Values

TITLE_ATTRIBUTE

protected static final java.lang.String TITLE_ATTRIBUTE
See Also:
Constant Field Values

TYPE_ATTRIBUTE

protected static final java.lang.String TYPE_ATTRIBUTE
See Also:
Constant Field Values

HREF_ATTRIBUTE

protected static final java.lang.String HREF_ATTRIBUTE
See Also:
Constant Field Values

ENTRY_TAG

protected static final java.lang.String ENTRY_TAG
See Also:
Constant Field Values

FEED_TAG

protected static final java.lang.String FEED_TAG
See Also:
Constant Field Values

ID_TAG

protected static final java.lang.String ID_TAG
See Also:
Constant Field Values

AUTHOR_TAG

protected static final java.lang.String AUTHOR_TAG
See Also:
Constant Field Values

UPDATED_TAG

protected static final java.lang.String UPDATED_TAG
See Also:
Constant Field Values

AUTHOR_NAME

public static final java.lang.String AUTHOR_NAME
A simple Author because the ATOM specification requires something.

See Also:
Constant Field Values
Constructor Detail

SDataRequestEntry

protected SDataRequestEntry(org.w3c.dom.Element node,
                            java.lang.String ifMatch)
constructs an instance of the SDataRequestEntry class based on the information at and below the given node, with an if-match value as specified.

The ifMatch value should be extracted from the http if-match header if this entry is the direct payload of an update request and should be taken from the ifMatch sdata extension property if this entry is part of a batch request.

Specify a null value for the ifMatch value if there is none available

Parameters:
node - the node of the Document Object Model corresponding to the entry; the one whose tag type is "entry".
ifMatch - the value of the if-match information for the entry.
Method Detail

getETag

public java.lang.String getETag()
return the eTag specified for the entry, or null if there is none

Returns:
the eTag or null if there is none.

getPayload

public SDataResourceElement getPayload()
returns the 'sdata:payload' portion of the entry, or null if there is none

Returns:
an SDataResourceElement representing the payload portion, or null if there is none

appendIfNotNull

protected static void appendIfNotNull(org.w3c.dom.Element entry,
                                      org.w3c.dom.Element child)
Utility to append a child only if it is defined

Parameters:
entry - entry
child - child

getLinkRelationElement

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

Parameters:
document - the document which will own the entry
relationship - the relationship; one of schema, template, post and service
type - the type of the result? depends on relationship
title - title
href - href
Returns:
atom link element

getAtomLinkElement

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

Parameters:
document - the document which will own the entry
relationship - the relationship; one of schema, template, post and service
type - the type of the result? depends on relationship
title - title
href - href
Returns:
atom link element

addSchemaEtcLinks

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

Parameters:
parent - the entry or feed element to which the links are attached
urlBase - 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)

createSchemaLink

protected final 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

Parameters:
urlBase - the base string to use in forming the href
atomElement - the parent element that is the feed or entry

createElement

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

Parameters:
doc - document
isDocumentElement - whether document is document element
resourcesURL - resources URL
errors - errors
typeTag - type tag ( i.e. feed or entry)
Returns:
atom element of specified type

addNamespaces

protected static final void addNamespaces(org.w3c.dom.Element parent)
Add the namespace attributes that are common to SDataEntry and SDataFeed

Parameters:
parent - the element to which to add the attributes

addCategory

protected final void addCategory(org.w3c.dom.Element atomElement)
Add the category information to the given DOM element (feed or entry)

Parameters:
atomElement - the parent element that is the feed or entry


Copyright © 2011 Sage Software, Inc. All rights reserved.