org.objectweb.medor.optim.jorm

Class JormRule

Implemented Interfaces:
RewriteRule
Known Direct Subclasses:
Jorm2Rdb, JormFilteredInheritance, JormFlatten2Rdb, JormLeafRewriter

public abstract class JormRule
extends BasicRule

This class is a tool for the management of the JormExtent.

It is used for the replacement of JormExtent instances into specific QueryLeaf instances.

Author:
S.Chassande-Barrioz

Nested Class Summary

Nested classes/interfaces inherited from class org.objectweb.medor.optim.lib.BasicRule

BasicRule.ModifiedExpression

Field Summary

Fields inherited from class org.objectweb.medor.optim.lib.BasicRule

debug, log

Constructor Summary

JormRule(String suffix)

Method Summary

protected ClassMapping
getClassMapping(JormExtent extent)
Retrieves the jorm meta object describing the mapping of the persistent object representing by its extent.
protected GenClassMapping
getGenClassMapping(JormExtent extent)
Retrieves the jorm meta object describing the mapping of the persistent object representing by its extent.
protected String
getJORMFieldName(String fullName, JormExtent ext)
Returns the field name without the extent name
protected PrimitiveElementMapping
getPEM(JormExtent extent, String fieldName)
Retrieves the RdbPrimitiveElementMapping of a field
protected Operand
getPNCOperand(JormExtent extent, PNameField pnf)
Retrieves the Operand representing the PNameCoder needed to decode a pname.
protected PrimitiveElement
getPrimitiveElement(JormExtent extent, String fieldname)
Retrieves the primitive element corresponding to a field name of a jorm object (class or generic class).

Methods inherited from class org.objectweb.medor.optim.lib.BasicRule

replaceUsage, rewrite

Constructor Details

JormRule

public JormRule(String suffix)

Method Details

getClassMapping

protected ClassMapping getClassMapping(JormExtent extent)
            throws MedorException
Retrieves the jorm meta object describing the mapping of the persistent object representing by its extent. This method must be call with a ClassExtent instance. It retrieves a RdbClassMultiMapping instance. The JormExtent instance must contain the project name and the mapper instance.

Parameters:
extent - must be a ClassExtent instance.

Returns:
a RdbClassMultiMapping instance

Throws:
MedorException - if no class mapping has been found for the project name and the mapper specified by the JormExtent.


getGenClassMapping

protected GenClassMapping getGenClassMapping(JormExtent extent)
            throws MedorException
Retrieves the jorm meta object describing the mapping of the persistent object representing by its extent. This method must be call with a GenClassExtent instance. It retrieves a RdbGenClassMapping instance. The JormExtent instance must contain the project name and the mapper instance.

Parameters:
extent - must be a ClassExtent instance.

Returns:
a RdbGenClassMapping instance

Throws:
MedorException - if no class mapping has been found for the project name and the mapper specified by the JormExtent.


getJORMFieldName

protected String getJORMFieldName(String fullName,
                                  JormExtent ext)
Returns the field name without the extent name

Parameters:
fullName - the full field name containing the extent name
ext - the extent

Returns:
the abridged field name


getPEM

protected PrimitiveElementMapping getPEM(JormExtent extent,
                                         String fieldName)
            throws MedorException
Retrieves the RdbPrimitiveElementMapping of a field

Parameters:
extent - the extent of a persistent class (ClassExtent or GenClassExtent)
fieldName - is the name of the field which the mapping is expected

Throws:
MedorException - if the extent is not managed or if the field does not have a mapping.


getPNCOperand

protected Operand getPNCOperand(JormExtent extent,
                                PNameField pnf)
Retrieves the Operand representing the PNameCoder needed to decode a pname. If the mapper is assigned to the extent and the persistent class is initialized then a constant operand is returned. Otherwise a ParameterOperand is returned.

Parameters:
extent - can contain the mapper
pnf - is the field representing the PName to be decoded

Returns:
a Operand instance.


getPrimitiveElement

protected PrimitiveElement getPrimitiveElement(JormExtent extent,
                                               String fieldname)
            throws MedorException
Retrieves the primitive element corresponding to a field name of a jorm object (class or generic class).

Parameters:
extent - represents the Jorm persistent class and references the Jorm meta object containing the expected jorm meta object.
fieldname - is the name of the

Throws:
MedorException - if the field does not exist.