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 void restoreFolderFromTrash(long folderId) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("folderId", folderId);

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

    session.invoke(_command);
}

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

public void deleteFolder(long folderId) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("folderId", folderId);

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

    session.invoke(_command);
}

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

public void deleteFolder(long folderId, boolean includeTrashedEntries) throws Exception {
    JSONObject _command = new JSONObject();

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

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

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

    session.invoke(_command);
}

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

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

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

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

        _command.put("/journal.journalfolder/add-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 fetchFolder(long folderId) throws Exception {
    JSONObject _command = new JSONObject();

    try {//from w w  w . j  a  va2 s .  c  o  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 {/*w  ww .ja va2  s .  co m*/
        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 {/*w  w  w  . j av  a2s . com*/
        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 {/*from   ww  w . j  av a 2s . c  o  m*/
        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 {//  w w w.ja  v a2s  .  c  o  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 {/*  w ww . ja  v  a 2  s .co 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);
}