TableUtils - Global
-
- UpdatedAug 1, 2024
- 5 minutes to read
- Xanadu
- API reference
The TableUtils script include provides shortcuts for accessing table related information.
This class is available to server-side scripts.
TableUtils - TableUtils(String tableName)
Creates an instance of a TableUtils class.
Name | Type | Description |
---|---|---|
tableName | String | The table name |
Example
TableUtils - drop(String tableName)
Drops a database table.
Name | Type | Description |
---|---|---|
tableName | String | Name of the table to drop |
Type | Description |
---|---|
void |
Example
TableUtils - dropAndClean(String tableName)
Drops a database table and cleans up references to the table.
Name | Type | Description |
---|---|---|
tableName | String | Name of the table to drop |
Type | Description |
---|---|
void |
Example
TableUtils - dropTableAndExtensions(String tableName)
Drops a database table, all of it's extended tables, and cleans up references to the tables.
Name | Type | Description |
---|---|---|
tableName | String | The table to drop |
Type | Description |
---|---|
void |
Example
TableUtils - getAbsoluteBase()
Returns the base table name from which the table was extended.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Base table name |
Example
Output: cmdb_ci
TableUtils - getAllExtensions()
Returns the list of tables that extend a table, includes the base table.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
ArrayList | A list of tables that extend the table, includes the base table. |
Example
TableUtils - getHierarchy()
Returns a list of all classes participating in the hierarchy of the specified table.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
ArrayList | A list of all classes in the specified table's hierarchy. |
Example
Output: [cmdb_ci_server, cmdb_ci_computer, cmdb_ci_hardware, cmdb_ci, cmdb_ci_mainframe, cmdb_ci_linux_server, cmdb_ci_mainframe_lpar, cmdb_ci_esx_server, cmdb_ci_unix_server, cmdb_ci_solaris_server, cmdb_ci_hpux_server, cmdb_ci_aix_server, cmdb_ci_osx_server, cmdb_ci_netware_server, cmdb_ci_win_server]
TableUtils - getTables()
Returns the table hierarchy.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
ArrayList | A list of table names in the parent hierarchy. |
Example
TableUtils - getTableExtensions()
Returns a list of tables that extend a table.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
ArrayList | A list of table names that extend the table. |
Example
This example shows that 58 tables in this instance extend the Computer [cmdb_ci_computer] table. (Output condensed below.)
TableUtils - hasExtensions()
Determines if a table has been extended.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | True if the table has extensions. |
Example
TableUtils - isBaseClass()
Determines if a table is a base class, meaning it has no parents and has extensions.
For example, Task is a base class since it is not extended from another table and has tables extended from it. Sys_user is not a base class because it has no parents, but does not have extensions.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | Flag that indicates whether a table is a base class table meaning it has no
parents but has extensions. Valid values:
|
Example
TableUtils - isSoloClass()
Determines if the table has no parents and no extensions.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | True if the table has no parent and no table is extended from it. |
Example
TableUtils - tableExists()
Checks to see if a table exists.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | True if the table exists. |
Example
Output: Does 'my_table' exist? false
On this page
- TableUtils - TableUtils(String tableName)
- TableUtils - drop(String tableName)
- TableUtils - dropAndClean(String tableName)
- TableUtils - dropTableAndExtensions(String tableName)
- TableUtils - getAbsoluteBase()
- TableUtils - getAllExtensions()
- TableUtils - getHierarchy()
- TableUtils - getTables()
- TableUtils - getTableExtensions()
- TableUtils - hasExtensions()
- TableUtils - isBaseClass()
- TableUtils - isSoloClass()
- TableUtils - tableExists()