Dresden OCL Toolkit

tudresden.ocl.sql
Class ORMappingImpl

java.lang.Object
  extended bytudresden.ocl.sql.ORMappingImpl
All Implemented Interfaces:
ORMapping

public class ORMappingImpl
extends Object
implements ORMapping

Implementation of the ORMapping interface. This class represents an object-relational mapping for UML models to relational database Tables. To make the actual mapping as flexible as possible special mapping strategies can be assigned to different modelelements or be set as default strategies for mapping of kinds of modelelements.

Author:
Andrea Kling
See Also:
ClassStrategy, KeyStrategy, DatatypeStrategy, InheritanceStrategy, OrderedStrategy, AssociationStrategy

Field Summary
private  Hashtable associationEnds
           
private  Set associations
           
private  Hashtable associationStrategies
           
private  Hashtable associationTables
           
static String CLASS
          marks a ClassStrategy
private  Set classAttributes
           
private  Set classifiers
           
private  Hashtable classStrategies
           
private  Hashtable classToTables
           
private  Hashtable classViews
           
private  Hashtable datatypeStrategies
           
private  Map defaultStrategies
           
private  Set generalizationRoots
           
static String INHERIT
          marks an InheritanceStrategy
private  Hashtable inheritanceStrategies
           
private  Hashtable keyStrategies
           
static String MANY_MANY
          marks an AssociationStrategy that can be used to map N:M Associations
private  Hashtable nameToClassifier
           
private  Hashtable navigationGuides
           
static String ONE_MANY
          marks an AssociationStrategy that can be used to map 1:N or 0..1:N Associations
static String ONE_ONE
          marks an AssociationStrategy that can be used to map 1:1 or 0..1:1 Associations
static String ORDERED
          marks an OrderedStrategy
private  Hashtable orderStrategies
           
static String PK
          marks a KeyStrategy
private  Set tables
           
private  ru.novosoft.uml.model_management.MModel theModel
           
static String TYPE
          marks a DatatypeStrategy
private  Set undefinedAttributes
           
 
Constructor Summary
ORMappingImpl(ru.novosoft.uml.model_management.MModel theModel, ModelAdjuster ma)
           
 
Method Summary
 Map associationEnds(String classifier)
          returns a Map containing the name of the classifier for every association (opposite roleName) classifier takes part in
 Set attributes(String classifier)
          returns a Set containing the names of all attributes of classifier
 Set classifiers()
          returns the names of all classifiers the ModelAdjuster selected for mapping
 Set directSupertypeNames(String classifier)
           
 Set getAssociations()
           
 ru.novosoft.uml.foundation.core.MClassifier getClassifier(String name)
           
 List getClassTables(String classifier)
          contains all Tables classifier has been mapped to, including Tables containing inherited attributes and external attribute tables
 ObjectView getClassView(String classifier)
          returns the ObjectView for classifier.
 Set getClassViews()
          returns a Set of ObjectView containg ObjectViews for all classifiers mapped
 Set getGeneralizationRoots()
          returns all generalization roots marked for mapping
 Set getUndefinedAttributes()
          contains all attributes having a type undefined in TypeManager and no classifier defined in this Model
 List guidesToAssociationEnds(String classifier, String assEnd)
          returns a List containing the Guide to the ObjectView of the classifier corresponding the Associationend role name assEnd
 void map()
          initiates the mapping process
 Set operations(String classifier)
          returns a Set containing the names of all operations of classifier
 void setDefaultStrategies(Map strategies)
          sets default strategies for modelelements strategies should map Strategykinds as defined in ORMappingImpl to concrete strategies
 void setStrategy(ru.novosoft.uml.foundation.core.MAssociation association, AssociationStrategy strategy)
          sets a special mapping strategy for association
 void setStrategy(ru.novosoft.uml.foundation.core.MAssociationEnd associationEnd, OrderedStrategy strategy)
          sets a special mapping strategy for an ordered association end
 void setStrategy(ru.novosoft.uml.foundation.core.MAttribute attribute, DatatypeStrategy strategy)
          sets a special mapping strategy for attribute's datatype
 void setStrategy(ru.novosoft.uml.foundation.core.MClassifier classifier, ClassStrategy strategy)
          sets a special mapping strategy for classifier
 void setStrategy(ru.novosoft.uml.foundation.core.MClassifier generalizationRoot, InheritanceStrategy strategy)
          sets a special mapping strategy for a generalization
 void setStrategy(ru.novosoft.uml.foundation.core.MClassifier classifier, KeyStrategy strategy)
          sets a special mapping strategy for classifier's primary key
 List tables()
          returns a List containing all Tables tht were created during mapping the sequence of this list is random
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INHERIT

public static String INHERIT
marks an InheritanceStrategy


CLASS

public static String CLASS
marks a ClassStrategy


TYPE

public static String TYPE
marks a DatatypeStrategy


PK

public static String PK
marks a KeyStrategy


ONE_ONE

public static String ONE_ONE
marks an AssociationStrategy that can be used to map 1:1 or 0..1:1 Associations


ONE_MANY

public static String ONE_MANY
marks an AssociationStrategy that can be used to map 1:N or 0..1:N Associations


MANY_MANY

public static String MANY_MANY
marks an AssociationStrategy that can be used to map N:M Associations


ORDERED

public static String ORDERED
marks an OrderedStrategy


classStrategies

private Hashtable classStrategies

datatypeStrategies

private Hashtable datatypeStrategies

keyStrategies

private Hashtable keyStrategies

