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.assetentry.AssetEntryService.java

public JSONArray getEntries(JSONObjectWrapper entryQuery) throws Exception {
    JSONObject _command = new JSONObject();

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

        mangleWrapper(_params, "entryQuery", "com.liferay.asset.kernel.service.persistence.AssetEntryQuery",
                entryQuery);

        _command.put("/assetentry/get-entries", _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.assetentry.AssetEntryService.java

public JSONObject getEntry(long entryId) 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("entryId", entryId);

        _command.put("/assetentry/get-entry", _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.assetentry.AssetEntryService.java

public JSONObject updateEntry(long groupId, long createDate, long modifiedDate, String className, long classPK,
        String classUuid, long classTypeId, JSONArray categoryIds, JSONArray tagNames, boolean visible,
        long startDate, long endDate, long expirationDate, String mimeType, String title, String description,
        String summary, String url, String layoutUuid, int height, int width, int priority, boolean sync)
        throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("groupId", groupId);
        _params.put("createDate", createDate);
        _params.put("modifiedDate", modifiedDate);
        _params.put("className", checkNull(className));
        _params.put("classPK", classPK);
        _params.put("classUuid", checkNull(classUuid));
        _params.put("classTypeId", classTypeId);
        _params.put("categoryIds", checkNull(categoryIds));
        _params.put("tagNames", checkNull(tagNames));
        _params.put("visible", visible);
        _params.put("startDate", startDate);
        _params.put("endDate", endDate);
        _params.put("expirationDate", expirationDate);
        _params.put("mimeType", checkNull(mimeType));
        _params.put("title", checkNull(title));
        _params.put("description", checkNull(description));
        _params.put("summary", checkNull(summary));
        _params.put("url", checkNull(url));
        _params.put("layoutUuid", checkNull(layoutUuid));
        _params.put("height", height);
        _params.put("width", width);
        _params.put("priority", priority);
        _params.put("sync", sync);

        _command.put("/assetentry/update-entry", _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.assetentry.AssetEntryService.java

public JSONObject updateEntry(long groupId, long createDate, long modifiedDate, String className, long classPK,
        String classUuid, long classTypeId, JSONArray categoryIds, JSONArray tagNames, boolean visible,
        long startDate, long endDate, long expirationDate, String mimeType, String title, String description,
        String summary, String url, String layoutUuid, int height, int width, double priority)
        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("createDate", createDate);
        _params.put("modifiedDate", modifiedDate);
        _params.put("className", checkNull(className));
        _params.put("classPK", classPK);
        _params.put("classUuid", checkNull(classUuid));
        _params.put("classTypeId", classTypeId);
        _params.put("categoryIds", checkNull(categoryIds));
        _params.put("tagNames", checkNull(tagNames));
        _params.put("visible", visible);
        _params.put("startDate", startDate);
        _params.put("endDate", endDate);
        _params.put("expirationDate", expirationDate);
        _params.put("mimeType", checkNull(mimeType));
        _params.put("title", checkNull(title));
        _params.put("description", checkNull(description));
        _params.put("summary", checkNull(summary));
        _params.put("url", checkNull(url));
        _params.put("layoutUuid", checkNull(layoutUuid));
        _params.put("height", height);
        _params.put("width", width);
        _params.put("priority", priority);

        _command.put("/assetentry/update-entry", _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.assetentry.AssetEntryService.java

public JSONObject fetchEntry(long entryId) throws Exception {
    JSONObject _command = new JSONObject();

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

        _params.put("entryId", entryId);

        _command.put("/assetentry/fetch-entry", _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.assetentry.AssetEntryService.java

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

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

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

        _command.put("/assetentry/increment-view-counter", _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.assetentry.AssetEntryService.java

public Integer getEntriesCount(JSONObjectWrapper entryQuery) throws Exception {
    JSONObject _command = new JSONObject();

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

        mangleWrapper(_params, "entryQuery", "com.liferay.asset.kernel.service.persistence.AssetEntryQuery",
                entryQuery);

        _command.put("/assetentry/get-entries-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.assetentry.AssetEntryService.java

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

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

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

        _command.put("/assetentry/get-company-entries", _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.assetentry.AssetEntryService.java

public Integer getCompanyEntriesCount(long companyId) 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("companyId", companyId);

        _command.put("/assetentry/get-company-entries-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.mindmeapp.extensions.ExtensionData.java

/**
 * Serializes the contents of this object to JSON.
 *///from w  ww .j  a  va  2  s. c om
public JSONObject serialize() throws JSONException {
    JSONObject data = new JSONObject();
    data.put(KEY_VISIBLE, mVisible);
    data.put(KEY_ICON, mIcon);
    data.put(KEY_ICON_URI, (mIconUri == null ? null : mIconUri.toString()));
    data.put(KEY_STATUS_TO_DISPLAY, mStatusToDisplay);
    data.put(KEY_STATUS_TO_SPEAK, mStatusToSpeak);
    data.put(KEY_CONTENT_DESCRIPTION, mContentDescription);
    data.put(KEY_BACKGROUND, mBackground);
    data.put(KEY_BACKGROUND_URI, (mBackgroundUri == null ? null : mBackgroundUri.toString()));

    //Decompose Locale object
    data.put(KEY_LOCALE_LANGUAGE, mLanguageToSpeak.getLanguage());
    data.put(KEY_LOCALE_COUNTRY, mLanguageToSpeak.getCountry());

    return data;
}