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