Interface ConversionHelper

  • All Known Implementing Classes:
    EjbConversionHelper

    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
    • 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 bean
        fieldName - 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 when generateFields() returns true.
        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

        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 bean
        fieldName - 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 even generateFields() is false because it holds version column information.
        Returns:
        true to 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:
        true to 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)
        Returns true if 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 bean
        fieldName - The name of a container managed field in the named bean
        Returns:
        true if the field is generated; false otherwise.
      • isGeneratedRelationship

        boolean isGeneratedRelationship​(String ejbName,
                                        String fieldName)
        Flag whether the conversion helper generated the relationship field
        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 was created by the conversion helper.
      • getGeneratedRelationships

        List getGeneratedRelationships​(String ejbName)
        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