1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.http;
16  
17  import com.liferay.portal.kernel.json.JSONArray;
18  import com.liferay.portal.kernel.json.JSONFactoryUtil;
19  import com.liferay.portal.kernel.json.JSONObject;
20  import com.liferay.portal.model.Company;
21  
22  import java.util.List;
23  
24  /**
25   * <a href="CompanyJSONSerializer.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class is used by {@link CompanyServiceJSON} to translate objects.
34   * </p>
35   *
36   * @author    Brian Wing Shun Chan
37   * @see       com.liferay.portal.service.http.CompanyServiceJSON
38   * @generated
39   */
40  public class CompanyJSONSerializer {
41      public static JSONObject toJSONObject(Company model) {
42          JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
43  
44          jsonObj.put("companyId", model.getCompanyId());
45          jsonObj.put("accountId", model.getAccountId());
46          jsonObj.put("webId", model.getWebId());
47          jsonObj.put("key", model.getKey());
48          jsonObj.put("virtualHost", model.getVirtualHost());
49          jsonObj.put("mx", model.getMx());
50          jsonObj.put("homeURL", model.getHomeURL());
51          jsonObj.put("logoId", model.getLogoId());
52          jsonObj.put("system", model.getSystem());
53  
54          return jsonObj;
55      }
56  
57      public static JSONArray toJSONArray(
58          com.liferay.portal.model.Company[] models) {
59          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
60  
61          for (Company model : models) {
62              jsonArray.put(toJSONObject(model));
63          }
64  
65          return jsonArray;
66      }
67  
68      public static JSONArray toJSONArray(
69          com.liferay.portal.model.Company[][] models) {
70          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
71  
72          for (Company[] model : models) {
73              jsonArray.put(toJSONArray(model));
74          }
75  
76          return jsonArray;
77      }
78  
79      public static JSONArray toJSONArray(
80          List<com.liferay.portal.model.Company> models) {
81          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
82  
83          for (Company model : models) {
84              jsonArray.put(toJSONObject(model));
85          }
86  
87          return jsonArray;
88      }
89  }