Fido Alpha 3.2

fido.db
Class ClassLinkTypeTable

java.lang.Object
  |
  +--fido.db.ClassLinkTypeTable

public class ClassLinkTypeTable
extends java.lang.Object

Holds a list of ClassLinkTypes. The list is a hashtable that maps link names to ClassLinkType objects. The list is stored in a database file. After each add, update, or removal of a ClassLinkType, the list is updated in the database.

See Also:
ClassLinkType

Field Summary
static int SYSTEM_LINK
          Used for the type of link value.
static int USER_LINK
          Used for the type of link value.
 
Constructor Summary
ClassLinkTypeTable()
          Constructs a new ClassLinkTypeList with no entries in the list.
 
Method Summary
 void add(java.lang.String name)
          Adds or modifies a ClassLinkType.
 boolean contains(java.lang.String name)
          Tests for the existance of a link type.
 void delete(java.lang.String name)
          Removes the ClassLinkType referenced by the parameters name.
 boolean isSystemLink(java.sql.Statement stmt, java.lang.String name)
           
 java.util.Collection list()
          Returns the names of all ClassLinkType entries in the list.
 java.util.Collection listLinkNames()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_LINK

public static final int SYSTEM_LINK
Used for the type of link value. This value specifies the Fido system created the link, and a user may not modify or delete it.

See Also:
Constant Field Values

USER_LINK

public static final int USER_LINK
Used for the type of link value. This value is the default for users adding link types. Other users may modify or delete it.

See Also:
Constant Field Values
Constructor Detail

ClassLinkTypeTable

public ClassLinkTypeTable()
Constructs a new ClassLinkTypeList with no entries in the list. The database reference is stored so any updates will store in the database. Upon creation, this class will write itself to the database. If an entry with the name ClassLinkTypeList already exists in the database, the object it points to is replaced.

Throws:
FidoIOException - Input / Output error on creating the ClassLinkTypeList object
Method Detail

add

public void add(java.lang.String name)
         throws FidoDatabaseException
Adds or modifies a ClassLinkType. The name parameter is the string used to reference the object in the list. If an entry with this name already is in the list, the object replaced with the linkType object parameter.

The Fido system has a constraint that every link field name must be unique. Therefore, the forward and backward fields of the ClassLinkType parameter are searched for in every other link type in the system. If any other enter contains the same field name, a DupulicateClassLinkField exception is thrown.

If there is not duplicate field exception, the list is not updated in the database file.

The forward field cannot be null. If it is, a NullPointerException is thrown.

Throws:
FidoIOException - Input / Output error saving ClassLinkTypeList
DuplicateLinkFieldException - thrown if a field in the linkType parameter already exists in another ClassLinkType.
java.lang.NullPointerException - thrown if the forwardField is null.
FidoDatabaseException

isSystemLink

public boolean isSystemLink(java.sql.Statement stmt,
                            java.lang.String name)
                     throws java.sql.SQLException,
                            ClassLinkTypeNotFoundException
Throws:
FidoIOException - Input / Output error saving ClassLinkTypeList
java.sql.SQLException
ClassLinkTypeNotFoundException

delete

public void delete(java.lang.String name)
            throws FidoDatabaseException,
                   CannotDeleteSystemLinkException,
                   ClassLinkTypeNotFoundException
Removes the ClassLinkType referenced by the parameters name. If the list contains no entery with that name, this call does nothing. The list is only updated in the database file if the link type was acutally removed.

Parameters:
name - Name of the ClassLinkType to remove
Throws:
FidoIOException - Input / Output error saving ClassLinkTypeList
CannotDeleteSystemLinkException - Attempt to delete a link deemed as a System link. These cannot be modified, but ususally have another method of modifying the link.
FidoDatabaseException
ClassLinkTypeNotFoundException

contains

public boolean contains(java.lang.String name)
                 throws FidoDatabaseException
Tests for the existance of a link type.

Parameters:
name - Name of the ClassLinkType to test for
Returns:
true if the link type is in the list, false otherwise
FidoDatabaseException

list

public java.util.Collection list()
                          throws FidoDatabaseException
Returns the names of all ClassLinkType entries in the list. The names of the link types are in alphabetical order.

Returns:
list of link type names
FidoDatabaseException

listLinkNames

public java.util.Collection listLinkNames()
                                   throws FidoDatabaseException
FidoDatabaseException

Fido Alpha 3.2