Examples of PropertyFilter


Examples of org.b3log.latke.repository.PropertyFilter

        super(Tag.TAG + "_" + Article.ARTICLE);
    }

    @Override
    public List<JSONObject> getByArticleId(final String articleId) throws RepositoryException {
        final Query query = new Query().setFilter(new PropertyFilter(Article.ARTICLE + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, articleId)).setPageCount(
            1);

        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);
View Full Code Here

Examples of org.b3log.latke.repository.PropertyFilter

        return CollectionUtils.jsonArrayToList(array);
    }

    @Override
    public JSONObject getByTagId(final String tagId, final int currentPageNum, final int pageSize) throws RepositoryException {
        final Query query = new Query().setFilter(new PropertyFilter(Tag.TAG + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, tagId)).addSort(Article.ARTICLE + "_" + Keys.OBJECT_ID, SortDirection.DESCENDING).setCurrentPageNum(currentPageNum).setPageSize(pageSize).setPageCount(
            1);

        return get(query);
    }
View Full Code Here

Examples of org.b3log.latke.repository.PropertyFilter

            feed.setLink(Latkes.getServePath() + "/blog-articles-feed.do");
            feed.setId(Latkes.getServePath() + "/");

            final List<Filter> filters = new ArrayList<Filter>();

            filters.add(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true));
            filters.add(new PropertyFilter(Article.ARTICLE_VIEW_PWD, FilterOperator.EQUAL, ""));
            final Query query = new Query().setCurrentPageNum(1).setPageSize(outputCnt).setFilter(new CompositeFilter(CompositeFilterOperator.AND, filters)).addSort(Article.ARTICLE_UPDATE_DATE, SortDirection.DESCENDING).setPageCount(
                1);

            final boolean hasMultipleUsers = userQueryService.hasMultipleUsers();
            String authorName = "";
View Full Code Here

Examples of org.b3log.latke.repository.PropertyFilter

            channel.setLanguage(language + '-' + country);
            channel.setDescription(blogSubtitle);

            final List<Filter> filters = new ArrayList<Filter>();

            filters.add(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true));
            filters.add(new PropertyFilter(Article.ARTICLE_VIEW_PWD, FilterOperator.EQUAL, ""));
            final Query query = new Query().setCurrentPageNum(1).setPageSize(outputCnt).setFilter(new CompositeFilter(CompositeFilterOperator.AND, filters)).addSort(Article.ARTICLE_UPDATE_DATE, SortDirection.DESCENDING).setPageCount(
                1);

            final JSONObject articleResult = articleRepository.get(query);
            final JSONArray articles = articleResult.getJSONArray(Keys.RESULTS);
View Full Code Here

Examples of org.b3log.latke.repository.PropertyFilter

        Assert.assertNotNull(admin);
        Assert.assertEquals("test", admin.optString(User.USER_NAME));

        final JSONObject result = userRepository.get(new Query().setFilter(
                new PropertyFilter(User.USER_NAME, FilterOperator.EQUAL, "test1")));

        final JSONArray users = result.getJSONArray(Keys.RESULTS);
        Assert.assertEquals(users.length(), 1);
        Assert.assertEquals(users.getJSONObject(0).getString(User.USER_EMAIL), "test1@gmail.com");
View Full Code Here

Examples of org.springside.modules.orm.PropertyFilter

public class PropertyFilterTest {

  @Test
  public void createFilter() {
    //Boolean EQ filter
    PropertyFilter booleanEqFilter = new PropertyFilter("EQB_foo", "true");
    assertEquals(MatchType.EQ, booleanEqFilter.getMatchType());
    assertEquals(Boolean.class, booleanEqFilter.getPropertyClass());
    assertEquals(true, booleanEqFilter.getMatchValue());

    //Date LT filter
    PropertyFilter dateLtFilter = new PropertyFilter("LTD_foo", "2046-01-01");
    assertEquals(MatchType.LT, dateLtFilter.getMatchType());
    assertEquals(Date.class, dateLtFilter.getPropertyClass());
    assertEquals("foo", dateLtFilter.getPropertyName());
    assertEquals(new DateTime(2046, 1, 1, 0, 0, 0, 0).toDate(), dateLtFilter.getMatchValue());

    //Integer GT filter
    PropertyFilter intGtFilter = new PropertyFilter("GTI_foo", "123");
    assertEquals(MatchType.GT, intGtFilter.getMatchType());
    assertEquals(Integer.class, intGtFilter.getPropertyClass());
    assertEquals("foo", intGtFilter.getPropertyName());
    assertEquals(123, intGtFilter.getMatchValue());

    //Double LE filter
    PropertyFilter doubleLeFilter = new PropertyFilter("LEN_foo", "12.33");
    assertEquals(MatchType.LE, doubleLeFilter.getMatchType());
    assertEquals(Double.class, doubleLeFilter.getPropertyClass());
    assertEquals("foo", doubleLeFilter.getPropertyName());
    assertEquals(12.33, doubleLeFilter.getMatchValue());

    //Long GE filter
    PropertyFilter longGeFilter = new PropertyFilter("GEL_foo", "123456789");
    assertEquals(MatchType.GE, longGeFilter.getMatchType());
    assertEquals(Long.class, longGeFilter.getPropertyClass());
    assertEquals("foo", longGeFilter.getPropertyName());
    assertEquals(123456789L, longGeFilter.getMatchValue());

    //Like OR filter
    PropertyFilter likeOrFilter = new PropertyFilter("LIKES_foo_OR_bar", "hello");
    assertEquals(MatchType.LIKE, likeOrFilter.getMatchType());
    assertEquals(String.class, likeOrFilter.getPropertyClass());
    assertArrayEquals(new String[] { "foo", "bar" }, likeOrFilter.getPropertyNames());
    assertEquals("hello", likeOrFilter.getMatchValue());
  }
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.