com.ibm.workplace.wcm.api.identity
Interface IdentityBuilder


public interface IdentityBuilder

Converts between DocumentId's and ReST URIs

Since:
8.5

Method Summary
 boolean isRestURI(java.net.URI uri)
          Determine if the provided URI is a valid ReST URI.
 RestURI toRestURI(DocumentId<?> id)
          Converts the given document id into a canonical form of the ReST URI for the same item.
 RestURI toRestURI(java.net.URI restUri)
          Converts a java.net.URI that refers to a WCM item into a RestURI for the same item.
 

Method Detail

toRestURI

RestURI toRestURI(DocumentId<?> id)
                  throws IdentityCreationException,
                         java.net.URISyntaxException
Converts the given document id into a canonical form of the ReST URI for the same item.

An example canonical URI is;
wcmrest:Content/1234-1234-1234-1234

The ReST representation of an item can be retrieved using the canonical representation by issuing a GET request of the form;
http://myserver.com/wps/mypoc?uri=wcmrest:Content/1234-1234-1234-1234&mode=download

Alternatively, the expanded URI can be determined by issuing a GET request of the form
http://myserver.com/wps/mypoc?uri=wcmrest:Content/1234-1234-1234-1234&mode=lookup
This will return XML specifying the expanded URI.

Parameters:
id - the document id to convert
Returns:
the rest URI, never null
Throws:
IdentityCreationException - if there is an error during conversion
java.net.URISyntaxException - if there is a syntax error with the generated URI
java.lang.IllegalArgumentException - if the provided DocumentId is null

toRestURI

RestURI toRestURI(java.net.URI restUri)
                  throws IdentityCreationException
Converts a java.net.URI that refers to a WCM item into a RestURI for the same item.

Parameters:
restUri - the ReST URI
Returns:
the document id for the item specified, never null
Throws:
com.ibm.workplace.wcm.api.exceptions.DocumentIdCreationException - if there is an error during conversion
IdentityCreationException - if there is an error during conversion
java.lang.IllegalArgumentException - if the provided URI is null, or not a valid rest URI

isRestURI

boolean isRestURI(java.net.URI uri)
Determine if the provided URI is a valid ReST URI. Such that, calling #toDocumentId(URI) with the URI will not result in an exception being thrown.

Parameters:
uri - the URI to check
Returns:
true if the URI is a valid ReST URI false otherwise