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

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

    try {/*from w w  w  . j a v  a 2s  . co  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-vocabulary-categories-display", _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 getVocabularyRootCategories(long vocabularyId, int start, int end, JSONObjectWrapper obc)
        throws Exception {
    JSONObject _command = new JSONObject();

    try {/* ww w . j  a  v a 2s. co  m*/
        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-vocabulary-root-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 getVocabularyRootCategories(long groupId, long vocabularyId, int start, int end,
        JSONObjectWrapper obc) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("groupId", groupId);
        _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-vocabulary-root-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 Integer getVocabularyRootCategoriesCount(long groupId, long vocabularyId) throws Exception {
    JSONObject _command = new JSONObject();

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

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

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

public JSONObject moveCategory(long categoryId, long parentCategoryId, long vocabularyId,
        JSONObjectWrapper serviceContext) throws Exception {
    JSONObject _command = new JSONObject();

    try {/*from   www  .  j a v a2  s.com*/
        JSONObject _params = new JSONObject();

        _params.put("categoryId", categoryId);
        _params.put("parentCategoryId", parentCategoryId);
        _params.put("vocabularyId", vocabularyId);
        mangleWrapper(_params, "serviceContext", "com.liferay.portal.service.ServiceContext", serviceContext);

        _command.put("/assetcategory/move-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 search(long groupId, String name, JSONArray categoryProperties, int start, int end)
        throws Exception {
    JSONObject _command = new JSONObject();

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

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

        _command.put("/assetcategory/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 JSONArray search(JSONArray groupIds, String name, JSONArray vocabularyIds, int start, int end)
        throws Exception {
    JSONObject _command = new JSONObject();

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

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

        _command.put("/assetcategory/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 JSONArray search(long groupId, String keywords, long vocabularyId, int start, int end,
        JSONObjectWrapper obc) throws Exception {
    JSONObject _command = new JSONObject();

    try {/*ww  w . jav a2s .c om*/
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("keywords", checkNull(keywords));
        _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/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 updateCategory(long categoryId, long parentCategoryId, JSONObject titleMap,
        JSONObject descriptionMap, long vocabularyId, JSONArray categoryProperties,
        JSONObjectWrapper serviceContext) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("categoryId", categoryId);
        _params.put("parentCategoryId", parentCategoryId);
        _params.put("titleMap", checkNull(titleMap));
        _params.put("descriptionMap", checkNull(descriptionMap));
        _params.put("vocabularyId", vocabularyId);
        _params.put("categoryProperties", checkNull(categoryProperties));
        mangleWrapper(_params, "serviceContext", "com.liferay.portal.service.ServiceContext", serviceContext);

        _command.put("/assetcategory/update-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:old.server.packet.PacketFactory.java

public static Packet make(final PACKET_TYPE packet_type, final ENUM_CLIENT_TYPE client_type)
        throws JSONException {
    // Disconnect player, result success, result fail
    final JSONObject jo = new JSONObject();

    jo.put(CommonPacketConsts.CLIENT_TYPE, client_type);

    switch (PACKET_TYPE.values()[packet_type.ordinal()]) {
    case PACKET_TYPE_DISCONNECT_PLAYER: {
        jo.put(CommonPacketConsts.ACTION_TYPE, CommonPacketConsts.ENUM_ACTION_TYPE.ACTION_UNREGISTER.ordinal());
        break;/*from  ww  w .j a  v a 2  s .  c om*/
    }
    case PACKET_TYPE_RESULT_SUCCESS: {
        jo.put(CommonPacketConsts.ACTION_TYPE, CommonPacketConsts.ENUM_ACTION_TYPE.ACTION_RESULT.ordinal());
        jo.put(CommonPacketConsts.RESULT, CommonPacketConsts.ENUM_RESULT.RESULT_SUCCESS.ordinal());
        break;
    }
    case PACKET_TYPE_RESULT_FAIL: {
        jo.put(CommonPacketConsts.ACTION_TYPE, CommonPacketConsts.ENUM_ACTION_TYPE.ACTION_RESULT.ordinal());
        jo.put(CommonPacketConsts.RESULT, CommonPacketConsts.ENUM_RESULT.RESULT_FAIL.ordinal());
        break;
    }
    default: {
        break;
    }
    }

    final Packet packet = new Packet(jo.toString());

    return packet;
}