List of usage examples for org.json JSONArray getBoolean
public boolean getBoolean(int index) throws JSONException
From source file:com.cranberrygame.cordova.plugin.ad.admob.Plugin.java
private void setUp(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { //Activity activity=cordova.getActivity(); //webView//from w ww .j a v a 2s . com //args.length() //args.getString(0) //args.getString(1) //args.getInt(0) //args.getInt(1) //args.getBoolean(0) //args.getBoolean(1) //JSONObject json = args.optJSONObject(0); //json.optString("bannerAdUnit") //json.optString("interstitialAdUnit") //JSONObject inJson = json.optJSONObject("inJson"); //final String bannerAdUnit = args.getString(0); //final String interstitialAdUnit = args.getString(1); //final boolean isOverlap = args.getBoolean(2); //final boolean isTest = args.getBoolean(3); //final String[] zoneIds = new String[args.getJSONArray(4).length()]; //for (int i = 0; i < args.getJSONArray(4).length(); i++) { // zoneIds[i] = args.getJSONArray(4).getString(i); //} //Log.d(LOG_TAG, String.format("%s", bannerAdUnit)); //Log.d(LOG_TAG, String.format("%s", interstitialAdUnit)); //Log.d(LOG_TAG, String.format("%b", isOverlap)); //Log.d(LOG_TAG, String.format("%b", isTest)); final String bannerAdUnit = args.getString(0); final String interstitialAdUnit = args.getString(1); final String rewardedVideoAdUnit = args.getString(2); final boolean isOverlap = args.getBoolean(3); final boolean isTest = args.getBoolean(4); Log.d(LOG_TAG, String.format("%s", bannerAdUnit)); Log.d(LOG_TAG, String.format("%s", interstitialAdUnit)); Log.d(LOG_TAG, String.format("%s", rewardedVideoAdUnit)); Log.d(LOG_TAG, String.format("%b", isOverlap)); Log.d(LOG_TAG, String.format("%b", isTest)); callbackContextKeepCallback = callbackContext; if (isOverlap) pluginDelegate = new AdMobOverlap(this); else pluginDelegate = new AdMobSplit(this); cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { _setUp(bannerAdUnit, interstitialAdUnit, rewardedVideoAdUnit, isOverlap, isTest); } }); }
From source file:com.wikitude.phonegap.WikitudePlugin.java
@Override public boolean execute(final String action, final JSONArray args, final CallbackContext callContext) { /* hide architect-view -> destroy and remove from activity */ if (WikitudePlugin.ACTION_CLOSE.equals(action)) { if (this.architectView != null) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override/*w w w . jav a 2s . c o m*/ public void run() { removeArchitectView(); } }); callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } return true; } /* return success only if view is opened (no matter if visible or not) */ if (WikitudePlugin.ACTION_STATE_ISOPEN.equals(action)) { if (this.architectView != null) { callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } return true; } /* return success only if view is opened (no matter if visible or not) */ if (WikitudePlugin.ACTION_IS_DEVICE_SUPPORTED.equals(action)) { if (ArchitectView.isDeviceSupported(this.cordova.getActivity()) && hasNeonSupport()) { callContext.success(action + ": this device is ARchitect-ready"); } else { callContext.error(action + action + ":Sorry, this device is NOT ARchitect-ready"); } return true; } if (WikitudePlugin.ACTION_CAPTURE_SCREEN.equals(action)) { if (architectView != null) { int captureMode = ArchitectView.CaptureScreenCallback.CAPTURE_MODE_CAM_AND_WEBVIEW; try { captureMode = (args.getBoolean(0)) ? ArchitectView.CaptureScreenCallback.CAPTURE_MODE_CAM_AND_WEBVIEW : ArchitectView.CaptureScreenCallback.CAPTURE_MODE_CAM; } catch (Exception e) { // unexpected error; } architectView.captureScreen(captureMode, new CaptureScreenCallback() { @Override public void onScreenCaptured(Bitmap screenCapture) { try { // final File imageDirectory = cordova.getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES); final File imageDirectory = Environment.getExternalStorageDirectory(); if (imageDirectory == null) { callContext.error("External storage not available"); } final File screenCaptureFile = new File(imageDirectory, System.currentTimeMillis() + ".jpg"); if (screenCaptureFile.exists()) { screenCaptureFile.delete(); } final FileOutputStream out = new FileOutputStream(screenCaptureFile); screenCapture.compress(Bitmap.CompressFormat.JPEG, 90, out); out.flush(); out.close(); cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { final String absoluteCaptureImagePath = screenCaptureFile.getAbsolutePath(); callContext.success(absoluteCaptureImagePath); // in case you want to sent the pic to other applications, uncomment these lines (for future use) // final Intent share = new Intent(Intent.ACTION_SEND); // share.setType("image/jpg"); // share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(screenCaptureFile)); // final String chooserTitle = "Share Snaphot"; // cordova.getActivity().startActivity(Intent.createChooser(share, chooserTitle)); } }); } catch (Exception e) { callContext.error(e.getMessage()); } } }); return true; } } /* life-cycle's RESUME */ if (WikitudePlugin.ACTION_ON_RESUME.equals(action)) { if (this.architectView != null) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { WikitudePlugin.this.architectView.onResume(); callContext.success(action + ": architectView is present"); locationProvider.onResume(); } }); // callContext.success( action + ": architectView is present" ); } else { callContext.error(action + ": architectView is not present"); } return true; } /* life-cycle's PAUSE */ if (WikitudePlugin.ACTION_ON_PAUSE.equals(action)) { if (architectView != null) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { WikitudePlugin.this.architectView.onPause(); locationProvider.onPause(); } }); callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } return true; } /* set visibility to "visible", return error if view is null */ if (WikitudePlugin.ACTION_SHOW.equals(action)) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (architectView != null) { architectView.setVisibility(View.VISIBLE); callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } } }); return true; } /* set visibility to "invisible", return error if view is null */ if (WikitudePlugin.ACTION_HIDE.equals(action)) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (architectView != null) { architectView.setVisibility(View.INVISIBLE); callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } } }); return true; } /* define call-back for url-invocations */ if (WikitudePlugin.ACTION_ON_URLINVOKE.equals(action)) { this.urlInvokeCallback = callContext; final PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT, action + ": registered callback"); result.setKeepCallback(true); callContext.sendPluginResult(result); return true; } /* location update */ if (WikitudePlugin.ACTION_SET_LOCATION.equals(action)) { if (this.architectView != null) { try { final double lat = args.getDouble(0); final double lon = args.getDouble(1); float alt = Float.MIN_VALUE; try { alt = (float) args.getDouble(2); } catch (Exception e) { // invalid altitude -> ignore it } final float altitude = alt; Double acc = null; try { acc = args.getDouble(3); } catch (Exception e) { // invalid accuracy -> ignore it } final Double accuracy = acc; if (this.cordova != null && this.cordova.getActivity() != null) { cordova.getActivity().runOnUiThread( // this.cordova.getThreadPool().execute( new Runnable() { @Override public void run() { if (accuracy != null) { WikitudePlugin.this.architectView.setLocation(lat, lon, altitude, accuracy.floatValue()); } else { WikitudePlugin.this.architectView.setLocation(lat, lon, altitude); } } }); } } catch (Exception e) { callContext.error( action + ": exception thrown, " + e != null ? e.getMessage() : "(exception is NULL)"); return true; } callContext.success(action + ": updated location"); return true; } else { /* return error if there is no architect-view active*/ callContext.error(action + ": architectView is not present"); } return true; } if (WikitudePlugin.ACTION_CALL_JAVASCRIPT.equals(action)) { String logMsg = null; try { final String callJS = args.getString(0); logMsg = callJS; this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (architectView != null) { WikitudePlugin.this.architectView.callJavascript(callJS); } else { callContext.error(action + ": architectView is not present"); } } }); } catch (JSONException je) { callContext.error( action + ": exception thrown, " + je != null ? je.getMessage() : "(exception is NULL)"); return true; } callContext.success(action + ": called js, '" + logMsg + "'"); return true; } /* initial set-up, show ArchitectView full-screen in current screen/activity */ if (WikitudePlugin.ACTION_OPEN.equals(action)) { this.openCallback = callContext; PluginResult result = null; try { final String apiKey = args.getString(0); final String filePath = args.getString(1); this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { try { WikitudePlugin.this.addArchitectView(apiKey, filePath); /* call success method once architectView was added successfully */ if (openCallback != null) { PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(false); openCallback.sendPluginResult(result); } } catch (Exception e) { /* in case "addArchitectView" threw an exception -> notify callback method asynchronously */ openCallback.error(e != null ? e.getMessage() : "Exception is 'null'"); } } }); } catch (Exception e) { result = new PluginResult(PluginResult.Status.ERROR, action + ": exception thown, " + e != null ? e.getMessage() : "(exception is NULL)"); result.setKeepCallback(false); callContext.sendPluginResult(result); return true; } /* adding architect-view is done in separate thread, ensure to setKeepCallback so one can call success-method properly later on */ result = new PluginResult(PluginResult.Status.NO_RESULT, action + ": no result required, just registered callback-method"); result.setKeepCallback(true); callContext.sendPluginResult(result); return true; } /* fall-back return value */ callContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "no such action: " + action)); return false; }
From source file:com.remobile.file.FileUtils.java
public boolean execute(String action, final JSONArray args, final CallbackContext callbackContext) { if (!configured) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "File plugin is not configured. Please see the README.md file for details on how to update config.xml")); return true; }//from w w w. ja va 2s. c o m if (action.equals("testSaveLocationExists")) { threadhelper(new FileOp() { public void run(JSONArray args) { boolean b = DirectoryManager.testSaveLocationExists(); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b)); } }, args, callbackContext); } else if (action.equals("getFreeDiskSpace")) { threadhelper(new FileOp() { public void run(JSONArray args) { long l = DirectoryManager.getFreeDiskSpace(false); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l)); } }, args, callbackContext); } else if (action.equals("testFileExists")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException { String fname = args.getString(0); boolean b = DirectoryManager.testFileExists(fname); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b)); } }, args, callbackContext); } else if (action.equals("testDirectoryExists")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException { String fname = args.getString(0); boolean b = DirectoryManager.testFileExists(fname); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b)); } }, args, callbackContext); } else if (action.equals("readAsText")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, MalformedURLException { String encoding = args.getString(1); int start = args.getInt(2); int end = args.getInt(3); String fname = args.getString(0); readFileAs(fname, start, end, callbackContext, encoding, PluginResult.MESSAGE_TYPE_STRING); } }, args, callbackContext); } else if (action.equals("readAsDataURL")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, MalformedURLException { int start = args.getInt(1); int end = args.getInt(2); String fname = args.getString(0); readFileAs(fname, start, end, callbackContext, null, -1); } }, args, callbackContext); } else if (action.equals("readAsArrayBuffer")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, MalformedURLException { int start = args.getInt(1); int end = args.getInt(2); String fname = args.getString(0); readFileAs(fname, start, end, callbackContext, null, PluginResult.MESSAGE_TYPE_ARRAYBUFFER); } }, args, callbackContext); } else if (action.equals("readAsBinaryString")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, MalformedURLException { int start = args.getInt(1); int end = args.getInt(2); String fname = args.getString(0); readFileAs(fname, start, end, callbackContext, null, PluginResult.MESSAGE_TYPE_BINARYSTRING); } }, args, callbackContext); } else if (action.equals("write")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, FileNotFoundException, IOException, NoModificationAllowedException { String fname = args.getString(0); String data = args.getString(1); int offset = args.getInt(2); Boolean isBinary = args.getBoolean(3); long fileSize = write(fname, data, offset, isBinary); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, args, callbackContext); } else if (action.equals("truncate")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, FileNotFoundException, IOException, NoModificationAllowedException { String fname = args.getString(0); int offset = args.getInt(1); long fileSize = truncateFile(fname, offset); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize)); } }, args, callbackContext); } else if (action.equals("requestAllFileSystems")) { threadhelper(new FileOp() { public void run(JSONArray args) throws IOException, JSONException { callbackContext.success(requestAllFileSystems()); } }, args, callbackContext); } else if (action.equals("requestAllPaths")) { cordova.getThreadPool().execute(new Runnable() { public void run() { try { callbackContext.success(requestAllPaths()); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } else if (action.equals("requestFileSystem")) { threadhelper(new FileOp() { public void run(JSONArray args) throws IOException, JSONException { int fstype = args.getInt(0); long size = args.optLong(1); if (size != 0 && size > (DirectoryManager.getFreeDiskSpace(true) * 1024)) { callbackContext.sendPluginResult( new PluginResult(PluginResult.Status.ERROR, FileUtils.QUOTA_EXCEEDED_ERR)); } else { JSONObject obj = requestFileSystem(fstype); callbackContext.success(obj); } } }, args, callbackContext); } else if (action.equals("resolveLocalFileSystemURI")) { threadhelper(new FileOp() { public void run(JSONArray args) throws IOException, JSONException { String fname = args.getString(0); JSONObject obj = resolveLocalFileSystemURI(fname); callbackContext.success(obj); } }, args, callbackContext); } else if (action.equals("getFileMetadata")) { threadhelper(new FileOp() { public void run(JSONArray args) throws FileNotFoundException, JSONException, MalformedURLException { String fname = args.getString(0); JSONObject obj = getFileMetadata(fname); callbackContext.success(obj); } }, args, callbackContext); } else if (action.equals("getParent")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, IOException { String fname = args.getString(0); JSONObject obj = getParent(fname); callbackContext.success(obj); } }, args, callbackContext); } else if (action.equals("getDirectory")) { threadhelper(new FileOp() { public void run(JSONArray args) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException { String dirname = args.getString(0); String path = args.getString(1); JSONObject obj = getFile(dirname, path, args.optJSONObject(2), true); callbackContext.success(obj); } }, args, callbackContext); } else if (action.equals("getFile")) { threadhelper(new FileOp() { public void run(JSONArray args) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException { String dirname = args.getString(0); String path = args.getString(1); JSONObject obj = getFile(dirname, path, args.optJSONObject(2), false); callbackContext.success(obj); } }, args, callbackContext); } else if (action.equals("remove")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, NoModificationAllowedException, InvalidModificationException, MalformedURLException { String fname = args.getString(0); boolean success = remove(fname); if (success) { callbackContext.success(); } else { callbackContext.error(FileUtils.NO_MODIFICATION_ALLOWED_ERR); } } }, args, callbackContext); } else if (action.equals("removeRecursively")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, FileExistsException, MalformedURLException, NoModificationAllowedException { String fname = args.getString(0); boolean success = removeRecursively(fname); if (success) { callbackContext.success(); } else { callbackContext.error(FileUtils.NO_MODIFICATION_ALLOWED_ERR); } } }, args, callbackContext); } else if (action.equals("moveTo")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, NoModificationAllowedException, IOException, InvalidModificationException, EncodingException, FileExistsException { String fname = args.getString(0); String newParent = args.getString(1); String newName = args.getString(2); JSONObject entry = transferTo(fname, newParent, newName, true); callbackContext.success(entry); } }, args, callbackContext); } else if (action.equals("copyTo")) { threadhelper(new FileOp() { public void run(JSONArray args) throws JSONException, NoModificationAllowedException, IOException, InvalidModificationException, EncodingException, FileExistsException { String fname = args.getString(0); String newParent = args.getString(1); String newName = args.getString(2); JSONObject entry = transferTo(fname, newParent, newName, false); callbackContext.success(entry); } }, args, callbackContext); } else if (action.equals("readEntries")) { threadhelper(new FileOp() { public void run(JSONArray args) throws FileNotFoundException, JSONException, MalformedURLException { String fname = args.getString(0); JSONArray entries = readEntries(fname); callbackContext.success(entries); } }, args, callbackContext); } else if (action.equals("_getLocalFilesystemPath")) { // Internal method for testing: Get the on-disk location of a local filesystem url. // [Currently used for testing file-transfer] threadhelper(new FileOp() { public void run(JSONArray args) throws FileNotFoundException, JSONException, MalformedURLException { String localURLstr = args.getString(0); String fname = filesystemPathForURL(localURLstr); callbackContext.success(fname); } }, args, callbackContext); } else { return false; } return true; }
From source file:com.remcob00.cordova.youtube.YouTube.java
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { cordova.setActivityResultCallback(YouTube.this); if (action.equals("playVideo")) { if (args.length() == 2) { Intent youtubeIntent = YouTubeStandalonePlayer.createVideoIntent(cordova.getActivity(), args.getString(0), args.getString(1)); cordova.startActivityForResult(this, youtubeIntent, 2300010); return true; } else if (args.length() == 5) { Intent youtubeIntent = YouTubeStandalonePlayer.createVideoIntent(cordova.getActivity(), args.getString(0), args.getString(1), args.getInt(2), args.getBoolean(3), args.getBoolean(4)); cordova.startActivityForResult(this, youtubeIntent, 2300010); return true; } else {/*from ww w.java 2 s . c o m*/ return false; } } else if (action.endsWith("playPlaylist")) { if (args.length() == 2) { Intent youtubeIntent = YouTubeStandalonePlayer.createPlaylistIntent(cordova.getActivity(), args.getString(0), args.getString(1)); cordova.startActivityForResult(this, youtubeIntent, 2300010); return true; } else if (args.length() == 6) { Intent youtubeIntent = YouTubeStandalonePlayer.createPlaylistIntent(cordova.getActivity(), args.getString(0), args.getString(1), args.getInt(2), args.getInt(3), args.getBoolean(4), args.getBoolean(5)); cordova.startActivityForResult(this, youtubeIntent, 2300010); return true; } else { return false; } } else if (action.endsWith("playVideos")) { List<String> videos = new ArrayList<String>(); for (int i = 0; i < args.getJSONArray(1).length(); i++) { videos.add(args.getJSONArray(1).getString(i)); } if (args.length() == 2) { Intent youtubeIntent = YouTubeStandalonePlayer.createVideosIntent(cordova.getActivity(), args.getString(0), videos); cordova.startActivityForResult(this, youtubeIntent, 2300010); return true; } else if (args.length() == 6) { Intent youtubeIntent = YouTubeStandalonePlayer.createVideosIntent(cordova.getActivity(), args.getString(0), videos, args.getInt(2), args.getInt(3), args.getBoolean(4), args.getBoolean(5)); cordova.startActivityForResult(this, youtubeIntent, 2300010); return true; } else { return false; } } return false; }
From source file:oculus.aperture.common.JSONProperties.java
@Override public Iterable<Boolean> getBooleans(String key) { try {/*www. j a va 2s .com*/ final JSONArray array = obj.getJSONArray(key); return new Iterable<Boolean>() { @Override public Iterator<Boolean> iterator() { return new Iterator<Boolean>() { private final int n = array.length(); private int i = 0; @Override public boolean hasNext() { return n > i; } @Override public Boolean next() { try { return (n > i) ? array.getBoolean(i++) : null; } catch (JSONException e) { return null; } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; } catch (JSONException e) { return EmptyIterable.instance(); } }
From source file:com.mm.yamingapp.core.MethodDescriptor.java
/** * Converts a parameter from JSON into a Java Object. * /* w ww.j a va2 s . com*/ * @return TODO */ // TODO(damonkohler): This signature is a bit weird (auto-refactored). The obvious alternative // would be to work on one supplied parameter and return the converted parameter. However, that's // problematic because you lose the ability to call the getXXX methods on the JSON array. @VisibleForTesting static Object convertParameter(final JSONArray parameters, int index, Type type) throws JSONException, RpcError { try { // We must handle null and numbers explicitly because we cannot magically cast them. We // also need to convert implicitly from numbers to bools. if (parameters.isNull(index)) { return null; } else if (type == Boolean.class) { try { return parameters.getBoolean(index); } catch (JSONException e) { return new Boolean(parameters.getInt(index) != 0); } } else if (type == Long.class) { return parameters.getLong(index); } else if (type == Double.class) { return parameters.getDouble(index); } else if (type == Integer.class) { return parameters.getInt(index); } else { // Magically cast the parameter to the right Java type. return ((Class<?>) type).cast(parameters.get(index)); } } catch (ClassCastException e) { throw new RpcError( "Argument " + (index + 1) + " should be of type " + ((Class<?>) type).getSimpleName() + "."); } }
From source file:com.liferay.mobile.android.v7.dlfileentry.DLFileEntryService.java
public Boolean hasFileEntryLock(long fileEntryId) throws Exception { JSONObject _command = new JSONObject(); try {/*w w w. j a va 2 s. com*/ JSONObject _params = new JSONObject(); _params.put("fileEntryId", fileEntryId); _command.put("/dlfileentry/has-file-entry-lock", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getBoolean(0); }
From source file:com.liferay.mobile.android.v7.dlfileentry.DLFileEntryService.java
public Boolean isFileEntryCheckedOut(long fileEntryId) throws Exception { JSONObject _command = new JSONObject(); try {//from www. java2s . c om JSONObject _params = new JSONObject(); _params.put("fileEntryId", fileEntryId); _command.put("/dlfileentry/is-file-entry-checked-out", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getBoolean(0); }
From source file:com.liferay.mobile.android.v7.dlfileentry.DLFileEntryService.java
public Boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid) throws Exception { JSONObject _command = new JSONObject(); try {//from w w w . j ava 2 s . c om JSONObject _params = new JSONObject(); _params.put("fileEntryId", fileEntryId); _params.put("lockUuid", checkNull(lockUuid)); _command.put("/dlfileentry/verify-file-entry-check-out", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getBoolean(0); }
From source file:com.liferay.mobile.android.v7.dlfileentry.DLFileEntryService.java
public Boolean verifyFileEntryLock(long fileEntryId, String lockUuid) throws Exception { JSONObject _command = new JSONObject(); try {//from w w w.j av a 2 s.co m JSONObject _params = new JSONObject(); _params.put("fileEntryId", fileEntryId); _params.put("lockUuid", checkNull(lockUuid)); _command.put("/dlfileentry/verify-file-entry-lock", _params); } catch (JSONException _je) { throw new Exception(_je); } JSONArray _result = session.invoke(_command); if (_result == null) { return null; } return _result.getBoolean(0); }