Example usage for org.json JSONArray getJSONArray

List of usage examples for org.json JSONArray getJSONArray

Introduction

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

Prototype

public JSONArray getJSONArray(int index) throws JSONException 

Source Link

Document

Get the JSONArray associated with an index.

Usage

From source file:com.liferay.mobile.android.v62.ddmstructure.DDMStructureService.java

public JSONArray getStructures(JSONArray groupIds) throws Exception {
    JSONObject _command = new JSONObject();

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

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

        _command.put("/ddmstructure/get-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.v62.ddmstructure.DDMStructureService.java

public JSONArray search(long companyId, JSONArray groupIds, JSONArray classNameIds, String name,
        String description, String storageType, int type, boolean andOperator, int start, int end,
        JSONObjectWrapper orderByComparator) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("companyId", companyId);
        _params.put("groupIds", checkNull(groupIds));
        _params.put("classNameIds", checkNull(classNameIds));
        _params.put("name", checkNull(name));
        _params.put("description", checkNull(description));
        _params.put("storageType", checkNull(storageType));
        _params.put("type", type);
        _params.put("andOperator", andOperator);
        _params.put("start", start);
        _params.put("end", end);
        mangleWrapper(_params, "orderByComparator", "com.liferay.portal.kernel.util.OrderByComparator",
                orderByComparator);

        _command.put("/ddmstructure/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.ddmstructure.DDMStructureService.java

public JSONArray search(long companyId, JSONArray groupIds, JSONArray classNameIds, String keywords, int start,
        int end, JSONObjectWrapper orderByComparator) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("companyId", companyId);
        _params.put("groupIds", checkNull(groupIds));
        _params.put("classNameIds", checkNull(classNameIds));
        _params.put("keywords", checkNull(keywords));
        _params.put("start", start);
        _params.put("end", end);
        mangleWrapper(_params, "orderByComparator", "com.liferay.portal.kernel.util.OrderByComparator",
                orderByComparator);

        _command.put("/ddmstructure/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.port.ocean.shipping.data.VehicleInfoData.java

@Override
protected void onExtractData(JSONObject jsonData) throws Exception {
    if (licensePlateNumber != null) {
        // ??//from w  ww . j  a va 2s .c om

        JSONArray jsonArray = jsonData.getJSONArray(DATA_TAG);
        if (jsonArray.length() > 2) {
            data = new Vehicle();
            data.setId(jsonArray.getString(0));
            data.setLicensePlateNumber(jsonArray.getString(1));
            data.setAddTime(jsonArray.getString(2));
        }
    } else {
        // ????
        JSONArray jsonArray = jsonData.getJSONArray(DATA_TAG);
        dataList = new ArrayList<>();

        for (int i = 0; i < jsonArray.length(); i++) {
            JSONArray jsonRow = jsonArray.getJSONArray(i);
            if (jsonRow.length() > 2) {
                data = new Vehicle();
                data.setId(jsonRow.getString(0));
                data.setLicensePlateNumber(jsonRow.getString(1));
                data.setAddTime(jsonRow.getString(2));
            }
            dataList.add(data);
        }
    }
}

From source file:com.dubsar_dictionary.Dubsar.model.Model.java

protected void parsePointers(JSONArray pointers) throws JSONException {
    mPointers = new HashMap<String, List<List<Object>>>();
    mPointerCount = pointers.length();//from w w w .j  a  v  a2 s. c  o m

    for (int j = 0; j < pointers.length(); ++j) {
        JSONArray _pointer = pointers.getJSONArray(j);

        String ptype = _pointer.getString(0);
        String targetType = _pointer.getString(1);
        int targetId = _pointer.getInt(2);
        String targetText = _pointer.getString(3);
        String targetGloss = _pointer.getString(4);

        List<List<Object>> pointersByType = mPointers.get(ptype);
        if (pointersByType == null) {
            pointersByType = new ArrayList<List<Object>>();
            mPointers.put(ptype, pointersByType);
        }

        ArrayList<Object> pointer = new ArrayList<Object>();
        pointer.add(targetType);
        pointer.add(Integer.valueOf(targetId));
        pointer.add(targetText);
        pointer.add(targetGloss);

        pointersByType.add(pointer);
    }
}

From source file:com.liferay.mobile.android.v7.wikinode.WikiNodeService.java

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

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

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

        _command.put("/wiki.wikinode/get-nodes", _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.wikinode.WikiNodeService.java

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

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

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

        _command.put("/wiki.wikinode/get-nodes", _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.wikinode.WikiNodeService.java

public JSONArray getNodes(long groupId, int status, int start, int end, JSONObjectWrapper obc)
        throws Exception {
    JSONObject _command = new JSONObject();

    try {/*from w  w w .java2  s.c om*/
        JSONObject _params = new JSONObject();

        _params.put("groupId", groupId);
        _params.put("status", status);
        _params.put("start", start);
        _params.put("end", end);
        mangleWrapper(_params, "obc",
                "com.liferay.portal.kernel.util.OrderByComparator<com.liferay.wiki.model.WikiNode>", obc);

        _command.put("/wiki.wikinode/get-nodes", _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.wikinode.WikiNodeService.java

public JSONArray getNodes(long groupId) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("groupId", groupId);

        _command.put("/wiki.wikinode/get-nodes", _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.wikinode.WikiNodeService.java

public JSONArray getNodes(long groupId, int status) throws Exception {
    JSONObject _command = new JSONObject();

    try {/*from  w w  w  .j av  a2s . co  m*/
        JSONObject _params = new JSONObject();

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

        _command.put("/wiki.wikinode/get-nodes", _params);
    } catch (JSONException _je) {
        throw new Exception(_je);
    }

    JSONArray _result = session.invoke(_command);

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

    return _result.getJSONArray(0);
}