NSClient fix
This commit is contained in:
parent
2ce590a700
commit
c66ca2ea43
2 changed files with 10 additions and 10 deletions
|
@ -42,29 +42,29 @@ public class DbRequest {
|
||||||
|
|
||||||
// dbAdd
|
// dbAdd
|
||||||
public DbRequest(String action, String collection, JSONObject data) {
|
public DbRequest(String action, String collection, JSONObject data) {
|
||||||
|
this.action = action;
|
||||||
|
this.collection = collection;
|
||||||
|
this.nsClientID = "" + DateUtil.now();
|
||||||
try {
|
try {
|
||||||
data.put("NSCLIENT_ID", nsClientID);
|
data.put("NSCLIENT_ID", nsClientID);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.action = action;
|
|
||||||
this.collection = collection;
|
|
||||||
this.data = data.toString();
|
this.data = data.toString();
|
||||||
this.nsClientID = "" + DateUtil.now();
|
|
||||||
this._id = "";
|
this._id = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// dbUpdate, dbUpdateUnset
|
// dbUpdate, dbUpdateUnset
|
||||||
public DbRequest(String action, String collection, String _id, JSONObject data) {
|
public DbRequest(String action, String collection, String _id, JSONObject data) {
|
||||||
|
this.action = action;
|
||||||
|
this.collection = collection;
|
||||||
|
this.nsClientID = "" + DateUtil.now();
|
||||||
try {
|
try {
|
||||||
data.put("NSCLIENT_ID", nsClientID);
|
data.put("NSCLIENT_ID", nsClientID);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.action = action;
|
|
||||||
this.collection = collection;
|
|
||||||
this.data = data.toString();
|
this.data = data.toString();
|
||||||
this.nsClientID = "" + DateUtil.now();
|
|
||||||
this._id = _id;
|
this._id = _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,15 +72,15 @@ public class DbRequest {
|
||||||
public DbRequest(String action, String collection,
|
public DbRequest(String action, String collection,
|
||||||
String _id) {
|
String _id) {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
|
this.action = action;
|
||||||
|
this.collection = collection;
|
||||||
|
this.nsClientID = "" + DateUtil.now();
|
||||||
try {
|
try {
|
||||||
data.put("NSCLIENT_ID", nsClientID);
|
data.put("NSCLIENT_ID", nsClientID);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.action = action;
|
|
||||||
this.collection = collection;
|
|
||||||
this.data = data.toString();
|
this.data = data.toString();
|
||||||
this.nsClientID = "" + DateUtil.now();
|
|
||||||
this._id = _id;
|
this._id = _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class NSUpload {
|
||||||
deviceStatus.uploaderBattery = batteryLevel;
|
deviceStatus.uploaderBattery = batteryLevel;
|
||||||
|
|
||||||
deviceStatus.created_at = DateUtil.toISOString(new Date());
|
deviceStatus.created_at = DateUtil.toISOString(new Date());
|
||||||
UploadQueue.add(new DbRequest("dbAdd", "devicestatus", deviceStatus.mongoRecord().toString()));
|
UploadQueue.add(new DbRequest("dbAdd", "devicestatus", deviceStatus.mongoRecord()));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue