org.ujorm.orm.metaModel
Class MetaTable

java.lang.Object
  extended by org.ujorm.extensions.SuperAbstractUjo
      extended by org.ujorm.extensions.AbstractUjo
          extended by org.ujorm.orm.AbstractMetaModel
              extended by org.ujorm.orm.metaModel.MetaTable
All Implemented Interfaces:
Serializable, UjoCloneable, UjoTextable, TableWrapper, Ujo

public final class MetaTable
extends AbstractMetaModel
implements TableWrapper

DB table or view meta-model.

Author:
Pavel Ponec
See Also:
Serialized Form

Field Summary
static Key<MetaTable,String> ALIAS
          The unique table/view name over all Databases in scope one OrmHandler
static ListKey<MetaTable,MetaColumn> COLUMNS
          Table Columns (no relations)
static Key<MetaTable,String> COMMENT
          Comment of the database table
static Key<MetaTable,MetaDatabase> DATABASE
          Database
static Key<MetaTable,RelationToMany> DB_PROPERTY
          Database relative property (a base definition of table)
static Key<MetaTable,String> ID
          The meta-model id
static Key<MetaTable,String> NAME
          DB table name
static Key<MetaTable,Orm2ddlPolicy> ORM2DLL_POLICY
          A policy to defining the database structure by a DDL.
static Key<MetaTable,MetaPKey> PK
          Unique Primary Key
static Key<MetaTable,Boolean> READ_ONLY
          The state read-only for the database.
static ListKey<MetaTable,MetaRelation2Many> RELATIONS
          Table relations to many
static Key<MetaTable,String> SELECT
          SQL SELECT statement
static Key<MetaTable,MetaSelect> SELECT_MODEL
          SQL SELECT model.
static Key<MetaTable,String> SEQUENCE
          Name of DB sequence.
static Key<MetaTable,String> SCHEMA
          Name of table schema.
static Key<MetaTable,Boolean> VIEW
          Is it a model of a database view or table ?
 
Constructor Summary
MetaTable()
          No parameter constructor.
MetaTable(MetaDatabase database, RelationToMany dbProperty, MetaTable parTable)
          Create new MetaTable.
 
Method Summary
 void assertChangeAllowed()
          Asssert that the table may be changed.
 void assignPrimaryKey(OrmUjo bo, Session session)
          Assign a PK from framework
 OrmUjo createBO()
          Returns a new instance or the BO.
 boolean equals(Object obj)
          Compare object by the same instance.
 String getAlias()
          Returns a unique table name over all Databases of the one OrmHandler.
 List<? extends ColumnWrapper> getColumns()
          Returns all columns
 String getComment()
          Get a Comment from meta-model annotation.
 MetaDatabase getDatabase()
          Returns the database
 MetaColumn getFirstPK()
          Returns the first PK
 List<MetaColumn> getForeignColumns()
          Get all foreign columns
 Collection<MetaIndex> getIndexCollection()
          Create a new collection of the table indexes.
 MetaTable getModel()
          Return an instance of Meta Model
 Orm2ddlPolicy getOrm2ddlPolicy()
          Returns Orm2DDl policy
 OrmUjo getParent(OrmUjo bo)
          Returns a parrent of the parameter or the null if no parent was not found.
 UjoSequencer getSequencer()
          UJO sequencer
 Class<OrmUjo> getType()
          Returns a base table class.
 boolean isCommented()
          Has the instance assigned a non empty comment?
 boolean isDefaultSchema()
          Has this table assigned the database default database schema ?
 boolean isPersistent()
          Is the instance a database relation model?
 boolean isReadOnly()
          Have the table got a READ-ONLU mode ?
 boolean isSelectModel()
          Is the query from a SQL select model ?
 boolean isTable()
          Is the instance a database persistent table?
 boolean isView()
          Is the instance a database relation model?
 void setNotPersistent()
          Database model is not persistent.
 
Methods inherited from class org.ujorm.orm.AbstractMetaModel
get, changeDefault, checkReadOnly, isFilled, isFilled, readAuthorization, readOnly, setReadOnly, writeValue
 
Methods inherited from class org.ujorm.extensions.AbstractUjo
newCamelFactory, newFactory, readValue
 
Methods inherited from class org.ujorm.extensions.SuperAbstractUjo
clone, init, init, readKeys, readProperties, readUjoManager, readValueString, toString, writeValueString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public static final Key<MetaTable,String> ID
The meta-model id


NAME

public static final Key<MetaTable,String> NAME
DB table name


ALIAS