inheritanceStrategies

private Hashtable inheritanceStrategies

associationStrategies

private Hashtable associationStrategies

orderStrategies

private Hashtable orderStrategies

defaultStrategies

private Map defaultStrategies

classToTables

private Hashtable classToTables

nameToClassifier

private Hashtable nameToClassifier

associationEnds

private Hashtable associationEnds

navigationGuides

private Hashtable navigationGuides

associationTables

private Hashtable associationTables

classViews

private Hashtable classViews

theModel

private ru.novosoft.uml.model_management.MModel theModel

tables

private Set tables

classifiers

private Set classifiers

associations

private Set associations

generalizationRoots

private Set generalizationRoots

undefinedAttributes

private Set undefinedAttributes

classAttributes

private Set classAttributes
Constructor Detail

ORMappingImpl

public ORMappingImpl(ru.novosoft.uml.model_management.MModel theModel,
                     ModelAdjuster ma)
Parameters:
theModel - to be mapped to a database scheme
ma - a ModelAdjuster filtering the interesting model data
Method Detail

associationEnds

public Map associationEnds(String classifier)
returns a Map containing the name of the classifier for every association (opposite roleName) classifier takes part in

Specified by:
associationEnds in interface ORMapping
Parameters:
classifier - a classifier
Returns:
Map (String opposite roleName -> String classifier of opposite association end)

attributes

public Set attributes(String classifier)
returns a Set containing the names of all attributes of classifier

Specified by:
attributes in interface ORMapping
Parameters:
classifier - a classifier
Returns:
a Set of String

classifiers

public Set classifiers()
returns the names of all classifiers the ModelAdjuster selected for mapping

Specified by:
classifiers in interface ORMapping
Returns:
a Set of String
See Also:
ModelAdjuster

getClassifier

public ru.novosoft.uml.foundation.core.MClassifier getClassifier(String name)
Returns:
the MClassifier with the name 'name'

directSupertypeNames

public Set directSupertypeNames(String classifier)
Specified by:
directSupertypeNames in interface ORMapping
Parameters:
classifier - a classifier
Returns:
a Set of String containing the names of classifiers direct supertypes

getClassTables

public List getClassTables(String classifier)
contains all Tables classifier has been mapped to, including Tables containing inherited attributes and external attribute tables

Specified by:
getClassTables in interface ORMapping
Parameters:
classifier - a classifier
Returns:
a List of Table
See Also:
Table

getClassView

public ObjectView getClassView(String classifier)
returns the ObjectView for classifier. this View does not contain multivalue attributes mapped to additional Tables


getClassViews

public Set getClassViews()
returns a Set of ObjectView containg ObjectViews for all classifiers mapped

See Also:
ObjectView

guidesToAssociationEnds

public List guidesToAssociationEnds(String classifier,
                                    String assEnd)
returns a List containing the Guide to the ObjectView of the classifier corresponding the Associationend role name assEnd

Specified by:
guidesToAssociationEnds in interface ORMapping
Parameters:
classifier - a classifier
assEnd - the name of the association end
Returns:
a List that contains guides to to the specified association end from the classifier
See Also:
Guide, ObjectView

operations

public Set operations(String classifier)
returns a Set containing the names of all operations of classifier

Specified by:
operations in interface ORMapping
Parameters:
classifier - a classifier
Returns:
a Set of String

tables

public List tables()
returns a List containing all Tables tht were created during mapping the sequence of this list is random

Specified by:
tables in interface ORMapping
Returns:
a List of Table
See Also:
Table

setStrategy

public void setStrategy(ru.novosoft.uml.foundation.core.MClassifier classifier,
                        ClassStrategy strategy)
sets a special mapping strategy for classifier


setStrategy

public void setStrategy(ru.novosoft.uml.foundation.core.MAttribute attribute,
                        DatatypeStrategy strategy)
sets a special mapping strategy for attribute's datatype


setStrategy

public void setStrategy(ru.novosoft.uml.foundation.core.MClassifier classifier,
                        KeyStrategy strategy)
sets a special mapping strategy for classifier's primary key


setStrategy

public void setStrategy(ru.novosoft.uml.foundation.core.MClassifier generalizationRoot,
                        InheritanceStrategy strategy)
sets a special mapping strategy for a generalization


setStrategy

public void setStrategy(ru.novosoft.uml.foundation.core.MAssociation association,
                        AssociationStrategy strategy)
sets a special mapping strategy for association


setStrategy

public void setStrategy(ru.novosoft.uml.foundation.core.MAssociationEnd associationEnd,
                        OrderedStrategy strategy)
sets a special mapping strategy for an ordered association end


setDefaultStrategies

public void setDefaultStrategies(Map strategies)
sets default strategies for modelelements strategies should map Strategykinds as defined in ORMappingImpl to concrete strategies

Parameters:
strategies - a Map (String -> Strategy)
See Also:
ClassStrategy, KeyStrategy, DatatypeStrategy, InheritanceStrategy, OrderedStrategy, AssociationStrategy

getGeneralizationRoots

public Set getGeneralizationRoots()
returns all generalization roots marked for mapping

Returns:
a Set of MClassifier

getAssociations

public Set getAssociations()
Returns:
a Set of MAssociation

getUndefinedAttributes

public Set getUndefinedAttributes()
contains all attributes having a type undefined in TypeManager and no classifier defined in this Model

Returns:
a Set of MAttribute

map

public void map()
initiates the mapping process


Dresden OCL Toolkit

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