Package com.salas.bb.domain.query

Examples of com.salas.bb.domain.query.ICriteria


    public void testRemoveCriteria()
    {
        IQuery query = new DummyStringQuery();
        builder.setQuery(query);
        builder.addEmptyCriteria();
        ICriteria defaultCriteria = query.getCriteriaAt(0);

        builder.removeCriteria(0);
        assertEquals("Criteria should be removed.", 1, query.getCriteriaCount());
        assertFalse("Wrong criteria removed.", defaultCriteria == query.getCriteriaAt(0));
View Full Code Here


        int count = query.getCriteriaCount();
        if (count > 0)
        {
            for (int i = 0; i < count; i++)
            {
                ICriteria criteria = query.getCriteriaAt(i);
                appendCriteriaBuilderToPanel(criteria);
            }
        } else addEmptyCriteria();
    }
View Full Code Here

        IProperty firstProperty = ArticleTextProperty.INSTANCE;
        IComparisonOperation firstOperation =
            (IComparisonOperation)firstProperty.getComparsonOperations().iterator().next();
        String defaultValue = firstProperty.getDefaultValue();

        ICriteria criteria = query.addCriteria();
        criteria.setProperty(firstProperty);
        criteria.setComparisonOperation(firstOperation);
        criteria.setValue(defaultValue);
       
        appendCriteriaBuilderToPanel(criteria);
    }
View Full Code Here

    {
        Query query = new Query();

        assertNotNull("Query is empty.", SmartFeedDialog.validateSearchFeedData(query, true, 1));

        ICriteria criteria = query.addCriteria();

        assertNotNull("Criteria is bad.", SmartFeedDialog.validateSearchFeedData(query, true, 1));

        IProperty someProperty = (IProperty)query.getAvailableProperties().toArray()[0];
        IComparisonOperation someOperation = (IComparisonOperation)someProperty.getComparsonOperations().toArray()[0];
        criteria.setProperty(someProperty);
        criteria.setComparisonOperation(someOperation);
        criteria.setValue("1");

        assertEquals("Query is ok.", null, SmartFeedDialog.validateSearchFeedData(query, true, 1));
    }
View Full Code Here

     * NOTE: It was the reason for most of "Article is not in database" errors
     */
    public void testClearFeedIDSearchFeed()
    {
        Query query = new Query();
        ICriteria criteria = query.addCriteria();
        criteria.setProperty(ArticleTextProperty.INSTANCE);
        criteria.setComparisonOperation(StringContainsCO.INSTANCE);
        criteria.setValue("*a*");

        SearchFeed feed = new SearchFeed();
        feed.setQuery(query);
        feed.setArticlesLimit(1);

View Full Code Here

        manager.insertFeed(feed);
        manager.addFeedToGuide(guide, feed);
        pm.commit();

        Query otherQuery = new Query();
        ICriteria criteria = otherQuery.addCriteria();
        criteria.setProperty(ArticleTextProperty.INSTANCE);
        criteria.setComparisonOperation(StringContainsCO.INSTANCE);
        criteria.setValue("other");

        feed.setQuery(otherQuery);
        feed.setDedupEnabled(false);
        feed.setDedupFrom(11);
        manager.updateFeed(feed, SearchFeed.PROP_QUERY);
View Full Code Here

    }

    private static SearchFeed createSearchFeed()
    {
        Query query = new Query();
        ICriteria criteria = query.addCriteria();
        criteria.setProperty(ArticleTextProperty.INSTANCE);
        criteria.setComparisonOperation(StringContainsCO.INSTANCE);
        criteria.setValue("test");

        SearchFeed feed = new SearchFeed();
        feed.setQuery(query);
        feed.setBaseTitle("Title");
        feed.setRating(2);
View Full Code Here

    }

    private static Query createArticlesQuery(boolean read)
    {
        Query sampleQuery = new Query();
        ICriteria sampleCriteria = sampleQuery.addCriteria();
        sampleCriteria.setProperty(ArticleStatusProperty.INSTANCE);
        sampleCriteria.setComparisonOperation(StringEqualsCO.INSTANCE);
        sampleCriteria.setValue(read
            ? ArticleStatusProperty.VALUE_READ
            : ArticleStatusProperty.VALUE_UNREAD);

        return sampleQuery;
    }
View Full Code Here

    private Query createNoArticlesQuery()
    {
        Query sampleQuery = new Query();

        ICriteria sampleCriteria = sampleQuery.addCriteria();
        sampleCriteria.setProperty(ArticleStatusProperty.INSTANCE);
        sampleCriteria.setComparisonOperation(StringEqualsCO.INSTANCE);
        sampleCriteria.setValue("read");

        sampleCriteria = sampleQuery.addCriteria();
        sampleCriteria.setProperty(ArticleStatusProperty.INSTANCE);
        sampleCriteria.setComparisonOperation(StringEqualsCO.INSTANCE);
        sampleCriteria.setValue("unread");

        sampleQuery.setAndQuery(true);

        return sampleQuery;
    }
View Full Code Here

    }

    private Query createUnreadArticlesQuery()
    {
        Query sampleQuery = new Query();
        ICriteria sampleCriteria = sampleQuery.addCriteria();
        sampleCriteria.setProperty(ArticleStatusProperty.INSTANCE);
        sampleCriteria.setComparisonOperation(StringEqualsCO.INSTANCE);
        sampleCriteria.setValue("unread");

        return sampleQuery;
    }
View Full Code Here

TOP

Related Classes of com.salas.bb.domain.query.ICriteria

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.