Package com.amazonaws.services.simpledb.model

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


            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));
            }
        }
    }
View Full Code Here


            // Replace an attribute
            System.out.println("Replacing Size of Item_03 with Medium.\n");
            List<ReplaceableAttribute> replaceableAttributes = new ArrayList<ReplaceableAttribute>();
            replaceableAttributes.add(new ReplaceableAttribute("Size", "Medium", true));
            sdb.putAttributes(new PutAttributesRequest(myDomain, "Item_03", replaceableAttributes));

            // Delete an item and all of its attributes
            System.out.println("Deleting Item_03.\n");
            sdb.deleteAttributes(new DeleteAttributesRequest(myDomain, "Item_03"));
View Full Code Here

  }

  public boolean save()
  {
    boolean result = false;
    PutAttributesRequest par = new PutAttributesRequest();
    par.setItemName(path);
    par.withAttributes(new ReplaceableAttribute("ReadRevisionNumber", "" + ReadRevisionNumber, true));
    par.withAttributes(new ReplaceableAttribute("WriteRevisionNumber", "" + WriteRevisionNumber, true));
    String[] pathComp = getPathComps(path);
    if(pathComp != null)
    {
      par.withAttributes(new ReplaceableAttribute("Levels", "" + pathComp.length, true));
      for(int i = 0; i<pathComp.length; i++)
      {
        par.withAttributes(new ReplaceableAttribute("Level"+i, "" + pathComp[i], true));
      }
      par.setDomainName(myDomain);
      DataObject.sdb.putAttributes(par);
    }
    return result;
  }
View Full Code Here

  }
 
  public boolean create()
  {
    boolean result = false;
    PutAttributesRequest par = new PutAttributesRequest();
    par.setItemName(path);
    par.withAttributes(new ReplaceableAttribute("ReadRevisionNumber", "1", true));
    par.withAttributes(new ReplaceableAttribute("WriteRevisionNumber", "1", true));
    String[] pathComp = getPathComps(path);
    if(pathComp != null)
    {
      par.withAttributes(new ReplaceableAttribute("Levels", "" + pathComp.length, true));
      for(int i = 0; i<pathComp.length; i++)
      {
        par.withAttributes(new ReplaceableAttribute("Level"+i, "" + pathComp[i], true));
      }
      par.setDomainName(myDomain);
      DataObject.sdb.putAttributes(par);
    }
    return result;
  }
View Full Code Here

        if (!domainSet.contains(ctx.getDomain()))
            service.createDomain(new CreateDomainRequest(ctx.domain));
    }

    private void putAttribute(PutAttributesContext ctx, ObjectNode objectNode) {
        PutAttributesRequest request = new PutAttributesRequest();

        request.setDomainName(ctx.getDomain());

        Iterator<String> itFieldName = objectNode.fieldNames();

        while (itFieldName.hasNext()) {
            String key = itFieldName.next();

            if ("name".equals(key)) {
                String value = objectNode.get("name").textValue();

                request.setItemName(value);
            } else if ("append".equals(key) || "replace".equals(key)) {
                boolean replaceP = "replace".equals(key);

                ArrayNode attributesNode = (ArrayNode) objectNode.get(key);

                Collection<ReplaceableAttribute> value = getAttributesFrom(attributesNode, replaceP);

                request.getAttributes().addAll(value);
            } else if ("expect".equals(key)) {
                ObjectNode expectNode = (ObjectNode) objectNode.get("expect");

                request.setExpected(getUpdateCondition(expectNode));
            }
        }

        service.putAttributes(request);
    }
View Full Code Here

            // Replace an attribute
            System.out.println("Replacing Size of Item_03 with Medium.\n");
            List<ReplaceableAttribute> replaceableAttributes = new ArrayList<ReplaceableAttribute>();
            replaceableAttributes.add(new ReplaceableAttribute("Size", "Medium", true));
            sdb.putAttributes(new PutAttributesRequest(myDomain, "Item_03", replaceableAttributes));

            // Delete an item and all of its attributes
            System.out.println("Deleting Item_03.\n");
            sdb.deleteAttributes(new DeleteAttributesRequest(myDomain, "Item_03"));
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpledb.model.PutAttributesRequest

Copyright © 2018 www.massapicom. 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.