List of usage examples for org.json JSONObject put
public JSONObject put(String key, Object value) throws JSONException
From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java
public JSONObject fetchFolder(long folderId) throws Exception { JSONObject _command = new JSONObject(); try {/*from w ww .j ava 2 s. co m*/ JSONObject _params = new JSONObject(); _params.put("folderId", folderId); _command.put("/journal.journalfolder/fetch-folder", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getJSONObject(0); }
From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java
public JSONArray getFoldersAndArticles(long groupId, long folderId, int start, int end, JSONObjectWrapper obc) throws Exception { JSONObject _command = new JSONObject(); try {//from ww w . ja v a2s. c om JSONObject _params = new JSONObject(); _params.put("groupId", groupId); _params.put("folderId", folderId); _params.put("start", start); _params.put("end", end); mangleWrapper(_params, "obc", "com.liferay.portal.kernel.util.OrderByComparator", obc); _command.put("/journal.journalfolder/get-folders-and-articles", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getJSONArray(0); }
From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java
public JSONArray getFoldersAndArticles(long groupId, long userId, long folderId, int status, int start, int end, JSONObjectWrapper obc) throws Exception { JSONObject _command = new JSONObject(); try {/*from w w w. j ava2s.c o m*/ JSONObject _params = new JSONObject(); _params.put("groupId", groupId); _params.put("userId", userId); _params.put("folderId", folderId); _params.put("status", status); _params.put("start", start); _params.put("end", end); mangleWrapper(_params, "obc", "com.liferay.portal.kernel.util.OrderByComparator", obc); _command.put("/journal.journalfolder/get-folders-and-articles", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getJSONArray(0); }
From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java
public JSONArray getFoldersAndArticles(long groupId, long folderId, int status, int start, int end, JSONObjectWrapper obc) throws Exception { JSONObject _command = new JSONObject(); try {// w w w .ja v a2 s . com JSONObject _params = new JSONObject(); _params.put("groupId", groupId); _params.put("folderId", folderId); _params.put("status", status); _params.put("start", start); _params.put("end", end); mangleWrapper(_params, "obc", "com.liferay.portal.kernel.util.OrderByComparator", obc); _command.put("/journal.journalfolder/get-folders-and-articles", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getJSONArray(0); }
From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java
public Integer getFoldersAndArticlesCount(long groupId, long folderId) throws Exception { JSONObject _command = new JSONObject(); try {/*from w w w.j a va 2s . co m*/ JSONObject _params = new JSONObject(); _params.put("groupId", groupId); _params.put("folderId", folderId); _command.put("/journal.journalfolder/get-folders-and-articles-count", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getInt(0); }
From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java
public Integer getFoldersAndArticlesCount(long groupId, JSONArray folderIds, int status) throws Exception { JSONObject _command = new JSONObject(); try {//ww w .j a va2s .c o m JSONObject _params = new JSONObject(); _params.put("groupId", groupId); _params.put("folderIds", checkNull(folderIds)); _params.put("status", status); _command.put("/journal.journalfolder/get-folders-and-articles-count", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getInt(0); }
From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java
public Integer getFoldersAndArticlesCount(long groupId, long userId, long folderId, int status) throws Exception { JSONObject _command = new JSONObject(); try {/*w ww. ja v a 2 s .com*/ JSONObject _params = new JSONObject(); _params.put("groupId", groupId); _params.put("userId", userId); _params.put("folderId", folderId); _params.put("status", status); _command.put("/journal.journalfolder/get-folders-and-articles-count", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getInt(0); }
From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java
public Integer getFoldersAndArticlesCount(long groupId, long folderId, int status) throws Exception { JSONObject _command = new JSONObject(); try {//from w w w .j a va 2 s .c o m JSONObject _params = new JSONObject(); _params.put("groupId", groupId); _params.put("folderId", folderId); _params.put("status", status); _command.put("/journal.journalfolder/get-folders-and-articles-count", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getInt(0); }
From source file:org.loklak.api.iot.NMEAServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Query post = RemoteAccess.evaluate(request); // Sample usage for each line of NMEA Sentence data // GPSPosition a = new GPSPosition(); // a = parse("$GPGGA,220550,4124.7580,N,08152.2565,W,2,04,4.4,235.1,M,-34.0,M,,*7B"); if (post.isDoS_blackout()) { response.sendError(503, "your request frequency is too high"); return;/*from w ww . java 2 s . c o m*/ } // Send the stream URL as stream parameter. String stream = post.get("stream", ""); String minified = post.get("minified", ""); // Download the file/Stream of NMEA data as a buffered stream. URL url = new URL(stream); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String NMEALine; JSONObject json = new JSONObject(true); int lines = 0; // Read each buffered stream line by line and parse and convert NMEA to an actual object. while ((NMEALine = in.readLine()) != null) { lines++; GPSPosition gpsObject = new GPSPosition(); gpsObject = parse(NMEALine); json.put(String.valueOf(lines), gpsObject.toJSONString()); } in.close(); // Start the printwriter and get ready to respond with json PrintWriter sos = response.getWriter(); if (minified != "true") { sos.print(json.toString(2)); } else { sos.print(json.toString()); } sos.println(); post.finalize(); }
From source file:at.alladin.rmbt.client.SpeedItem.java
public JSONObject toJSON() throws JSONException { final JSONObject result = new JSONObject(); result.put("direction", upload ? "upload" : "download"); result.put("thread", thread); result.put("time", time); result.put("bytes", bytes); return result; }