Dresden OCL Toolkit

tudresden.ocl.sql
Class ObjectViewSchema

java.lang.Object
  extended bytudresden.ocl.sql.ObjectViewSchema
All Implemented Interfaces:
ORMappingScheme, SQLDirector

public class ObjectViewSchema
extends Object
implements ORMappingScheme, SQLDirector

Implements ORMappingSchema and realizes the object-view-concept. That is, for each class an according view is going to be generated. The view queries all tables which belong to the class and thus enables to query all tupels respectivly objects related to a class via one virtual table.


Field Summary
(package private)  Map classifiersToMappedClasses
           
(package private)  Map classifiersToViews
           
(package private)  ORMapping theORM
           
(package private)  SQLBuilder theSQLBuilder
           
 
Constructor Summary
ObjectViewSchema(ORMapping orm, SQLBuilder sqlb)
           
 
Method Summary
 void construct()
          Does the construction of the SQL code.
private  void createMappedClassLinks()
          Creates all necessary links between MappedClass objects.
private  void createObjectViews()
          Basic mapping of class tables to one view including attributes.
 String getCode()
           
 MappedClass getMappedClass(String classifier)
           
 String[] getQueriedTables(String viewName)
           
 String getViewDefinition(String classifier)
           
 String getViewDefinitions()
           
private  void insertQueryMethodes()
          Inserts information about query methodes contained by the classes in the class model.
 void setBuilder(SQLBuilder sqlb)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theORM

ORMapping theORM

theSQLBuilder

SQLBuilder theSQLBuilder

classifiersToMappedClasses

Map classifiersToMappedClasses

classifiersToViews

Map classifiersToViews
Constructor Detail

ObjectViewSchema

public ObjectViewSchema(ORMapping orm,
                        SQLBuilder sqlb)
Parameters:
orm - an object relational mapping
sqlb - a SQLBuilder
Method Detail

getMappedClass

public MappedClass getMappedClass(String classifier)
Specified by:
getMappedClass in interface ORMappingScheme
Parameters:
classifier - a classifier
Returns:
a MappedClass object containing object views

getViewDefinition

public String getViewDefinition(String classifier)
Parameters:
classifier - a classifier
Returns:
the definition of the view that belongs to the classifier

getViewDefinitions

public String getViewDefinitions()
Returns:
a String that contains the view definitions of all classifiers

getQueriedTables

public String[] getQueriedTables(String viewName)
Parameters:
viewName - the name of a view
Returns:
a String array that contains the names of all tables the view queries or a String array that contains just the viewName itself, if the view does not exist

setBuilder

public void setBuilder(SQLBuilder sqlb)
Specified by:
setBuilder in interface SQLDirector
Parameters:
sqlb - a builder used by the director to build database specific code

construct

public void construct()
Does the construction of the SQL code. This is also done during the creation of this object.

Specified by:
construct in interface SQLDirector

getCode

public String getCode()
Specified by:
getCode in interface SQLDirector
Returns:
the resulting SQL code from the construction process

createObjectViews

private void createObjectViews()
Basic mapping of class tables to one view including attributes.


createMappedClassLinks

private void createMappedClassLinks()
Creates all necessary links between MappedClass objects. These links result from association ends and generalization relationships. Futhermore, the according guides will be inserted.


insertQueryMethodes

private void insertQueryMethodes()
Inserts information about query methodes contained by the classes in the class model.


Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.