com.sage.orion.sdata.servlet
Interface SDataRequest

All Known Implementing Classes:
SDataRequestImpl

public interface SDataRequest

The SDataRequest interface exposes the incoming SData Request in terms of SData terminology. To support asynchronous operations all implementations must be aware that they might be put away in memory for some time.


Nested Class Summary
static class SDataRequest.SDataMethod
          The possible types of SData request
 
Method Summary
 java.lang.String getAccpacSessionID()
          Gets the Sage 300 ERP (formerly Accpac) session ID for the current session.
 java.lang.String getApplicationName()
          Gets the application name from the request.
 java.lang.String getAuthorizationToken()
          gets the authorization token for the request.
 java.lang.String getConnectionID()
          Gets the connectionID of the request.
 java.lang.String getContractName()
          Gets the contract name in the SData Request.
 java.lang.String getDataSet()
          Gets the dataset name for the SData Request.
 SDataRequestEntry getEntryPayload()
          Gets the Entry payload.
 SDataRequestFeed getFeedPayload()
          Gets the Feed payload.
 java.lang.String getFullURL()
          returns the full URI of the Resources set
 javax.servlet.http.HttpSession getHttpSession()
          returns the HTTP Session
 java.util.Locale getHttpSessionLocale()
          returns the HTTP Session Locale
 java.lang.String getIfMatch()
          Gets the if-Match header value, or null if there is none.
 SDataRequest.SDataMethod getMethod()
          Gets the method for the SDataRequest.
 java.util.List<OrderByParameter> getOrderByParameters()
          Gets the list of order by parameters from the url.
 PagingControl getPagingControlRequest()
          return the paging request
 com.sage.swt.common.filter.QueryExpression getQueryFilter()
          Gets the QueryFilter for the SDataRequest.
 QueryPayloadControl getQueryPayloadControl()
          Gets the QueryPayloadControl for the SDataRequest.
 java.util.List<ResourceElement> getResourceElements()
          Gets a list of the Resource Elements.
 java.lang.String getResourceKindName()
          Gets the ResourceKindName for the SDataRequest.
 java.lang.String getResourceSetURL()
          Get the URL that defines the resource set.
 java.lang.String getResourcesURL()
          returns the full URI of the Resources set, as required for links
 SDataDiagnoses getSDataDiagnoses()
          Get the error stack for this request.
 int getSequenceNumber()
          Gets the sequence number of the request.
 SDataServer getServer()
          Gets the SData Server that is handling the request.
 int getSessionTimeout()
          Gets the Tomcat Session Timeout value in minutes.
 TrackingIDInfo getTrackingIDInfoRequest()
          Get the TrackingIDInfo object from either the Resource Element or from Query Parameter.
 java.lang.String getWebappURL()
          returns the URL of the Webapp
 java.lang.String getWhereClause()
          returns the where clause or null if there is none
 boolean hasApplication()
          Checks to see if the request has an application specified.
 boolean hasContract()
          Checks to see if the request has a contract specified.
 boolean hasDataset()
          Checks to see if the request has a dataset specified (including the hyphen signifying the default dataset).
 boolean hasDefaultDataset()
          returns whether the request specifies the default dataset as opposed to a named dataset
 boolean hasQueryFilter()
           
 boolean isAsyncRequest()
           
 boolean isBatchRequest()
          returns whether the request is for a batch
 boolean isCommitted()
          returns true if and only if the request is to be committed.
 boolean isConnectRequest()
          returns true if and only if the request is for maintaining a connection.
 boolean isForSingleResource()
          returns true if the request is for a single resource, i.e.
 boolean isSameRequest(SDataRequest other)
          is this request the same as the other one in all important aspects (e.g.
 boolean isSchemaRequest()
          returns whether the request is for a schema
 boolean isServiceListRequest()
          returns true if the request is a Service Request to get a list of services.
 boolean isServiceRequest()
          returns whether the request is for a service operation
 boolean isSpecialRequest()
          returns whether the request is a special (e.g.
 boolean isStatelessRequest()
          returns true if and only if the request is stateless.
 boolean isTemplateRequest()
          returns whether the request is for a template
 boolean specifiesInlinedSchema()
          returns true if and only if the request specifies that an inlined schema should be included in the response
 boolean specifiesReturnDelta()
          returns true if and only if the request specified that the server should only include the properties that have been modified in the response
 

Method Detail

getServer

SDataServer getServer()
Gets the SData Server that is handling the request. This includes such information as the contract and dataset and is frequently used to generate links to other resources such as schemas etc.

Returns:
an SDataServer representing the server that is handling the request

getApplicationName

java.lang.String getApplicationName()
Gets the application name from the request.

The application name returned consists only of ASCII characters and is returned in lower case.

Returns:
the application name or null if not found.
See Also:
hasApplication()

getAuthorizationToken

java.lang.String getAuthorizationToken()
gets the authorization token for the request. The format of the token varies between application

Returns:
the authorization token

getConnectionID

java.lang.String getConnectionID()
Gets the connectionID of the request.

The request has a connection ID if it is a connection maintenance request (see isConnectRequest()) or if it is not a stateless request (see isStatelessRequest()).

The returned value will not be a null reference nor an empty string

This and the other methods about state are Sage 300 ERP extensions

Returns:
the connection ID of the request
Throws:
java.lang.IllegalStateException - if the request is not one that would have a connection id (i.e. is stateless and not a connection maintenance request)
MalformedURLException - if there is no connection ID when there should be one or if there is some other defect with the connection ID itself
See Also:
getSequenceNumber(), isStatelessRequest(), isConnectRequest(), isCommitted()

getContractName

java.lang.String getContractName()
Gets the contract name in the SData Request. If there is no contract the behaviour is not defined

Returns:
the contract
See Also:
hasContract()

getDataSet

java.lang.String getDataSet()
Gets the dataset name for the SData Request. If there is no dataset specified (e.g. the request was for an intermediate feed of datasets, contracts etc.) then the behaviour is not defined. Call hasDataset() to see if there is a dataset. If the dataset is the default dataset (as indicated currently by a hyphen in the URL) then the behaviour is not defined. Call hasDefaultDataset() to see if the dataset is the default dataset (after checking that there is indeed a dataset in the URL).

Returns:
the dataset name for the SData Request.
See Also:
hasDataset(), hasDefaultDataset()

hasApplication

boolean hasApplication()
Checks to see if the request has an application specified. This will be false if the request was an intermediate URL for the list of applications. Call getApplicationName() to get the name of the application.

Returns:
true if and only if the request specified an application name.
See Also:
getApplicationName(), hasContract()

hasContract

boolean hasContract()
Checks to see if the request has a contract specified. This will be false if the request was an intermediate URL for the list of applications or contracts. Call getContractName() to get the name of the contract.

Returns:
true if and only if the request specified a contract
See Also:
getContractName(), hasDataset(), hasApplication()

hasDataset

boolean hasDataset()
Checks to see if the request has a dataset specified (including the hyphen signifying the default dataset). This will be false if the request was an intermediate URL for the list of datasets, contracts or applications. Call hasDefaultDataset() to see if the dataset specified is the default dataset or a named dataset. If it is a named dataset then call getDataSet() to get the name of the dataset.

Returns:
true if and only if the request specified a (possibly default) dataset.
See Also:
hasDefaultDataset(), getDataSet()

getEntryPayload

SDataRequestEntry getEntryPayload()
Gets the Entry payload. This returns a null reference if the request is not compatible with having an entry payload

Returns:
the entry payload, or a null reference if there is none.

getFeedPayload

SDataRequestFeed getFeedPayload()
Gets the Feed payload. This returns a null reference if the request is not compatible with having a feed payload

Returns:
the feed payload, or a null reference if there is none.

getFullURL

java.lang.String getFullURL()
returns the full URI of the Resources set

Returns:
the full URI of the Resources set

getWebappURL

java.lang.String getWebappURL()
returns the URL of the Webapp

Returns:
the URL of the Webapp

getHttpSession

javax.servlet.http.HttpSession getHttpSession()
returns the HTTP Session

Returns:
the HTTP Session

getHttpSessionLocale

java.util.Locale getHttpSessionLocale()
returns the HTTP Session Locale

Returns:
the current locale of HTTP Session

getIfMatch

java.lang.String getIfMatch()
Gets the if-Match header value, or null if there is none.

Returns:
null if there is no ifMatch header and its value if there is one.

getMethod

SDataRequest.SDataMethod getMethod()
Gets the method for the SDataRequest.

Returns:
the method

getOrderByParameters

java.util.List<OrderByParameter> getOrderByParameters()
Gets the list of order by parameters from the url.

Returns:
list of order by parameters.

getPagingControlRequest

PagingControl getPagingControlRequest()
return the paging request

There must be a paging request (i.e. this function must return a non-null value), although the request may actually have no data in it

Returns:
the paging request (and never null)

getQueryFilter

com.sage.swt.common.filter.QueryExpression getQueryFilter()
Gets the QueryFilter for the SDataRequest.

Returns:
the QueryFilter for the SDataRequest. Returns null if there is no query filter.

getQueryPayloadControl

QueryPayloadControl getQueryPayloadControl()
Gets the QueryPayloadControl for the SDataRequest.

Returns:
a non-null QueryPayloadControl containing the various elements that control the response payload content

getResourceElements

java.util.List<ResourceElement> getResourceElements()
Gets a list of the Resource Elements.

A Resource Element is a resource or property name along with its key or predicate, or one of the special names such as $schema.

e.g. http://someserver/sdata/app('abc')/contract/Orders('01')/Details('6')/DetailComments consists of 3 Resource Element objects: Orders, Details and DetailComments.

Returns:
a List of the resource elements

getResourceKindName

java.lang.String getResourceKindName()
Gets the ResourceKindName for the SDataRequest.

Returns:
the resourceKindName

getResourceSetURL

java.lang.String getResourceSetURL()
Get the URL that defines the resource set. That is, the URL that includes the where & orderBy if they presents, but does not include paging info (StartKey, etc.)

Returns:
the URL for the resource set

getResourcesURL

java.lang.String getResourcesURL()
returns the full URI of the Resources set, as required for links

Returns:
the full URI of the Resources set, as required for links

getSDataDiagnoses

SDataDiagnoses getSDataDiagnoses()
Get the error stack for this request. This is initially an empty stack and provides a home to allow building up diagnostic messages while processing the request.

Returns:
SDataDiagnoses for the request.

getSequenceNumber

int getSequenceNumber()
Gets the sequence number of the request.

If the request has a connection ID (see getConnectionID()) then it must also have a sequence number, which specifies the order in which the requests were generated, so that they can be handled in the same order.

This and the other methods about state are Sage 300 ERP extensions

Returns:
the sequence number of the request
Throws:
java.lang.IllegalStateException - if the request is not one that would have a sequence number (i.e. is stateless and not a connection maintenance request)
MalformedURLException - if there is no sequence number when there should be one or if there is some other defect with the sequence number itself
See Also:
getConnectionID(), isStatelessRequest(), isConnectRequest(), isCommitted()

getTrackingIDInfoRequest

TrackingIDInfo getTrackingIDInfoRequest()
Get the TrackingIDInfo object from either the Resource Element or from Query Parameter. TrackingIDInfo object contains the TrackingID and also the Operation Name.

Returns:
TrackingIDInfo

getWhereClause

java.lang.String getWhereClause()
returns the where clause or null if there is none

Returns:
the where clause or null if there is none

hasDefaultDataset

boolean hasDefaultDataset()
returns whether the request specifies the default dataset as opposed to a named dataset

Returns:
true or false;
Throws:
java.lang.IllegalStateException - if there is no dataset specified (see @link hasDataset()

hasQueryFilter

boolean hasQueryFilter()
Returns:
true if the request includes a query filter.

isAsyncRequest

boolean isAsyncRequest()
Returns:
true if the request is asynchronous.

isBatchRequest

boolean isBatchRequest()
returns whether the request is for a batch

Returns:
whether the request is for a batch

isCommitted

boolean isCommitted()
returns true if and only if the request is to be committed.

If the request is stateful then the request may be flagged as not to be committed. If the request is stateless then for convenience this function will return true rather than throwing an exception.

This and the other methods about state are Sage 300 ERP extensions

Returns:
true if and only if the request is to be committed.
See Also:
isStatelessRequest(), isConnectRequest(), getConnectionID()

isConnectRequest

boolean isConnectRequest()
returns true if and only if the request is for maintaining a connection.

Currently maintaining a connection includes creating or deleting the connection. If we add the ability to get information about the connection or update the state of the connection then those will be here too, as will getting the schema

This does not return true if the request is merely using a connection; see isStatelessRequest().

This and the other methods about state are Sage 300 ERP extensions

Returns:
true if the request is for maintaining a connection
See Also:
isStatelessRequest(), getConnectionID(), getSequenceNumber()

isForSingleResource

boolean isForSingleResource()
returns true if the request is for a single resource, i.e. if the last ResourceElement in the URL specifies a ResourceSelector

Returns:
true if and only if the request is for a single resource rather than a feed

isSameRequest

boolean isSameRequest(SDataRequest other)
is this request the same as the other one in all important aspects (e.g. a repeated request or an echo)

Parameters:
other - The other SDataRequest to compare.
Returns:
true if and only if the two requests are equivalent

isSchemaRequest

boolean isSchemaRequest()
returns whether the request is for a schema

Returns:
whether the request is for a schema

isServiceListRequest

boolean isServiceListRequest()
returns true if the request is a Service Request to get a list of services. For example ..\contract\resourceKind\$service\ but not ..\contract\resourceKind\$service\operationName\

Returns:
whether the request is to get a list of services

isServiceRequest

boolean isServiceRequest()
returns whether the request is for a service operation

Returns:
whether the request is for a service operation

isSpecialRequest

boolean isSpecialRequest()
returns whether the request is a special (e.g. $schema, $template)

Returns:
whether the request is a special (e.g. $schema, $template)

isStatelessRequest

boolean isStatelessRequest()
returns true if and only if the request is stateless.

If the request is not stateless (is stateful) then the request will typically be handled slightly differently from if it is stateless.

If the request is not stateless then call getConnectionID() to find the connection ID.

The connection maintenance requests themselves (see isConnectRequest()) are stateless.

This and the other methods about state are Sage 300 ERP extensions

Returns:
true if and only if the request is stateless.
See Also:
isConnectRequest(), getConnectionID(), getSequenceNumber(), isCommitted()

isTemplateRequest

boolean isTemplateRequest()
returns whether the request is for a template

Returns:
whether the request is for a template

specifiesInlinedSchema

boolean specifiesInlinedSchema()
returns true if and only if the request specifies that an inlined schema should be included in the response

Returns:
whether the request specifies returning a schema with the response

specifiesReturnDelta

boolean specifiesReturnDelta()
returns true if and only if the request specified that the server should only include the properties that have been modified in the response

Returns:
whether the request specified a delta return

getAccpacSessionID

java.lang.String getAccpacSessionID()
Gets the Sage 300 ERP (formerly Accpac) session ID for the current session.

Returns:
session id

getSessionTimeout

int getSessionTimeout()
Gets the Tomcat Session Timeout value in minutes.



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