|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jorm.metainfo.lib.BasicMetaObject
org.objectweb.jorm.metainfo.lib.BasicMappingStructure
org.objectweb.jorm.metainfo.lib.BasicCommonClassMapping
org.objectweb.jorm.metainfo.lib.BasicClassMapping
org.objectweb.jorm.mapper.rdb.metainfo.RdbClassMapping
This class defines information on the mapping of a class to relational structures In the case of inheritance, one must defines how the mapping definitions are inherited, and how to distinguish instances of the class to instances of super or sub classes. Following the partitionning schemes in relational database we defines three ways to inherit the mapping of its parent. In the case of multi-inheritance, all combinations are valid. One can map new fields relative to class A to new columns or tables (to-extended or to-added rules) while the resulting stuctures being completely redefined relatively to the ones of another class B (to-new rule). One class can also inherits with a to-added or to-extended rule from class A and also with a to-added or to-exended rule from another class B provided they map their id the same way, which implies that they have the same main table. One limitation is relative to the "abscractness" of the classes. In fact, the inheritance rules are those of Java. That is, a class cannot inherit from more than one concrete class (the 'extends' keyword is limited to only one class). Note that Jorm support abstract classes inheriting from concrete classes, even though this has no sense from a persistance point of view. The reason is that Jorm is used to map Java classes to persistant ones, that Java authorizes abstract classes deriving from concrete classes by defining new abstract methods. Even though methods are not translated in a persistance point of view since they do not represent fields (exception made of accessors), we need to represent the abstract classes since there may exist references of this abstract class.
Field Summary | |
static java.lang.String |
MAP_NEW_FIELDS_TO_ADDED_STRUCTURES
Specifies that the structures and the mapping of the parent is inherited, new structures are added (i.e. new tables are added) and the some of new fields are mapped to this new structures. |
static java.lang.String |
MAP_NEW_FIELDS_TO_EXTENDED_STRUCTURES
Specifies that the structures and the mapping of the parent is inherited, the structures are extended (i.e. new columns are defined in existing tables) and the new fields are mapped to this extension. |
static java.lang.String |
REMAP_FIELDS_TO_NEW_STRUCTURES
Specifies that neither the structures nor the mapping is inherited, structures are completely redefined (i.e. new tables are defined) and ALL the fields (defined in the class or previously defined in super classes are remapped to this new structures. |
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicClassMapping |
parentClassMappings |
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicMappingStructure |
linkedMO |
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject |
debug, logger, loggerFactory, parent |
Constructor Summary | |
RdbClassMapping(java.lang.String ruleName,
MetaObject linkedMO,
MetaObject parent)
Builds a new BasicRdbClassMapping object. |
Method Summary | |
void |
addImplicitDependencies()
The creation of tables cannot be done until all columns are known and those columns can be defined in the super and subclasses with wich there is a 'to-extended' or a 'to-added' inheritance rule. |
ParentClassMapping |
createImplicitParentClassMapping(Class superClass)
Creates a implicit parent class mapping. |
RdbFilter |
createRdbFilter()
|
RdbInheritanceQuery |
createRdbInheritanceQuery()
|
RdbTable |
createRdbTable(java.lang.String tableName)
|
java.util.Set |
getAddedOrExtendedParentClassMapping()
Returns the parent class mappings having an extened or added inheritance rule. |
java.util.List |
getAllPrimitiveElementMappings()
Returns the list of PEM of the current class and its super classes. |
protected java.util.Collection |
getChildren()
|
RdbTable |
getMainRdbTable()
|
void |
getMainRdbTableOld(java.util.ArrayList res)
Get the main table (tables ??). |
Expression |
getMappingFilterFromNamingFilter()
|
Expression |
getMappingFilterFromNamingFilter(NamingFilterKeyProvider nfkp)
|
java.util.Set |
getParentClassMapping(java.util.Set inheritanceRules)
Returns the parent class mappings having a inheritance rule in a set of inheritance rules. |
PrimitiveElementMapping |
getPrimitiveElementMapping(java.lang.String fieldName,
boolean searchInSuper)
Get the primitive element mapping corresponding to a field name by searching recursively in the super classes until it is found (if requested) |
RdbFilter |
getRdbFilter()
|
RdbInheritanceQuery |
getRdbInheritanceQuery()
|
RdbTable |
getRdbTable()
|
boolean |
hasUnmappedPrimitiveElements(java.util.Collection pes)
Check if any (hidden) field defined in the class (or its supers) has a defined mapping (defined in the class mapping or in it supers) |
boolean |
inheritsStructures()
|
boolean |
inheritsStructures(ParentClassMapping pcm)
|
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicClassMapping |
addParentClassMapping, addReferenceMapping, createParentClassMapping, createReferenceMapping, getJormClass, getParentClassMapping, getParentClassMappings, getReferenceMapping, getReferenceMappings, iterateParentClassMappings, iterateReferenceMappings |
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicCommonClassMapping |
addDependency, addPrimitiveElementMapping, addPrimitiveElementMapping, createIdentifierMapping, getDependencies, getIdentifierMapping, getPrimitiveElementMapping, getPrimitiveElementMappings, getRuleName, primitiveElementMappingsIterator, removeDependency, setIdentifierMapping, setRuleName |
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicMappingStructure |
getLinkedMO, getMapperName, getProjectName, setLinkedMO |
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject |
getLogger, getLoggerFactory, getManager, getParent, setLogger, setLoggerFactory, setLoggingOnChild, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.objectweb.jorm.metainfo.api.CommonClassMapping |
addDependency, addPrimitiveElementMapping, addPrimitiveElementMapping, createIdentifierMapping, getDependencies, getIdentifierMapping, getPrimitiveElementMapping, getPrimitiveElementMappings, getRuleName, primitiveElementMappingsIterator, removeDependency, setIdentifierMapping, setRuleName |
Methods inherited from interface org.objectweb.jorm.metainfo.api.MappingStructure |
getLinkedMO, getMapperName, getProjectName, setLinkedMO |
Methods inherited from interface org.objectweb.jorm.metainfo.api.MetaObject |
getParent, setParent |
Field Detail |
public static final java.lang.String MAP_NEW_FIELDS_TO_EXTENDED_STRUCTURES
public static final java.lang.String MAP_NEW_FIELDS_TO_ADDED_STRUCTURES
public static final java.lang.String REMAP_FIELDS_TO_NEW_STRUCTURES
Constructor Detail |
public RdbClassMapping(java.lang.String ruleName, MetaObject linkedMO, MetaObject parent)
ruleName
- the name of the rule used to map the class,
linkedMo the Class object referenced by the current object,
parent the parent of the current object.Method Detail |
public java.util.List getAllPrimitiveElementMappings()
CommonClassMapping
getAllPrimitiveElementMappings
in interface CommonClassMapping
getAllPrimitiveElementMappings
in class BasicCommonClassMapping
public RdbTable createRdbTable(java.lang.String tableName)
public RdbTable getRdbTable()
public void getMainRdbTableOld(java.util.ArrayList res)
res
- the list of RdbTable meta-object in ancestors relative to the
the main table of the classpublic RdbTable getMainRdbTable()
public RdbFilter createRdbFilter()
public RdbFilter getRdbFilter()
public RdbInheritanceQuery getRdbInheritanceQuery()
public RdbInheritanceQuery createRdbInheritanceQuery()
public Expression getMappingFilterFromNamingFilter() throws ExpressionException
ExpressionException
public Expression getMappingFilterFromNamingFilter(NamingFilterKeyProvider nfkp) throws ExpressionException
ExpressionException
protected java.util.Collection getChildren()
getChildren
in class BasicClassMapping
public ParentClassMapping createImplicitParentClassMapping(Class superClass)
ClassMapping
superClass
- the super class that will be referenced by this
parent class mapping
public void addImplicitDependencies()
public boolean hasUnmappedPrimitiveElements(java.util.Collection pes)
public java.util.Set getParentClassMapping(java.util.Set inheritanceRules)
inheritanceRules
- the set of inheritance rule names
public java.util.Set getAddedOrExtendedParentClassMapping()
public boolean inheritsStructures(ParentClassMapping pcm)
public boolean inheritsStructures()
public PrimitiveElementMapping getPrimitiveElementMapping(java.lang.String fieldName, boolean searchInSuper)
ClassMapping
fieldName
- the name of the field of which the primitive element
mapping must be returnedsearchInSuper
- if true search recursively in super classes
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |