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.portlet.expando.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  
21  import com.liferay.portlet.expando.model.ExpandoColumn;
22  
23  import java.util.List;
24  
25  /**
26   * <a href="ExpandoColumnJSONSerializer.java.html"><b><i>View Source</i></b></a>
27   *
28   * <p>
29   * ServiceBuilder generated this class. Modifications in this class will be
30   * overwritten the next time is generated.
31   * </p>
32   *
33   * <p>
34   * This class is used by {@link ExpandoColumnServiceJSON} to translate objects.
35   * </p>
36   *
37   * @author    Brian Wing Shun Chan
38   * @see       com.liferay.portlet.expando.service.http.ExpandoColumnServiceJSON
39   * @generated
40   */
41  public class ExpandoColumnJSONSerializer {
42      public static JSONObject toJSONObject(ExpandoColumn model) {
43          JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
44  
45          jsonObj.put("columnId", model.getColumnId());
46          jsonObj.put("companyId", model.getCompanyId());
47          jsonObj.put("tableId", model.getTableId());
48          jsonObj.put("name", model.getName());
49          jsonObj.put("type", model.getType());
50          jsonObj.put("defaultData", model.getDefaultData());
51          jsonObj.put("typeSettings", model.getTypeSettings());
52  
53          return jsonObj;
54      }
55  
56      public static JSONArray toJSONArray(
57          com.liferay.portlet.expando.model.ExpandoColumn[] models) {
58          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
59  
60          for (ExpandoColumn model : models) {
61              jsonArray.put(toJSONObject(model));
62          }
63  
64          return jsonArray;
65      }
66  
67      public static JSONArray toJSONArray(
68          com.liferay.portlet.expando.model.ExpandoColumn[][] models) {
69          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
70  
71          for (ExpandoColumn[] model : models) {
72              jsonArray.put(toJSONArray(model));
73          }
74  
75          return jsonArray;
76      }
77  
78      public static JSONArray toJSONArray(
79          List<com.liferay.portlet.expando.model.ExpandoColumn> models) {
80          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
81  
82          for (ExpandoColumn model : models) {
83              jsonArray.put(toJSONObject(model));
84          }
85  
86          return jsonArray;
87      }
88  }