© 2005 BEA Systems, Inc.

com.bea.content
Class ID

java.lang.Object
  extended bycom.bea.content.ID
All Implemented Interfaces:
Serializable

public class ID
extends Object
implements Serializable

The ID of a content element. The id includes the name of the Repository where it resides and also the unique id given by the repository.

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 uid.
 
Method Summary
 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()
          Gets the repository unique id for the content element.
 int hashCode()
           
 boolean hasUid()
          Returns true if the id is not null and not an 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
clone, 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 an SPI implementation where the uid is known, but not the repositoryName as it will be set by the management layer.


ID

public ID(String repositoryName,
          String uid)
Constructor with repositoryName and uid. When creating a ContentEntity, such as a Node, the repositoryName must be set, but the uid would be null (since it hasn't been created yet).

Method Detail

equals

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

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

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.

  • getRepositoryName

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


    getUid

    public String getUid()
    Gets the repository unique id for the content element.


    hashCode

    public int hashCode()

    hasUid

    public boolean hasUid()
    Returns true if the id is not null and not an empty String.


    setRepositoryName

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


    setUid

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


    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".


    © 2005 BEA Systems, Inc.

    Copyright © 2005 BEA Systems, Inc. All Rights Reserved