1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
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("logoId", model.getLogoId());
51          jsonObj.put("system", model.getSystem());
52  
53          return jsonObj;
54      }
55  
56      public static JSONArray toJSONArray(
57          com.liferay.portal.model.Company[] models) {
58          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
59  
60          for (Company model : models) {
61              jsonArray.put(toJSONObject(model));
62          }
63  
64          return jsonArray;
65      }
66  
67      public static JSONArray toJSONArray(
68          com.liferay.portal.model.Company[][] models) {
69          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
70  
71          for (Company[] model : models) {
72              jsonArray.put(toJSONArray(model));
73          }
74  
75          return jsonArray;
76      }
77  
78      public static JSONArray toJSONArray(
79          List<com.liferay.portal.model.Company> models) {
80          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
81  
82          for (Company model : models) {
83              jsonArray.put(toJSONObject(model));
84          }
85  
86          return jsonArray;
87      }
88  }