SAP NetWeaver '04

com.sap.netweaver.bc.rf.common
Class Rid

[contained in: com.sap.netweaver.bc.rf.par - bc.rf.common_api.jar]
java.lang.Object
  |
  +--com.sap.netweaver.bc.rf.common.Rid
All Implemented Interfaces:
java.lang.Comparable, IRid, java.io.Serializable

public final class Rid
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable, IRid

A Rid is an identifier for a CM resource. It holds all information to identify a CM resource and retrieve it via the CM Framework. Each CM resource has its unique Rid. The first pathsegment must be a valid name of a repository (prefix).

A Rid has a path-like structure, like a path in a file system and follows the following production:

   Rid         ::= '/' pathsegment | '/' pathsegment '?' query
   pathsegment ::= name | name '/' pathsegment | empty
   name        ::= any char except '/'
   query       ::= parameter | parameter '&' query | empty
   parameter   ::= varname | varname '=' value
   varname     ::= any char except '=', '&'
   value       ::= any character except '&'
 
Equality is defined as ignoring trailing '/' characters. Thus, the Rids "/docs/" and /docs" are considered equal. There is special handling for the root collection "/", which is not equal to the empty Rid "".

Copyright (c) SAP AG 2001-2003

See Also:
Serialized Form

Field Summary
static char PATH_SEPARATOR
           
 
Constructor Summary
Rid(java.lang.String uri)
          Deprecated. as of NW04. Use Rid.getRid(uri)
Rid(java.lang.String path, java.lang.String query)
          Deprecated. as of NW04. Use Rid.getRid(path, query)
 
Method Summary
 IRid add(IRid uri)
          Concatenate this Rid with the given Rid.
 IRid add(java.lang.String uri)
          Concatenate this Rid with the given Rid.
 IRid addPathSegment(java.lang.String segment)
          Adds a path segment.
 IRid addQueryParameter(java.util.Properties parameter)
          Deprecated. as of NW04. Use setQueryParameter
 int compareTo(java.lang.Object o)
           
 Rid decode()
          Deprecated. as of NW04. Rid objects are never decoded
 Rid encode()
          Deprecated. as of NW04. Rid objects are never encoded
 boolean endsWithSlash()
          Return if this Rid ends with a slash.
 boolean equals(IRid other)
          Determine if this Rid equals other.
 boolean equals(java.lang.Object other)
          Determine if this Rid equals other.
 java.lang.String extension()
          Get the extension part of the resource name.
 java.lang.String getPath()
          Return the path component of this Rid.
 java.lang.String getQuery()
          Return the query component of this Rid (null if it does not exist).
 java.util.Properties getQueryParameter()
          Get the query parameters of the Rid.
static Rid getRid(java.lang.String uri)
           