public static final Key<MetaTable,String> ALIAS
The unique table/view name over all Databases in scope one OrmHandler


SCHEMA

public static final Key<MetaTable,String> SCHEMA
Name of table schema.


READ_ONLY

public static final Key<MetaTable,Boolean> READ_ONLY
The state read-only for the database.


ORM2DLL_POLICY

public static final Key<MetaTable,Orm2ddlPolicy> ORM2DLL_POLICY
A policy to defining the database structure by a DDL.

See Also:
Parameter values

SEQUENCE

public static final Key<MetaTable,String> SEQUENCE
Name of DB sequence. The value is not used by default, however a special implementation of the UjoSequencer can do it.


VIEW

public static final Key<MetaTable,Boolean> VIEW
Is it a model of a database view or table ?


SELECT

public static final Key<MetaTable,String> SELECT
SQL SELECT statement


COMMENT

public static final Key<MetaTable,String> COMMENT
Comment of the database table


COLUMNS

public static final ListKey<MetaTable,MetaColumn> COLUMNS
Table Columns (no relations)


RELATIONS

public static final ListKey<MetaTable,MetaRelation2Many> RELATIONS
Table relations to many


SELECT_MODEL

public static final Key<MetaTable,MetaSelect> SELECT_MODEL
SQL SELECT model. Note: this property must not be persistent due a blank spaces in key names!


PK

public static final Key<MetaTable,MetaPKey> PK
Unique Primary Key


DB_PROPERTY

public static final Key<MetaTable,RelationToMany> DB_PROPERTY
Database relative property (a base definition of table)


DATABASE

public static final Key<MetaTable,MetaDatabase> DATABASE
Database

Constructor Detail

MetaTable

public MetaTable()
No parameter constructor.


MetaTable

public MetaTable(MetaDatabase database,
                 RelationToMany dbProperty,
                 MetaTable parTable)
Create new MetaTable.

Parameters:
database - Database for the table
dbProperty - Configuration property
parTable - Configuration data from a XML file
Method Detail

assignPrimaryKey

public void assignPrimaryKey(OrmUjo bo,
                             Session session)
Assign a PK from framework


createBO

public OrmUjo createBO()
                throws InstantiationException,
                       IllegalAccessException
Returns a new instance or the BO.

Throws:
InstantiationException
IllegalAccessException

getType

public final Class<OrmUjo> getType()
Returns a base table class.


getFirstPK

public MetaColumn getFirstPK()
Returns the first PK


isPersistent

public boolean isPersistent()
Is the instance a database relation model?


isDefaultSchema

public boolean isDefaultSchema()
Has this table assigned the database default database schema ?


isView

public boolean isView()
Is the instance a database relation model?

Specified by:
isView in interface TableWrapper

isTable

public boolean isTable()
Is the instance a database persistent table? The false value means that the object is a relation model or a view.


isCommented

public boolean isCommented()
Has the instance assigned a non empty comment?


getComment

public String getComment()
Get a Comment from meta-model annotation.

See Also:
Comment

isSelectModel

public boolean isSelectModel()
Is the query from a SQL select model ?


setNotPersistent

public void setNotPersistent()
Database model is not persistent. A side efect is that the DATABASE property has hot a null value.


getAlias

public String getAlias()
Returns a unique table name over all Databases of the one OrmHandler.

Specified by:
getAlias in interface TableWrapper

getDatabase

public final MetaDatabase getDatabase()
Returns the database


equals

public boolean equals(Object obj)
Compare object by the same instance.

Overrides:
equals in class SuperAbstractUjo

getForeignColumns

public List<MetaColumn> getForeignColumns()
Get all foreign columns


getSequencer

public UjoSequencer getSequencer()
UJO sequencer


getIndexCollection

public Collection<MetaIndex> getIndexCollection()
Create a new collection of the table indexes.


getParent

public OrmUjo getParent(OrmUjo bo)
Returns a parrent of the parameter or the null if no parent was not found.
The method provides a parent in case of emulated inheritance.


isReadOnly

public boolean isReadOnly()
Have the table got a READ-ONLU mode ?


assertChangeAllowed

public void assertChangeAllowed()
Asssert that the table may be changed.


getOrm2ddlPolicy

public Orm2ddlPolicy getOrm2ddlPolicy()
Returns Orm2DDl policy


getModel

public MetaTable getModel()
Return an instance of Meta Model

Specified by:
getModel in interface TableWrapper

getColumns

public List<? extends ColumnWrapper> getColumns()
Returns all columns

Specified by:
getColumns in interface TableWrapper


Copyright © 2012. All Rights Reserved.