2.17.2: 2011-06-17

net.sf.basedb.core
Class SystemItems

java.lang.Object
  extended by net.sf.basedb.core.SystemItems

public class SystemItems
extends Object

This class is used to map the system id of all SystemData items to the numerical internal id in the current installation. This information is initialised at startup and is then kept in memory.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Field Summary
private static boolean isInitialised
           
private static int[] roleKeys
          An array to hold mappings for RoleKeyData: RoleKeyData.itemType --> RoleKeyData.id
private static Map<String,Integer> systemIds
          A map from system id --> numeric id
 
Constructor Summary
SystemItems()
           
 
Method Summary
(package private) static void add(SystemData item)
          Register a system item.
(package private) static void addRoleKey(RoleKeyData roleKey)
          Register a role key.
static int getId(String systemId)
          Get the numeric id for an item when you know the system id.
static int getRoleKeyId(Item itemType)
          Get the numeric id for a RoleKey when you know the Item type of the RoleKey.
(package private) static void init()
          Initialize the class and load all mappings for item.systemId --> item.id and for RoleKeyData.itemType --> RoleKeyData.id
(package private) static void unload()
          Unload all settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isInitialised

private static boolean isInitialised

systemIds

private static Map<String,Integer> systemIds
A map from system id --> numeric id


roleKeys

private static int[] roleKeys
An array to hold mappings for RoleKeyData: RoleKeyData.itemType --> RoleKeyData.id

Constructor Detail

SystemItems

public SystemItems()
Method Detail

init

static void init()
          throws BaseException
Initialize the class and load all mappings for item.systemId --> item.id and for RoleKeyData.itemType --> RoleKeyData.id

Throws:
BaseException - If there is an error

unload

static void unload()
Unload all settings.


add

static void add(SystemData item)
Register a system item. Used by the Install class while creating new items.


getId

public static int getId(String systemId)
Get the numeric id for an item when you know the system id.

Parameters:
systemId - The system id string
Returns:
The numeric id of the item, or 0 if it could not be found

addRoleKey

static void addRoleKey(RoleKeyData roleKey)
Register a role key. Used by the Install class while creating new items.


getRoleKeyId

public static int getRoleKeyId(Item itemType)
Get the numeric id for a RoleKey when you know the Item type of the RoleKey.

Parameters:
itemType - The item type code as defined by the Item class
Returns:
The numeric id for the RoleKey

2.17.2: 2011-06-17