Example usage for com.liferay.portal.kernel.json JSONArray getLong

List of usage examples for com.liferay.portal.kernel.json JSONArray getLong

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.json JSONArray getLong.

Prototype

public long getLong(int index);

Source Link

Usage

From source file:at.graz.meduni.liferay.portlet.bibbox.service.service.impl.LogapiServiceImpl.java

License:Open Source License

/**
 * //from   w  ww . j  a v  a  2 s. c  o m
 * @return
 */
@AccessControlled(guestAccessEnabled = true)
@JSONWebService(value = "regbbs", method = "POST")
public JSONArray regbbs(String data) {
    JSONArray jsonarray = JSONFactoryUtil.createJSONArray();
    try {
        JSONArray array = JSONFactoryUtil.createJSONArray(data);
        for (int arrayindex = 0; arrayindex < array.length(); arrayindex++) {
            jsonarray.put(regbb(array.getLong(arrayindex)));
        }
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return jsonarray;
}

From source file:com.idetronic.subur.service.impl.AuthorLocalServiceImpl.java

License:Open Source License

/**
 * Update all author with up to date item count
 * @param companyId/*ww  w .j a v a 2 s  .  co  m*/
 * @param groupId
 */
public void updateAllItemCount(long companyId, long groupId) {
    List authorItemCounts = AuthorFinderUtil.getItemCountByGroupCompanyScalar(companyId, groupId);
    String serilizeString = null;
    JSONArray authorJsonArray = null;

    for (Object elemObject : authorItemCounts) {
        serilizeString = JSONFactoryUtil.serialize(elemObject);
        try {
            authorJsonArray = JSONFactoryUtil.createJSONArray(serilizeString);
            long authorId = authorJsonArray.getLong(0);
            int itemCount = authorJsonArray.getInt(1);
            Author author = authorPersistence.fetchByPrimaryKey(authorId);
            author.setItemCount(itemCount);
            authorPersistence.update(author);

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}