001
014
015 package com.liferay.portlet.announcements.service.http;
016
017 import com.liferay.portal.kernel.json.JSONArray;
018 import com.liferay.portal.kernel.json.JSONFactoryUtil;
019 import com.liferay.portal.kernel.json.JSONObject;
020
021 import com.liferay.portlet.announcements.model.AnnouncementsDelivery;
022
023 import java.util.List;
024
025
029 public class AnnouncementsDeliveryJSONSerializer {
030 public static JSONObject toJSONObject(AnnouncementsDelivery model) {
031 JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
032
033 jsonObj.put("deliveryId", model.getDeliveryId());
034 jsonObj.put("companyId", model.getCompanyId());
035 jsonObj.put("userId", model.getUserId());
036 jsonObj.put("type", model.getType());
037 jsonObj.put("email", model.getEmail());
038 jsonObj.put("sms", model.getSms());
039 jsonObj.put("website", model.getWebsite());
040
041 return jsonObj;
042 }
043
044 public static JSONArray toJSONArray(
045 com.liferay.portlet.announcements.model.AnnouncementsDelivery[] models) {
046 JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
047
048 for (AnnouncementsDelivery model : models) {
049 jsonArray.put(toJSONObject(model));
050 }
051
052 return jsonArray;
053 }
054
055 public static JSONArray toJSONArray(
056 com.liferay.portlet.announcements.model.AnnouncementsDelivery[][] models) {
057 JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
058
059 for (AnnouncementsDelivery[] model : models) {
060 jsonArray.put(toJSONArray(model));
061 }
062
063 return jsonArray;
064 }
065
066 public static JSONArray toJSONArray(
067 List<com.liferay.portlet.announcements.model.AnnouncementsDelivery> models) {
068 JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
069
070 for (AnnouncementsDelivery model : models) {
071 jsonArray.put(toJSONObject(model));
072 }
073
074 return jsonArray;
075 }
076 }