Examples of FieldDescriptorJDONature


Examples of org.exolab.castor.jdo.engine.nature.FieldDescriptorJDONature

        sqlTypes0 = new int[fields.length + 1];
        // the first field is the identity

        count = 1;
        jdoFields0[0] = _clsDesc.getIdentity().getFieldName();
        sqlTypes0[0] new FieldDescriptorJDONature(_clsDesc.getIdentity()).getSQLType()[0];
        for (int i = 0; i < fields.length; ++i) {
            if (fields[i].hasNature(FieldDescriptorJDONature.class.getName())) {
                jdoFields0[count] = new FieldDescriptorJDONature(fields[i]).getSQLName()[0];
                sqlTypes0[count] new FieldDescriptorJDONature(fields[i]).getSQLType()[0];
                ++count;
            }
        }
        jdoFields = new String[count];
        sqlTypes = new int[count];
View Full Code Here

Examples of org.exolab.castor.jdo.engine.nature.FieldDescriptorJDONature

    }
    if (desc != null) {
        _fieldType = desc.getFieldType();
        try {
            _sqlType = SQLTypeInfos.sqlTypeNum2javaType(
                    new FieldDescriptorJDONature(desc).getSQLType()[0]);
        } catch (Exception ex) {
            throw new QueryException("Can't determine SQL class: " + ex);
        }
        _convertor = new FieldDescriptorJDONature(desc).getConvertor();
    }
  }
View Full Code Here

Examples of org.exolab.castor.jdo.engine.nature.FieldDescriptorJDONature

            FieldDescriptor[] identityDescriptors = cdi.getIdentities();
            boolean isNull = true;
           
            for (int i = 0; i < identityDescriptors.length; i++) {
                Object temp;
                final FieldDescriptorJDONature jdoFieldNature =
                    new FieldDescriptorJDONature(identityDescriptors[i]);
               
                if (jdoFieldNature.getSQLName().length == 1) {
                    temp = SQLTypeInfos.getValue(rs, columnIndex++, java.sql.Types.JAVA_OBJECT);
                } else {
                    Object[] temps = new Object[jdoFieldNature.getSQLName().length];
                    for (int j = 0; j < jdoFieldNature.getSQLName().length; j++) {
                        temps[j] = SQLTypeInfos.getValue(
                                rs, columnIndex++, java.sql.Types.JAVA_OBJECT);
                    }
                    temp = new Identity(temps);
                }
               
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Obtained value " + temp + " for additional (extending) identity "
                            + potentialClassDescriptor.getJavaClass().getName() + "/"
                            + identityDescriptors[i].getFieldName() + " at position "
                            + columnIndex);
                }
               
                isNull = (temp == null);
                if (!isNull) {
                    numberOfIdentitiesToAnalyze += 1;
                    potentialClassDescriptorPrevious = potentialClassDescriptor;
                }
               
            }
           
            if (!iter.hasNext() && !isNull && numberOfIdentitiesToAnalyze > 0) {
                potentialLeafDescriptor = potentialClassDescriptor;
                suggestedNumberOfFields += potentialClassDescriptor.getFields().length;
            } else if (!iter.hasNext() && isNull && numberOfIdentitiesToAnalyze > 0) {
                potentialLeafDescriptor = potentialClassDescriptorPrevious;
                // suggestedNumberOfFields += potentialClassDescriptor.getFields().length;
            } else {
                FieldDescriptor[] potentialFields =
                    potentialClassDescriptor.getFields();
                for (int i = 0; i < potentialFields.length; i++) {
                    String[] columnNames =
                        new FieldDescriptorJDONature(potentialFields[i]).getSQLName();
                    if (columnNames != null) {
                        columnIndex = columnIndex + columnNames.length;
                    }
                }
               
View Full Code Here

Examples of org.exolab.castor.jdo.engine.nature.FieldDescriptorJDONature

   
    public static String[] getIdentitySQLNames(final ClassDescriptor desc) {
        FieldDescriptor[] identities = ((ClassDescriptorImpl) desc).getIdentities();
        String[] sqlNames = new String[identities.length];
        for (int i = 0; i < identities.length; i++) {
            sqlNames[i] = new FieldDescriptorJDONature(identities[i]).getSQLName()[0];
        }

        return sqlNames;
    }
View Full Code Here

Examples of org.exolab.castor.jdo.engine.nature.FieldDescriptorJDONature

            FieldDescriptor leftField = oldDesc.getIdentity();
            FieldDescriptor rightField = tempDesc.getIdentity();
           
            _queryExpr.addInnerJoin(
                    new ClassDescriptorJDONature(oldDesc).getTableName(),
                    new FieldDescriptorJDONature(leftField).getSQLName(),
                    new ClassDescriptorJDONature(tempDesc).getTableName(),
                    new FieldDescriptorJDONature(rightField).getSQLName());

            oldDesc = tempDesc;
            tempDesc = tempDesc.getExtends();
        }
        _queryExpr.addSelect(getSQLExpr(selectPart));
