Package org.eclipse.persistence.mappings.structures

Examples of org.eclipse.persistence.mappings.structures.ArrayMapping


            // Process the @Column or column element if there is one.
            // A number of methods depend on this field so it must be
            // initialized before any further processing can take place.
            mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
        } else {
            ArrayMapping mapping = new ArrayMapping();
           
            // Add the mapping to the descriptor.
            setMapping(mapping);
   
            // Set the attribute name.
            mapping.setAttributeName(getAttributeName());
           
            // Will check for PROPERTY access
            setAccessorMethods(mapping);
           
            mapping.setStructureName(getDatabaseType());
           
            // Process the @Column or column element if there is one.
            // A number of methods depend on this field so it must be
            // initialized before any further processing can take place.
            mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
        }
    }
View Full Code Here


            }
            tableHelper.nestedIsComplex();
        }
        else  {
            if (!itemsMappingFound) {
                ArrayMapping itemsMapping = new ArrayMapping();
                itemsMapping.setAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME);
                itemsMapping.setFieldName(ITEMS_MAPPING_FIELD_NAME);
                itemsMapping.useCollectionClass(ArrayList.class);
                itemsMapping.setStructureName(tableHelper.targetTypeName());
                ordt.addMapping(itemsMapping);
            }
            if (top.isTable()) {
                tableHelper.nestedIsComplex();
            }
View Full Code Here

                            objectArrayMapping.setReferenceClassName(((TableHelper)top).tableName()
                                .toLowerCase() + COLLECTION_WRAPPER_SUFFIX);
                            ordt.addMapping(objectArrayMapping);
                        }
                        else {
                            ArrayMapping arrayMapping = new ArrayMapping();
                            arrayMapping.setAttributeName(lFieldName);
                            arrayMapping.setFieldName(lFieldName);
                            arrayMapping.setStructureName(top.targetTypeName());
                            ordt.addMapping(arrayMapping);
                        }
                    }
                    else if (top.isRecord()) {
                        StructureMapping structureMapping = new StructureMapping();
View Full Code Here

                    ObjectRelationalDataTypeDescriptor ordt =
                        descriptorMap.get(sqlArrayTypeHelper.arrayTypename());
                    DatabaseMapping dm = ordt.getMappingForAttributeName(attributeName);
                    if (dm == null) {
                        ordt.addFieldOrdering(fieldName);
                        ArrayMapping arrayMapping = new ArrayMapping();
                        arrayMapping.setFieldName(fieldName);
                        arrayMapping.setAttributeName(attributeName);
                        arrayMapping.useCollectionClass(ArrayList.class);
                        arrayMapping.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                        DatabaseField nestedField = new DatabaseField("");
                        nestedField.setSqlType(typecode);
                        nestedField.setColumnDefinition(sqlTypeName);
                        ObjectRelationalDatabaseField field =
                            (ObjectRelationalDatabaseField)arrayMapping.getField();
                        field.setNestedTypeField(nestedField);
                        ordt.addMapping(arrayMapping);
                    }
                }
            }
            else if (listenerHelper.isArray()) {
                SqlArrayTypeHelper sqlArrayTypeHelper = (SqlArrayTypeHelper)listenerHelper;
                ObjectRelationalDataTypeDescriptor ordt =
                    descriptorMap.get(sqlArrayTypeHelper.arrayTypename());
                DatabaseMapping dm = ordt.getMappingForAttributeName(ITEMS_ATTRIBUTE_NAME);
                if (dm == null) {
                    ArrayMapping arrayMapping = new ArrayMapping();
                    arrayMapping.setFieldName(ITEMS_ATTRIBUTE_NAME);
                    arrayMapping.setAttributeName(ITEMS_ATTRIBUTE_NAME);
                    arrayMapping.useCollectionClass(ArrayList.class);
                    arrayMapping.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                    DatabaseField nestedField = new DatabaseField("");
                    nestedField.setSqlType(typecode);
                    nestedField.setColumnDefinition(sqlTypeName);
                    ObjectRelationalDatabaseField field =
                        (ObjectRelationalDatabaseField)arrayMapping.getField();
                    field.setNestedTypeField(nestedField);
                    ordt.addMapping(arrayMapping);
                }
                ListenerHelper listenerHelper3 = stac.peek();
                ListenerHelper listenerHelper4 = null;
                if (listenerHelper3.isArray()) {
                    /*
                     * table of table scenario:
                    CREATE TYPE SOMEPACKAGE_TBL2 AS TABLE OF NUMBER;
                    CREATE TYPE SOMEPACKAGE_TBL4 AS TABLE OF SOMEPACKAGE_TBL2;
                     */
                    SqlArrayTypeHelper sqlArrayTypeHelper2 = (SqlArrayTypeHelper)listenerHelper3;
                    stac.pop();
                    ObjectRelationalDataTypeDescriptor ordt3 =
                        descriptorMap.get(sqlArrayTypeHelper2.arrayTypename());
                    DatabaseMapping dm3 = ordt3.getMappingForAttributeName(ITEMS_ATTRIBUTE_NAME);
                    if (dm3 == null) {
                        ObjectArrayMapping objArrayMapping = new ObjectArrayMapping();
                        objArrayMapping.setAttributeName(ITEMS_ATTRIBUTE_NAME);
                        objArrayMapping.setFieldName(ITEMS_ATTRIBUTE_NAME);
                        objArrayMapping.setStructureName(sqlArrayTypeHelper2.arrayTypename().toUpperCase());
                        objArrayMapping.setReferenceClassName(ordt.getJavaClassName());
                        objArrayMapping.useCollectionClass(ArrayList.class);
                        ordt3.addMapping(objArrayMapping);
                    }
                    // more stack peeking
                    if (stac.peek().isAttribute()) {
                        listenerHelper4 = stac.peek();
                    }
                }
                else {
                    listenerHelper4 = listenerHelper3;
                }
                if (listenerHelper4.isAttribute()) {
                    // type built above used in field definition of object further up stack
                    AttributeFieldHelper fieldHelper = (AttributeFieldHelper)listenerHelper4;
                    stac.pop();
                    ListenerHelper listenerHelper5 = stac.peek();
                    if (listenerHelper5.isObject()) {
                        ObjectTypeHelper objectTypeHelper = (ObjectTypeHelper)listenerHelper5;
                        ObjectRelationalDataTypeDescriptor ordt2 =
                            descriptorMap.get(objectTypeHelper.objectTypename());
                        String fieldName = fieldHelper.attributeFieldName();
                        DatabaseMapping dm2 =
                            ordt2.getMappingForAttributeName(fieldName.toLowerCase());
                        if (dm2 == null) {
                            ordt2.addFieldOrdering(fieldName);
                            // simple or complex array?
                            if (listenerHelper4 == listenerHelper3) {
                                ArrayMapping arrayMapping2 = new ArrayMapping();
                                arrayMapping2.setAttributeName(fieldName.toLowerCase());
                                arrayMapping2.setFieldName(fieldName);
                                arrayMapping2.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                                arrayMapping2.useCollectionClass(ArrayList.class);
                                DatabaseField nestedField = new DatabaseField("");
                                nestedField.setSqlType(typecode);
                                nestedField.setColumnDefinition(sqlTypeName);
                                ObjectRelationalDatabaseField field =
                                    (ObjectRelationalDatabaseField)arrayMapping2.getField();
                                field.setNestedTypeField(nestedField);
                                ordt2.addMapping(arrayMapping2);
                            }
                            else {
                                ObjectArrayMapping objArrayMapping2 = new ObjectArrayMapping();
View Full Code Here

            // Process the @Column or column element if there is one.
            // A number of methods depend on this field so it must be
            // initialized before any further processing can take place.
            mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
        } else {
            ArrayMapping mapping = new ArrayMapping();
           
            // Add the mapping to the descriptor.
            setMapping(mapping);
   
            // Set the attribute name.
            mapping.setAttributeName(getAttributeName());
           
            // Will check for PROPERTY access
            setAccessorMethods(mapping);
           
            mapping.setStructureName(getDatabaseType());
           
            // Process the @Column or column element if there is one.
            // A number of methods depend on this field so it must be
            // initialized before any further processing can take place.
            mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
        }
    }
View Full Code Here

                    ObjectRelationalDataTypeDescriptor ordt =
                        descriptorMap.get(sqlArrayTypeHelper.arrayTypename());
                    DatabaseMapping dm = ordt.getMappingForAttributeName(attributeName);
                    if (dm == null) {
                        ordt.addFieldOrdering(fieldName);
                        ArrayMapping arrayMapping = new ArrayMapping();
                        arrayMapping.setFieldName(fieldName);
                        arrayMapping.setAttributeName(attributeName);
                        arrayMapping.useCollectionClass(ArrayList.class);
                        arrayMapping.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                        DatabaseField nestedField = new DatabaseField("");
                        nestedField.setSqlType(typecode);
                        nestedField.setColumnDefinition(sqlTypeName);
                        ObjectRelationalDatabaseField field =
                            (ObjectRelationalDatabaseField)arrayMapping.getField();
                        field.setNestedTypeField(nestedField);
                        ordt.addMapping(arrayMapping);
                    }
                }
            }
            else if (listenerHelper.isArray()) {
                SqlArrayTypeHelper sqlArrayTypeHelper = (SqlArrayTypeHelper)listenerHelper;
                ObjectRelationalDataTypeDescriptor ordt =
                    descriptorMap.get(sqlArrayTypeHelper.arrayTypename());
                DatabaseMapping dm = ordt.getMappingForAttributeName(ITEMS_ATTRIBUTE_NAME);
                if (dm == null) {
                    ArrayMapping arrayMapping = new ArrayMapping();
                    arrayMapping.setFieldName(ITEMS_ATTRIBUTE_NAME);
                    arrayMapping.setAttributeName(ITEMS_ATTRIBUTE_NAME);
                    arrayMapping.useCollectionClass(ArrayList.class);
                    arrayMapping.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                    DatabaseField nestedField = new DatabaseField("");
                    nestedField.setSqlType(typecode);
                    nestedField.setColumnDefinition(sqlTypeName);
                    ObjectRelationalDatabaseField field =
                        (ObjectRelationalDatabaseField)arrayMapping.getField();
                    field.setNestedTypeField(nestedField);
                    ordt.addMapping(arrayMapping);
                }
                ListenerHelper listenerHelper3 = stac.peek();
                ListenerHelper listenerHelper4 = null;
                if (listenerHelper3.isArray()) {
                    /*
                     * table of table scenario:
                    CREATE TYPE SOMEPACKAGE_TBL2 AS TABLE OF NUMBER;
                    CREATE TYPE SOMEPACKAGE_TBL4 AS TABLE OF SOMEPACKAGE_TBL2;
                     */
                    SqlArrayTypeHelper sqlArrayTypeHelper2 = (SqlArrayTypeHelper)listenerHelper3;
                    stac.pop();
                    ObjectRelationalDataTypeDescriptor ordt3 =
                        descriptorMap.get(sqlArrayTypeHelper2.arrayTypename());
                    DatabaseMapping dm3 = ordt3.getMappingForAttributeName(ITEMS_ATTRIBUTE_NAME);
                    if (dm3 == null) {
                        ObjectArrayMapping objArrayMapping = new ObjectArrayMapping();
                        objArrayMapping.setAttributeName(ITEMS_ATTRIBUTE_NAME);
                        objArrayMapping.setFieldName(ITEMS_ATTRIBUTE_NAME);
                        objArrayMapping.setStructureName(sqlArrayTypeHelper2.arrayTypename().toUpperCase());
                        objArrayMapping.setReferenceClassName(ordt.getJavaClassName());
                        objArrayMapping.useCollectionClass(ArrayList.class);
                        ordt3.addMapping(objArrayMapping);
                    }
                    // more stack peeking
                    if (stac.peek().isAttribute()) {
                        listenerHelper4 = stac.peek();
                    }
                }
                else {
                    listenerHelper4 = listenerHelper3;
                }
                if (listenerHelper4.isAttribute()) {
                    // type built above used in field definition of object further up stack
                    AttributeFieldHelper fieldHelper = (AttributeFieldHelper)listenerHelper4;
                    stac.pop();
                    ListenerHelper listenerHelper5 = stac.peek();
                    if (listenerHelper5.isObject()) {
                        ObjectTypeHelper objectTypeHelper = (ObjectTypeHelper)listenerHelper5;
                        ObjectRelationalDataTypeDescriptor ordt2 =
                            descriptorMap.get(objectTypeHelper.objectTypename());
                        String fieldName = fieldHelper.attributeFieldName();
                        DatabaseMapping dm2 =
                            ordt2.getMappingForAttributeName(fieldName.toLowerCase());
                        if (dm2 == null) {
                            ordt2.addFieldOrdering(fieldName);
                            // simple or complex array?
                            if (listenerHelper4 == listenerHelper3) {
                                ArrayMapping arrayMapping2 = new ArrayMapping();
                                arrayMapping2.setAttributeName(fieldName.toLowerCase());
                                arrayMapping2.setFieldName(fieldName);
                                arrayMapping2.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                                arrayMapping2.useCollectionClass(ArrayList.class);
                                DatabaseField nestedField = new DatabaseField("");
                                nestedField.setSqlType(typecode);
                                nestedField.setColumnDefinition(sqlTypeName);
                                ObjectRelationalDatabaseField field =
                                    (ObjectRelationalDatabaseField)arrayMapping2.getField();
                                field.setNestedTypeField(nestedField);
                                ordt2.addMapping(arrayMapping2);
                            }
                            else {
                                ObjectArrayMapping objArrayMapping2 = new ObjectArrayMapping();
View Full Code Here

            }
            tableHelper.nestedIsComplex();
        }
        else  {
            if (!itemsMappingFound) {
                ArrayMapping itemsMapping = new ArrayMapping();
                itemsMapping.setAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME);
                itemsMapping.setFieldName(ITEMS_MAPPING_FIELD_NAME);
                itemsMapping.useCollectionClass(ArrayList.class);
                itemsMapping.setStructureName(tableHelper.targetTypeName());
                ordt.addMapping(itemsMapping);
            }
            if (top.isTable()) {
                tableHelper.nestedIsComplex();
            }
View Full Code Here

                            objectArrayMapping.setReferenceClassName(((TableHelper)top).tableName()
                                .toLowerCase() + COLLECTION_WRAPPER_SUFFIX);
                            ordt.addMapping(objectArrayMapping);
                        }
                        else {
                            ArrayMapping arrayMapping = new ArrayMapping();
                            arrayMapping.setAttributeName(lFieldName);
                            arrayMapping.setFieldName(lFieldName);
                            arrayMapping.setStructureName(top.targetTypeName());
                            ordt.addMapping(arrayMapping);
                        }
                    }
                    else if (top.isRecord()) {
                        StructureMapping structureMapping = new StructureMapping();
View Full Code Here

            // Process the @Column or column element if there is one.
            // A number of methods depend on this field so it must be
            // initialized before any further processing can take place.
            mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
        } else {
            ArrayMapping mapping = new ArrayMapping();
           
            // Add the mapping to the descriptor.
            setMapping(mapping);
   
            // Set the attribute name.
            mapping.setAttributeName(getAttributeName());
           
            // Will check for PROPERTY access
            setAccessorMethods(mapping);
           
            mapping.setStructureName(getDatabaseType());
           
            // Process the @Column or column element if there is one.
            // A number of methods depend on this field so it must be
            // initialized before any further processing can take place.
            mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
        }
    }
View Full Code Here

            // Process the @Column or column element if there is one.
            // A number of methods depend on this field so it must be
            // initialized before any further processing can take place.
            mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
        } else {
            ArrayMapping mapping = new ArrayMapping();
           
            // Add the mapping to the descriptor.
            setMapping(mapping);
   
            // Set the attribute name.
            mapping.setAttributeName(getAttributeName());
           
            // Will check for PROPERTY access
            setAccessorMethods(mapping);
           
            mapping.setStructureName(getDatabaseType());
           
            // Process the @Column or column element if there is one.
            // A number of methods depend on this field so it must be
            // initialized before any further processing can take place.
            mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.mappings.structures.ArrayMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.