List of usage examples for org.json JSONObject JSONObject
public JSONObject()
From source file:com.liferay.mobile.android.v7.ddmstructure.DDMStructureService.java
public JSONObject copyStructure(long structureId, JSONObjectWrapper serviceContext) throws Exception { JSONObject _command = new JSONObject(); try {//from w ww. j av a 2 s. c o m JSONObject _params = new JSONObject(); _params.put("structureId", structureId); mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext", serviceContext); _command.put("/ddm.ddmstructure/copy-structure", _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.ddmstructure.DDMStructureService.java
public JSONObject copyStructure(long structureId, JSONObject nameMap, JSONObject descriptionMap, JSONObjectWrapper serviceContext) throws Exception { JSONObject _command = new JSONObject(); try {/*from w ww . ja va2s . c o m*/ JSONObject _params = new JSONObject(); _params.put("structureId", structureId); _params.put("nameMap", checkNull(nameMap)); _params.put("descriptionMap", checkNull(descriptionMap)); mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext", serviceContext); _command.put("/ddm.ddmstructure/copy-structure", _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.ddmstructure.DDMStructureService.java
public JSONArray getStructures(long companyId, JSONArray groupIds, long classNameId, int status) throws Exception { JSONObject _command = new JSONObject(); try {/*from w w w . j ava 2 s . c o m*/ JSONObject _params = new JSONObject(); _params.put("companyId", companyId); _params.put("groupIds", checkNull(groupIds)); _params.put("classNameId", classNameId); _params.put("status", status); _command.put("/ddm.ddmstructure/get-structures", _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.ddmstructure.DDMStructureService.java
public JSONArray getStructures(long companyId, JSONArray groupIds, long classNameId, int status, int start, int end, JSONObjectWrapper orderByComparator) throws Exception { JSONObject _command = new JSONObject(); try {//from w ww . jav a2 s . c om JSONObject _params = new JSONObject(); _params.put("companyId", companyId); _params.put("groupIds", checkNull(groupIds)); _params.put("classNameId", classNameId); _params.put("status", status); _params.put("start", start); _params.put("end", end); mangleWrapper(_params, "orderByComparator", "com.liferay.portal.kernel.util.OrderByComparator<com.liferay.dynamic.data.mapping.model.DDMStructure>", orderByComparator); _command.put("/ddm.ddmstructure/get-structures", _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.ddmstructure.DDMStructureService.java
public void revertStructure(long structureId, String version, JSONObjectWrapper serviceContext) throws Exception { JSONObject _command = new JSONObject(); try {/*w w w .j av a 2s . c o m*/ JSONObject _params = new JSONObject(); _params.put("structureId", structureId); _params.put("version", checkNull(version)); mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext", serviceContext); _command.put("/ddm.ddmstructure/revert-structure", _params); } catch (JSONException _je) { throw new Exception(_je); } session.invoke(_command); }
From source file:CNCEntities.ResponseTopup.java
@Override public JSONObject getJsonEntity() { JSONObject jo = new JSONObject(); try {/*from ww w .j av a2s . c om*/ jo.put("code", code); jo.put("msg", msg); jo.put("tranid", tranid); } catch (JSONException ex) { Logger.getLogger(ResponseTopup.class.getName()).log(Level.SEVERE, null, ex); } return jo; }
From source file:Servlet.AjaxRestockIngredientServlet.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods.//from ww w .j a v a 2 s .c om * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here. You may use following sample code. */ JSONObject obj = new JSONObject(); String ingredientID = request.getParameter("restockingredientID"); IngredientInterface ingredientDAO = new IngredientImplementation(); IngredientBean ingredientBean = ingredientDAO.getIngredient(Integer.parseInt(ingredientID)); // System.out.println("pumasok sa ajaxrestockingredient servlet"); System.out.println("it's this " + ingredientID); // System.out.println(ingredientBean.getIngredient_id()); try { obj.put("RestockIngredientID", ingredientBean.getIngredient_id()); } catch (JSONException ex) { Logger.getLogger(AjaxEditIngredientServlet.class.getName()).log(Level.SEVERE, null, ex); } out.print(obj); out.flush(); } finally { out.close(); } }
From source file:net.jmhertlein.mcanalytics.console.gui.HostEntry.java
public JSONObject toJSON() { JSONObject ret = new JSONObject(); ret.put("nick", displayName); ret.put("url", url); ret.put("port", port); return ret;//from w ww . j a va2 s . c om }
From source file:com.jsonstore.util.JSONStoreLogger.java
public static void logAnalytics(Long startTime, Long endTime, String username, String collection, String operation) {/*from w w w . ja va 2 s .c om*/ if (!analyticsEnabled) { return; } String analyticsMessage = ""; //$NON-NLS-1$ JSONObject metadata = new JSONObject(); try { metadata.put(ANALYTICS_SOURCE_KEY, ANALYTICS_SOURCE); metadata.put(ANALYTICS_START_TIME, startTime); metadata.put(ANALYTICS_END_TIME, endTime); metadata.put(ANALYTICS_USERNAME, username); metadata.put(ANALYTICS_COLLECTION, collection); metadata.put(ANALYTICS_OPERATION, operation); metadata.put(ANALYTICS_RETURN_CODE, 0); } catch (JSONException e) { // Will not happen, only adding properties to a JSONObject created in this method logger.error("Error logging JSONStore analytics.", e); } logger.info(analyticsMessage, metadata); }
From source file:com.jsonstore.util.JSONStoreLogger.java
public static void logFileInfo(List<JSONStoreFileInfo> fileInfoList) { if (!analyticsEnabled) { return;/* www. ja v a 2 s . co m*/ } for (JSONStoreFileInfo fileInfo : fileInfoList) { String analyticsMessage = ""; //$NON-NLS-1$ JSONObject metadata = new JSONObject(); try { metadata.put(ANALYTICS_SOURCE_KEY, ANALYTICS_SOURCE); metadata.put(ANALYTICS_USERNAME, fileInfo.getUsername()); metadata.put(ANALYTICS_SIZE, fileInfo.getFileSizeBytes()); metadata.put(ANALYTICS_IS_ENCRYPTED, fileInfo.isEncrypted()); metadata.put(ANALYTICS_RETURN_CODE, 0); } catch (JSONException e) { // Will not happen, only adding properties to a JSONObject created in this method logger.error("Error logging JSONStore analytics.", e); } logger.info(analyticsMessage, metadata); } }