Package com.amazonaws.services.dynamodbv2.model

Examples of com.amazonaws.services.dynamodbv2.model.AttributeValue


        return new AttributeValue().withN(longValue.toString());
    }

    public static Long safeGetLong(Map<String, AttributeValue> dynamoRecord, String key) {
        AttributeValue av = dynamoRecord.get(key);
        if (av == null) {
            return null;
        } else {
            return new Long(av.getN());
        }
    }
View Full Code Here


            return new Long(av.getN());
        }
    }

    public static String safeGetString(Map<String, AttributeValue> dynamoRecord, String key) {
        AttributeValue av = dynamoRecord.get(key);
        if (av == null) {
            return null;
        } else {
            return av.getS();
        }
    }
View Full Code Here

            return av.getS();
        }
    }

    public static List<String> safeGetSS(Map<String, AttributeValue> dynamoRecord, String key) {
        AttributeValue av = dynamoRecord.get(key);

        if (av == null) {
            return new ArrayList<String>();
        } else {
            return av.getSS();
        }
    }
View Full Code Here

    try {
      for (Entry<String, AttributeValue> attr : row.entrySet()) {
        rou.put(attr.getKey(), new AttributeValueUpdate(attr.getValue(), AttributeAction.PUT));
      }
      UpdateItemRequest updateItemRequest = new UpdateItemRequest(appid,
          Collections.singletonMap(Config._KEY, new AttributeValue(key)), rou);
      client().updateItem(updateItemRequest);
    } catch (Exception e) {
      logger.error(null, e);
    }
  }
View Full Code Here

      return null;
    }
    Map<String, AttributeValue> row = null;
    try {
      GetItemRequest getItemRequest = new GetItemRequest(appid,
          Collections.singletonMap(Config._KEY, new AttributeValue(key)));
      GetItemResult res = client().getItem(getItemRequest);
      if (res != null && res.getItem() != null && !res.getItem().isEmpty()) {
        row = res.getItem();
      }
    } catch (Exception e) {
View Full Code Here

    if (StringUtils.isBlank(key) || StringUtils.isBlank(appid)) {
      return;
    }
    try {
      DeleteItemRequest delItemRequest = new DeleteItemRequest(appid,
          Collections.singletonMap(Config._KEY, new AttributeValue(key)));
      client().deleteItem(delItemRequest);
    } catch (Exception e) {
      logger.error(null, e);
    }
  }
View Full Code Here

    Map<String, P> results = new LinkedHashMap<String, P>();
    ArrayList<Map<String, AttributeValue>> keyz = new ArrayList<Map<String, AttributeValue>>();

    for (String key : keys) {
      results.put(key, null);
      keyz.add(Collections.singletonMap(Config._KEY, new AttributeValue(key)));
    }

    KeysAndAttributes kna = new KeysAndAttributes().withKeys(keyz);
    if (!getAllColumns) {
      kna.setAttributesToGet(Arrays.asList(Config._KEY, Config._TYPE));
View Full Code Here

          withLimit(pager.getLimit()).
          withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);

      if (!StringUtils.isBlank(pager.getLastKey())) {
        scanRequest.setExclusiveStartKey(Collections.singletonMap(Config._KEY,
            new AttributeValue(pager.getLastKey())));
      }

      ScanResult result = client().scan(scanRequest);
      logger.debug("readPage() CC: {}", result.getConsumedCapacity());
View Full Code Here

    List<WriteRequest> reqs = new ArrayList<WriteRequest>();
    for (ParaObject object : objects) {
      if (object != null) {
        reqs.add(new WriteRequest().withDeleteRequest(new DeleteRequest().
            withKey(Collections.singletonMap(Config._KEY, new AttributeValue(object.getId())))));
      }
    }
    batchWrite(Collections.singletonMap(appid, reqs));
    logger.debug("DAO.deleteAll() {}", objects.size());
  }
View Full Code Here

      return row;
    }
    for (Entry<String, Object> entry : Utils.getAnnotatedFields(so, filter).entrySet()) {
      Object value = entry.getValue();
      if (value != null && !StringUtils.isBlank(value.toString())) {
        row.put(entry.getKey(), new AttributeValue(value.toString()));
      }
    }
    return row;
  }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.model.AttributeValue

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.