Interface ConversionHelper
public interface ConversionHelper
Helper interface for the
MappingFile.
The mapping file classes use an object that
implements this interface to assist in the conversion
from the sun-cmp-mapping file, into a TP dot-mapping file.
The APIs to the deployment descriptors differ at deployment time
and at development time. This interface provides a level of abstraction
for the needed information.- Version:
- 1.0
- Author:
- vkraemer
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanapplyDefaultUnknownPKClassStrategy(String ejbName) Returns flag whether the mapping conversion should apply the default strategy for dealing with unknown primary key classes.booleanReturns the flag whether the mapping conversion should validate all fields against schema columns.booleanReturns the flag whether the mapping conversion should generate relationship fields and primary key fields to support run-time.Object[]Returns the name used for generated primary key fields.getGeneratedRelationships(String ejbName) Returns a list of generated relationship field names.Returns the prefix used for generated version fields.getInverseFieldName(String ejbName, String fieldName) getMappedClassName(String beanName) Computes the name of the TP implementation class for a bean.getMultiplicity(String ejbName, String fieldName) getRelationshipFieldContent(String ejbName, String fieldName) Return the name of the opposite roles ejb-namegetRelationshipFieldType(String ejbName, String fieldName) booleanbooleanisGeneratedField(String ejbName, String fieldName) Returnstrueif the field is generated.booleanisGeneratedRelationship(String ejbName, String fieldName) Flag whether the conversion helper generated the relationship fieldbooleanCompute the keyness of a field.booleanrelatedObjectsAreDeleted(String ejbName, String fieldName) voidsetEnsureValidation(boolean isValidating) Sets the flag whether the mapping conversion should validate all fields against schema columns.voidsetGenerateFields(boolean generateFields) Sets the flag whether the mapping conversion should generate relationship fields, primary key fields, and version fields to support run-time.
-
Field Details
-
ONE
- See Also:
-
MANY
- See Also:
-
-
Method Details
-
getMappedClassName
Computes the name of the TP implementation class for a bean.- Parameters:
beanName- The value of the ejb-name element for a bean.- Returns:
- The full name of the TP class that implements the fields and relationships of an EJB.
-
hasField
- Parameters:
beanName- Name of bean to investigate for field.fieldName- Name of field sought in named bean.- Returns:
- True if the named bean has the named field
-
getFields
-
isKey
Compute the keyness of a field. The value returned is the keyness of the field, if it is computable. If it is not, the candidate value is returned.- Parameters:
beanName- The value of the ejb-name element for a bean.fieldName- The name of a container managed field in the named bean.candidate- The value "proposed" by the content of the sun-cmp-mapping file.- Returns:
- The real value of the keyness of a field. This may be different than the candidate value, if the correct values of a fields keyness can be computed from available data.
-
getRelationshipFieldContent
Return the name of the opposite roles ejb-name- Parameters:
ejbName- The value of the ejb-name element for a bean.fieldName- The name of a container managed field in the named bean.- Returns:
- The ejb-name of the bean that is referenced by a relationship field. This is the ejb-name of the "other" roles relationship-role-source.
-
getMultiplicity
- Parameters:
ejbName- The ejb-name element for the beanfieldName- The name of a container managed field in the named bean.- Returns:
- The String values "One" or "Many".
-
getRelationshipFieldType
- Parameters:
ejbName- The value of the ejb-name element for a bean.fieldName- The name of a container managed field in the named bean.- Returns:
- The String values "One" or "Many".
-
getInverseFieldName
- Parameters:
ejbName- The value of the ejb-name element for a bean.fieldName- The name of a container managed field in the named bean.- Returns:
- The String values "One" or "Many".
-
applyDefaultUnknownPKClassStrategy
Returns flag whether the mapping conversion should apply the default strategy for dealing with unknown primary key classes. This method will only be called whengenerateFields()returnstrue.- Parameters:
ejbName- The value of the ejb-name element for a bean.- Returns:
trueto apply the default unknown PK Class Strategy,falseotherwise
-
getGeneratedPKFieldName
String getGeneratedPKFieldName()Returns the name used for generated primary key fields.- Returns:
- a string for key field name
-
getGeneratedVersionFieldNamePrefix
String getGeneratedVersionFieldNamePrefix()Returns the prefix used for generated version fields.- Returns:
- a string for version field name prefix
-
generateFields
boolean generateFields()Returns the flag whether the mapping conversion should generate relationship fields and primary key fields to support run-time. The version field is always created evengenerateFields()isfalsebecause it holds version column information.- Returns:
trueto generate fields in the dot-mapping file (if they are not present).
-
setGenerateFields
void setGenerateFields(boolean generateFields) Sets the flag whether the mapping conversion should generate relationship fields, primary key fields, and version fields to support run-time.- Parameters:
generateFields- a flag which indicates whether fields should be generated
-
ensureValidation
boolean ensureValidation()Returns the flag whether the mapping conversion should validate all fields against schema columns.- Returns:
trueto validate all the fields in the dot-mapping file.
-
setEnsureValidation
void setEnsureValidation(boolean isValidating) Sets the flag whether the mapping conversion should validate all fields against schema columns.- Parameters:
isValidating- a boolean of indicating validating fields or not
-
isGeneratedField
Returnstrueif the field is generated. There are three types of generated fields: generated relationships, unknown primary key fields, and version consistency fields.- Parameters:
ejbName- The ejb-name element for the beanfieldName- The name of a container managed field in the named bean- Returns:
trueif the field is generated;falseotherwise.
-
isGeneratedRelationship
Flag whether the conversion helper generated the relationship field- Parameters:
ejbName- The ejb-name element for the beanfieldName- The name of a container managed field in the named bean.- Returns:
trueif the field was created by the conversion helper.
-
getGeneratedRelationships
Returns a list of generated relationship field names.- Parameters:
ejbName- The ejb-name element for the bean- Returns:
- a list of generated relationship field names
-