out.flush();
}
private void updatePoint(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
GeoPoint geoPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng"));
AttributeValue rangeKeyAttributeValue = new AttributeValue().withS(requestObject.getString("rangeKey"));
String schoolName = requestObject.getString("schoolName");
AttributeValueUpdate schoolNameValueUpdate = null;
String memo = requestObject.getString("memo");
AttributeValueUpdate memoValueUpdate = null;
if (schoolName == null || schoolName.equalsIgnoreCase("")) {
schoolNameValueUpdate = new AttributeValueUpdate().withAction(AttributeAction.DELETE);
} else {
AttributeValue schoolNameAttributeValue = new AttributeValue().withS(schoolName);
schoolNameValueUpdate = new AttributeValueUpdate().withAction(AttributeAction.PUT).withValue(
schoolNameAttributeValue);
}
if (memo == null || memo.equalsIgnoreCase("")) {
memoValueUpdate = new AttributeValueUpdate().withAction(AttributeAction.DELETE);
} else {
AttributeValue memoAttributeValue = new AttributeValue().withS(memo);
memoValueUpdate = new AttributeValueUpdate().withAction(AttributeAction.PUT).withValue(memoAttributeValue);
}
UpdatePointRequest updatePointRequest = new UpdatePointRequest(geoPoint, rangeKeyAttributeValue);
updatePointRequest.getUpdateItemRequest().addAttributeUpdatesEntry("schoolName", schoolNameValueUpdate);