View Full Code Here

Examples of org.exolab.castor.jdo.engine.nature.FieldDescriptorJDONature

            }
            fieldDesc = (FieldDescriptor) fieldAndClass[0];
            sourceClass = (ClassDescriptor) fieldAndClass[1];

            ClassDescriptor clsDesc = fieldDesc.getClassDescriptor();
            FieldDescriptorJDONature fieldJDONature = new FieldDescriptorJDONature(fieldDesc);
            if (clsDesc != null) {
                //we must add this table as a join
                ClassDescriptorJDONature sourceClassJDONature =
                    new ClassDescriptorJDONature(sourceClass);
                if (fieldJDONature.getManyKey() == null) {
                    //a many -> one relationship
                    FieldDescriptor foreignKey = clsDesc.getIdentity();
                    String sourceTableAlias = sourceClassJDONature.getTableName();
                    if (i > 1) {
                        sourceTableAlias = buildTableAlias(sourceTableAlias, path, i - 1);
                    }

                    ClassDescriptorJDONature clsDescNature;
                    clsDescNature = new ClassDescriptorJDONature(clsDesc);
                    _queryExpr.addInnerJoin(
                            sourceClassJDONature.getTableName(),
                            new FieldDescriptorJDONature(fieldDesc).getSQLName(),
                            sourceTableAlias,
                            clsDescNature.getTableName(),
                            new FieldDescriptorJDONature(foreignKey).getSQLName(),
                            buildTableAlias(clsDescNature.getTableName(), path, i));
                } else if (fieldJDONature.getManyTable() == null) {
                    //a one -> many relationship
                    FieldDescriptor identity = sourceClass.getIdentity();
                    String sourceTableAlias = sourceClassJDONature.getTableName();
                    if (i > 1) {
                        sourceTableAlias = buildTableAlias(sourceTableAlias, path, i - 1);
                    }

                    ClassDescriptorJDONature clsDescNature;
                    clsDescNature = new ClassDescriptorJDONature(clsDesc);
                    _queryExpr.addInnerJoin(
                            sourceClassJDONature.getTableName(),
                            new FieldDescriptorJDONature(identity).getSQLName(),
                            sourceTableAlias,
                            clsDescNature.getTableName(),
                            fieldJDONature.getManyKey(),
                            buildTableAlias(clsDescNature.getTableName(), path, i));
                } else {
                    //a many -> many relationship
                    FieldDescriptor identity = sourceClass.getIdentity();
                    FieldDescriptor foreignKey = clsDesc.getIdentity();
                    String manyTableAlias = fieldJDONature.getManyTable();
                    String sourceTableAlias = sourceClassJDONature.getTableName();
                    if (i > 1) {
                        manyTableAlias = buildTableAlias(manyTableAlias, path, i - 1);
                        sourceTableAlias = buildTableAlias(sourceTableAlias, path, i - 1);
                    }

                    _queryExpr.addInnerJoin(
                            sourceClassJDONature.getTableName(),
                            new FieldDescriptorJDONature(identity).getSQLName(),
                            sourceTableAlias,
                            fieldJDONature.getManyTable(),
                            fieldJDONature.getManyKey(),
                            manyTableAlias);

                    ClassDescriptorJDONature clsDescNature;
                    clsDescNature = new ClassDescriptorJDONature(clsDesc);
                    _queryExpr.addInnerJoin(
                            fieldJDONature.getManyTable(),
                            new FieldDescriptorJDONature(fieldDesc).getSQLName(),
                            manyTableAlias,
                            clsDescNature.getTableName(),
                            new FieldDescriptorJDONature(foreignKey).getSQLName(),
                            buildTableAlias(clsDescNature.getTableName(), path, i));
                }
                sourceClass = clsDesc;
            }
        }
View Full Code Here

Examples of org.exolab.castor.jdo.engine.nature.FieldDescriptorJDONature

            } else {
              clsTableAlias = buildTableAlias(classDescriptorJDONature.getTableName(), path, 9999);
            }
           
            return _queryExpr.encodeColumn(clsTableAlias,
                    new FieldDescriptorJDONature(field).getSQLName()[0]);
        case TokenType.DOLLAR:
            //parameters
            //return a question mark with the parameter number.
            //The calling function will do a mapping
            int child = exprTree.getChildCount() - 1;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.