com.apelon.dts.client.namespace
Class Namespace

java.lang.Object
  extended by com.apelon.dts.client.namespace.Namespace
All Implemented Interfaces:
Cloneable

public class Namespace
extends Object
implements Cloneable

Defines a Namespace. A Namespace defines a collection of concepts/terms in an Apelon knowledgebase.

To set the relative id, use setRelativeId(int) after constructing the namespace.

Copyright: Copyright (c) 2003

Company: Apelon, Inc.

Since:
DTS 3.0.0
Version:
DTS 3.4.0
Author:
Apelon, Inc.

Field Summary
static int LOCAL_NAMESPACE_ID_THRESHOLD
          Minimum local namespace ID.
static int MAXIMUM_NAMESPACE_ID
          Maximum namespace ID ( = 65535 ).
 
Constructor Summary
Namespace(String name, int id, String code, Authority authority, NamespaceType namespaceType, boolean writable, boolean isLocal)
          Namespace constructor.
Namespace(String name, int id, String code, Authority authority, NamespaceType namespaceType, int linkedNamespaceId, boolean writable, boolean local)
          Namespace constructor for namespaces of type Ontylog Extension.
 
Method Summary
 Object clone()
          Clone this Namespace object.
 boolean equals(Object o)
          Tests if two Namespaces are equal.
 Authority getAuthority()
          Gets Authority for the namespace.
 String getCode()
          Gets the code of the Namespace.
 ContentVersion getContentVersion()
          Returns the latest ContentVersion for this namespace.
 int getId()
          Gets the ID of the Namespace.
 int getLinkedNamespaceId()
          Returns the Linked Namespace ID.
 String getName()
          Gets the name of the Namespace.
 NamespaceType getNamespaceType()
          Gets type of namespace.
 int getRelativeId()
          Gets the namespace ID relative to a base of 0 for subscription namespaces, or to LOCAL_NAMESPACE_ID_THRESHOLD for a local namespace.
 int hashCode()
          Returns a hash code for this Namespace.
 boolean isLocal()
          Indicates whether the namespace is local or externally defined.
 boolean isWritable()
          Indicates whether it's permissible to write to this namespace.
 void setAuthority(Authority newAuthority)
          Sets the Authority for the Namespace.
 void setCode(String code)
          Sets the code of the Namespace.
 void setContentVersion(ContentVersion contentVersion)
          Sets the latest ContentVersion for this namespace.
 void setId(int id)
          Sets the ID of the Namespace.
 void setName(String name)
          Sets the name of the Namespace.
 void setNamespaceType(NamespaceType namespaceType)
          Deprecated. -- namespaceType can only be set in constructor since version 3.3
 void setRelativeId(int newId)
          Set namespace ID according to the convention that the ID for a local namespace must be at least LOCAL_NAMESPACE_ID_THRESHOLD.
 void setWritable(boolean writable)
          Indicate whether it's permissible to write to this namespace.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCAL_NAMESPACE_ID_THRESHOLD

public static int LOCAL_NAMESPACE_ID_THRESHOLD
Minimum local namespace ID. Namespace IDs lower than this threshold ( 32768 ) are reserved for nonlocal, subscription namespaces.


MAXIMUM_NAMESPACE_ID

public static int MAXIMUM_NAMESPACE_ID
Maximum namespace ID ( = 65535 ).

Constructor Detail

Namespace

public Namespace(String name,
                 int id,
                 String code,
                 Authority authority,
                 NamespaceType namespaceType,
                 boolean writable,
                 boolean isLocal)
Namespace constructor. This should be used for all namespace types except Ontylog Extension. The linked namesspace id is set to -1.

To set the relative id, use setRelativeId(int) after constructing the namespace.

Parameters:
name - name of the namespace
id - namespace ID
code - namespace code
authority - identified Authority for the namespace
namespaceType - NamespaceType of namespace (Ontylog, Thesaurus, Connection, or Ontylog Extension)
writable - namespace writable indicator
isLocal - indicator whether namespace is a local, non-subscription namespace

Namespace

public Namespace(String name,
                 int id,
                 String code,
                 Authority authority,
                 NamespaceType namespaceType,
                 int linkedNamespaceId,
                 boolean writable,
                 boolean local)
Namespace constructor for namespaces of type Ontylog Extension.

