Examples of SelectRequest


Examples of com.amazonaws.services.simpledb.model.SelectRequest

        final DomainItemBuilder<T> domainItemBuilder = new DomainItemBuilder<T>();

        validateSelectQuery(query);

        final String escapedQuery = getEscapedQuery(query, entityInformation);
        SelectRequest selectRequest = new SelectRequest(escapedQuery, consistentRead);

        selectRequest.setNextToken(nextToken);

        final SelectResult selectResult = getDB().select(selectRequest);

        return domainItemBuilder.populateDomainItems(entityInformation, selectResult);
    }
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

    private String getNextToken(String query, boolean consistentRead) {
        LOGGER.debug("Get next token for query: " + query);

        Assert.isTrue(query.contains("limit"), "Only queries with limit have a next token!");

        final SelectResult selectResult = getDB().select(new SelectRequest(query, consistentRead));

        return selectResult.getNextToken();
    }
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

    public <T> long queryCount(Class<T> modelClass, Query<T> query)
        throws JsodaException
    {
        String          modelName = jsoda.getModelName(modelClass);
        String          queryStr = toQueryStr(query, true);
        SelectRequest   request = new SelectRequest(queryStr, query.consistentRead);

        try {
            for (Item item : sdbClient.select(request).getItems()) {
                for (Attribute attr : item.getAttributes()) {
                    String  attrName  = attr.getName();
                    String  fieldValue = attr.getValue();
                    long    count = Long.parseLong(fieldValue);
                    return count;
                }
            }
        } catch(Exception e) {
            throw new JsodaException("Query failed.  Query: " + request.getSelectExpression() + "  Error: " + e.getMessage(), e);
        }
        throw new JsodaException("Query failed.  Not result for count query.");
    }
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

        if (continueFromLastRun && !queryHasNext(query))
            return resultObjs;

        String          queryStr = toQueryStr(query, false);
        log.info("Query: " + queryStr);
        SelectRequest   request = new SelectRequest(queryStr, query.consistentRead);

        if (continueFromLastRun)
            request.setNextToken((String)query.nextKey);

        try {
            SelectResult    result = sdbClient.select(request);
            query.nextKey = request.getNextToken();
            for (Item item : result.getItems()) {
                String      idValue = item.getName();   // get the id from the item's name()
                T           obj = buildLoadObj(modelClass, query.modelName, idValue, item.getAttributes(), query);
                resultObjs.add(obj);
            }
            return resultObjs;
        } catch(Exception e) {
            throw new JsodaException("Query failed.  Query: " + request.getSelectExpression() + "  Error: " + e.getMessage(), e);
        }
    }
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

    private List<Item> querySimpleDBItems(String query) {
        Validate.notNull(query);
        String nextToken = null;
        List<Item> items = new ArrayList<Item>();
        do {
            SelectRequest request = new SelectRequest(query);
            request.setNextToken(nextToken);
            request.setConsistentRead(Boolean.TRUE);
            SelectResult result = this.simpleDBClient.select(request);
            items.addAll(result.getItems());
            nextToken = result.getNextToken();
        } while (nextToken != null);
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

        query.append(String.format(" and eventTime > '%d'", after));
        // always return with most recent record first
        query.append(" order by eventTime desc");

        List<Event> list = new LinkedList<Event>();
        SelectRequest request = new SelectRequest(query.toString());
        request.setConsistentRead(Boolean.TRUE);

        SelectResult result = new SelectResult();
        do {
            result = sdbClient().select(request.withNextToken(result.getNextToken()));
            for (Item item : result.getItems()) {
                Map<String, String> fields = new HashMap<String, String>();
                Map<String, String> res = new HashMap<String, String>();
                for (Attribute attr : item.getAttributes()) {
                    if (Keys.KEYSET.contains(attr.getName())) {
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

    private List<Item> querySimpleDBItems(String query) {
        Validate.notNull(query);
        String nextToken = null;
        List<Item> items = new ArrayList<Item>();
        do {
            SelectRequest request = new SelectRequest(query);
            request.setNextToken(nextToken);
            request.setConsistentRead(Boolean.TRUE);
            SelectResult result = this.simpleDBClient.select(request);
            items.addAll(result.getItems());
            nextToken = result.getNextToken();
        } while (nextToken != null);
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

   */
  @Override
  public int getNumberOfJobs(SchedulingContext ctxt) {
    logDebug("Finding number of jobs");
    try {
      SelectResult result = amazonSimpleDb.select(new SelectRequest(query
          .countJobs()));
      Item item = result.getItems().get(0);
      return Integer.parseInt(item.getAttributes().get(0).getValue());
    } catch (Exception e) {
      log.error("Could not find number of jobs", e);
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

   */
  @Override
  public int getNumberOfTriggers(SchedulingContext ctxt) {
    logDebug("Finding number of triggers");
    try {
      SelectResult result = amazonSimpleDb.select(new SelectRequest(query
          .countTriggers()));
      Item item = result.getItems().get(0);
      return Integer.parseInt(item.getAttributes().get(0).getValue());
    } catch (Exception e) {
      log.error("Could not find number of triggers", e);
View Full Code Here

Examples of com.amazonaws.services.simpledb.model.SelectRequest

   * </p>
   */
  @Override
  public String[] getJobNames(SchedulingContext ctxt, String groupName) {
    logDebug("Getting names of jobs");
    SelectResult result = amazonSimpleDb.select(new SelectRequest(query
        .jobNamesInGroup(groupName)));
    List<Item> jobs = result.getItems();
    String[] outList = new String[jobs.size()];
    int i = 0;
    for (Item item : jobs) {
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.