Java 类com.amazonaws.services.simpledb.model.DeletableItem 实例源码

项目:Camel    文件:SdbComponentSpringTest.java   
@Test
public void batchDeleteAttributes() {
    final List<DeletableItem> deletableItems = Arrays.asList(new DeletableItem[] {
        new DeletableItem("ITEM1", null),
        new DeletableItem("ITEM2", null)});

    template.send("direct:start", new Processor() {
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchDeleteAttributes);
            exchange.getIn().setHeader(SdbConstants.DELETABLE_ITEMS, deletableItems);
        }
    });

    assertEquals("TestDomain", amazonSDBClient.batchDeleteAttributesRequest.getDomainName());
    assertEquals(deletableItems, amazonSDBClient.batchDeleteAttributesRequest.getItems());
}
项目:Camel    文件:SdbComponentTest.java   
@Test
public void batchDeleteAttributes() {
    final List<DeletableItem> deletableItems = Arrays.asList(new DeletableItem[] {
        new DeletableItem("ITEM1", null),
        new DeletableItem("ITEM2", null)});

    template.send("direct:start", new Processor() {
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchDeleteAttributes);
            exchange.getIn().setHeader(SdbConstants.DELETABLE_ITEMS, deletableItems);
        }
    });

    assertEquals("TestDomain", amazonSDBClient.batchDeleteAttributesRequest.getDomainName());
    assertEquals(deletableItems, amazonSDBClient.batchDeleteAttributesRequest.getItems());
}
项目:spring-data-simpledb    文件:SimpleDbTemplate.java   
@Override
public <T, ID> void delete(Class<T> entityClass, Iterable<? extends ID> ids) {

    if (ids.iterator().hasNext()) {
        String domainName = getDomainName(entityClass);

        List<DeletableItem> deleteList = new ArrayList<DeletableItem>();
        for (ID id : ids) {
            deleteList.add(new DeletableItem().withName((String) id));
        }
        // max allowed batch size is 25
        List<DeletableItem> batch = new ArrayList<DeletableItem>(MAX_BATCH_SIZE);
        for (int i = 0; i < deleteList.size(); i += MAX_BATCH_SIZE) {
            int batchIndex = ((i + MAX_BATCH_SIZE) < deleteList.size()) ? (i + MAX_BATCH_SIZE)
                    : deleteList.size();
            for (int j = i; j < batchIndex; j++) {
                batch.add(deleteList.get(j));
            }
            LOGGER.debug(String.format("Batch size: %d", batch.size()));
            getDB().batchDeleteAttributes(new BatchDeleteAttributesRequest(
                    domainName, batch));
            batch.clear();
        }
    }
}
项目:Camel    文件:SdbComponentIntegrationTest.java   
@Test
public void batchDeleteAttributes() {
    final List<DeletableItem> deletableItems = Arrays.asList(new DeletableItem[] {
        new DeletableItem("ITEM1", null),
        new DeletableItem("ITEM2", null)});

    template.send("direct:start", new Processor() {
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchDeleteAttributes);
            exchange.getIn().setHeader(SdbConstants.DELETABLE_ITEMS, deletableItems);
        }
    });
}
项目:Camel    文件:BatchDeleteAttributesCommand.java   
@SuppressWarnings("unchecked")
protected Collection<DeletableItem> determineDeletableItems() {
    return exchange.getIn().getHeader(SdbConstants.DELETABLE_ITEMS, Collection.class);
}