Commit b18d9b3e by Adi Amir

publish startTime & endTime to public-safety

parent 4cdc3108
Showing with 18 additions and 5 deletions
......@@ -29,6 +29,7 @@ import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.util.Deque;
import java.util.Map;
......@@ -239,10 +240,22 @@ public class GEManager {
logger.info("getSensorDetails() activated. camId=" + sensorId);
// execute the request ...
// envType
String envType = requestContext.getParameter("envType");
Long tsEndTime = System.currentTimeMillis();
Long tsStartTime = tsEndTime - ONE_DAY_IN_MILLI_SECS;
req = buildSensorDetailsRequest(sensorId, envType, tsStartTime,tsEndTime);
if (envType == null)
return errorResponse("missing mandatory parameter: envType");
// endTime
String endTime = requestContext.getParameter("endTime"); //System.currentTimeMillis(); // 1486758673000L;
if (endTime == null)
return errorResponse("missing mandatory parameter: endTime");
Long tsEndTime = Long.parseLong(endTime);
// start time
String startTime = requestContext.getParameter("startTime"); //tsEndTime - ONE_DAY_IN_MILLI_SECS; //1486755073000L;
if (startTime == null)
return errorResponse("missing mandatory parameter: startTime");
Long tsStartTime = Long.parseLong(startTime);
req = buildSensorDetailsRequest(sensorId, envType, tsStartTime, tsEndTime);
try {
httpResp = httpClient.processRequest(req);
if(httpResp.getStatusCode() == 200)
......@@ -274,8 +287,8 @@ public class GEManager {
// query string
StringBuilder sb = new StringBuilder();
sb.append("eventType=").append(envType).append("&")
.append("startTime=").append(1486755073000L).append("&")
.append("endTime=").append(1486758673000L);
.append("startTime=").append(tsStartTime).append("&")
.append("endTime=").append(tsEndTime);
String queryStr = sb.toString();
request.setQueryString(queryStr);
request.addHeader("Authorization", "Bearer " + TOKEN);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment