Package org.eclipse.persistence.internal.helper

Examples of org.eclipse.persistence.internal.helper.ComplexDatabaseType


            }
        }
        if (!typeStack.empty()) {
            DatabaseType top = typeStack.peek();
            if (top.isComplexDatabaseType()) {
                ComplexDatabaseType cdt = (ComplexDatabaseType)top;
                if (cdt.isCollection()) {
                    if (cdt.isJDBCType()) {
                        //TODO Oracle Varray
                    }
                    else {
                        PLSQLCollection coll = (PLSQLCollection)cdt;
                        if (coll.getNestedType() == null) {
                            coll.setNestedType(databaseType);
                        }
                    }
                }
                else {
                    if (cdt.isRecord()) {
                        PLSQLrecord rec = (PLSQLrecord)cdt;
                        List<PLSQLargument> fields = rec.getFields();
                        PLSQLargument arg = fields.get(fields.size() - 1);
                        if (arg.databaseType == null) {
                            arg.databaseType = databaseType;
                        }
                    }
                    else if (cdt.isJDBCType()) {
                        OracleObjectType oot = (OracleObjectType)cdt;
                        Map<String, DatabaseType> fields = oot.getFields();
                        Object[] keys = oot.getFields().keySet().toArray();
                        String lastInsertedKey = (String)keys[oot.getLastFieldIndex()];
                        fields.put(lastInsertedKey, databaseType);
View Full Code Here


        if (databaseType == null) {
            OracleObjectType objectType = new OracleObjectType();
            objectType.setTypeName(objectTypename);
            DatabaseType top = typeStack.peek();
            if (top.isComplexDatabaseType()) {
                ComplexDatabaseType cdt = (ComplexDatabaseType)top;
                if (cdt.isJDBCType()) {
                    if (cdt.isCollection()) {
                        OracleArrayType oat = (OracleArrayType)cdt;
                        oat.setNestedType(objectType);
                    }
                    else {
                        OracleObjectType oot = (OracleObjectType)cdt;
View Full Code Here

            databaseType = getKnownDatabaseType(objectTypename);
        }
        if (!typeStack.empty()) {
            DatabaseType top = typeStack.peek();
            if (top.isComplexDatabaseType()) {
                ComplexDatabaseType cdt = (ComplexDatabaseType)top;
                if (cdt.isCollection()) {
                    PLSQLCollection coll = (PLSQLCollection)cdt;
                    if (coll.getNestedType() == null) {
                        coll.setNestedType(databaseType);
                    }
                }
                else if (cdt.isRecord()) {
                    PLSQLrecord rec = (PLSQLrecord)cdt;
                    List<PLSQLargument> fields = rec.getFields();
                    PLSQLargument arg = fields.get(fields.size() - 1);
                    if (arg.databaseType == null) {
                        arg.databaseType = databaseType;
                    }
                }
                else if (cdt.isJDBCType()) {
                    if (typeStack.size() > 1) {
                        typeStack.pop();
                        DatabaseType topMinus1 = typeStack.peek();
                        if (topMinus1.isComplexDatabaseType()) {
                            ComplexDatabaseType cdtMinus1 = (ComplexDatabaseType)topMinus1;
                            if (cdtMinus1.isRecord()) {
                                PLSQLrecord rec = (PLSQLrecord)cdtMinus1;
                                List<PLSQLargument> fields = rec.getFields();
                                PLSQLargument arg = fields.get(fields.size() - 1);
                                if (arg.databaseType == null) {
                                    arg.databaseType = cdt;
View Full Code Here

    @Override
    public void handleAttributeField(String attributeFieldName, int idx) {
        if (!typeStack.empty()) {
            DatabaseType top = typeStack.peek();
            if (top.isComplexDatabaseType() && top.isJDBCType()) {
                ComplexDatabaseType cdt = (ComplexDatabaseType)top;
                OracleObjectType oot = (OracleObjectType)cdt;
                oot.getFields().put(attributeFieldName, JDBCTypes.NULL_TYPE); // placeholder
                oot.setLastFieldIndex(idx);
            }
        }
View Full Code Here

    @Override
    public void endPlsqlRecordField(String fieldName, int idx) {
        if (!typeStack.empty()) {
            DatabaseType top = typeStack.peek();
            if (top.isComplexDatabaseType()) {
                ComplexDatabaseType cdt = (ComplexDatabaseType)top;
                if (cdt.isJDBCType() && cdt.isCollection()) {
                    // take OracleArrayType off stack
                    DatabaseType pop = typeStack.pop();
                    if (!typeStack.isEmpty()) {
                        DatabaseType topMinus1 = typeStack.peek();
                        if (topMinus1.isComplexDatabaseType()) {
                            ComplexDatabaseType cdtMinus1 = (ComplexDatabaseType)topMinus1;
                            if (cdtMinus1.isRecord()) {
                                PLSQLrecord recMinus1 = (PLSQLrecord)cdtMinus1;
                                PLSQLargument arg = null;
                                for (Iterator<PLSQLargument> i = recMinus1.getFields().iterator(); i.hasNext();) {
                                    arg = i.next();
                                    if (arg.name.equalsIgnoreCase(fieldName)) {
View Full Code Here

                break;
            }
            for (int i = 0, len = databaseTypes.length; i < len; i++) {
                DatabaseType databaseType = databaseTypes[i];
                if (databaseType != null && databaseType.isComplexDatabaseType()) {
                    ComplexDatabaseType cdt = (ComplexDatabaseType)databaseType;
                    if (cdt.isCollection()) {
                        PLSQLCollection tmp = (PLSQLCollection)cdt;
                        if (tmp.getCompatibleType().equalsIgnoreCase(targetTypeName)) {
                            found = true;
                            plsqlCollection = tmp;
                            break;
View Full Code Here

        plsqlCollection.setJavaTypeName(
            plsqlCollection.getTypeName().toLowerCase() + COLLECTION_WRAPPER_SUFFIX);
        if (!typeStack.empty()) {
            DatabaseType top = typeStack.peek();
            if (top.isComplexDatabaseType()) {
                ComplexDatabaseType cdt = (ComplexDatabaseType)top;
                if (cdt.isCollection()) {
                    ((PLSQLCollection)cdt).setNestedType(plsqlCollection);
                }
                else if (cdt.isRecord()) {
                    List<PLSQLargument> fields = ((PLSQLrecord)cdt).getFields();
                    PLSQLargument field = fields.get(fields.size() - 1);
                    if (field.databaseType == null) {
                        field.databaseType = plsqlCollection;
                    }
View Full Code Here

     */
    public static DatabaseTypeWrapper wrapType(DatabaseType databaseType) {
        if (databaseType.isJDBCType()) {
            return new JDBCTypeWrapper(databaseType);
        } else if (databaseType.isComplexDatabaseType()) {
            ComplexDatabaseType complexType = (ComplexDatabaseType)databaseType;
            if (complexType.isRecord()) {
              return new PLSQLRecordWrapper(databaseType);
            } else if (complexType.isCollection()) {
              return new PLSQLCollectionWrapper(databaseType);
            }
        } else {
            return new SimplePLSQLTypeWrapper(databaseType);
        }
View Full Code Here

        for (PLSQLargument inArg : inArguments) {
            DatabaseType type = inArg.databaseType;
            if (!type.isComplexDatabaseType()) {
                super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode());
            } else {
                ComplexDatabaseType complexType = (ComplexDatabaseType) type;
                if (inArg.inIndex != MIN_VALUE) {
                    if (type instanceof PLSQLCollection) {
                        DatabaseType nestedType = ((PLSQLCollection) type).getNestedType();
                        if (nestedType != null) {
                            ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(inArg.name);
                            field.setSqlType(nestedType.getConversionCode());
                            if (nestedType.isComplexDatabaseType()) {
                                field.setSqlTypeName(((ComplexDatabaseType) nestedType).getCompatibleType());
                            }
                            super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType(), field);
                        } else {
                            super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
                        }
                    } else {
                        super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
                    }
                }
            }
        }
        List<PLSQLargument> outArguments = getArguments(arguments, OUT);
        outArguments.addAll(inOutArguments);
        for (ListIterator<PLSQLargument> outArgsIter = outArguments.listIterator(); outArgsIter.hasNext();) {
            PLSQLargument outArg = outArgsIter.next();
            newIndex = outArg.databaseType.computeOutIndex(outArg, newIndex, outArgsIter);
        }
        for (PLSQLargument outArg : outArguments) {
            DatabaseType type = outArg.databaseType;
            if (!type.isComplexDatabaseType()) {
                super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode());
            } else {
                ComplexDatabaseType complexType = (ComplexDatabaseType) type;
                if (outArg.outIndex != MIN_VALUE) {
                    if (complexType instanceof PLSQLCollection) {
                        DatabaseType nestedType = ((PLSQLCollection) complexType).getNestedType();
                        if (nestedType != null) {
                            ObjectRelationalDatabaseField nestedField = new ObjectRelationalDatabaseField(outArg.name);
                            nestedField.setSqlType(nestedType.getConversionCode());
                            if (nestedType.isComplexDatabaseType()) {
                                ComplexDatabaseType complexNestedType = (ComplexDatabaseType) nestedType;
                                nestedField.setType(complexNestedType.getJavaType());
                                nestedField.setSqlTypeName(complexNestedType.getCompatibleType());
                            }
                            super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getCompatibleType(), complexType.getJavaType(), nestedField);
                        } else {
                            super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getCompatibleType());
                        }
View Full Code Here

                DatabaseType databaseType, Set<DatabaseType> processed) {
        if ((databaseType == null) || !databaseType.isComplexDatabaseType()
                || databaseType.isJDBCType() || processed.contains(databaseType)) {
            return;
        }
        ComplexDatabaseType type = (ComplexDatabaseType)databaseType;
        if (!type.hasCompatibleType()) {
            return;
        }
        processed.add(type);
        if (type instanceof PLSQLCollection) {
            DatabaseType nestedType = ((PLSQLCollection)type).getNestedType();
            addNestedFunctionsForArgument(functions, argument, nestedType, processed);
        } else if (type instanceof PLSQLrecord) {
            for (PLSQLargument field : ((PLSQLrecord)type).getFields()) {
                DatabaseType nestedType = field.databaseType;
                addNestedFunctionsForArgument(functions, argument, nestedType, processed);
            }
        }
        TypeInfo info = this.typesInfo.get(type.getTypeName());
        // If the info was not found in publisher, then generate it.
        if (info == null) {
            info = generateNestedFunction(type);
        }
        if (argument.direction == IN) {
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.internal.helper.ComplexDatabaseType

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.