public class VirtualDb extends ChildItem
This class is not intended to be exposed to client applications. It is only used internally to handle the creation and deletion of the tables in the dynamic database.
The names of the dynamic tables depends on the ID of this object. The name
is generated by the VirtualTable
enumeration.
VirtualTable
,
VirtualColumn
Modifier and Type | Field and Description |
---|---|
private static boolean |
debugSqlEnabled
So we don't always have to call logSql.debug()
|
private static org.slf4j.Logger |
logSql
Log all SQL statements.
|
static Item |
TYPE
The type of item represented by this class.
|
Constructor and Description |
---|
VirtualDb(VirtualDbData data)
Creates a new experiment item from the given data.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
createTables(VirtualTable... tables)
Create the real database tables for this virtual database.
|
(package private) int |
deleteAllCubeData(short cubeNo)
Delete all analysed data for the specified data cube.
|
(package private) int |
deleteAllCubeExtraValueData(short cubeNo,
short extraNo,
VirtualTable extraTable)
Delete all extra value data for the specified extra value type in the
specified data cube.
|
(package private) int |
deleteAllCubeFilterData(short cubeNo,
short filterNo)
Delete all analysed data for the specified filter in the specified data cube.
|
(package private) int |
deleteAllCubeLayerData(short cubeNo,
short layerNo)
Delete all analysed data for the specified layer in the specified data cube.
|
private void |
dropAllTables()
Drop all real database tables in this virtual database.
|
(package private) static VirtualDb |
getById(DbControl dc,
int id)
Get a
VirtualDb item when you know the id. |
short |
getCubes()
Get the number of
DataCube :s in this virtual database. |
(package private) VirtualDbData |
getData()
Get the
BasicData object that holds all data for this item. |
Experiment |
getExperiment()
Get the experiment this set of tables stores data for.
|
short |
getMappings()
Get the number of DataCubeMapping:s in this virtual database.
|
(package private) static VirtualDb |
getNew(DbControl dc)
Create a new
DynamicTables item. |
(package private) short |
getNextCubeNo()
Generate the next available cube number.
|
(package private) Permission |
getPermissionForWriteDeleteAndCreate()
USE permission is enough to be able to manage virtual db.
|
Filter<String> |
getQueryPropertyInspector()
Return a filter that can be used to check that a query is only
using cloned reporter properties for sorting, filtering, etc.
|
RawDataType |
getRawDataType()
Get the raw data type the experiment uses for the raw data.
|
ReporterCloneTemplate |
getReporterCloneTemplate()
Get the reporter clone template that is active in the current virtual database.
|
(package private) SharedData |
getSharedParent()
Get the experiment.
|
Item |
getType()
Get the type of item represented by the object.
|
boolean |
hasClonedReporterProperty(String propertyName)
Checks if this virtual db has cloned the given reporter property or not.
|
boolean |
hasClonedReporters()
Check if this virtual db is storing cloned reporter information or not.
|
boolean |
hasTable(VirtualTable table)
Check if a real database table for this virtual database exists.
|
(package private) DataCube |
newDataCube()
Create a new data cube in this virtual database.
|
(package private) void |
onAfterCommit(Transactional.Action action)
Remove all dynamic tables if action == Action.DELETE
|
getPermissionForUse, getPluginPermissions, initPermissions
addUsingItems, addUsingItems, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
private static final org.slf4j.Logger logSql
private static final boolean debugSqlEnabled
public static final Item TYPE
Item.VIRTUALDB
,
getType()
VirtualDb(VirtualDbData data)
data
- the datastatic VirtualDb getNew(DbControl dc) throws BaseException
DynamicTables
item.dc
- The DbControl
which will be used for
permission checking and database access.DynamicTables
itemBaseException
- If there is an errorstatic VirtualDb getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
VirtualDb
item when you know the id.dc
- The DbControl
which will be used for
permission checking and database access.id
- The id of the item to loadVirtualDb
itemItemNotFoundException
- If an item with the specified id
is not foundPermissionDeniedException
- If the logged in user doesn't have
Permission.READ
permission to the itemBaseException
- If there is another errorVirtualDbData getData()
BasicItem
BasicData
object that holds all data for this item.public Item getType()
Identifiable
Item
enumeration.void onAfterCommit(Transactional.Action action)
onAfterCommit
in class BasicItem
Transactional
,
Developer documentation: Transactions,
Developer documentation: Coding rules and guidelines for item classesSharedData getSharedParent()
getSharedParent
in class ChildItem
Permission getPermissionForWriteDeleteAndCreate()
getPermissionForWriteDeleteAndCreate
in class ChildItem
public RawDataType getRawDataType()
RawDataType
objectpublic Experiment getExperiment() throws PermissionDeniedException, BaseException
Experiment
objectPermissionDeniedException
- If the logged in user doesn't have
read permission to the experimentBaseException
- If there is another errorpublic ReporterCloneTemplate getReporterCloneTemplate()
ReporterCloneTemplate
(locked) or nullpublic boolean hasClonedReporters()
public boolean hasClonedReporterProperty(String propertyName)
propertyName
- The name of a reporter propertypublic Filter<String> getQueryPropertyInspector()
ItemContext.setPropertyInspector(Filter)
public short getCubes()
DataCube
:s in this virtual database.
Each new data cube increases this value with one.short getNextCubeNo() throws BaseException
getCubes()
property by one.BaseException
public short getMappings()
DataCube newDataCube() throws PermissionDeniedException, BaseException
getCubes()
.void createTables(VirtualTable... tables) throws BaseException
tables
- The tables to createBaseException
HibernateUtil.createVirtualTable(VirtualDb, VirtualTable)
public boolean hasTable(VirtualTable table) throws BaseException
table
- The table to checkBaseException
- If there is some kind of error.HibernateUtil.virtualTableExists(VirtualDb, VirtualTable)
private void dropAllTables() throws BaseException
BaseException
HibernateUtil.dropVirtualTable(VirtualDb, VirtualTable)
int deleteAllCubeData(short cubeNo) throws BaseException
cubeNo
- The number of the cubeBaseException
DataCube.onBeforeCommit(Transactional.Action)
int deleteAllCubeLayerData(short cubeNo, short layerNo) throws BaseException
cubeNo
- The number of the cubelayerNo
- The number of the layerBaseException
DataCubeLayer.onBeforeCommit(Transactional.Action)
int deleteAllCubeFilterData(short cubeNo, short filterNo) throws BaseException
cubeNo
- The number of the cubefilterNo
- The number of the filterBaseException
DataCubeFilter.onBeforeCommit(Transactional.Action)
int deleteAllCubeExtraValueData(short cubeNo, short extraNo, VirtualTable extraTable) throws BaseException
cubeNo
- The number of the cubeextraNo
- The number of the extra value typeBaseException
DataCubeExtraValue.onBeforeCommit(Transactional.Action)