com.sun.jdo.spi.persistence.support.ejb.ejbc
Class EjbConversionHelper

java.lang.Object
  extended by com.sun.jdo.spi.persistence.support.ejb.ejbc.EjbConversionHelper
All Implemented Interfaces:
ConversionHelper

public class EjbConversionHelper
extends Object
implements ConversionHelper


Field Summary
 
Fields inherited from interface com.sun.jdo.api.persistence.mapping.ejb.ConversionHelper
MANY, ONE
 
Constructor Summary
EjbConversionHelper(NameMapper nameMapper)
           
 
Method Summary
 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)
           
 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)
           
 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)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EjbConversionHelper

public EjbConversionHelper(NameMapper nameMapper)
Method Detail

getMappedClassName

public String getMappedClassName(String ejbName)
Specified by:
getMappedClassName in interface ConversionHelper

hasField

public 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.

Specified by:
hasField in interface ConversionHelper
Parameters:
ejbName - The ejb-name element for the bean
fieldName - The name of a container managed field in the named bean
Returns:
true if the bean contains the field, otherwise return false

getFields

public 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.

Specified by:
getFields in interface ConversionHelper
Parameters:
ejbName - The ejb-name element for the bean
Returns:
an array of fields in the ejb bean

isKey

public boolean isKey(String ejbName,
                     String fieldName,
                     boolean candidate)
The boolean argument candidate is ignored in this case.

Specified by:
isKey in interface ConversionHelper

getRelationshipFieldType

public String getRelationshipFieldType(String ejbName,
                                       String fieldName)
This API will only be called from MappingFile when multiplicity is Many on the other role.

Specified by:
getRelationshipFieldType in interface ConversionHelper

getMultiplicity

public String getMultiplicity(String ejbName,
                              String fieldName)
getMultiplicity of the other role on the relationship Please note that multiplicity is JDO style

Specified by:
getMultiplicity in interface ConversionHelper

getRelationshipFieldContent

public String getRelationshipFieldContent(String ejbName,
                                          String fieldName)
Specified by:
getRelationshipFieldContent in interface ConversionHelper

getInverseFieldName

public String getInverseFieldName(String ejbName,
                                  String fieldName)
This method return the fieldName of relation role on the other end.

Specified by:
getInverseFieldName in interface ConversionHelper

applyDefaultUnknownPKClassStrategy

public 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 when generateFields returns true.

Specified by:
applyDefaultUnknownPKClassStrategy in interface ConversionHelper
Parameters:
ejbName - The value of the ejb-name element for a bean.
Returns:
true to apply the default unknown PK Class Strategy, false otherwise

getGeneratedPKFieldName

public String getGeneratedPKFieldName()
Returns the name used for generated primary key fields.

Specified by:
getGeneratedPKFieldName in interface ConversionHelper
Returns:
a string for key field name

getGeneratedVersionFieldNamePrefix

public String getGeneratedVersionFieldNamePrefix()
Returns the prefix used for generated version fields.

Specified by:
getGeneratedVersionFieldNamePrefix in interface ConversionHelper
Returns:
a string for version field name prefix

relatedObjectsAreDeleted

public boolean relatedObjectsAreDeleted(String beanName,
                                        String fieldName)
Specified by:
relatedObjectsAreDeleted in interface ConversionHelper

generateFields

public 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 even generateFields is false because it holds version column information.

Specified by:
generateFields in interface ConversionHelper
Returns:
true to generate fields in the dot-mapping file (if they are not present).

setGenerateFields

public 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.

Specified by:
setGenerateFields in interface ConversionHelper
Parameters:
generateFields - a flag which indicates whether fields should be generated

ensureValidation

public boolean ensureValidation()
Returns the flag whether the mapping conversion should validate all fields against schema columns.

Specified by:
ensureValidation in interface ConversionHelper
Returns:
true to validate all the fields in the dot-mapping file.

setEnsureValidation

public void setEnsureValidation(boolean isValidating)
Sets the flag whether the mapping conversion should validate all fields against schema columns.

Specified by:
setEnsureValidation in interface ConversionHelper
Parameters:
isValidating - a boolean of indicating validating fields or not

isGeneratedField

public boolean isGeneratedField(String ejbName,
                                String fieldName)
Returns true if the field is generated. There are three types of generated fields: generated relationships, unknown primary key fields, and version consistency fields.

Specified by:
isGeneratedField in interface ConversionHelper
Parameters:
ejbName - The ejb-name element for the bean
fieldName - The name of a container managed field in the named bean
Returns:
true if the field is generated; false otherwise.

isGeneratedRelationship

public boolean isGeneratedRelationship(String ejbName,
                                       String fieldName)
Specified by:
isGeneratedRelationship in interface ConversionHelper

getGeneratedRelationships

public List getGeneratedRelationships(String ejbName)
Returns a list of generated relationship field names.

Specified by:
getGeneratedRelationships in interface ConversionHelper
Parameters:
ejbName - The ejb-name element for the bean
Returns:
a list of generated relationship field names


Copyright © 2012. All Rights Reserved.