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.v62.assetcategory.AssetCategoryService.java

public void deleteCategories(JSONArray categoryIds) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("categoryIds", checkNull(categoryIds));

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

    session.invoke(_command);
}

From source file:com.liferay.mobile.android.v62.assetcategory.AssetCategoryService.java

public JSONArray deleteCategories(JSONArray categoryIds, JSONObjectWrapper serviceContext) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("categoryIds", checkNull(categoryIds));
        mangleWrapper(_params, "serviceContext", "com.liferay.portal.service.ServiceContext", serviceContext);

        _command.put("/assetcategory/delete-categories", _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.assetcategory.AssetCategoryService.java

public void deleteCategory(long categoryId) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("categoryId", categoryId);

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

    session.invoke(_command);
}

From source file:com.liferay.mobile.android.v62.assetcategory.AssetCategoryService.java

public JSONArray getCategories(String className, long classPK) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("className", checkNull(className));
        _params.put("classPK", classPK);

        _command.put("/assetcategory/get-categories", _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.assetcategory.AssetCategoryService.java

public JSONObject getCategory(long categoryId) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("categoryId", categoryId);

        _command.put("/assetcategory/get-category", _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.v62.assetcategory.AssetCategoryService.java

public JSONArray getChildCategories(long parentCategoryId) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("parentCategoryId", parentCategoryId);

        _command.put("/assetcategory/get-child-categories", _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.assetcategory.AssetCategoryService.java

public JSONArray getChildCategories(long parentCategoryId, int start, int end, JSONObjectWrapper obc)
        throws Exception {
    JSONObject _command = new JSONObject();

    try {//ww  w  . ja va2s  .co m
        JSONObject _params = new JSONObject();

        _params.put("parentCategoryId", parentCategoryId);
        _params.put("start", start);
        _params.put("end", end);
        mangleWrapper(_params, "obc", "com.liferay.portal.kernel.util.OrderByComparator", obc);

        _command.put("/assetcategory/get-child-categories", _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.assetcategory.AssetCategoryService.java

public JSONArray getJsonSearch(long groupId, String name, JSONArray vocabularyIds, int start, int end)
        throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("groupId", groupId);
        _params.put("name", checkNull(name));
        _params.put("vocabularyIds", checkNull(vocabularyIds));
        _params.put("start", start);
        _params.put("end", end);

        _command.put("/assetcategory/get-json-search", _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.assetcategory.AssetCategoryService.java

public JSONObject getJsonVocabularyCategories(long vocabularyId, int start, int end, JSONObjectWrapper obc)
        throws Exception {
    JSONObject _command = new JSONObject();

    try {//from w  w w .  j  a v  a2 s .  c om
        JSONObject _params = new JSONObject();

        _params.put("vocabularyId", vocabularyId);
        _params.put("start", start);
        _params.put("end", end);
        mangleWrapper(_params, "obc", "com.liferay.portal.kernel.util.OrderByComparator", obc);

        _command.put("/assetcategory/get-json-vocabulary-categories", _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.v62.assetcategory.AssetCategoryService.java

public JSONObject getJsonVocabularyCategories(long groupId, String name, long vocabularyId, int start, int end,
        JSONObjectWrapper obc) throws Exception {
    JSONObject _command = new JSONObject();

    try {/*from   www .  j av  a2 s .c o  m*/
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("name", checkNull(name));
        _params.put("vocabularyId", vocabularyId);
        _params.put("start", start);
        _params.put("end", end);
        mangleWrapper(_params, "obc", "com.liferay.portal.kernel.util.OrderByComparator", obc);

        _command.put("/assetcategory/get-json-vocabulary-categories", _params);
    } catch (JSONException _je) {
        throw new Exception(_je);
    }

    JSONArray _result = session.invoke(_command);

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

    return _result.getJSONObject(0);
}