001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.expando.service.http;
016    
017    import com.liferay.portal.kernel.json.JSONArray;
018    import com.liferay.portal.kernel.json.JSONFactoryUtil;
019    import com.liferay.portal.kernel.json.JSONObject;
020    
021    import com.liferay.portlet.expando.model.ExpandoValue;
022    
023    import java.util.List;
024    
025    /**
026     * @author    Brian Wing Shun Chan
027     * @generated
028     */
029    public class ExpandoValueJSONSerializer {
030            public static JSONObject toJSONObject(ExpandoValue model) {
031                    JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
032    
033                    jsonObj.put("valueId", model.getValueId());
034                    jsonObj.put("companyId", model.getCompanyId());
035                    jsonObj.put("tableId", model.getTableId());
036                    jsonObj.put("columnId", model.getColumnId());
037                    jsonObj.put("rowId", model.getRowId());
038                    jsonObj.put("classNameId", model.getClassNameId());
039                    jsonObj.put("classPK", model.getClassPK());
040                    jsonObj.put("data", model.getData());
041    
042                    return jsonObj;
043            }
044    
045            public static JSONArray toJSONArray(
046                    com.liferay.portlet.expando.model.ExpandoValue[] models) {
047                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
048    
049                    for (ExpandoValue model : models) {
050                            jsonArray.put(toJSONObject(model));
051                    }
052    
053                    return jsonArray;
054            }
055    
056            public static JSONArray toJSONArray(
057                    com.liferay.portlet.expando.model.ExpandoValue[][] models) {
058                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
059    
060                    for (ExpandoValue[] model : models) {
061                            jsonArray.put(toJSONArray(model));
062                    }
063    
064                    return jsonArray;
065            }
066    
067            public static JSONArray toJSONArray(
068                    List<com.liferay.portlet.expando.model.ExpandoValue> models) {
069                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
070    
071                    for (ExpandoValue model : models) {
072                            jsonArray.put(toJSONObject(model));
073                    }
074    
075                    return jsonArray;
076            }
077    }