Java Code Examples for com.amazonaws.util.json.JSONObject#getDouble()
The following examples show how to use
com.amazonaws.util.json.JSONObject#getDouble() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeoDynamoDBServlet.java From reinvent2013-mobile-photo-share with Apache License 2.0 | 6 votes |
private void queryRectangle(JSONObject requestObject, PrintWriter out) throws IOException, JSONException { GeoPoint minPoint = new GeoPoint(requestObject.getDouble("minLat"), requestObject.getDouble("minLng")); GeoPoint maxPoint = new GeoPoint(requestObject.getDouble("maxLat"), requestObject.getDouble("maxLng")); String filterUserId = requestObject.getString("filterUserId"); List<String> attributesToGet = new ArrayList<String>(); attributesToGet.add(config.getRangeKeyAttributeName()); attributesToGet.add(config.getGeoJsonAttributeName()); attributesToGet.add("title"); attributesToGet.add("userId"); QueryRectangleRequest queryRectangleRequest = new QueryRectangleRequest(minPoint, maxPoint); queryRectangleRequest.getQueryRequest().setAttributesToGet(attributesToGet); QueryRectangleResult queryRectangleResult = geoDataManager.queryRectangle(queryRectangleRequest); printGeoQueryResult(queryRectangleResult, out, filterUserId); }
Example 2
Source File: GeoDynamoDBServlet.java From reinvent2013-mobile-photo-share with Apache License 2.0 | 6 votes |
private void queryRadius(JSONObject requestObject, PrintWriter out) throws IOException, JSONException { GeoPoint centerPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng")); double radiusInMeter = requestObject.getDouble("radiusInMeter"); String filterUserId = requestObject.getString("filterUserId"); List<String> attributesToGet = new ArrayList<String>(); attributesToGet.add(config.getRangeKeyAttributeName()); attributesToGet.add(config.getGeoJsonAttributeName()); attributesToGet.add("title"); attributesToGet.add("userId"); QueryRadiusRequest queryRadiusRequest = new QueryRadiusRequest(centerPoint, radiusInMeter); queryRadiusRequest.getQueryRequest().setAttributesToGet(attributesToGet); QueryRadiusResult queryRadiusResult = geoDataManager.queryRadius(queryRadiusRequest); printGeoQueryResult(queryRadiusResult, out, filterUserId); }
Example 3
Source File: GeoDynamoDBServlet.java From reinvent2013-mobile-photo-share with Apache License 2.0 | 5 votes |
private void putPoint(JSONObject requestObject, PrintWriter out) throws IOException, JSONException { GeoPoint geoPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng")); AttributeValue rangeKeyAttributeValue = new AttributeValue().withS(requestObject.getString("s3-photo-url")); AttributeValue titleAttributeValue = new AttributeValue().withS(requestObject.getString("title")); AttributeValue userIdAttributeValue = new AttributeValue().withS(requestObject.getString("userId")); PutPointRequest putPointRequest = new PutPointRequest(geoPoint, rangeKeyAttributeValue); putPointRequest.getPutItemRequest().addItemEntry("title", titleAttributeValue); putPointRequest.getPutItemRequest().addItemEntry("userId", userIdAttributeValue); PutPointResult putPointResult = geoDataManager.putPoint(putPointRequest); printPutPointResult(putPointResult, out); }
Example 4
Source File: GeoDynamoDBServlet.java From reinvent2013-mobile-photo-share with Apache License 2.0 | 5 votes |
private void getPoint(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")); GetPointRequest getPointRequest = new GetPointRequest(geoPoint, rangeKeyAttributeValue); GetPointResult getPointResult = geoDataManager.getPoint(getPointRequest); printGetPointRequest(getPointResult, out); }
Example 5
Source File: GeoDynamoDBServlet.java From reinvent2013-mobile-photo-share with Apache License 2.0 | 5 votes |
private void deletePoint(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")); DeletePointRequest deletePointRequest = new DeletePointRequest(geoPoint, rangeKeyAttributeValue); DeletePointResult deletePointResult = geoDataManager.deletePoint(deletePointRequest); printDeletePointResult(deletePointResult, out); }
Example 6
Source File: GeoDynamoDBServlet.java From dynamodb-geo with Apache License 2.0 | 5 votes |
private void putPoint(JSONObject requestObject, PrintWriter out) throws IOException, JSONException { GeoPoint geoPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng")); AttributeValue rangeKeyAttributeValue = new AttributeValue().withS(UUID.randomUUID().toString()); AttributeValue schoolNameKeyAttributeValue = new AttributeValue().withS(requestObject.getString("schoolName")); PutPointRequest putPointRequest = new PutPointRequest(geoPoint, rangeKeyAttributeValue); putPointRequest.getPutItemRequest().addItemEntry("schoolName", schoolNameKeyAttributeValue); PutPointResult putPointResult = geoDataManager.putPoint(putPointRequest); printPutPointResult(putPointResult, out); }
Example 7
Source File: GeoDynamoDBServlet.java From dynamodb-geo with Apache License 2.0 | 5 votes |
private void getPoint(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")); GetPointRequest getPointRequest = new GetPointRequest(geoPoint, rangeKeyAttributeValue); GetPointResult getPointResult = geoDataManager.getPoint(getPointRequest); printGetPointRequest(getPointResult, out); }
Example 8
Source File: GeoDynamoDBServlet.java From dynamodb-geo with Apache License 2.0 | 5 votes |
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); updatePointRequest.getUpdateItemRequest().addAttributeUpdatesEntry("memo", memoValueUpdate); UpdatePointResult updatePointResult = geoDataManager.updatePoint(updatePointRequest); printUpdatePointResult(updatePointResult, out); }
Example 9
Source File: GeoDynamoDBServlet.java From dynamodb-geo with Apache License 2.0 | 5 votes |
private void queryRectangle(JSONObject requestObject, PrintWriter out) throws IOException, JSONException { GeoPoint minPoint = new GeoPoint(requestObject.getDouble("minLat"), requestObject.getDouble("minLng")); GeoPoint maxPoint = new GeoPoint(requestObject.getDouble("maxLat"), requestObject.getDouble("maxLng")); List<String> attributesToGet = new ArrayList<String>(); attributesToGet.add(config.getRangeKeyAttributeName()); attributesToGet.add(config.getGeoJsonAttributeName()); attributesToGet.add("schoolName"); QueryRectangleRequest queryRectangleRequest = new QueryRectangleRequest(minPoint, maxPoint); queryRectangleRequest.getQueryRequest().setAttributesToGet(attributesToGet); QueryRectangleResult queryRectangleResult = geoDataManager.queryRectangle(queryRectangleRequest); printGeoQueryResult(queryRectangleResult, out); }
Example 10
Source File: GeoDynamoDBServlet.java From dynamodb-geo with Apache License 2.0 | 5 votes |
private void queryRadius(JSONObject requestObject, PrintWriter out) throws IOException, JSONException { GeoPoint centerPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng")); double radiusInMeter = requestObject.getDouble("radiusInMeter"); List<String> attributesToGet = new ArrayList<String>(); attributesToGet.add(config.getRangeKeyAttributeName()); attributesToGet.add(config.getGeoJsonAttributeName()); attributesToGet.add("schoolName"); QueryRadiusRequest queryRadiusRequest = new QueryRadiusRequest(centerPoint, radiusInMeter); queryRadiusRequest.getQueryRequest().setAttributesToGet(attributesToGet); QueryRadiusResult queryRadiusResult = geoDataManager.queryRadius(queryRadiusRequest); printGeoQueryResult(queryRadiusResult, out); }
Example 11
Source File: GeoDynamoDBServlet.java From dynamodb-geo with Apache License 2.0 | 5 votes |
private void deletePoint(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")); DeletePointRequest deletePointRequest = new DeletePointRequest(geoPoint, rangeKeyAttributeValue); DeletePointResult deletePointResult = geoDataManager.deletePoint(deletePointRequest); printDeletePointResult(deletePointResult, out); }