use of com.amazonaws.services.simpledb.model.ReplaceableItem in project siena by mandubian.
the class SdbMappingUtils method createItem.
public static ReplaceableItem createItem(Object obj) {
Class<?> clazz = obj.getClass();
ReplaceableItem item = new ReplaceableItem(getItemName(clazz, obj));
for (Field field : ClassInfo.getClassInfo(clazz).updateFields) {
try {
String value = objectFieldToString(obj, field);
if (value != null) {
ReplaceableAttribute attr = new ReplaceableAttribute(getAttributeName(field), value, true);
item.withAttributes(attr);
} else {
if (ClassInfo.isEmbeddedNative(field)) {
SdbNativeSerializer.embed(item, ClassInfo.getSingleColumnName(field), value);
}
}
} catch (Exception e) {
throw new SienaException(e);
}
}
return item;
}
use of com.amazonaws.services.simpledb.model.ReplaceableItem in project camel by apache.
the class BatchPutAttributesCommandTest method execute.
@Test
public void execute() {
List<ReplaceableItem> replaceableItems = new ArrayList<ReplaceableItem>();
replaceableItems.add(new ReplaceableItem("ITEM1"));
exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
command.execute();
assertEquals("DOMAIN1", sdbClient.batchPutAttributesRequest.getDomainName());
assertEquals(replaceableItems, sdbClient.batchPutAttributesRequest.getItems());
}
use of com.amazonaws.services.simpledb.model.ReplaceableItem in project camel by apache.
the class SdbComponentIntegrationTest method batchPutAttributes.
@Test
public void batchPutAttributes() {
final List<ReplaceableItem> replaceableItems = Arrays.asList(new ReplaceableItem[] { new ReplaceableItem("ITEM1") });
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchPutAttributes);
exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
}
});
}
Aggregations