SAP NetWeaver '04

com.sapportals.wcm.util.uri
Class RID

[contained in: com.sap.netweaver.bc.util.par - bc.util.public_api.jar]
java.lang.Object
  |
  +--com.sapportals.wcm.util.uri.RID
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

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

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-2004

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
 RID add(RID uri)
          Concatenate this RID with the given RID.
 RID add(java.lang.String uri)
          Concatenate this RID with the given RID.
 RID addPathSegment(java.lang.String segment)
          Adds a path segment.
 RID 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(java.lang.Object other)
          Determine if this RID equals other.
 boolean equals(RID other)
          Determine if this RID equals other.
 boolean equals(java.lang.String 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 RID 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(RID child)
          Determine if this RID is an ancestor (parent or parent's parent, etc.) of the given child RID.
 boolean isAncestorOfOrSelf(RID 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
 RID name()
          Get the name of the resource, designated by this RID.
 RID parent()
          Get the RID of the parent collection of this RID
 RID removeExtension()
          Remove the (optional) extension of the resource name.
 RID removeName()
          Remove the name of the resource, same as parent()
 RID removeRoot()
          Get a new RID with the toplevel collection removed
 RID removeTrailingSlash()
          Remove a possible trailing slash from the RID.
 RID resolveRelativeRID(java.lang.String uri)
          Resolve relative RIDs
 RID root()
          Get RID of toplevel collection (below root) of this RID.
 RID 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()
           
 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 RID 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()

getPath

public java.lang.String getPath()
Return the path component of this RID.
Returns:
the path component

getQuery

public java.lang.String getQuery()
Return the query component of this RID (null if it does not exist).
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.
Returns:
query parameters as Properties

root

public RID 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.

Returns:
RID of toplevel collection below root

name

public RID name()
Get the name of the resource, designated by this RID. If the RID has query parameter, these are discarded.
Returns:
the name of the resource, designated by this RID

parent

public RID parent()
Get the RID of the parent collection of this RID
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.
Returns:
the extension part of the resource name

removeRoot

public RID removeRoot()
Get a new RID with the toplevel collection removed
Returns:
RID with toplevel collection removed

removeName

public RID removeName()
Remove the name of the resource, same as parent()
Returns:
parent of the resource

removeExtension

public RID removeExtension()
Remove the (optional) extension of the resource name. Query parameters are discarded.
Returns:
uri with extension of name removed

removeTrailingSlash

public RID removeTrailingSlash()
Remove a possible trailing slash from the RID. Query parameters are preserved.
Returns:
RID without trailing slash

isAbsolute

public boolean isAbsolute()
Return if RID is absolute, e.g. start with a slash.
Returns:
if RID is absolute path

isRoot

public boolean isRoot()
Return if RID is root collection.
Returns:
if this is the root collection

isAncestorOf

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

isAncestorOfOrSelf

public boolean isAncestorOfOrSelf(RID child)
Determine if this RID is an ancestor (parent or parent's parent, etc.) of the given child RID or the same.
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.
Returns:
if this RID ends with a slash

add

public RID 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.

Parameters:
uri - to append to this
Returns:
new RID as concatenation

add

public RID add(RID 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.
Parameters:
uri - to append to this
Returns:
new RID as concatenation

split

public java.util.List split()
Splits the RID into its path components
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(RID other)
Determine if this RID equals other.
Parameters:
other - RID
Returns:
if this RID equals other

equals

public boolean equals(java.lang.String other)
Determine if this RID equals other.
Parameters:
other - RID (string representation)
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
Returns:
length of RID in string representation

resolveRelativeRID

public RID resolveRelativeRID(java.lang.String uri)
Resolve relative RIDs
Parameters:
uri - An RID, which may be relative or absolute
Returns:
TBD: Description of the outgoing return value

addPathSegment

public RID addPathSegment(java.lang.String segment)
                   throws WcmException
Adds a path segment.
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 RID 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 RID setQueryParameter(java.util.Properties parameter)
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

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.