001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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.ExpandoColumn;
022    
023    import java.util.List;
024    
025    /**
026     * @author    Brian Wing Shun Chan
027     * @generated
028     */
029    public class ExpandoColumnJSONSerializer {
030            public static JSONObject toJSONObject(ExpandoColumn model) {
031                    JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
032    
033                    jsonObj.put("columnId", model.getColumnId());
034                    jsonObj.put("companyId", model.getCompanyId());
035                    jsonObj.put("tableId", model.getTableId());
036                    jsonObj.put("name", model.getName());
037                    jsonObj.put("type", model.getType());
038                    jsonObj.put("defaultData", model.getDefaultData());
039                    jsonObj.put("typeSettings", model.getTypeSettings());
040    
041                    return jsonObj;
042            }
043    
044            public static JSONArray toJSONArray(
045                    com.liferay.portlet.expando.model.ExpandoColumn[] models) {
046                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
047    
048                    for (ExpandoColumn model : models) {
049                            jsonArray.put(toJSONObject(model));
050                    }
051    
052                    return jsonArray;
053            }
054    
055            public static JSONArray toJSONArray(
056                    com.liferay.portlet.expando.model.ExpandoColumn[][] models) {
057                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
058    
059                    for (ExpandoColumn[] model : models) {
060                            jsonArray.put(toJSONArray(model));
061                    }
062    
063                    return jsonArray;
064            }
065    
066            public static JSONArray toJSONArray(
067                    List<com.liferay.portlet.expando.model.ExpandoColumn> models) {
068                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
069    
070                    for (ExpandoColumn model : models) {
071                            jsonArray.put(toJSONObject(model));
072                    }
073    
074                    return jsonArray;
075            }
076    }