Package org.sql.generation.api.grammar.builders.booleans

Examples of org.sql.generation.api.grammar.builders.booleans.BooleanBuilder


                if( value instanceof Collection<?> )
                {
                    throw new IllegalArgumentException(
                        "ContainsPredicate may have only either primitive or value composite as value." );
                }
                BooleanBuilder condition = b.booleanBuilder();
                modifyFromClauseAndWhereClauseToGetValue(
                    QualifiedName.fromAccessor( predicate.collectionProperty().accessor() ), value, predicate,
                    false, lastTableIndex, new ModifiableInt( lastTableIndex ),
                    DBNames.QNAME_TABLE_VALUE_COLUMN_NAME,
                    DBNames.QNAME_TABLE_COLLECTION_PATH_TOP_LEVEL_NAME,
                    vendor, condition, afterWhere, builder.getFrom().getTableReferences()
                    .iterator().next(),
                    builder.getGroupBy(), builder.getHaving(), new ArrayList<QNameJoin>(),
                    variables, values, valueSQLTypes );
                builder.getWhere().and( condition.createExpression() );
            }
            } //
        );

        return this.finalizeContainsQuery( vendor, contains, entityTypeCondition, negationActive );
View Full Code Here


                    {
                        throw new IllegalArgumentException(
                            "ContainsAllPredicate may not have nested collections as value." );
                    }

                    BooleanBuilder conditionForItem = b.booleanBuilder(
                        b.regexp( c.colName( TABLE_NAME_PREFIX + lastTableIndex,
                                             DBNames.QNAME_TABLE_COLLECTION_PATH_COLUMN_NAME ),
                                  l.s( DBNames.QNAME_TABLE_COLLECTION_PATH_TOP_LEVEL_NAME + ".*{1,}" ) ) );
                    modifyFromClauseAndWhereClauseToGetValue(
                        QualifiedName.fromAccessor( predicate.collectionProperty().accessor() ),
                        value, predicate, false, lastTableIndex,
                        new ModifiableInt( lastTableIndex ),
                        DBNames.QNAME_TABLE_VALUE_COLUMN_NAME,
                        DBNames.QNAME_TABLE_COLLECTION_PATH_TOP_LEVEL_NAME, vendor,
                        conditionForItem, afterWhere,
                        builder.getFrom().getTableReferences().iterator().next(),
                        builder.getGroupBy(), builder.getHaving(),
                        joins, variables, values, valueSQLTypes );
                    builder.getWhere().or( conditionForItem.createExpression() );

                }

                builder.getHaving()
                    .and(
View Full Code Here

                + ", assoRef=" + assoRef + ", predicate=" + predicate + "]." );
        }

        builder.getFrom().addTableReferences( from );

        BooleanBuilder afterWhere = vendor.getBooleanFactory().booleanBuilder();
        whereClauseGenerator.processWhereClause( builder, afterWhere, joinStyle, startingIndex, lastTableIndex );

        BooleanBuilder where = builder.getWhere();
        if( negationActive )
        {
            where.not();
        }
        where.and( afterWhere.createExpression() );

        where.and( entityTypeCondition );

        builder.trimGroupBy();

        return builder.createExpression();
    }
View Full Code Here

            Boolean topLevel = collectionPath.equals( DBNames.QNAME_TABLE_COLLECTION_PATH_TOP_LEVEL_NAME );
            String collTable = TABLE_NAME_PREFIX + currentTableIndex;
            String collCol = DBNames.QNAME_TABLE_COLLECTION_PATH_COLUMN_NAME;
            ColumnReferenceByName collColExp = c.colName( collTable, collCol );

            BooleanBuilder collectionCondition = b.booleanBuilder();

            if( topLevel && negationActive )
            {
                afterWhere
                    .and( b
                        .booleanBuilder(
                            b.neq( collColExp,
                                   l.s( DBNames.QNAME_TABLE_COLLECTION_PATH_TOP_LEVEL_NAME ) ) )
                        .or( b.isNull( collColExp ) ).createExpression() );
            }

            Integer totalItemsProcessed = 0;
            for( Object item : (Collection<?>) value )
            {
                String path = collectionPath + DBNames.QNAME_TABLE_COLLECTION_PATH_SEPARATOR
                              + ( collectionIsSet ? "*{1,}" : collectionIndex );
                Boolean isCollection = ( item instanceof Collection<?> );
                BooleanBuilder newWhere = b.booleanBuilder();
                if( !isCollection )
                {
                    newWhere.reset( b.regexp( collColExp, l.s( path ) ) );
                }
                totalItemsProcessed
                = totalItemsProcessed
                  + modifyFromClauseAndWhereClauseToGetValue( qName, item, predicate,
                                                              negationActive,
                                                              currentTableIndex, maxTableIndex, columnName, path, vendor,
                                                              newWhere, afterWhere, fromClause,
                                                              groupBy, having, qNameJoins, variables, values, valueSQLTypes );

                ++collectionIndex;
                collectionCondition.or( newWhere.createExpression() );
            }
            result = totalItemsProcessed;

            if( topLevel )
            {
View Full Code Here

TOP

Related Classes of org.sql.generation.api.grammar.builders.booleans.BooleanBuilder

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.