Examples of FilterCriterion


Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

    public void testFilterOnDate() {
       
        String dql = "last_modified = 2010-01-23";
       
        AntlrDqlParser parser = new AntlrDqlParser();
        FilterCriterion criterion = parser.parse(dql);
       
        assertEquals(CriterionFieldEnum.LAST_MODIFIED_DATE, criterion.getField());
        assertEquals(CriterionOperator.EQ, criterion.getOperator());
        assertEquals(new DateMidnight(2010, 01, 23).toDate(), criterion.getValue());
       
    }
View Full Code Here

Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

    public void testFilterOnYear() {
       
        String dql = "last_modified = 2010";
       
        AntlrDqlParser parser = new AntlrDqlParser();
        FilterCriterion criterion = parser.parse(dql);
       
        assertEquals(CriterionFieldEnum.LAST_MODIFIED_DATE, criterion.getField());
        assertEquals(CriterionOperator.EQ, criterion.getOperator());
        assertEquals(2010L, criterion.getValue());
       
    }
View Full Code Here

Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

    public void testFilterOnAnySet() {
       
        String dql = "puid ANY a b c d";
       
        AntlrDqlParser parser = new AntlrDqlParser();
        FilterCriterion criterion = parser.parse(dql);
       
        assertEquals(CriterionFieldEnum.PUID, criterion.getField());
        assertEquals(CriterionOperator.ANY_OF, criterion.getOperator());
        assertArrayEquals(new String[] {
            "a", "b", "c", "d",    
        }, (Object[]) criterion.getValue());
    }
View Full Code Here

Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

    public void testFilterOnNoneSet() {
       
        String dql = "puid NONE a b c d";
       
        AntlrDqlParser parser = new AntlrDqlParser();
        FilterCriterion criterion = parser.parse(dql);

        assertEquals(CriterionFieldEnum.PUID, criterion.getField());
        assertEquals(CriterionOperator.NONE_OF, criterion.getOperator());
        assertArrayEquals(new String[] {
            "a", "b", "c", "d",    
        }, (Object[]) criterion.getValue());
    }
View Full Code Here

Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

   
    @Test
    public void testNotContains() {
        String dql = "file_name not contains 'foo'";
        AntlrDqlParser parser = new AntlrDqlParser();
        FilterCriterion criterion = parser.parse(dql);
       
        assertEquals(CriterionFieldEnum.FILE_NAME, criterion.getField());
        assertEquals(CriterionOperator.NOT_CONTAINS, criterion.getOperator());
        assertEquals("foo", criterion.getValue());
       
    }
View Full Code Here

Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

    @Test
    public void testNotStartsWith() {
        String dql = "file_name not starts 'foo'";
        AntlrDqlParser parser = new AntlrDqlParser();
        FilterCriterion criterion = parser.parse(dql);
       
        assertEquals(CriterionFieldEnum.FILE_NAME, criterion.getField());
        assertEquals(CriterionOperator.NOT_STARTS_WITH, criterion.getOperator());
        assertEquals("foo", criterion.getValue());
    }
View Full Code Here

Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

    @Test
    public void testNotEndsWith() {
        String dql = "file_name not ends 'foo'";
        AntlrDqlParser parser = new AntlrDqlParser();
        FilterCriterion criterion = parser.parse(dql);
       
        assertEquals(CriterionFieldEnum.FILE_NAME, criterion.getField());
        assertEquals(CriterionOperator.NOT_ENDS_WITH, criterion.getOperator());
        assertEquals("foo", criterion.getValue());
    }
View Full Code Here

Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

       
        Filter filter = filterCaptor.getValue();
        final List<FilterCriterion> criteria = filter.getCriteria();
        assertEquals(2, criteria.size());
       
        FilterCriterion sizeCriterion = criteria.get(0);
        FilterCriterion puidCriterion = criteria.get(1);
       
        assertEquals(CriterionOperator.EQ, sizeCriterion.getOperator());
        assertEquals(CriterionFieldEnum.FILE_SIZE, sizeCriterion.getField());
        assertEquals(Long.valueOf(720), sizeCriterion.getValue());
       
        assertEquals(CriterionOperator.ANY_OF, puidCriterion.getOperator());
        assertEquals(CriterionFieldEnum.PUID, puidCriterion.getField());
        assertArrayEquals(new Object[] {"fmt/101", "fmt/666"}, (Object[]) puidCriterion.getValue());
    }
View Full Code Here

Examples of uk.gov.nationalarchives.droid.core.interfaces.filter.FilterCriterion

            CommonTree operator = (CommonTree) children.get(1);
            String dqlOperator = operator.getText();
           
            CommonTree values = (CommonTree) children.get(2);
           
            FilterCriterion criterion;
           
            final List<CommonTree> setValues = values.getChildren();
            if (setValues == null) {
                String dqlValue = values.getText();
                criterion = DqlCriterionFactory.newCriterion(dqlField, dqlOperator,
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.