Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Query.addProjection()


  }

  @Override
  public Set<String> getRootPipelinesDisplayName() {
    Query query = new Query(JobRecord.DATA_STORE_KIND);
    query.addProjection(
        new PropertyProjection(JobRecord.ROOT_JOB_DISPLAY_NAME, String.class));
    query.setDistinct(true);
    final PreparedQuery preparedQuery = dataStore.prepare(query);
    return tryFiveTimes(new Operation<Set<String>>("getRootPipelinesDisplayName") {
      @Override
View Full Code Here


    protected List<Entity> doQuery(String kind, String pName, Class<?> type, boolean indexed) {
        FetchOptions fo = FetchOptions.Builder.withDefaults();
        Query query = new Query(kind, rootKey);
        if (indexed) {
            query.addProjection(new PropertyProjection(pName, type));
            query.addSort(pName);
        }
        return service.prepare(query).asList(fo);
    }
View Full Code Here

    }

    @Test
    public void testDistinctStr() {
        Query query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("stringData", String.class));
        query.setDistinct(true);
        assertTrue(query.getDistinct());
        // distinct false
        query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("stringData", String.class));
View Full Code Here

        query.addProjection(new PropertyProjection("stringData", String.class));
        query.setDistinct(true);
        assertTrue(query.getDistinct());
        // distinct false
        query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("stringData", String.class));
        query.setDistinct(false);
        assertEquals(count, service.prepare(query).countEntities(fo));
        assertFalse(query.getDistinct());
    }
View Full Code Here

    }

    @Test
    public void testDistinctNum() {
        Query query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("floatData", Float.class));
        query.setDistinct(true);
        assertEquals(4, service.prepare(query).countEntities(fo));
        assertTrue(query.getDistinct());
        query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("floatData", Float.class));
View Full Code Here

        query.addProjection(new PropertyProjection("floatData", Float.class));
        query.setDistinct(true);
        assertEquals(4, service.prepare(query).countEntities(fo));
        assertTrue(query.getDistinct());
        query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("floatData", Float.class));
        query.setDistinct(false);
        assertEquals(count, service.prepare(query).countEntities(fo));
        assertFalse(query.getDistinct());
    }
View Full Code Here

    }

    @Test
    public void testDistinctList() {
        Query query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("intList", Integer.class));
        query.setDistinct(true);
        assertEquals(24, service.prepare(query).countEntities(fo));
        assertTrue(query.getDistinct());
        // distinct false
        query = new Query(kindName, rootKey);
View Full Code Here

        query.setDistinct(true);
        assertEquals(24, service.prepare(query).countEntities(fo));
        assertTrue(query.getDistinct());
        // distinct false
        query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("intList", Integer.class));
        query.setDistinct(false);
        // 3 cols * 30 rows
        assertEquals(count * 3, service.prepare(query).countEntities(fo));
        assertFalse(query.getDistinct());
    }
View Full Code Here

    }

    @Test
    public void testDistinctMix() {
        Query query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("stringData", String.class));
        query.addProjection(new PropertyProjection("floatData", Float.class));
        query.setDistinct(true);
        assertEquals(7, service.prepare(query).countEntities(fo));
        assertTrue(query.getDistinct());
        // distinct false
View Full Code Here

    @Test
    public void testDistinctMix() {
        Query query = new Query(kindName, rootKey);
        query.addProjection(new PropertyProjection("stringData", String.class));
        query.addProjection(new PropertyProjection("floatData", Float.class));
        query.setDistinct(true);
        assertEquals(7, service.prepare(query).countEntities(fo));
        assertTrue(query.getDistinct());
        // distinct false
        query = new Query(kindName, rootKey);
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.