com.bea.content
Class ID

java.lang.Object
  extended by com.bea.content.ID
All Implemented Interfaces
Serializable, Cloneable

public class ID
extends Object
implements Serializable, Cloneable

The ID of a content element. The id includes the name of the Repository where it resides and also the opaque unique id given by the repository. When VCR client code creates a ContentEntity, such as an ObjectClass, the repositoryName must be set, but the uid would be null (since it hasn't been created yet).

See Also
Serialized Form

Constructor Summary
ID()
          Empty constructor.
ID(String uid)
          Constructor with just the id.
ID(String repositoryName, String uid)
          Constructor with repositoryName and opaque uid.
 
Method Summary
 Object clone()
          Clones an ID.
 int compareTo(Object obj)
          Compares this ID to obj
 boolean equals(Object o)
          Checks equality.
static ID fromString(String id)
          Parses an id in path format and creates an ID instance from it.
 String getRepositoryName()
          Gets the name of the repository where the content element resides.
 String getUid()
          Retrieve the opaque repository unique id, as configured by the repository, for the content element.
 int hashCode()
          Returns a hash code value for the object.
 boolean hasUid()
          Returns true if the uid is neither null nor the empty String.
 void setRepositoryName(String repositoryName)
          Sets the name of the repository where the content element resides.
 void setUid(String uid)
          Sets the repository unique id for the content element.
 String toString()
          Returns ID in unix-path like format.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ID

public ID()
Empty constructor.


ID

public ID(String uid)
Constructor with just the id. Most useful for SPI implementation code which knows the uid, but not the repositoryName. The repositoryName will be set by the VCR.


ID

public ID(String repositoryName,
          String uid)
Constructor with repositoryName and opaque uid. This constructor can be used by VCR client code, which knows the repositoryName.

When creating a ContentEntity, such as an ObjectClass, the repositoryName must be set, but the uid would be null (since it is assigned by the repository, and the entity hasn't been created yet).

When retrieving children of the repository root Node, the repositoryName must be set, and the uid must be null or the empty string.

Method Detail

getRepositoryName

public String getRepositoryName()
Gets the name of the repository where the content element resides.


setRepositoryName

public void setRepositoryName(String repositoryName)
Sets the name of the repository where the content element resides.


getUid

public String getUid()
Retrieve the opaque repository unique id, as configured by the repository, for the content element.


setUid

public void setUid(String uid)
Sets the repository unique id for the content element.

This method should generally only be called by the repository, except when VCR client code wants to retrieve children of the repository root node, which has a uid of null or the empty string.


hasUid

public boolean hasUid()
Returns true if the uid is neither null nor the empty String.


fromString

public static ID fromString(String id)
Parses an id in path format and creates an ID instance from it. Below are valid example combinations.
  • /repo/123 - repositoryName will be "repo" and uid will be "123"
  • /repo - repositoryName will be "repo" and uid will be an empty string.
  • repo - repositoryName will be "repo" and uid will be an empty string.

    Parameters
    id - in the format /repository/uid
    Returns
    ID the new ID.

  • toString

    public String toString()
    Returns ID in unix-path like format. For example, an ID with repositoryName = "Repo" and uid = "123" would be returned as "/Repo/123".

    Overrides:
    toString in class Object

    compareTo

    public int compareTo(Object obj)
    Compares this ID to obj


    equals

    public boolean equals(Object o)
    Checks equality. O is equal to this if the repositoryName and the uid are logically equivalent.

    Overrides:
    equals in class Object
    Parameters
    o - the object to check equality on.
    Returns
    true if o is equal to this, false otherwise.

    hashCode

    public int hashCode()
    Returns a hash code value for the object.

    Overrides:
    hashCode in class Object

    clone

    public Object clone()
                 throws CloneNotSupportedException
    Clones an ID.

    Overrides:
    clone in class Object
    Returns
    A clone of the ID.
    Throws
    CloneNotSupportedException - If the clone fails.


    Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
    Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
    Other names may be trademarks of their respective owners.