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.portlet.tags.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.tags.model.TagsSource;
22  
23  import java.util.List;
24  
25  /**
26   * <a href="TagsSourceJSONSerializer.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 TagsSourceServiceJSON} to translate objects.
35   * </p>
36   *
37   * @author    Brian Wing Shun Chan
38   * @see       com.liferay.portlet.tags.service.http.TagsSourceServiceJSON
39   * @generated
40   */
41  public class TagsSourceJSONSerializer {
42      public static JSONObject toJSONObject(TagsSource model) {
43          JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
44  
45          jsonObj.put("sourceId", model.getSourceId());
46          jsonObj.put("parentSourceId", model.getParentSourceId());
47          jsonObj.put("name", model.getName());
48          jsonObj.put("acronym", model.getAcronym());
49  
50          return jsonObj;
51      }
52  
53      public static JSONArray toJSONArray(
54          com.liferay.portlet.tags.model.TagsSource[] models) {
55          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
56  
57          for (TagsSource model : models) {
58              jsonArray.put(toJSONObject(model));
59          }
60  
61          return jsonArray;
62      }
63  
64      public static JSONArray toJSONArray(
65          com.liferay.portlet.tags.model.TagsSource[][] models) {
66          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
67  
68          for (TagsSource[] model : models) {
69              jsonArray.put(toJSONArray(model));
70          }
71  
72          return jsonArray;
73      }
74  
75      public static JSONArray toJSONArray(
76          List<com.liferay.portlet.tags.model.TagsSource> models) {
77          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
78  
79          for (TagsSource model : models) {
80              jsonArray.put(toJSONObject(model));
81          }
82  
83          return jsonArray;
84      }
85  }