org.ujorm.orm.metaModel
Class MetaTable

java.lang.Object
  extended by org.ujorm.extensions.AbstractUjo
      extended by org.ujorm.implementation.quick.QuickUjo
          extended by org.ujorm.orm.AbstractMetaModel
              extended by org.ujorm.orm.metaModel.MetaTable
All Implemented Interfaces:
java.io.Serializable, UjoCloneable, UjoTextable, Ujo

public final class MetaTable
extends AbstractMetaModel

DB table or view meta-model.

Author:
Pavel Ponec
See Also:
Serialized Form

Field Summary
static Property<MetaTable,java.lang.String> ALIAS
          The unique table/view name over all Databases in scope one OrmHandler
static ListProperty<MetaTable,MetaColumn> COLUMNS
          Table Columns (no relations)
static Property<MetaTable,java.lang.String> COMMENT
          Comment of the database table
static Property<MetaTable,MetaDatabase> DATABASE
          Database
static Property<MetaTable,RelationToMany> DB_PROPERTY
          Database relative property (a base definition of table)
static Property<MetaTable,java.lang.String> ID
          The meta-model id
static Property<MetaTable,java.lang.String> NAME
          DB table name
static Property<MetaTable,Orm2ddlPolicy> ORM2DLL_POLICY
          A policy to defining the database structure by a DDL.
static Property<MetaTable,MetaPKey> PK
          Unique Primary Key
static Property<MetaTable,java.lang.Boolean> READ_ONLY
          The state read-only for the database.
static ListProperty<MetaTable,MetaRelation2Many> RELATIONS
          Table relations to many
static Property<MetaTable,java.lang.String> SELECT
          SQL SELECT statement
static Property<MetaTable,MetaSelect> SELECT_MODEL
          SQL SELECT model.
static Property<MetaTable,java.lang.String> SEQUENCE
          Name of DB sequence.
static Property<MetaTable,java.lang.String> SCHEMA
          Name of table schema.
static Property<MetaTable,java.lang.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(java.lang.Object obj)
          Compare object by the same instance.
 java.lang.String getAlias()
          Returns a unique table name over all Databases of the one OrmHandler.
 java.lang.String getComment()
          Get a Comment from meta-model annotation.
 MetaDatabase getDatabase()
          Returns the database
 MetaColumn getFirstPK()
          Returns the first PK
 java.util.List<MetaColumn> getForeignColumns()
          Get all foreign columns
 java.util.Collection<MetaIndex> getIndexCollection()
          Create a collection of the table indexes.
 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
 java.lang.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.implementation.quick.QuickUjo
newListProperty, newListProperty, newProperty, newProperty, newProperty, newProperty, newProperty, newProperty, readValue
 
Methods inherited from class org.ujorm.extensions.AbstractUjo
clone, init, init, 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 Property<MetaTable,java.lang.String> ID
The meta-model id


NAME

public static final Property<MetaTable,java.lang.String> NAME
DB table name


ALIAS

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


SCHEMA

public static final Property<MetaTable,java.lang.String> SCHEMA
Name of table schema.


READ_ONLY

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


ORM2DLL_POLICY

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

See Also:
Parameter values

SEQUENCE

public static final Property<MetaTable,java.lang.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 Property<MetaTable,java.lang.Boolean> VIEW
Is it a model of a database view or table ?


SELECT

public static final Property<MetaTable,java.lang.String> SELECT
SQL SELECT statement


COMMENT

public static final Property<MetaTable,java.lang.String> COMMENT
Comment of the database table


COLUMNS

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


RELATIONS

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


SELECT_MODEL

public static final Property<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 Property<MetaTable,MetaPKey> PK
Unique Primary Key


DB_PROPERTY

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


DATABASE

public static final Property<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 java.lang.InstantiationException,
                       java.lang.IllegalAccessException
Returns a new instance or the BO.

Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

getType

public final java.lang.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?


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 java.lang.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 java.lang.String getAlias()
Returns a unique table name over all Databases of the one OrmHandler.


getDatabase

public final MetaDatabase getDatabase()
Returns the database


equals

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

Overrides:
equals in class AbstractUjo

getForeignColumns

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


getSequencer

public UjoSequencer getSequencer()
UJO sequencer


getIndexCollection

public java.util.Collection<MetaIndex> getIndexCollection()
Create a 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



Copyright © 2007-2012 PPonec