Example usage for org.json JSONObject put

List of usage examples for org.json JSONObject put

Introduction

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

Prototype

public JSONObject put(String key, Object value) throws JSONException 

Source Link

Document

Put a key/value pair in the JSONObject.

Usage

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

public JSONArray getFolders(long groupId, long parentFolderId, int status, int start, int end)
        throws Exception {
    JSONObject _command = new JSONObject();

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

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

        _command.put("/journal.journalfolder/get-folders", _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 getFolders(long groupId, long parentFolderId, int start, int end) 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);
        _params.put("start", start);
        _params.put("end", end);

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

    try {/*from   w  w w  . j  a  va2s. c  om*/
        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", _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 getDdmStructures(JSONArray groupIds, long folderId, int restrictionType) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("groupIds", checkNull(groupIds));
        _params.put("folderId", folderId);
        _params.put("restrictionType", restrictionType);

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

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

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

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

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

    session.invoke(_command);
}

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

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

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

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

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

    session.invoke(_command);
}

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