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.portal.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    import com.liferay.portal.model.Company;
021    
022    import java.util.List;
023    
024    /**
025     * @author    Brian Wing Shun Chan
026     * @generated
027     */
028    public class CompanyJSONSerializer {
029            public static JSONObject toJSONObject(Company model) {
030                    JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
031    
032                    jsonObj.put("companyId", model.getCompanyId());
033                    jsonObj.put("accountId", model.getAccountId());
034                    jsonObj.put("webId", model.getWebId());
035                    jsonObj.put("key", model.getKey());
036                    jsonObj.put("virtualHost", model.getVirtualHost());
037                    jsonObj.put("mx", model.getMx());
038                    jsonObj.put("homeURL", model.getHomeURL());
039                    jsonObj.put("logoId", model.getLogoId());
040                    jsonObj.put("system", model.getSystem());
041                    jsonObj.put("maxUsers", model.getMaxUsers());
042    
043                    return jsonObj;
044            }
045    
046            public static JSONArray toJSONArray(
047                    com.liferay.portal.model.Company[] models) {
048                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
049    
050                    for (Company model : models) {
051                            jsonArray.put(toJSONObject(model));
052                    }
053    
054                    return jsonArray;
055            }
056    
057            public static JSONArray toJSONArray(
058                    com.liferay.portal.model.Company[][] models) {
059                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
060    
061                    for (Company[] model : models) {
062                            jsonArray.put(toJSONArray(model));
063                    }
064    
065                    return jsonArray;
066            }
067    
068            public static JSONArray toJSONArray(
069                    List<com.liferay.portal.model.Company> models) {
070                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
071    
072                    for (Company model : models) {
073                            jsonArray.put(toJSONObject(model));
074                    }
075    
076                    return jsonArray;
077            }
078    }