Examples of QTuple


Examples of com.mysema.query.types.QTuple

    BooleanExpression predicate = operation.type.id.eq(OperationType.CARD).and(operation.status.id.eq(OperationStatus.RESOLVED)).and(operation.account.id.eq(accountId))
        .and(buildOperationSignPredicate(sign));
    predicate = addOperationYearMonthExpression(predicate, operation, yearMonth);

    List<Tuple> tuples = from(operation).where(predicate).groupBy(operation.card.id).list(new QTuple(operation.amount.sum(), operation.card.id));

    return newArrayList(transform(tuples, new Function<Tuple, Operation>() {
      @Override
      public Operation apply(Tuple input) {
        return Operation.newOperation().withAmount(input.get(operation.amount.sum())).withCard(Card.newCardBuilder().withId(input.get(operation.card.id)).build()).build();
View Full Code Here

Examples of com.mysema.query.types.QTuple

    }

    @Test
    public void TupleProjection() {
        List<Tuple> tuples = CollQueryFactory.from(cat, data)
            .list(new QTuple(cat.name, cat.birthdate));
        for (Tuple tuple : tuples) {
            assertNotNull(tuple.get(cat.name));
            assertNotNull(tuple.get(cat.birthdate));
        }
    }
View Full Code Here

Examples of com.mysema.query.types.QTuple

   
    @Test
    public void Nested_TupleProjection() {
        Concatenation concat = new Concatenation(cat.name, cat.name);
        List<Tuple> tuples = CollQueryFactory.from(cat, data)
            .list(new QTuple(concat, cat.name, cat.birthdate));
        for (Tuple tuple : tuples) {
            assertNotNull(tuple.get(cat.name));
            assertNotNull(tuple.get(cat.birthdate));
            assertEquals(tuple.get(cat.name) + tuple.get(cat.name), tuple.get(concat));
        }
View Full Code Here

Examples of com.mysema.query.types.QTuple

        standardTest.report();
    }

    @Test
    public void TupleProjection() {
        List<Tuple> tuples = query().from(product).list(new QTuple(product.name, product.price));
        assertFalse(tuples.isEmpty());
        for (Tuple tuple : tuples) {
            assertNotNull(tuple);
            assertNotNull(tuple.get(product.name));
            assertNotNull(tuple.get(product.price));
View Full Code Here

Examples of com.mysema.query.types.QTuple

        }
        return rv;
    }

    public List<Tuple> pairsAsTuple(List<Cat> cat_, List<Cat> otherCat_) {
        query().from(cat, cats).from(otherCat, cats).where(cat.name.eq(otherCat.name)).list(new QTuple(cat, otherCat));

        List<Tuple> rv = new ArrayList<Tuple>();
        for (Cat cat : cat_) {                                  // from
            for (Cat otherCat : otherCat_) {                    // from
                if (cat.getName().equals(otherCat.getName())) { // where
View Full Code Here

Examples of com.mysema.query.types.QTuple

    @Test
    public void In_Tuple() throws ClassNotFoundException, IOException {
        //(survey.id, survey.name)
        QSurvey survey = QSurvey.survey;
        QTuple tuple = new QTuple(survey.id, survey.name);
        serialize(tuple);
        serialize(tuple.newInstance(1, "a"));
    }
View Full Code Here

Examples of com.mysema.query.types.QTuple

       
        SubQueryExpression<?> subQuery = subQuery().from(cat)
        .where(subQuery()
           .from(cat)
           .groupBy(cat.mate)
           .list(new QTuple(cat.mate, cat.birthdate.max()))
             .contains(new QTuple(cat.mate, cat.birthdate)))
        .list(new QTuple(cat.birthdate, cat.name, cat.mate));
       
        assertToString(
                "(select cat.birthdate, cat.name, cat.mate from Cat cat " +
                "where (cat.mate, cat.birthdate) in " +
                    "(select cat.mate, max(cat.birthdate) from Cat cat group by cat.mate))", subQuery);
View Full Code Here

Examples of com.mysema.query.types.QTuple

            return expr;
        }
    }

    public Expression<Tuple> createProjection(Expression<?>[] args) {
        return new QTuple(args);
    }
View Full Code Here

Examples of com.mysema.query.types.QTuple

                              assetThreat.id,
                              set(Projections.bean(Threat.class, threat.id)).as("threats")))
                          .as("assetThreats")));

        Projectable projectable = createMock(Projectable.class);
        expect(projectable.iterate(new QTuple(
                riskAnalysis.id,
                riskAnalysis.id,
                assetThreat.id,
                Projections.bean(Threat.class, threat.id))))
            .andReturn(new EmptyCloseableIterator());
View Full Code Here

Examples of com.mysema.query.types.QTuple

                          assetThreat.id,
                           set(Projections.bean(Threat.class, threat.id)).as("threats"))
                          .as("assetThreats")));

        Projectable projectable = createMock(Projectable.class);
        expect(projectable.iterate(new QTuple(
                riskAnalysis.id,
                riskAnalysis.id,
                assetThreat.id,
                Projections.bean(Threat.class, threat.id))))
            .andReturn(new EmptyCloseableIterator());
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.