com.sage.orion.sdata.servlet
Interface ResourceElement


public interface ResourceElement

Element in a resource tree

The Resource portion of an SData URL is the portion from the contract up to the end of the URL or to the question mark that denotes the beginning of the query. It consists of a list of elements, which may be special elements, resource sets, single resources (or properties, but these cannot be distinguished from resource sets).

An element whose name begins with a dollar sign is a Special element. For example the $schema element denotes the schema of the Set above it. For some Special elements there may be Elements after it (such as $service) but for others (such as $template) the element must be last in the list and preceded by a Set.

An element consisting of merely a name is (normally) a Set. It is a plural name and denotes a set of resources. For example customers means "the customers" as a set, and the set may be constrained by a "where" clause.

At the end of the list an element consisting of merely a name may actually be a Property, basically a field.

The parsing cannot distinguish a Set from a Property; that depends on the handlers.

An element consisting of a name followed by something in parentheses denotes a single resource. What appears between the parentheses defines which resource it is. It may be an explicit key surrounded by single quotes or else it may be an expression in the SData Query language which (hopefully) defines a single resource.

For the time being there is a third option for defining a single resource, which may be deprecated soon. That is an Accpac predicate expression denoting a particular record, for example the first or last or previous or next of a key.


Nested Class Summary
static class ResourceElement.Navigation
           
static class ResourceElement.Type
          An enumeration of the types of resource element
 
Method Summary
 java.lang.String getKey()
          the key identifying which individual resource, in the sdata form
 java.lang.String getName()
          the name of the element
 ResourceElement.Navigation getNavigation()
          Gets the ResourceElement.Navigation method of the Resource Element
 com.sage.swt.common.filter.QueryExpression getQuery()
          the query identifying which individual resource.
 ResourceElement.Type getType()
          the type of the element
 boolean isAbsolute()
          returns true if the navigation is absolute, FIRST or LAST
 boolean isRelative()
          returns true if the navigation is relative to the key, CURRENT, PREVIOUS or NEXT
 

Method Detail

getName

java.lang.String getName()
the name of the element


getType

ResourceElement.Type getType()
the type of the element


getKey

java.lang.String getKey()
the key identifying which individual resource, in the sdata form

It is up to the application to split the key into parts if the application supports multipart keys

Returns:
null if the element is a Single resource not defined by an explicit key (e.g. defined by a predicate)
Throws:
java.lang.UnsupportedOperationException - if the element is not a Single resource

getQuery

com.sage.swt.common.filter.QueryExpression getQuery()
the query identifying which individual resource.

Returns:
null if the element is a Single resource not defined by a query (e.g. defined by an explicit key)
Throws:
java.lang.UnsupportedOperationException - if the element is not a Single resource

getNavigation

ResourceElement.Navigation getNavigation()
Gets the ResourceElement.Navigation method of the Resource Element

Returns:
the ResourceElement.Navigation method of the Resource Element

isAbsolute

boolean isAbsolute()
returns true if the navigation is absolute, FIRST or LAST

Returns:
true if the navigation is absolute, FIRST or LAST

isRelative

boolean isRelative()
returns true if the navigation is relative to the key, CURRENT, PREVIOUS or NEXT

Returns:
true if the navigation is relative, CURRENT, PREVIOUS or NEXT


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