Package com.socrata.builders

Examples of com.socrata.builders.SoqlQueryBuilder


        Soda2Consumer   consumer = createConsumer();

        //
        //  Check floating timestamp
        SoqlQuery query = new SoqlQueryBuilder()
                .setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Confirmation Vote"+ "=to_fixed_timestamp('2012-6-20T07:00:00Z')"))
                .build();

        final List<Nomination>  results = consumer.query(NOMINATION_DATA_SET, query, Nomination.LIST_TYPE);
        final Set<String>       names = Sets.newHashSet("Masumoto, David", "Trottenberg, Polly Ellen");

        for (Nomination n: results) {
            TestCase.assertTrue(names.remove(n.getName()));
            TestCase.assertEquals(d, n.getNominationDate());
        }

        //
        //  Check greater than floating timestamp
        SoqlQuery queryGreater = new SoqlQueryBuilder()
                .setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Confirmation Vote"+ ">to_fixed_timestamp('2012-6-20T07:00:00Z')"))
                .build();

        final List<Nomination>  resultsGreater = consumer.query(NOMINATION_DATA_SET, queryGreater, Nomination.LIST_TYPE);

        for (Nomination n: resultsGreater) {
            if (n.getConfirmationVoteDate() != null) {
                TestCase.assertTrue(d.before(n.getConfirmationVoteDate()));
            }
        }

        //
        //  Check greater than floating timestamp
        SoqlQuery queryLesser = new SoqlQueryBuilder()
                .setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Confirmation Vote"+ "<to_fixed_timestamp('2012-6-20T07:00:00Z')"))
                .build();

        final List<Nomination>  resultsLesser = consumer.query(NOMINATION_DATA_SET, queryLesser, Nomination.LIST_TYPE);
View Full Code Here


        Soda2Consumer   consumer = createConsumer();

        //
        //  Check floating timestamp
        SoqlQuery query = new SoqlQueryBuilder()
                .setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Confirmation Vote"+ "=to_fixed_timestamp('2012-6-20T07:00:00Z')"))
                .build();

        final List<NominationWithJoda>  results = consumer.query(NOMINATION_DATA_SET, query, NominationWithJoda.LIST_TYPE);
        final Set<String>       names = Sets.newHashSet("Masumoto, David", "Trottenberg, Polly Ellen");

        for (NominationWithJoda n: results) {
            TestCase.assertTrue(names.remove(n.getName()));
            TestCase.assertEquals(d, n.getNominationDate().toDate());
        }

        //
        //  Check greater than floating timestamp
        SoqlQuery queryGreater = new SoqlQueryBuilder()
                .setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Confirmation Vote"+ ">to_fixed_timestamp('2012-6-20T07:00:00Z')"))
                .build();

        final List<NominationWithJoda>  resultsGreater = consumer.query(NOMINATION_DATA_SET, queryGreater, NominationWithJoda.LIST_TYPE);

        for (NominationWithJoda n: resultsGreater) {
            if (n.getConfirmationVoteDate() != null) {
                TestCase.assertTrue(d.before(n.getConfirmationVoteDate().toDate()));
            }
        }

        //
        //  Check greater than floating timestamp
        SoqlQuery queryLesser = new SoqlQueryBuilder()
                .setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Confirmation Vote"+ "<to_fixed_timestamp('2012-6-20T07:00:00Z')"))
                .build();

        final List<NominationWithJoda>  resultsLesser = consumer.query(NOMINATION_DATA_SET, queryLesser, NominationWithJoda.LIST_TYPE);
View Full Code Here

        ClientResponse response;
    ObjectMapper mapper = new ObjectMapper();
        List<Map<String, Object>> rowSet;

    do {
      SoqlQuery myQuery =new SoqlQueryBuilder().setOffset(offset).build();
      response = streamExporter.query(sourceSetID, HttpLowLevel.JSON_TYPE, myQuery);
            rowSet = mapper.readValue(response.getEntityInputStream(), new TypeReference<List<Map<String,Object>>>() {});
      if (rowSet.size() > 0) {
                offset += rowSet.size();
                UpsertResult result = streamUpserter.upsert(sinkSetID, rowSet);
View Full Code Here

        tempFile.deleteOnExit();
        try (FileWriter tempOut = new FileWriter(tempFile, true)) {

            tempOut.write("[\n");
            do {
                myQuery = new SoqlQueryBuilder().setOffset(offset).build();
                response = streamExporter.query(sourceSetID, HttpLowLevel.JSON_TYPE, myQuery);
                rowSet = mapper.readValue(response.getEntityInputStream(),
                        new TypeReference<List<Map<String, Object>>>() {
                        }
                );
View Full Code Here

TOP

Related Classes of com.socrata.builders.SoqlQueryBuilder

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.