public class EjbConversionHelper extends Object implements ConversionHelper
MANY, ONE
Constructor and Description |
---|
EjbConversionHelper(NameMapper nameMapper) |
Modifier and Type | Method and Description |
---|---|
boolean |
applyDefaultUnknownPKClassStrategy(String ejbName)
Returns flag whether the mapping conversion should apply the default
strategy for dealing with unknown primary key classes.
|
boolean |
ensureValidation()
Returns the flag whether the mapping conversion should validate
all fields against schema columns.
|
boolean |
generateFields()
Returns the flag whether the mapping conversion should generate
relationship fields and primary key fields to support run-time.
|
Object[] |
getFields(String ejbName)
If
generateFields is true , then this method will
return an array of cmp + cmr + pseudo cmr fields, otherwise
the method will return an array of cmp + cmr fields. |
String |
getGeneratedPKFieldName()
Returns the name used for generated primary key fields.
|
List |
getGeneratedRelationships(String ejbName)
Returns a list of generated relationship field names.
|
String |
getGeneratedVersionFieldNamePrefix()
Returns the prefix used for generated version fields.
|
String |
getInverseFieldName(String ejbName,
String fieldName)
This method return the fieldName of relation role on the other end.
|
String |
getMappedClassName(String ejbName)
Computes the name of the TP implementation class for a bean.
|
String |
getMultiplicity(String ejbName,
String fieldName)
getMultiplicity of the other role on the relationship
Please note that multiplicity is JDO style
|
String |
getRelationshipFieldContent(String ejbName,
String fieldName)
Return the name of the opposite roles ejb-name
|
String |
getRelationshipFieldType(String ejbName,
String fieldName)
This API will only be called from MappingFile when multiplicity is Many
on the other role.
|
boolean |
hasField(String ejbName,
String fieldName)
If
generateFields is true , then this method will
check if the field is one of the cmp + cmr + pseudo cmr fields, otherwise
the method will check if the field is one of the cmp + cmr fields. |
boolean |
isGeneratedField(String ejbName,
String fieldName)
Returns
true if the field is generated. |
boolean |
isGeneratedRelationship(String ejbName,
String fieldName)
Flag whether the conversion helper generated the relationship field
|
boolean |
isKey(String ejbName,
String fieldName,
boolean candidate)
The boolean argument candidate is ignored in this case.
|
boolean |
relatedObjectsAreDeleted(String beanName,
String fieldName) |
void |
setEnsureValidation(boolean isValidating)
Sets the flag whether the mapping conversion should validate all fields
against schema columns.
|
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.
|
public EjbConversionHelper(NameMapper nameMapper)
public String getMappedClassName(String ejbName)
ConversionHelper
getMappedClassName
in interface ConversionHelper
ejbName
- The value of the ejb-name element for a bean.public boolean hasField(String ejbName, String fieldName)
generateFields
is true
, then this method will
check if the field is one of the cmp + cmr + pseudo cmr fields, otherwise
the method will check if the field is one of the cmp + cmr fields.hasField
in interface ConversionHelper
ejbName
- The ejb-name element for the beanfieldName
- The name of a container managed field in the named beantrue
if the bean contains the field, otherwise
return false
public Object[] getFields(String ejbName)
generateFields
is true
, then this method will
return an array of cmp + cmr + pseudo cmr fields, otherwise
the method will return an array of cmp + cmr fields.getFields
in interface ConversionHelper
ejbName
- The ejb-name element for the beanpublic boolean isKey(String ejbName, String fieldName, boolean candidate)
isKey
in interface ConversionHelper
ejbName
- 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.public String getRelationshipFieldType(String ejbName, String fieldName)
getRelationshipFieldType
in interface ConversionHelper
ejbName
- The value of the ejb-name element for a bean.fieldName
- The name of a container managed field in the named bean.public String getMultiplicity(String ejbName, String fieldName)
getMultiplicity
in interface ConversionHelper
ejbName
- The ejb-name element for the beanfieldName
- The name of a container managed field in the named bean.public String getRelationshipFieldContent(String ejbName, String fieldName)
ConversionHelper
getRelationshipFieldContent
in interface ConversionHelper
ejbName
- The value of the ejb-name element for a bean.fieldName
- The name of a container managed field in the named bean.public String getInverseFieldName(String ejbName, String fieldName)
getInverseFieldName
in interface ConversionHelper
ejbName
- The value of the ejb-name element for a bean.fieldName
- The name of a container managed field in the named bean.public boolean applyDefaultUnknownPKClassStrategy(String ejbName)
generateFields
returns true
.applyDefaultUnknownPKClassStrategy
in interface ConversionHelper
ejbName
- The value of the ejb-name element for a bean.true
to apply the default unknown PK Class Strategy,
false
otherwisepublic String getGeneratedPKFieldName()
getGeneratedPKFieldName
in interface ConversionHelper
public String getGeneratedVersionFieldNamePrefix()
getGeneratedVersionFieldNamePrefix
in interface ConversionHelper
public boolean relatedObjectsAreDeleted(String beanName, String fieldName)
relatedObjectsAreDeleted
in interface ConversionHelper
beanName
- The ejb-name element for the beanfieldName
- The name of a container managed field in the named bean.public boolean generateFields()
generateFields
is
false
because it holds version column information.generateFields
in interface ConversionHelper
true
to generate fields in the dot-mapping file
(if they are not present).public void setGenerateFields(boolean generateFields)
setGenerateFields
in interface ConversionHelper
generateFields
- a flag which indicates whether fields should be
generatedpublic boolean ensureValidation()
ensureValidation
in interface ConversionHelper
true
to validate all the fields in the dot-mapping
file.public void setEnsureValidation(boolean isValidating)
setEnsureValidation
in interface ConversionHelper
isValidating
- a boolean of indicating validating fields or notpublic boolean isGeneratedField(String ejbName, String fieldName)
true
if the field is generated. There are three
types of generated fields: generated relationships, unknown primary key
fields, and version consistency fields.isGeneratedField
in interface ConversionHelper
ejbName
- The ejb-name element for the beanfieldName
- The name of a container managed field in the named beantrue
if the field is generated; false
otherwise.public boolean isGeneratedRelationship(String ejbName, String fieldName)
ConversionHelper
isGeneratedRelationship
in interface ConversionHelper
ejbName
- The ejb-name element for the beanfieldName
- The name of a container managed field in the named bean.true
if the field was created by the conversion
helper.public List getGeneratedRelationships(String ejbName)
getGeneratedRelationships
in interface ConversionHelper
ejbName
- The ejb-name element for the beanCopyright © 2018. All rights reserved.