Example usage for org.json JSONObject JSONObject

List of usage examples for org.json JSONObject JSONObject

Introduction

In this page you can find the example usage for org.json JSONObject JSONObject.

Prototype

public JSONObject() 

Source Link

Document

Construct an empty JSONObject.

Usage

From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java

public JSONArray getFolderIds(long groupId, long folderId) throws Exception {
    JSONObject _command = new JSONObject();

    try {/*w ww .j a  v a 2 s.  c  om*/
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("folderId", folderId);

        _command.put("/journal.journalfolder/get-folder-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.v7.journalfolder.JournalFolderService.java

public JSONObject updateFolder(long groupId, long folderId, long parentFolderId, String name,
        String description, boolean mergeWithParentFolder, JSONObjectWrapper serviceContext) throws Exception {
    JSONObject _command = new JSONObject();

    try {// ww  w . ja v  a2 s .  c  om
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("folderId", folderId);
        _params.put("parentFolderId", parentFolderId);
        _params.put("name", checkNull(name));
        _params.put("description", checkNull(description));
        _params.put("mergeWithParentFolder", mergeWithParentFolder);
        mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext",
                serviceContext);

        _command.put("/journal.journalfolder/update-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 JSONObject updateFolder(long groupId, long folderId, long parentFolderId, String name,
        String description, JSONArray ddmStructureIds, int restrictionType, boolean mergeWithParentFolder,
        JSONObjectWrapper serviceContext) throws Exception {
    JSONObject _command = new JSONObject();

    try {//  w  w w. ja  v a2s .  com
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("folderId", folderId);
        _params.put("parentFolderId", parentFolderId);
        _params.put("name", checkNull(name));
        _params.put("description", checkNull(description));
        _params.put("ddmStructureIds", checkNull(ddmStructureIds));
        _params.put("restrictionType", restrictionType);
        _params.put("mergeWithParentFolder", mergeWithParentFolder);
        mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext",
                serviceContext);

        _command.put("/journal.journalfolder/update-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 Integer getFoldersCount(long groupId, long parentFolderId, int status) throws Exception {
    JSONObject _command = new JSONObject();

    try {//from w  ww .ja  va2 s . c o m
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("parentFolderId", parentFolderId);
        _params.put("status", status);

        _command.put("/journal.journalfolder/get-folders-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 getFoldersCount(long groupId, long parentFolderId) throws Exception {
    JSONObject _command = new JSONObject();

    try {/*w  w  w. j  a  v  a 2s .c o m*/
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("parentFolderId", parentFolderId);

        _command.put("/journal.journalfolder/get-folders-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 JSONArray getSubfolderIds(long groupId, long folderId, boolean recurse) throws Exception {
    JSONObject _command = new JSONObject();

    try {//from  w ww . jav a 2 s .co  m
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("folderId", folderId);
        _params.put("recurse", recurse);

        _command.put("/journal.journalfolder/get-subfolder-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.v7.journalfolder.JournalFolderService.java

public void getSubfolderIds(JSONArray folderIds, long groupId, long folderId) throws Exception {
    JSONObject _command = new JSONObject();

    try {/*from  ww w.j a v  a2  s . c  o m*/
        JSONObject _params = new JSONObject();

        _params.put("folderIds", checkNull(folderIds));
        _params.put("groupId", groupId);
        _params.put("folderId", folderId);

        _command.put("/journal.journalfolder/get-subfolder-ids", _params);
    } catch (JSONException _je) {
        throw new Exception(_je);
    }

    session.invoke(_command);
}

From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java

public void getSubfolderIds(JSONArray folderIds, long groupId, long folderId, boolean recurse)
        throws Exception {
    JSONObject _command = new JSONObject();

    try {/* w ww .j av a  2  s  .c om*/
        JSONObject _params = new JSONObject();

        _params.put("folderIds", checkNull(folderIds));
        _params.put("groupId", groupId);
        _params.put("folderId", folderId);
        _params.put("recurse", recurse);

        _command.put("/journal.journalfolder/get-subfolder-ids", _params);
    } catch (JSONException _je) {
        throw new Exception(_je);
    }

    session.invoke(_command);
}

From source file:com.liferay.mobile.android.v7.journalfolder.JournalFolderService.java

public JSONObject moveFolderFromTrash(long folderId, long parentFolderId, JSONObjectWrapper serviceContext)
        throws Exception {
    JSONObject _command = new JSONObject();

    try {//w  w  w.  j a  v  a 2  s  . co m
        JSONObject _params = new JSONObject();

        _params.put("folderId", folderId);
        _params.put("parentFolderId", parentFolderId);
        mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext",
                serviceContext);

        _command.put("/journal.journalfolder/move-folder-from-trash", _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 JSONObject moveFolderToTrash(long folderId) throws Exception {
    JSONObject _command = new JSONObject();

    try {/*from   ww w.  ja v  a  2s .c o  m*/
        JSONObject _params = new JSONObject();

        _params.put("folderId", folderId);

        _command.put("/journal.journalfolder/move-folder-to-trash", _params);
    } catch (JSONException _je) {
        throw new Exception(_je);
    }

    JSONArray _result = session.invoke(_command);

    if (_result == null) {
        return null;
    }

    return _result.getJSONObject(0);
}