Class XmlEntityMappingsGenerator

java.lang.Object
org.eclipse.persistence.tools.dbws.XmlEntityMappingsGenerator

public class XmlEntityMappingsGenerator extends Object
This class is responsible for generating an XMLEntityMappings instance based on a given OR Project's Queries and Descriptors.
  • Constructor Details

    • XmlEntityMappingsGenerator

      public XmlEntityMappingsGenerator()
  • Method Details

    • generateXmlEntityMappings

      public static XMLEntityMappings generateXmlEntityMappings(Project orProject, List<CompositeDatabaseType> complexTypes, Map<String,Map<String,String>> crudOperations)
      Generate an XMLEntityMappings instance based on a given OR Project's Queries and Descriptors.
      Parameters:
      orProject - the ORM Project instance containing Queries and Descriptors to be used to generate an XMLEntityMappings
      complexTypes - list of composite database types used to generate metadata for advanced Oracle and PL/SQL types
      crudOperations - map of maps keyed on table name - the second map are operation name to SQL string entries
    • generateMappingAccessor

      protected static MappingAccessor generateMappingAccessor(DatabaseMapping mapping, List<String> embeddables)
      Process a given DatabaseMapping and return a MappingAccessor. Expected mappings are:
      • org.eclipse.persistence.mappings.DirectToFieldMapping
      • org.eclipse.persistence.mappings.structures.ArrayMapping
      • org.eclipse.persistence.mappings.structures.ObjectArrayMapping
      • org.eclipse.persistence.mappings.structures.StructureMapping
    • processDirectMapping

      protected static BasicAccessor processDirectMapping(DirectToFieldMapping mapping)
      Generate a MappingAccessor for a given DirectToFieldMapping.
    • processArrayMapping

      protected static ArrayAccessor processArrayMapping(ArrayMapping mapping)
      Generate a MappingAccessor for a given ArrayMapping.
    • processObjectArrayMapping

      protected static ArrayAccessor processObjectArrayMapping(ObjectArrayMapping mapping)
      Generate a MappingAccessor for a given ObjectArrayMapping.
    • processStructureMapping

      protected static StructureAccessor processStructureMapping(StructureMapping mapping)
      Generate a MappingAccessor for a given StructureMapping.
    • processEmbeddedMapping

      protected static EmbeddedAccessor processEmbeddedMapping(AggregateMapping mapping)
      Generate an EmbeddedAccessor for a given AggregateMapping.
    • getDirectionAsString

      public static String getDirectionAsString(DatasourceCall.ParameterType direction)
      Return a parameter direction as a String based on a given in value. Expected 'direction' value is one of:
      • org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType.IN
      • org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType.INOUT
      • org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType.OUT
      • org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType.OUT_CURSOR
    • getParameterModeAsString

      public static String getParameterModeAsString(DatasourceCall.ParameterType direction)
      Return a parameter mode as a String based on a given in value. Expected 'direction' value is one of:
      • org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType.IN
      • org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType.INOUT
      • org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType.OUT
      • org.eclipse.persistence.internal.databaseaccess.DatasourceCall.ParameterType.OUT_CURSOR
      Will return one of:
      • org.eclipse.persistence.internal.jpa.metadata.MetadataConstants.JPA_PARAMETER_IN
      • org.eclipse.persistence.internal.jpa.metadata.MetadataConstants.JPA_PARAMETER_INOUT
      • org.eclipse.persistence.internal.jpa.metadata.MetadataConstants.JPA_PARAMETER_OUT
      • org.eclipse.persistence.internal.jpa.metadata.MetadataConstants.JPA_PARAMETER_REF_CURSOR
    • processTypeName

      protected static String processTypeName(String typeName)
      Alter the given type name if required.
    • processCompositeTypes

      protected static List<ComplexTypeMetadata> processCompositeTypes(List<CompositeDatabaseType> complexTypes, Project orProject)
      Returns a list of ComplexTypeMetadata instances generated based on a list of CompositeDatabaseTypes. The given non-empty list should contain one or more of the following types:
      • PLSQLCollectionType
      • PLSQLRecordType
      • ObjectTableType
      • ObjectType
      • VArrayType
    • processDatabaseType

      protected static ComplexTypeMetadata processDatabaseType(CompositeDatabaseType cdbType, Project orProject)
      Process the given CompositeDatabaseType and return a ComplexTypeMetadata instance. The given type is expected to be one of:
      • PLSQLCollectionType
      • PLSQLRecordType
      • ObjectTableType
      • ObjectType
      • VArrayType
      If the given type is not one of these, null is returned.
    • processDatabaseType

      protected static ComplexTypeMetadata processDatabaseType(CompositeDatabaseType cdbType, Project orProject, List<String> processedTypeNames)
      Process the given CompositeDatabaseType and return a ComplexTypeMetadata instance. The given type is expected to be one of:
      • PLSQLCollectionType
      • PLSQLRecordType
      • ObjectTableType
      • ObjectType
      • VArrayType
      If the given type is not one of these, null is returned. Previously processed types are tracked to avoid unnecessary work.
    • processPLSQLCollectionType

      protected static ComplexTypeMetadata processPLSQLCollectionType(PLSQLCollectionType plsqlCollectionType)
      Process the given PLSQLCollectionType and return a PLSQLTableMetadata instance.
    • processPLSQLRecordType

      protected static ComplexTypeMetadata processPLSQLRecordType(PLSQLRecordType plsqlRecordType)
      Process the given PLSQLRecordType and return a PLSQLRecordMetadata instance.
    • processObjectTableType

      protected static ComplexTypeMetadata processObjectTableType(ObjectTableType oTableType, Project orProject)
      Process the given ObjectTableType and return an OracleArrayTypeMetadata instance.
    • processObjectType

      protected static ComplexTypeMetadata processObjectType(ObjectType oType, Project orProject)
      Process the given ObjectType and return an OracleObjectTypeMetadata instance.
    • processVArrayType

      protected static ComplexTypeMetadata processVArrayType(VArrayType vType, Project orProject)
      Process the given VArrayType and return an OracleArrayTypeMetadata instance.
    • addQueryHint

      protected static void addQueryHint(NamedNativeQueryMetadata metadata)
      Adds a ReturnNameValuePairsHint to the given query metadata instance.