Interface ItemTypeRegistry
public interface ItemTypeRegistry
ItemTypeRegistry is an internal service that provides mapping of all known item type keys (module keys)
to int values (primary keys in a db table).
The underlying table is append-only; once the key is encountered, it is enumerated and will be kept in the database forever.
The values of item type registry must not be exported during backup, or during any other export process. They are local to this instance.
-
Method Summary
Modifier and TypeMethodDescriptionintgetOrCreateTypeId(String key) Retrieves a numeric ID for a given item type key.getTypeKey(int id) Retrieves the key of an item type, based on its ID.
-
Method Details
-
getTypeKey
Retrieves the key of an item type, based on its ID. The ID must be previously received by callinggetOrCreateTypeId(String).- Parameters:
id- the ID of the item type- Returns:
- the key of the item type, never null
- Throws:
ItemTypeNotFoundException- if the item ID is not known todo should the exception be checked? wait for usagesStructureRuntimeException
-
getOrCreateTypeId
Retrieves a numeric ID for a given item type key. If this is the first time such key is used, an entry in the database is created and ID is assigned. In all later cases, the assigned ID is always returned from this method.- Parameters:
key- item type key, must not be null- Returns:
- an integer used as the ID of the given item type key
- Throws:
StructureRuntimeException
-