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.ExpandoValue;
22  
23  import java.util.List;
24  
25  /**
26   * <a href="ExpandoValueJSONSerializer.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 ExpandoValueServiceJSON} to translate objects.
35   * </p>
36   *
37   * @author    Brian Wing Shun Chan
38   * @see       com.liferay.portlet.expando.service.http.ExpandoValueServiceJSON
39   * @generated
40   */
41  public class ExpandoValueJSONSerializer {
42      public static JSONObject toJSONObject(ExpandoValue model) {
43          JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
44  
45          jsonObj.put("valueId", model.getValueId());
46          jsonObj.put("companyId", model.getCompanyId());
47          jsonObj.put("tableId", model.getTableId());
48          jsonObj.put("columnId", model.getColumnId());
49          jsonObj.put("rowId", model.getRowId());
50          jsonObj.put("classNameId", model.getClassNameId());
51          jsonObj.put("classPK", model.getClassPK());
52          jsonObj.put("data", model.getData());
53  
54          return jsonObj;
55      }
56  
57      public static JSONArray toJSONArray(
58          com.liferay.portlet.expando.model.ExpandoValue[] models) {
59          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
60  
61          for (ExpandoValue model : models) {
62              jsonArray.put(toJSONObject(model));
63          }
64  
65          return jsonArray;
66      }
67  
68      public static JSONArray toJSONArray(
69          com.liferay.portlet.expando.model.ExpandoValue[][] models) {
70          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
71  
72          for (ExpandoValue[] model : models) {
73              jsonArray.put(toJSONArray(model));
74          }
75  
76          return jsonArray;
77      }
78  
79      public static JSONArray toJSONArray(
80          List<com.liferay.portlet.expando.model.ExpandoValue> models) {
81          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
82  
83          for (ExpandoValue model : models) {
84              jsonArray.put(toJSONObject(model));
85          }
86  
87          return jsonArray;
88      }
89  }