Package com.vaadin.data.util.filter

Examples of com.vaadin.data.util.filter.And


    @Test
    public void getWhereStringForFilters_oneAndFilter() {
        StatementHelper sh = mockedStatementHelper("%lle", 18);
        ArrayList<Filter> filters = new ArrayList<Filter>();
        filters.add(new And(new Like("NAME", "%lle"), new Greater("AGE", 18)));
        Assert.assertEquals(" WHERE (\"NAME\" LIKE ? AND \"AGE\" > ?)",
                QueryBuilder.getWhereStringForFilters(filters, sh));
        EasyMock.verify(sh);
    }
View Full Code Here


    @Test
    public void getWhereStringForFilters_complexCompoundFilters() {
        StatementHelper sh = mockedStatementHelper("%lle", 18, 65, "Pelle");
        ArrayList<Filter> filters = new ArrayList<Filter>();
        filters.add(new Or(new And(new Like("NAME", "%lle"), new Or(new Less(
                "AGE", 18), new Greater("AGE", 65))),
                new Equal("NAME", "Pelle")));
        Assert.assertEquals(
                " WHERE ((\"NAME\" LIKE ? AND (\"AGE\" < ? OR \"AGE\" > ?)) OR \"NAME\" = ?)",
                QueryBuilder.getWhereStringForFilters(filters, sh));
View Full Code Here

    @Test
    public void getWhereStringForFilters_complexCompoundFiltersAndSingleFilter() {
        StatementHelper sh = mockedStatementHelper("%lle", 18, 65, "Pelle",
                "Virtanen");
        ArrayList<Filter> filters = new ArrayList<Filter>();
        filters.add(new Or(new And(new Like("NAME", "%lle"), new Or(new Less(
                "AGE", 18), new Greater("AGE", 65))),
                new Equal("NAME", "Pelle")));
        filters.add(new Equal("LASTNAME", "Virtanen"));
        Assert.assertEquals(
                " WHERE ((\"NAME\" LIKE ? AND (\"AGE\" < ? OR \"AGE\" > ?)) OR \"NAME\" = ?) AND \"LASTNAME\" = ?",
View Full Code Here

        whereParameters.put("name", "alpha");
        whereParameters.put("assignee", "assignee-alpha");
        entityContainer.filter("e.name=:name and e.assignee=:assignee", whereParameters);*/

        entityContainer.addContainerFilter(
                new And(new Compare.Equal("name", "alpha"), new Compare.Equal("assignee", "assignee-alpha")));

        Assert.assertEquals("Verify entity alpha is in container", 1, entityContainer.size());
        Assert.assertEquals("Verify entity alpha is same", taskAlpha.getTaskId(),
                entityContainer.getEntity(0).getTaskId());

View Full Code Here

        whereParameters.put("name", "alpha");
        whereParameters.put("assignee", "assignee-alpha");
        entityContainer.filter("e.name=:name and e.assignee=:assignee", whereParameters);*/

        entityContainer.addContainerFilter(
                new And(new Compare.Equal("name", "alpha"), new Compare.Equal("assignee", "assignee-alpha")));

        Assert.assertEquals("Verify entity alpha is in container", 1, entityContainer.size());
        Assert.assertEquals("Verify entity alpha is same", taskAlpha, entityContainer.getEntity(0));

        entityContainer.removeAllContainerFilters();
View Full Code Here

        whereParameters.put("name", "alpha");
        whereParameters.put("assignee", "assignee-alpha");
        entityContainer.filter("e.name=:name and e.assignee=:assignee", whereParameters);*/

        entityContainer.addContainerFilter(
                new And(new Compare.Equal("name", "alpha"), new Compare.Equal("assignee", "assignee-alpha")));

        Assert.assertEquals("Verify entity alpha is in container", 1, entityContainer.size());
        Assert.assertEquals("Verify entity alpha is same", taskAlpha, entityContainer.getEntity(0));

        entityContainer.removeAllContainerFilters();
View Full Code Here

        whereParameters.put("name", "alpha");
        whereParameters.put("assignee", "assignee-alpha");
        entityContainer.filter("e.name=:name and e.assignee=:assignee", whereParameters);*/

        entityContainer.addContainerFilter(
                new And(new Compare.Equal("name", "alpha"), new Compare.Equal("assignee", "assignee-alpha")));

        Assert.assertEquals("Verify entity alpha is in container", 1, entityContainer.size());
        Assert.assertEquals("Verify entity alpha is same", taskAlpha.getTaskId(),
                entityContainer.getEntity(0).getTaskId());

View Full Code Here

TOP

Related Classes of com.vaadin.data.util.filter.And

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.