Interface ConversionHelper
-
- All Known Implementing Classes:
EjbConversionHelper
public interface ConversionHelperHelper interface for theMappingFile. 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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanapplyDefaultUnknownPKClassStrategy(String ejbName)Returns flag whether the mapping conversion should apply the default strategy for dealing with unknown primary key classes.booleanensureValidation()Returns the flag whether the mapping conversion should validate all fields against schema columns.booleangenerateFields()Returns the flag whether the mapping conversion should generate relationship fields and primary key fields to support run-time.Object[]getFields(String beanName)StringgetGeneratedPKFieldName()Returns the name used for generated primary key fields.ListgetGeneratedRelationships(String ejbName)Returns a list of generated relationship field names.StringgetGeneratedVersionFieldNamePrefix()Returns the prefix used for generated version fields.StringgetInverseFieldName(String ejbName, String fieldName)StringgetMappedClassName(String beanName)Computes the name of the TP implementation class for a bean.StringgetMultiplicity(String ejbName, String fieldName)StringgetRelationshipFieldContent(String ejbName, String fieldName)Return the name of the opposite roles ejb-nameStringgetRelationshipFieldType(String ejbName, String fieldName)booleanhasField(String beanName, String fieldName)booleanisGeneratedField(String ejbName, String fieldName)Returnstrueif the field is generated.booleanisGeneratedRelationship(String ejbName, String fieldName)Flag whether the conversion helper generated the relationship fieldbooleanisKey(String beanName, String fieldName, boolean candidate)Compute 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 Detail
-
ONE
static final String ONE
- See Also:
- Constant Field Values
-
MANY
static final String MANY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMappedClassName
String getMappedClassName(String beanName)
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
boolean hasField(String beanName, String fieldName)
- 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
-
isKey
boolean isKey(String beanName, String fieldName, boolean candidate)
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
String getRelationshipFieldContent(String ejbName, String fieldName)
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
String getMultiplicity(String ejbName, String fieldName)
- 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
String getRelationshipFieldType(String ejbName, String fieldName)
- 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
String getInverseFieldName(String ejbName, String fieldName)
- 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
boolean applyDefaultUnknownPKClassStrategy(String ejbName)
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
-
relatedObjectsAreDeleted
boolean relatedObjectsAreDeleted(String ejbName, String fieldName)
- Parameters:
ejbName- The ejb-name element for the beanfieldName- The name of a container managed field in the named bean.- Returns:
- boolean flag indicating whether the objects in this collection field are to be deleted when this field' owning object is deleted.
-
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
boolean isGeneratedField(String ejbName, String fieldName)
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
boolean isGeneratedRelationship(String ejbName, String fieldName)
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.
-
-