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.announcements.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.announcements.model.AnnouncementsDelivery;
22  
23  import java.util.List;
24  
25  /**
26   * <a href="AnnouncementsDeliveryJSONSerializer.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 AnnouncementsDeliveryServiceJSON} to translate objects.
35   * </p>
36   *
37   * @author    Brian Wing Shun Chan
38   * @see       com.liferay.portlet.announcements.service.http.AnnouncementsDeliveryServiceJSON
39   * @generated
40   */
41  public class AnnouncementsDeliveryJSONSerializer {
42      public static JSONObject toJSONObject(AnnouncementsDelivery model) {
43          JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
44  
45          jsonObj.put("deliveryId", model.getDeliveryId());
46          jsonObj.put("companyId", model.getCompanyId());
47          jsonObj.put("userId", model.getUserId());
48          jsonObj.put("type", model.getType());
49          jsonObj.put("email", model.getEmail());
50          jsonObj.put("sms", model.getSms());
51          jsonObj.put("website", model.getWebsite());
52  
53          return jsonObj;
54      }
55  
56      public static JSONArray toJSONArray(
57          com.liferay.portlet.announcements.model.AnnouncementsDelivery[] models) {
58          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
59  
60          for (AnnouncementsDelivery model : models) {
61              jsonArray.put(toJSONObject(model));
62          }
63  
64          return jsonArray;
65      }
66  
67      public static JSONArray toJSONArray(
68          com.liferay.portlet.announcements.model.AnnouncementsDelivery[][] models) {
69          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
70  
71          for (AnnouncementsDelivery[] model : models) {
72              jsonArray.put(toJSONArray(model));
73          }
74  
75          return jsonArray;
76      }
77  
78      public static JSONArray toJSONArray(
79          List<com.liferay.portlet.announcements.model.AnnouncementsDelivery> models) {
80          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
81  
82          for (AnnouncementsDelivery model : models) {
83              jsonArray.put(toJSONObject(model));
84          }
85  
86          return jsonArray;
87      }
88  }