List of usage examples for org.json JSONArray getJSONArray
public JSONArray getJSONArray(int index) throws JSONException
From source file:com.liferay.mobile.android.v62.user.UserService.java
public JSONArray getRoleUserIds(long roleId) throws Exception { JSONObject _command = new JSONObject(); try {/* w ww . j a v a 2s . com*/ JSONObject _params = new JSONObject(); _params.put("roleId", roleId); _command.put("/user/get-role-user-ids", _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.v62.user.UserService.java
public JSONArray getUserGroupUsers(long userGroupId) throws Exception { JSONObject _command = new JSONObject(); try {// w w w. ja va2 s . c o m JSONObject _params = new JSONObject(); _params.put("userGroupId", userGroupId); _command.put("/user/get-user-group-users", _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.connectsdk.cordova.DiscoveryManagerWrapper.java
public void configure(JSONObject config) throws JSONException { if (config.has("pairingLevel")) { String pairingLevel = config.getString("pairingLevel"); if ("off".equals(pairingLevel)) { discoveryManager.setPairingLevel(PairingLevel.OFF); } else if ("on".equals(pairingLevel)) { discoveryManager.setPairingLevel(PairingLevel.ON); }/* w ww .j a v a2 s. com*/ } if (config.has("capabilityFilters")) { JSONArray filters = config.getJSONArray("capabilityFilters"); ArrayList<CapabilityFilter> capabilityFilters = new ArrayList<CapabilityFilter>(); for (int i = 0; i < filters.length(); i++) { JSONArray filter = filters.getJSONArray(i); CapabilityFilter capabilityFilter = new CapabilityFilter(); for (int j = 0; j < filter.length(); j++) { capabilityFilter.addCapability(filter.getString(j)); } capabilityFilters.add(capabilityFilter); } discoveryManager.setCapabilityFilters(capabilityFilters); } }
From source file:com.dubsar_dictionary.Dubsar.model.Word.java
@Override public void parseData(Object jsonResponse) throws JSONException { JSONArray response = (JSONArray) jsonResponse; mId = response.getInt(0);/*from ww w. jav a 2 s.c o m*/ mName = new String(response.getString(1)); setPos(response.getString(2)); setInflections(response.getString(3)); setFreqCnt(response.getInt(5)); JSONArray list = response.getJSONArray(4); mSenses = new ArrayList<Sense>(list.length()); for (int j = 0; j < list.length(); ++j) { JSONArray entry = list.getJSONArray(j); int senseId; String senseName; Sense sense; JSONArray _synonyms = entry.getJSONArray(1); ArrayList<Sense> synonyms = new ArrayList<Sense>(_synonyms.length()); for (int k = 0; k < _synonyms.length(); ++k) { JSONArray _synonym = _synonyms.getJSONArray(k); senseId = _synonym.getInt(0); senseName = _synonym.getString(1); sense = new Sense(senseId, senseName, getPartOfSpeech()); synonyms.add(sense); } senseId = entry.getInt(0); String gloss = entry.getString(2); sense = new Sense(senseId, gloss, synonyms, this); sense.setLexname(entry.getString(3)); if (!entry.isNull(4)) { sense.setMarker(entry.getString(4)); } sense.setFreqCnt(entry.getInt(5)); mSenses.add(sense); } }
From source file:org.apache.cordova.dialogs.Notification.java
/** * Executes the request and returns PluginResult. * * @param action The action to execute. * @param args JSONArray of arguments for the plugin. * @param callbackContext The callback context used when calling back into JavaScript. * @return True when the action was valid, false otherwise. *//*from ww w . java 2s. com*/ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { /* * Don't run any of these if the current activity is finishing * in order to avoid android.view.WindowManager$BadTokenException * crashing the app. Just return true here since false should only * be returned in the event of an invalid action. */ if (this.cordova.getActivity().isFinishing()) return true; if (action.equals("beep")) { this.beep(args.getLong(0)); } else if (action.equals("alert")) { this.alert(args.getString(0), args.getString(1), args.getString(2), callbackContext); return true; } else if (action.equals("confirm")) { this.confirm(args.getString(0), args.getString(1), args.getJSONArray(2), callbackContext); return true; } else if (action.equals("prompt")) { this.prompt(args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), callbackContext); return true; } else if (action.equals("activityStart")) { this.activityStart(args.getString(0), args.getString(1)); } else if (action.equals("activityStop")) { this.activityStop(); } else if (action.equals("progressStart")) { this.progressStart(args.getString(0), args.getString(1)); } else if (action.equals("progressValue")) { this.progressValue(args.getInt(0)); } else if (action.equals("progressStop")) { this.progressStop(); } else { return false; } // Only alert and confirm are async. callbackContext.success(); return true; }
From source file:com.liferay.mobile.android.v7.assetvocabulary.AssetVocabularyService.java
public JSONArray deleteVocabularies(JSONArray vocabularyIds, JSONObjectWrapper serviceContext) throws Exception { JSONObject _command = new JSONObject(); try {/* w w w . j a va 2 s . c om*/ JSONObject _params = new JSONObject(); _params.put("vocabularyIds", checkNull(vocabularyIds)); mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext", serviceContext); _command.put("/assetvocabulary/delete-vocabularies", _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.assetvocabulary.AssetVocabularyService.java
public JSONArray getCompanyVocabularies(long companyId) throws Exception { JSONObject _command = new JSONObject(); try {//from w w w . j a v a 2 s. co m JSONObject _params = new JSONObject(); _params.put("companyId", companyId); _command.put("/assetvocabulary/get-company-vocabularies", _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.assetvocabulary.AssetVocabularyService.java
public JSONArray getGroupsVocabularies(JSONArray groupIds, String className) throws Exception { JSONObject _command = new JSONObject(); try {/*from w ww .j av a 2 s.c o m*/ JSONObject _params = new JSONObject(); _params.put("groupIds", checkNull(groupIds)); _params.put("className", checkNull(className)); _command.put("/assetvocabulary/get-groups-vocabularies", _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.assetvocabulary.AssetVocabularyService.java
public JSONArray getGroupsVocabularies(JSONArray groupIds) throws Exception { JSONObject _command = new JSONObject(); try {/*from w w w. j a v a 2s . com*/ JSONObject _params = new JSONObject(); _params.put("groupIds", checkNull(groupIds)); _command.put("/assetvocabulary/get-groups-vocabularies", _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.assetvocabulary.AssetVocabularyService.java
public JSONArray getGroupsVocabularies(JSONArray groupIds, String className, long classTypePK) throws Exception { JSONObject _command = new JSONObject(); try {// w w w .j a v a 2 s .c o m JSONObject _params = new JSONObject(); _params.put("groupIds", checkNull(groupIds)); _params.put("className", checkNull(className)); _params.put("classTypePK", classTypePK); _command.put("/assetvocabulary/get-groups-vocabularies", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getJSONArray(0); }