public Object call() throws Exception { String domainName = em.getOrCreateDomain(toDelete.getClass()); if(logger.isLoggable(Level.FINE)) logger.fine("deleting item with id: " + id); em.invokeEntityListener(toDelete, PreRemove.class); this.em.getSimpleDb().deleteAttributes(new DeleteAttributesRequest() .withDomainName(domainName) .withItemName(id)); em.invokeEntityListener(toDelete, PostRemove.class); return toDelete; } }
@Override public void deleteExpectedState(UUID slotId) { Preconditions.checkNotNull(slotId, "id is null"); if (isDomainCreated()) { List<Attribute> attributes = newArrayList(); attributes.add(new Attribute("state", null)); attributes.add(new Attribute("binary", null)); attributes.add(new Attribute("config", null)); try { simpleDb.deleteAttributes(new DeleteAttributesRequest().withDomainName(domainName).withItemName(slotId.toString()).withAttributes(attributes)); expectedStateStoreUp(); } catch (Exception e) { expectedStateStoreDown(e); } } }
@Override public void deleteExpectedState(UUID slotId) { Preconditions.checkNotNull(slotId, "id is null"); if (isDomainCreated()) { List<Attribute> attributes = newArrayList(); attributes.add(new Attribute("state", null)); attributes.add(new Attribute("binary", null)); attributes.add(new Attribute("config", null)); try { simpleDb.deleteAttributes(new DeleteAttributesRequest().withDomainName(domainName).withItemName(slotId.toString()).withAttributes(attributes)); expectedStateStoreUp(); } catch (Exception e) { expectedStateStoreDown(e); } } }
private void putAndDelete(String domainName, String oldAttributeName, String newAttributeName, List<Item> items) throws AmazonClientException { AmazonSimpleDB db = factory.getSimpleDb(); for (Item item : items) { GetAttributesResult getOldResults = db.getAttributes(new GetAttributesRequest().withDomainName(domainName).withConsistentRead(true).withItemName( item.getName()).withAttributeNames(oldAttributeName)); List<Attribute> oldAtts = getOldResults.getAttributes(); if (oldAtts.size() > 0) { Attribute oldAtt = oldAtts.get(0); List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>(); atts.add(new ReplaceableAttribute(newAttributeName, oldAtt.getValue(), true)); db.putAttributes(new PutAttributesRequest().withDomainName(domainName).withItemName(item.getName()).withAttributes(atts)); db.deleteAttributes(new DeleteAttributesRequest().withDomainName(domainName).withItemName(item.getName()).withAttributes(oldAtts)); } } }
new DeleteAttributesRequest().withDomainName(domainName).withItemName(id) .withAttributes(attsToDelete2)); new DeleteAttributesRequest().withDomainName(domainName).withItemName(id) .withAttributes(attsToDelete));