Package com.amazonaws.services.simpledb.model

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


  }
 
  public static void fillModel(String itemName, List<Attribute> attrs, Class<?> clazz, Object obj) {
    fillModelKeysOnly(itemName, clazz, obj);
   
    Attribute theAttr;
    for (Field field : ClassInfo.getClassInfo(clazz).updateFields) {     
      if(!ClassInfo.isEmbeddedNative(field)){
        theAttr = null;
        String attrName = getAttributeName(field);
        // searches attribute and if found, removes it from the list to reduce number of attributes
        for(Attribute attr: attrs){
          if(attrName.equals(attr.getName())){
            theAttr = attr;
            attrs.remove(attr);
            break;
          }
        }
        if(theAttr != null){
          setFromString(obj, field, theAttr.getValue());
        }
      }else {
        Object value = SdbNativeSerializer.unembed(
            field.getType(), ClassInfo.getSingleColumnName(field), attrs);
        Util.setField(obj, field, value);
View Full Code Here


  }
 
  public static int mapSelectResultToCount(SelectResult res) {
    Item item = res.getItems().get(0);
    if(item != null){
      Attribute attr = item.getAttributes().get(0);
      if("Count".equals(attr.getName())){
        return Integer.parseInt(attr.getValue());
      }
    }
   
    return -1;
  }
View Full Code Here

      throw new SienaException("can't serializer Array/Collection in native mode");
    }

    T obj = Util.createObjectInstance(clazz);
    try {
      Attribute theAttr;
     
      for (Field f : ClassInfo.getClassInfo(clazz).updateFields) {
        if(!ClassInfo.isEmbeddedNative(f)){
          // doesn't try to analyze fields, just try to store it
          String attrName = getEmbeddedAttributeName(embeddingFieldName, f);     
         
          theAttr = null;
          // searches attribute and if found, removes it from the list to reduce number of attributes
          for(Attribute attr: attrs){
            if(attrName.equals(attr.getName())){
              theAttr = attr;
              attrs.remove(attr);
              break;
            }
          }
          if(theAttr != null){
            SdbMappingUtils.setFromString(obj, f, theAttr.getValue());
          }
        } else {
          Object value = SdbNativeSerializer.unembed(
              f.getType(), getEmbeddedAttributeName(embeddingFieldName, f),
              attrs);
View Full Code Here

    @Override
    public GetAttributesResult getAttributes(GetAttributesRequest getAttributesRequest) throws AmazonServiceException, AmazonClientException {
        this.getAttributesRequest = getAttributesRequest;
       
        return new GetAttributesResult()
                .withAttributes(new Attribute("AttributeOne", "Value One"))
                .withAttributes(new Attribute("AttributeTwo", "Value Two"));
    }
View Full Code Here

    }
   
    @Test
    public void deleteAttributes() {
        final List<Attribute> attributes = Arrays.asList(new Attribute[] {
            new Attribute("NAME1", "VALUE1")});
        final UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
       
        template.send("direct:start-sdb", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.DeleteAttributes);
View Full Code Here

    }

    @Test
    public void execute() {
        List<Attribute> attributes = new ArrayList<Attribute>();
        attributes.add(new Attribute("NAME1", "VALUE1"));
        exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
        exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
        UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
        exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
       
View Full Code Here

    }
   
    @Test(expected = IllegalArgumentException.class)
    public void executeWithoutItemName() {
        List<Attribute> attributes = new ArrayList<Attribute>();
        attributes.add(new Attribute("NAME1", "VALUE1"));
        exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
        UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
        exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
       
        command.execute();
View Full Code Here

    @Test
    public void determineAttributes() {
        assertNull(this.command.determineAttributes());
       
        List<Attribute> attributes = new ArrayList<Attribute>();
        attributes.add(new Attribute("NAME1", "VALUE1"));
        exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
       
        assertEquals(attributes, this.command.determineAttributes());
    }
View Full Code Here

    }
   
    @Test
    public void deleteAttributes() {
        final List<Attribute> attributes = Arrays.asList(new Attribute[] {
            new Attribute("NAME1", "VALUE1")});
        final UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
       
        template.send("direct:start", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.DeleteAttributes);
View Full Code Here

    }
   
    @Test
    public void deleteAttributes() {
        final List<Attribute> attributes = Arrays.asList(new Attribute[] {
            new Attribute("NAME1", "VALUE1")});
        final UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
       
        template.send("direct:start", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.DeleteAttributes);
View Full Code Here

TOP

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

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.