To set the relative id, use setRelativeId(int) after constructing the namespace.

Parameters:
name - name of the namespace
id - namespace ID
code - namespace code
authority - identified Authority for the namespace
namespaceType - NamespaceType of namespace (Ontylog, Thesaurus, Connection, or Ontylog Extension)
linkedNamespaceId - for use with NamespaceType Ontylog Extension only
writable - namespace writable indicator
local - indicator whether namespace is a local, non-subscription namespace
Since:
DTS 3.3.0
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Clone this Namespace object.

Overrides:
clone in class Object
Returns:
a clone of this Namespace.
Throws:
CloneNotSupportedException - if unable to create a clone

getName

public String getName()
Gets the name of the Namespace.

Returns:
name of the Namespace.

setName

public void setName(String name)
Sets the name of the Namespace.

Parameters:
name - the new name of the Namespace.

getId

public int getId()
Gets the ID of the Namespace.

Returns:
the ID of the Namespace.

setId

public void setId(int id)
Sets the ID of the Namespace.

Parameters:
id - the new ID of the Namespace.

getCode

public String getCode()
Gets the code of the Namespace.

Returns:
the code of the Namespace.

setCode

public void setCode(String code)
Sets the code of the Namespace.

Parameters:
code - the new code of the Namespace.

setRelativeId

public void setRelativeId(int newId)
Set namespace ID according to the convention that the ID for a local namespace must be at least LOCAL_NAMESPACE_ID_THRESHOLD. If a namespace ID less than LOCAL_NAMESPACE_ID_THRESHOLD is passed for a local namespace, the ID will be incremented by LOCAL_NAMESPACE_ID_THRESHOLD.

Parameters:
newId - the new namespace ID

getRelativeId

public int getRelativeId()
Gets the namespace ID relative to a base of 0 for subscription namespaces, or to LOCAL_NAMESPACE_ID_THRESHOLD for a local namespace.

Returns:
relative namespace ID

setAuthority

public void setAuthority(Authority newAuthority)
Sets the Authority for the Namespace.

Parameters:
newAuthority - the new Authority for the Namespace

getAuthority

public Authority getAuthority()
Gets Authority for the namespace.

Returns:
Namespace Authority

setNamespaceType

public void setNamespaceType(NamespaceType namespaceType)
Deprecated. -- namespaceType can only be set in constructor since version 3.3

Sets the type of the namespace to one of the values designated by the NamespaceType class.

Parameters:
namespaceType - namespace type

getNamespaceType

public NamespaceType getNamespaceType()
Gets type of namespace. The possible values are:

Returns:
namespace type

getLinkedNamespaceId

public int getLinkedNamespaceId()
Returns the Linked Namespace ID. The linked namespace is an Ontylog namespace for a local Ontylog extension Namespace.

Returns:
linkedNamespaceId Id of the linked namespace if present, else -1
Since:
DTS 3.3.0

setWritable

public void setWritable(boolean writable)
Indicate whether it's permissible to write to this namespace.

Parameters:
writable - true if the namespace is to be writable; false if not.

isWritable

public boolean isWritable()
Indicates whether it's permissible to write to this namespace.

Returns:
true if the namespace is writable; false if not.

isLocal

public boolean isLocal()
Indicates whether the namespace is local or externally defined.

Returns:
true if the namespace is local; false otherwise

getContentVersion

public ContentVersion getContentVersion()
Returns the latest ContentVersion for this namespace. For subscription namespaces this is the latest version in the knowledgebase. A local namespace will have version only if it has been previously published.

Returns:
The latest ContentVersion.
Since:
DTS 3.4.0

setContentVersion

public void setContentVersion(ContentVersion contentVersion)
Sets the latest ContentVersion for this namespace. This field is usually set by the server when this object is built.

Parameters:
contentVersion - The latest ContentVersion.
Since:
DTS 3.4.0

equals

public boolean equals(Object o)
Tests if two Namespaces are equal. Two Namespace are equal if the following are true:

Overrides:
equals in class Object
Parameters:
o - object to compare with
Returns:
true if the two namespaces are equal; false otherwise

hashCode

public int hashCode()
Returns a hash code for this Namespace.

Overrides:
hashCode in class Object
Returns:
a hash code value for this Namespace.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.