Package com.vaadin.data.util.filter.Compare

Examples of com.vaadin.data.util.filter.Compare.Equal


        }
        Object refKey = getContainerProperty(itemId, r.getReferencingColumn())
                .getValue();

        refdCont.removeAllContainerFilters();
        refdCont.addContainerFilter(new Equal(r.getReferencedColumn(), refKey));
        Object toReturn = refdCont.firstItemId();
        refdCont.removeAllContainerFilters();
        return toReturn;
    }
View Full Code Here


        if (filters != null) {
            filtersAndKeys.addAll(filters);
        }
        int ix = 0;
        for (String colName : primaryKeyColumns) {
            filtersAndKeys.add(new Equal(colName, keys[ix]));
            ix++;
        }
        StatementHelper sh = sqlGenerator.generateSelectQuery(
                getFullTableName(), filtersAndKeys, orderBys, 0, 0, "*");

 
View Full Code Here

            SQLContainer myContainer = new SQLContainer(q);
            // Uncommenting these works around the issue
            // myContainer.addOrderBy(new OrderBy("PFX", true));
            // myContainer.addOrderBy(new OrderBy("NUMERO", true));
            myContainer.removeAllContainerFilters();
            myContainer.addContainerFilter(new Equal("PFX", "C"));

            VerticalLayout layout = new VerticalLayout();
            mainWindow.setContent(layout);

            final ComboBox myCombo = new ComboBox("MyCaption");
View Full Code Here

    // escape bad characters and wildcards

    @Test
    public void getWhereStringForFilter_equals() {
        StatementHelper sh = mockedStatementHelper("Fido");
        Equal f = new Equal("NAME", "Fido");
        Assert.assertEquals("\"NAME\" = ?",
                QueryBuilder.getWhereStringForFilter(f, sh));
        EasyMock.verify(sh);
    }
View Full Code Here

    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));
        EasyMock.verify(sh);
    }
View Full Code Here

        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\" = ?",
                QueryBuilder.getWhereStringForFilters(filters, sh));
        EasyMock.verify(sh);
    }
View Full Code Here

    @Test
    public void getWhereStringForFilters_NotFilter() {
        StatementHelper sh = mockedStatementHelper(18);
        ArrayList<Filter> filters = new ArrayList<Filter>();
        filters.add(new Not(new Equal("AGE", 18)));
        Assert.assertEquals(" WHERE NOT \"AGE\" = ?",
                QueryBuilder.getWhereStringForFilters(filters, sh));
        EasyMock.verify(sh);
    }
View Full Code Here

    @Test
    public void getWhereStringForFilters_complexNegatedFilter() {
        StatementHelper sh = mockedStatementHelper(65, 18);
        ArrayList<Filter> filters = new ArrayList<Filter>();
        filters.add(new Not(new Or(new Equal("AGE", 65), new Equal("AGE", 18))));
        Assert.assertEquals(" WHERE NOT (\"AGE\" = ? OR \"AGE\" = ?)",
                QueryBuilder.getWhereStringForFilters(filters, sh));
        EasyMock.verify(sh);
    }
View Full Code Here

        container.setAutoCommit(false);

        /* Check that the container size is correct and there is no 'Viljami' */
        Assert.assertEquals(4, container.size());
        List<Filter> filters = new ArrayList<Filter>();
        filters.add(new Equal("NAME", "Viljami"));
        tQuery.setFilters(filters);
        Assert.assertEquals(0, tQuery.getCount());
        tQuery.setFilters(null);

        /* Fetch first item, modify and commit */
 
View Full Code Here

                Integer.class));
        Item itemPositive = new PropertysetItem();
        itemPositive.addItemProperty(PROPERTY1, new ObjectProperty<Integer>(
                positive, Integer.class));

        Filter equalZero = new Equal(PROPERTY1, zero);
        Assert.assertFalse(equalZero.passesFilter(null, itemNegative));
        Assert.assertTrue(equalZero.passesFilter(null, itemZero));
        Assert.assertFalse(equalZero.passesFilter(null, itemPositive));

        Filter isPositive = new Greater(PROPERTY1, zero);
        Assert.assertFalse(isPositive.passesFilter(null, itemNegative));
        Assert.assertFalse(isPositive.passesFilter(null, itemZero));
        Assert.assertTrue(isPositive.passesFilter(null, itemPositive));
View Full Code Here

TOP

Related Classes of com.vaadin.data.util.filter.Compare.Equal

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.