当前位置: 首页>>代码示例>>Java>>正文


Java SelectResult.getItems方法代码示例

本文整理汇总了Java中com.amazonaws.services.simpledb.model.SelectResult.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java SelectResult.getItems方法的具体用法?Java SelectResult.getItems怎么用?Java SelectResult.getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.simpledb.model.SelectResult的用法示例。


在下文中一共展示了SelectResult.getItems方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPagedItems

import com.amazonaws.services.simpledb.model.SelectResult; //导入方法依赖的package包/类
/**
 * @{inheritDoc
 */
@Override
public PagedDatabaseResult getPagedItems(String tableName, Object token, String minRange, String maxRange, String instanceId, String jobId) {
    List<Item> ret = new ArrayList<Item>();
    String whereClause = null;
    if (minRange != null && maxRange != null) {
        whereClause = " Timestamp between '" + minRange + "' and '" + maxRange + "' ";
    } else if (minRange != null) {
        whereClause = " Timestamp >= '" + minRange + "' ";
    } else if (maxRange != null) {
        whereClause = " Timestamp < '" + maxRange + "' ";
    } else {
        whereClause = "";
    }
    SelectRequest request = new SelectRequest("SELECT * from `" + tableName + "`" + whereClause).withConsistentRead(true);
    String nextToken = (String) token;
    request.withNextToken(nextToken);
    SelectResult result = db.select(request);
    for (com.amazonaws.services.simpledb.model.Item item : result.getItems()) {
        ret.add(resultToItem(item));
    }
    nextToken = result.getNextToken();
    return new PagedDatabaseResult(ret, result.getNextToken());
}
 
开发者ID:intuit,项目名称:Tank,代码行数:27,代码来源:AmazonSimpleDatabase.java

示例2: findAll

import com.amazonaws.services.simpledb.model.SelectResult; //导入方法依赖的package包/类
@Override
public ImmutableSet<CassandraInstance> findAll(String ring) {
  List<CassandraInstance> instances = Lists.newArrayList();
  String nextToken = null;

  do {
    SelectRequest request = new SelectRequest(String.format(ALL_QUERY, domain(ring)))
        .withNextToken(nextToken);
    SelectResult result = client.select(request);

    for (Item item : result.getItems()) {
      instances.add(transform(item));
    }

    nextToken = result.getNextToken();
  } while (nextToken != null);

  return ImmutableSet.copyOf(instances);
}
 
开发者ID:signal,项目名称:agathon,代码行数:20,代码来源:SdbCassandraInstanceDao.java

示例3: invokeCountImpl

import com.amazonaws.services.simpledb.model.SelectResult; //导入方法依赖的package包/类
private <T> long invokeCountImpl(boolean consistentRead,
		SimpleDbEntityInformation<T, ?> entityInformation,
		final String countQuery) {
	
	LOGGER.debug("Count items for query " + countQuery);
       validateSelectQuery(countQuery);

       final String escapedQuery = getEscapedQuery(countQuery, entityInformation);

       final SelectResult selectResult = invokeFindImpl(consistentRead, escapedQuery);
       for (Item item : selectResult.getItems()) {
           if (item.getName().equals("Domain")) {
               for (Attribute attribute : item.getAttributes()) {
                   if (attribute.getName().equals("Count")) {
                       return Long.parseLong(attribute.getValue());
                   }
               }
           }
       }

       return 0;
}
 
开发者ID:3pillarlabs,项目名称:spring-data-simpledb,代码行数:23,代码来源:SimpleDbTemplate.java

示例4: internalQuery

import com.amazonaws.services.simpledb.model.SelectResult; //导入方法依赖的package包/类
private<T> List<T> internalQuery(Class<T> dataClass, SelectRequest selectRequest) throws WPBIOException
{
	List<T> result = new ArrayList<T>();
	try
	{
		SelectResult selectResult = null;
		do 
		{
			if (selectResult != null)
			{
				selectRequest.setNextToken(selectResult.getNextToken());
			}
			selectResult = sdbClient.select(selectRequest);
			List<Item> items = selectResult.getItems();
			for(Item item: items)
			{
				T t = copyAttributesToInstance(dataClass, item.getAttributes());
				result.add(t);
			}
			
		} while (selectResult.getNextToken() != null);
	} catch (Exception e)
	{
		throw new WPBIOException("cannot get all records " + dataClass.getSimpleName(), e);
	}
	
	return result;		
}
 
开发者ID:webpagebytes,项目名称:aws-cms-plugins,代码行数:29,代码来源:WPBAwsSdbAdminDataStorage.java

示例5: populateDomainItems

import com.amazonaws.services.simpledb.model.SelectResult; //导入方法依赖的package包/类
public List<T> populateDomainItems(SimpleDbEntityInformation<T, ?> entityInformation, SelectResult selectResult) {
	final List<T> allItems = new ArrayList<T>();

	for(Item item : selectResult.getItems()) {
		allItems.add(populateDomainItem(entityInformation, item));
	}

	return allItems;
}
 
开发者ID:3pillarlabs,项目名称:spring-data-simpledb,代码行数:10,代码来源:DomainItemBuilder.java

示例6: domainToCSV

import com.amazonaws.services.simpledb.model.SelectResult; //导入方法依赖的package包/类
private void domainToCSV(String domainPrefix, File csvFile) {
	log.info("Storing data from SDB domains starting with " + domainPrefix
			+ " to file " + csvFile);
	Set<String> attributes = null;

	List<String> domains = getDbClient().listDomains().getDomainNames();
	int c = 0;
	for (String domainName : domains) {
		if (domainName.startsWith(domainPrefix)) {
			c++;
			log.info("Exporting from " + domainName + " (" + c + "/"
					+ domains.size() + ")");
			long domainCount = getDbClient().domainMetadata(
					new DomainMetadataRequest(domainName)).getItemCount();
			if (domainCount < MIN_RESULTS) {
				log.info("Ignoring " + domainName + ", less than "
						+ MIN_RESULTS + " entries.");
				continue;
			}
			if (attributes == null) {
				attributes = getSdbAttributes(getDbClient(), domainName,
						MIN_RESULTS);
			}
			long total = 0;
			String select = "select * from `" + domainName + "` limit 2500";
			String nextToken = null;
			SelectResult res;
			do {
				res = getDbClient().select(
						new SelectRequest(select).withNextToken(nextToken)
								.withConsistentRead(false));

				for (Item i : res.getItems()) {
					Map<String, Object> csvEntry = new HashMap<String, Object>();
					csvEntry.put("_key", i.getName());
					for (String attr : attributes) {
						csvEntry.put(attr, "");
					}

					for (Attribute a : i.getAttributes()) {
						csvEntry.put(a.getName(), a.getValue());
					}
					CSVExport.writeToFile(csvEntry, csvFile);
				}
				nextToken = res.getNextToken();
				total += res.getItems().size();
				log.info("Exported " + total + " of " + domainCount);
			} while (nextToken != null);
			log.info("Finished exporting from " + domainName);

		}
	}
	CSVExport.closeWriter(csvFile);
}
 
开发者ID:JulianEberius,项目名称:dwtc-extractor,代码行数:55,代码来源:Master.java

示例7: recursiveFindImpl

import com.amazonaws.services.simpledb.model.SelectResult; //导入方法依赖的package包/类
@Override
public <T> List<T> recursiveFindImpl(Class<T> entityClass, String query, boolean consistentRead,
                                     SimpleDbEntityInformation<T, ?> entityInformation) {

    LOGGER.debug("Find All Domain \"{}\" isConsistent=\"{}\"", entityInformation.getDomain(), consistentRead);

    validateSelectQuery(query);

    final String escapedQuery = getEscapedQuery(query, entityInformation);

    List<T> result = new ArrayList<T>();

    List<String> referenceFieldsNames = ReflectionUtils.getReferencedAttributeNames(entityClass);

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

    final SelectResult selectResult = invokeFindImpl(consistentRead, escapedQuery);

    if (referenceFieldsNames.isEmpty()) {
        return domainItemBuilder.populateDomainItems(entityInformation, selectResult);
    }

    for (Item item : selectResult.getItems()) {

        T populatedItem = domainItemBuilder.populateDomainItem(entityInformation, item);

        result.add(populatedItem);
        for (Attribute attribute : item.getAttributes()) {
            if (!referenceFieldsNames.contains(attribute.getName())) {
                continue;
            }

            Class<?> referenceEntityClazz = ReflectionUtils.getFieldClass(entityClass, attribute.getName());
            Object referenceEntity = read(attribute.getValue(), referenceEntityClazz);

            ReflectionUtils.callSetter(populatedItem, attribute.getName(), referenceEntity);

        }
    }

    return result;
}
 
开发者ID:3pillarlabs,项目名称:spring-data-simpledb,代码行数:43,代码来源:SimpleDbTemplate.java


注:本文中的com.amazonaws.services.simpledb.model.SelectResult.getItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。