Package org.qi4j.index.sql.support.common

Examples of org.qi4j.index.sql.support.common.QNameInfo


            if( !this.negationActive )
            {
                ColumnsFactory c = this.vendor.getColumnsFactory();
                BooleanFactory b = this.vendor.getBooleanFactory();

                QNameInfo info = this.state
                    .qNameInfos()
                    .get()
                    .get(
                        QualifiedName.fromAccessor( this.propFunction.accessor() ) );
                String colName;
                if( info.getCollectionDepth() > 0 )
                {
                    colName = DBNames.ALL_QNAMES_TABLE_PK_COLUMN_NAME;
                }
                else
                {
View Full Code Here


        QualifiedName qName = pType.qualifiedName();
        if( !newQNames.contains( qName ) && !qName.name().equals( Identity.class.getName() ) )
        {
            newQNames.add( qName );
            // System.out.println("QName: " + qName + ", hc: " + qName.hashCode());
            QNameInfo info = qNameInfos.get( qName );
            if( info == null )
            {
                info
                = QNameInfo.fromProperty(
                    //
                    qName, //
                    setQNameTableNameToNull ? null : ( QNAME_TABLE_NAME_PREFIX + qNameInfos
                                                      .size() ), //
                    pType//
                );
                qNameInfos.put( qName, info );
            }
            Type vType = info.getFinalType();

            while( vType instanceof ParameterizedType )
            {
                vType = ( (ParameterizedType) vType ).getRawType();
            }
View Full Code Here

    {
        Set<QualifiedName> copy = new HashSet<QualifiedName>( qNames );
        copy.removeAll( qNameInsertPSs.keySet() );
        for( QualifiedName qName : copy )
        {
            QNameInfo info = this._state.qNameInfos().get().get( qName );
            if( info == null )
            {
                throw new InternalError(
                    "Could not find database information about qualified name [" + qName + "]" );
            }

            QNameType type = info.getQNameType();
            if( type.equals( QNameType.PROPERTY ) )
            {
                qNameInsertPSs.put( qName, this.createInsertPropertyPS( connection, info ) );
            }
            else if( type.equals( QNameType.ASSOCIATION ) )
View Full Code Here

        Integer result = propertyPK;
        if( property != null )
        {
            if( !qName.type().equals( Identity.class.getName() ) )
            {
                QNameInfo info = this._state.qNameInfos().get().get( qName );
                if( info.getCollectionDepth() > 0 )
                {
                    result = this.storeCollectionProperty( qNameInsertPSs, insertAllQNamesPS,
                                                           propertyPK, entityPK,
                                                           qName, (Collection<?>) property, parentQNameID );
                }
                else if( info.isFinalTypePrimitive() )
                {
                    result = this.storePrimitiveProperty( qNameInsertPSs, insertAllQNamesPS, propertyPK,
                                                          entityPK,
                                                          qName, property, parentQNameID );
                }
View Full Code Here

        Collection<?> property,
        Integer parentQNameID
    )
        throws SQLException
    {
        QNameInfo info = this._state.qNameInfos().get().get( qName );
        PreparedStatement ps = qNameInsertPSs.get( qName );
        propertyPK = this.storeCollectionInfo( insertAllQNamesPS, propertyPK, entityPK, parentQNameID, ps,
                                               info );

        propertyPK = this.storeCollectionItems( qNameInsertPSs, property, insertAllQNamesPS,
                                                DBNames.QNAME_TABLE_COLLECTION_PATH_TOP_LEVEL_NAME, ps, info.getTableName(),
                                                propertyPK, entityPK,
                                                parentQNameID, info.getFinalType(), info.isFinalTypePrimitive() );
        return propertyPK;
    }
View Full Code Here

        Object property,
        Integer parentQNameID
    )
        throws SQLException
    {
        QNameInfo info = this._state.qNameInfos().get().get( qName );
        insertAllQNamesPS.setInt( 1, propertyPK );
        insertAllQNamesPS.setLong( 2, entityPK );
        insertAllQNamesPS.addBatch();

        PreparedStatement ps = qNameInsertPSs.get( qName );
        ps.setInt( 1, propertyPK );
        ps.setLong( 2, entityPK );
        ps.setObject( 3, parentQNameID, Types.INTEGER );
        Type type = info.getFinalType();
        this.storePrimitiveUsingPS( ps, 4, property, type );
        ps.addBatch();

        return propertyPK + 1;
    }
View Full Code Here

            {
                if( orderBy[idx] != null )
                {
                    PropertyFunction<?> ref = orderBy[idx].property();
                    QualifiedName qName = QualifiedName.fromAccessor( ref.accessor() );
                    QNameInfo info = this._state.qNameInfos().get().get( qName );
                    qNames[idx] = info;
                    if( info == null )
                    {
                        throw new InternalError( "No qName info found for qName [" + qName + "]." );
                    }
View Full Code Here

        {
            QualifiedName qName = qNameStack.pop();
            PropertyFunction<?> ref = refStack.pop();
            if( !qName.type().equals( Identity.class.getName() ) )
            {
                QNameInfo info = this._state.qNameInfos().get().get( qName );
                if( info == null )
                {
                    throw new InternalError( "No qName info found for qName [" + qName + "]." );
                }

                String prevTableAlias = TABLE_NAME_PREFIX + lastTableIndex;
                String nextTableAlias = TABLE_NAME_PREFIX + nextAvailableIndex;
                TableReferenceByName nextTable = t.table( t.tableName( schemaName, info.getTableName() ),
                                                          t.tableAlias( nextTableAlias ) );
                // @formatter:off
                if( prevRef == null )
                {
                    builder.addQualifiedJoin(
View Full Code Here

            reference = reference.getTraversedAssociation();
        }
        while( !qNameStack.isEmpty() )
        {
            QualifiedName qName = qNameStack.pop();
            QNameInfo info = this._state.qNameInfos().get().get( qName );
            if( info == null )
            {
                throw new InternalError( "No qName info found for qName [" + qName + "]." );
            }
            // @formatter:off
            builder.addQualifiedJoin(
                joinStyle,
                t.table( t.tableName( schemaName, info.getTableName() ), t.tableAlias( TABLE_NAME_PREFIX
                                                                                       + nextAvailableIndex ) ),
                t.jc(
                b.eq(
                    c.colName( TABLE_NAME_PREFIX + lastTableIndex, DBNames.ENTITY_TABLE_PK_COLUMN_NAME ),
                    c.colName( TABLE_NAME_PREFIX + nextAvailableIndex, DBNames.ENTITY_TABLE_PK_COLUMN_NAME ) )
View Full Code Here

                }

                if( !qNameJoinDone )
                {
                    // @formatter:off
                    QNameInfo info = _state.qNameInfos().get().get( spi.propertyDescriptorFor( property ).qualifiedName() );
                    String prevTableName = TABLE_NAME_PREFIX + sourceIndex;
                    String nextTableName = TABLE_NAME_PREFIX + targetIndex;
                    fromClause.addQualifiedJoin(
                        JoinType.LEFT_OUTER,
                        t.table( t.tableName( schemaName, info.getTableName() ), t.tableAlias( TABLE_NAME_PREFIX + targetIndex ) ),
                        t.jc(
                        b.booleanBuilder( b.eq(
                                c.colName( prevTableName, DBNames.ALL_QNAMES_TABLE_PK_COLUMN_NAME ),
                                c.colName( nextTableName, DBNames.QNAME_TABLE_PARENT_QNAME_COLUMN_NAME )
                            ) )
View Full Code Here

TOP

Related Classes of org.qi4j.index.sql.support.common.QNameInfo

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.