Package com.mysema.query.types

Examples of com.mysema.query.types.Predicate


  }

  public void serialize(QueryMetadata metadata, boolean forCountRow, @Nullable String projection) {
    List<? extends Expression<?>> select = metadata.getProjection();
    List<JoinExpression> joins = metadata.getJoins();
    Predicate where = metadata.getWhere();
    List<? extends Expression<?>> groupBy = metadata.getGroupBy();
    Predicate having = metadata.getHaving();
    List<OrderSpecifier<?>> orderBy = metadata.getOrderBy();

    // select
    boolean inProjectionOrig = inProjection;
    inProjection = true;
View Full Code Here


            protected JpaRepository getRepository() {
                return null;
            }
        };

        Predicate predicate = service.getPredicate(configuration);
        String predicateString = predicate.toString();
        Assert.assertTrue(predicateString.contains("testEntity.testShort = 2"));
        Assert.assertTrue(predicateString.contains("testEntity.testFloat = 6.6"));
        Assert.assertTrue(predicateString.contains("testEntity.testLong = 4"));
        Assert.assertTrue(predicateString.contains("testEntity.testBigDecimal = 1.1"));
        Assert.assertTrue(predicateString.contains("testEntity.testInteger = 3"));
View Full Code Here

            protected JpaRepository getRepository() {
                return null;
            }
        };

        Predicate predicate = service.getPredicate(configuration);
        String predicateString = predicate.toString();
       
        Assert.assertTrue(predicateString.contains("testEntity.testDouble >= 5.5"));
        Assert.assertTrue(predicateString.contains("testEntity.testDouble <= 6.5"));
        Assert.assertTrue(predicateString.contains("testEntity.testShort >= 2"));
        Assert.assertTrue(predicateString.contains("testEntity.testShort <= 3"));
View Full Code Here

            protected JpaRepository getRepository() {
                return null;
            }
        };

        Predicate predicate = service.getPredicate(configuration);
        String predicateString = predicate.toString();
        Assert.assertTrue(predicateString.contains("testEntity.testShort = 2"));
        Assert.assertTrue(predicateString.contains("testEntity.testFloat = 6.6"));
        Assert.assertTrue(predicateString.contains("testEntity.testLong = 4"));
        Assert.assertTrue(predicateString.contains("testEntity.testBigDecimal = 1.1"));
        Assert.assertTrue(predicateString.contains("testEntity.testInteger = 3"));
View Full Code Here

            protected JpaRepository getRepository() {
                return null;
            }
        };

        Predicate predicate = service.getPredicate(configuration);
        String predicateString = predicate.toString();
       
        Assert.assertTrue(predicateString.contains("testEntity.testDouble >= 5.5"));
        Assert.assertTrue(predicateString.contains("testEntity.testDouble <= 6.5"));
        Assert.assertTrue(predicateString.contains("testEntity.testShort >= 2"));
        Assert.assertTrue(predicateString.contains("testEntity.testShort <= 3"));
View Full Code Here

    /**
     * @see ${package}.services.base.IService${symbol_pound}list(${package}.jsf.datatable.PaginationConfiguration)
     */
    @Override
    public List<T> list(final PaginationConfiguration config) {
        Predicate predicate = getPredicate(config);
        Pageable pageable = new PageRequest(config.getFirstRow() / config.getNumberOfRows(), config.getNumberOfRows(),
                config.getSortField() != null ? new Sort(new Sort.Order(config.getSortDirection(), config.getSortField())) : null);
        return ((GenericRepository<T, Long>) getRepository()).findAll(predicate, pageable, config.getFetchFields()).getContent();
    }
View Full Code Here

    /**
     * @see ${package}.services.base.IService${symbol_pound}count(${package}.jsf.datatable.PaginationConfiguration)
     */
    @Override
    public long count(PaginationConfiguration config) {
        Predicate predicate = getPredicate(config);
        return ((GenericRepository<T, Long>) getRepository()).count(predicate);
    }
View Full Code Here

    /**
     * @see org.happyfaces.services.base.IService#list(org.happyfaces.jsf.datatable.PaginationConfiguration)
     */
    @Override
    public List<T> list(final PaginationConfiguration config) {
        Predicate predicate = getPredicate(config);
        Pageable pageable = new PageRequest(config.getFirstRow() / config.getNumberOfRows(), config.getNumberOfRows(),
                config.getSortField() != null ? new Sort(new Sort.Order(config.getSortDirection(), config.getSortField())) : null);
        return ((GenericRepository<T, Long>) getRepository()).findAll(predicate, pageable, config.getFetchFields()).getContent();
    }
View Full Code Here

    /**
     * @see org.happyfaces.services.base.IService#count(org.happyfaces.jsf.datatable.PaginationConfiguration)
     */
    @Override
    public long count(PaginationConfiguration config) {
        Predicate predicate = getPredicate(config);
        return ((GenericRepository<T, Long>) getRepository()).count(predicate);
    }
View Full Code Here

   * @see DATAJPA-243
   */
  @Test
  public void considersSortingProvidedThroughPageable() {

    Predicate lastnameContainsE = user.lastname.contains("e");

    Page<User> result = repository.findAll(lastnameContainsE, new PageRequest(0, 1, Direction.ASC, "lastname"));

    assertThat(result.getContent(), hasSize(1));
    assertThat(result.getContent().get(0), is(carter));
View Full Code Here

TOP

Related Classes of com.mysema.query.types.Predicate

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.