Package org.happyfaces.jsf.datatable

Examples of org.happyfaces.jsf.datatable.PaginationConfiguration


        filters.put("testInteger", new Integer("3"));
        filters.put("testLong", new Long("4"));
        filters.put("testDouble", new Double("5.5"));
        filters.put("testFloat", new Float("6.6"));
        filters.put("testDate", DateUtils.createDate(2013, 1, 1));
        PaginationConfiguration configuration = new PaginationConfiguration(0, 10, filters, Arrays.asList("entity1"),
                "test1", SortOrder.ASCENDING);
        BaseService<TestEntity> service = new BaseService<TestEntity>() {
            @SuppressWarnings("unchecked")
            @Override
            protected JpaRepository getRepository() {
View Full Code Here


        filters.put("toRange-testDouble", new Double("6.5"));
        filters.put("fromRange-testFloat", new Float("6.6"));
        filters.put("toRange-testFloat", new Float("7.6"));
        filters.put("fromRange-testDate", DateUtils.createDate(2013, 2, 1));
        filters.put("toRange-testDate", DateUtils.createDate(2013, 3, 1));
        PaginationConfiguration configuration = new PaginationConfiguration(0, 10, filters, Arrays.asList("entity1"),
                "test1", SortOrder.ASCENDING);
        BaseService<TestEntity> service = new BaseService<TestEntity>() {
            @SuppressWarnings("unchecked")
            @Override
            protected JpaRepository getRepository() {
View Full Code Here

        Assert.assertEquals(3, userService.count());
    }

    @Test
    public void testPagination() {
        PaginationConfiguration config = new PaginationConfiguration(0, 2, null, null, null, null);
        List<User> users = userService.list(config);
        Assert.assertEquals(2, users.size());
        Assert.assertEquals(Long.valueOf(100), users.get(0).getId());
        Assert.assertEquals(Long.valueOf(101), users.get(1).getId());
        config = new PaginationConfiguration(2, 2, null, null, null, null);
        users = userService.list(config);
        Assert.assertEquals(1, users.size());
        Assert.assertEquals(Long.valueOf(102), users.get(0).getId());
    }
View Full Code Here

    @Test
    public void testFilterByFirstName() {
        Map<String, Object> filters = new HashMap<String, Object>();
        filters.put("firstName", "Ignas");
        PaginationConfiguration config = new PaginationConfiguration(0, 5, filters, null, null, null);
        List<User> users = userService.list(config);
        Assert.assertEquals(1, users.size());
        Assert.assertEquals(Long.valueOf(100), users.get(0).getId());
    }
View Full Code Here

        Assert.assertEquals(3, customerService.count());
    }

    @Test
    public void testPagination() {
        PaginationConfiguration config = new PaginationConfiguration(0, 2, null, null, null, null);
        List<Customer> customers = customerService.list(config);
        Assert.assertEquals(2, customers.size());
        Assert.assertEquals(Long.valueOf(1), customers.get(0).getId());
        Assert.assertEquals(Long.valueOf(2), customers.get(1).getId());
        config = new PaginationConfiguration(2, 2, null, null, null, null);
        customers = customerService.list(config);
        Assert.assertEquals(1, customers.size());
        Assert.assertEquals(Long.valueOf(3), customers.get(0).getId());
    }
View Full Code Here

    public void testFilterByMultipleFilters() {
        Map<String, Object> filters = new HashMap<String, Object>();
        filters.put("name", "tele2");
        filters.put("phone", "123456");
        filters.put("address", "aaa");
        PaginationConfiguration config = new PaginationConfiguration(0, 5, filters, null, null, null);
        List<Customer> customers = customerService.list(config);
        Assert.assertEquals(1, customers.size());
        Assert.assertEquals(Long.valueOf(1), customers.get(0).getId());
    }
View Full Code Here

                @Override
                public List<T> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> loadingFilters) {
                    Map<String, Object> copyOfFilters = new HashMap<String, Object>();
                    copyOfFilters.putAll(getFilters());
                    setRowCount((int) getPersistenceService().count(
                            new PaginationConfiguration(first, pageSize, copyOfFilters, getListFieldsToFetch(), sortField, sortOrder)));
                    if (getRowCount() > 0) {
                        copyOfFilters = new HashMap<String, Object>();
                        copyOfFilters.putAll(getFilters());
                        return getPersistenceService().list(
                                new PaginationConfiguration(first, pageSize, copyOfFilters, getListFieldsToFetch(), sortField, sortOrder));
                    } else {
                        return null; // no need to load then
                    }
                }
View Full Code Here

TOP

Related Classes of org.happyfaces.jsf.datatable.PaginationConfiguration

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.