static IRid getRid(java.lang.String path, java.lang.String query)
           
 int hashCode()
           
 boolean isAbsolute()
          Return if Rid is absolute, e.g. start with a slash.
 boolean isAncestorOf(IRid child)
          Determine if this Rid is an ancestor (parent or parent's parent, etc.) of the given child Rid.
 boolean isAncestorOfOrSelf(IRid child)
          Determine if this Rid is an ancestor (parent or parent's parent, etc.) of the given child Rid or the same.
 boolean isRoot()
          Return if Rid is root collection.
 int length()
          Return length of Rid in string representation
 IRid name()
          Get the name of the resource, designated by this Rid.
 IRid parent()
          Get the Rid of the parent collection of this Rid
 IRid removeExtension()
          Remove the (optional) extension of the resource name.
 IRid removeName()
          Remove the name of the resource, same as parent()
 IRid removeRoot()
          Get a new Rid with the toplevel collection removed
 IRid removeTrailingSlash()
          Remove a possible trailing slash from the Rid.
 IRid resolveRelativeRid(java.lang.String uri)
          Resolve relative Rids
 IRid root()
          Get Rid of toplevel collection (below root) of this Rid.
 IRid setQueryParameter(java.util.Properties parameter)
          Create a new Rid by setting the given parameters as query part of this Rid.
 java.util.List split()
          Splits the Rid into its path components
 java.lang.String toExternalForm()
          Convert this Rid to a representation usable in RFC2396 URI references.
 java.lang.String toString()
          Returns string representation of this Rid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PATH_SEPARATOR

public static final char PATH_SEPARATOR
Constructor Detail

Rid

public Rid(java.lang.String path,
           java.lang.String query)
Deprecated. as of NW04. Use Rid.getRid(path, query)

Create a new Rid with given path and query string
Parameters:
path - of Rid
query - part or Rid (can be null)

Rid

public Rid(java.lang.String uri)
Deprecated. as of NW04. Use Rid.getRid(uri)

Create a new Rid from a string (possibly including a query part).

Parameters:
uri - TBD: Description of the incoming method parameter
Method Detail

getRid

public static IRid getRid(java.lang.String path,
                          java.lang.String query)

getRid

public static Rid getRid(java.lang.String uri)

encode

public Rid encode()
Deprecated. as of NW04. Rid objects are never encoded

Returns:
TBD: Description of the outgoing return value

decode

public Rid decode()
Deprecated. as of NW04. Rid objects are never decoded

Returns:
TBD: Description of the outgoing return value

toExternalForm

public java.lang.String toExternalForm()
Description copied from interface: IRid
Convert this Rid to a representation usable in RFC2396 URI references. Non-ASCII and reserved characters are encoded.

Note that such an encoded string cannot be used to construct an new Rid object! The path in Rid objects is never, ever encoded.

Specified by:
toExternalForm in interface IRid
Following copied from interface: com.sap.netweaver.bc.rf.common.IRid
Returns:
Rid suitable escaped as RFC2396 URI reference

getPath

public java.lang.String getPath()
Return the path component of this Rid.
Specified by:
getPath in interface IRid
Returns:
the path component

getQuery

public java.lang.String getQuery()
Return the query component of this Rid (null if it does not exist).
Specified by:
getQuery in interface IRid
Returns:
the query component

getQueryParameter

public java.util.Properties getQueryParameter()
Get the query parameters of the Rid. Will return an empty Properties object if Rid has no query part. Modifying the Properties object has no effect on the Rid itself.
Specified by:
getQueryParameter in interface IRid
Returns:
query parameters as Properties

root

public IRid root()
Get Rid of toplevel collection (below root) of this Rid.

The root Rid of a toplevel collection is the root collection Rid. The root Rid of the root Rid is the root Rid itself.

Specified by:
root in interface IRid
Returns:
Rid of toplevel collection below root

name

public IRid name()
Get the name of the resource, designated by this Rid. If the Rid has query parameter, these are discarded.
Specified by:
name in interface IRid
Returns:
the name of the resource, designated by this Rid

parent

public IRid parent()
Get the Rid of the parent collection of this Rid
Specified by:
parent in interface IRid
Returns:
the Rid of the parent collection

extension

public java.lang.String extension()
Get the extension part of the resource name. Returns the empty string if there is no extension.
Specified by:
extension in interface IRid
Returns:
the extension part of the resource name

removeRoot

public IRid removeRoot()
Get a new Rid with the toplevel collection removed
Specified by:
removeRoot in interface IRid
Returns:
Rid with toplevel collection removed

removeName

public IRid removeName()
Remove the name of the resource, same as parent()
Specified by:
removeName in interface IRid
Returns:
parent of the resource

removeExtension

public IRid removeExtension()
Remove the (optional) extension of the resource name. Query parameters are discarded.
Specified by:
removeExtension in interface IRid
Returns:
uri with extension of name removed

removeTrailingSlash

public IRid removeTrailingSlash()
Remove a possible trailing slash from the Rid. Query parameters are preserved.
Specified by:
removeTrailingSlash in interface IRid
Returns:
Rid without trailing slash

isAbsolute

public boolean isAbsolute()
Return if Rid is absolute, e.g. start with a slash.
Specified by:
isAbsolute in interface IRid
Returns:
if Rid is absolute path

isRoot

public boolean isRoot()
Return if Rid is root collection.
Specified by:
isRoot in interface IRid
Returns:
if this is the root collection

isAncestorOf

public boolean isAncestorOf(IRid child)
Determine if this Rid is an ancestor (parent or parent's parent, etc.) of the given child Rid.
Specified by:
isAncestorOf in interface IRid
Parameters:
child - to test against
Returns:
if this Rid is ancestor of child

isAncestorOfOrSelf

public boolean isAncestorOfOrSelf(IRid child)
Determine if this Rid is an ancestor (parent or parent's parent, etc.) of the given child Rid or the same.
Specified by:
isAncestorOfOrSelf in interface IRid
Parameters:
child - to test against
Returns:
if this Rid is ancestor of child

endsWithSlash

public boolean endsWithSlash()
Return if this Rid ends with a slash.
Specified by:
endsWithSlash in interface IRid
Returns:
if this Rid ends with a slash

add

public IRid add(java.lang.String uri)
Concatenate this Rid with the given Rid. Treats this Rid as if it ends with a slash and the parameter Rid as if it starts without a slash.

Note: do not use this method to add path segments, as the parameter is parsed as legal Rid, not as a legal Rid segment; use addPathSegment(String) instead.

Specified by:
add in interface IRid
Parameters:
uri - to append to this
Returns:
new Rid as concatenation

add

public IRid add(IRid uri)
Concatenate this Rid with the given Rid. Treats this Rid as if it ends with a slash and the parameter Rid as if it starts without a slash.
Specified by:
add in interface IRid
Parameters:
uri - to append to this
Returns:
new Rid as concatenation

split

public java.util.List split()
Splits the Rid into its path components
Specified by:
split in interface IRid
Returns:
List of Strings

toString

public java.lang.String toString()
Returns string representation of this Rid
Overrides:
toString in class java.lang.Object
Returns:
this Rid as string

equals

public boolean equals(IRid other)
Determine if this Rid equals other.
Parameters:
other - Rid
Returns:
if this Rid equals other

equals

public boolean equals(java.lang.Object other)
Determine if this Rid equals other. Equality is defined for instances of Rid only.
Overrides:
equals in class java.lang.Object
Parameters:
other -  
Returns:
if this Rid equals other

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

length

public int length()
Return length of Rid in string representation
Specified by:
length in interface IRid
Returns:
length of Rid in string representation

resolveRelativeRid

public IRid resolveRelativeRid(java.lang.String uri)
Resolve relative Rids
Specified by:
resolveRelativeRid in interface IRid
Parameters:
uri - An Rid, which may be relative or absolute
Returns:
TBD: Description of the outgoing return value

addPathSegment

public IRid addPathSegment(java.lang.String segment)
                    throws WcmException
Adds a path segment.
Specified by:
addPathSegment in interface IRid
Parameters:
segment - String containing the new path segment
Returns:
new Rid
Throws:
WcmException - if segment contains characters that aren't allowed in path segments

addQueryParameter

public IRid addQueryParameter(java.util.Properties parameter)
Deprecated. as of NW04. Use setQueryParameter

Create a new Rid by setting the given parameters as query part of this Rid.
Parameters:
parameter - to set to query
Returns:
new Rid with parameter in query

setQueryParameter

public IRid setQueryParameter(java.util.Properties parameter)
Create a new Rid by setting the given parameters as query part of this Rid.
Specified by:
setQueryParameter in interface IRid
Parameters:
parameter - to set to query
Returns:
new Rid with parameter in query

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.