1
22
23 package com.liferay.portal.service.http;
24
25 import com.liferay.portal.kernel.json.JSONArray;
26 import com.liferay.portal.kernel.json.JSONFactoryUtil;
27 import com.liferay.portal.kernel.json.JSONObject;
28 import com.liferay.portal.model.Layout;
29
30 import java.util.List;
31
32
51 public class LayoutJSONSerializer {
52 public static JSONObject toJSONObject(Layout model) {
53 JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
54
55 jsonObj.put("plid", model.getPlid());
56 jsonObj.put("groupId", model.getGroupId());
57 jsonObj.put("companyId", model.getCompanyId());
58 jsonObj.put("privateLayout", model.getPrivateLayout());
59 jsonObj.put("layoutId", model.getLayoutId());
60 jsonObj.put("parentLayoutId", model.getParentLayoutId());
61 jsonObj.put("name", model.getName());
62 jsonObj.put("title", model.getTitle());
63 jsonObj.put("description", model.getDescription());
64 jsonObj.put("type", model.getType());
65 jsonObj.put("typeSettings", model.getTypeSettings());
66 jsonObj.put("hidden", model.getHidden());
67 jsonObj.put("friendlyURL", model.getFriendlyURL());
68 jsonObj.put("iconImage", model.getIconImage());
69 jsonObj.put("iconImageId", model.getIconImageId());
70 jsonObj.put("themeId", model.getThemeId());
71 jsonObj.put("colorSchemeId", model.getColorSchemeId());
72 jsonObj.put("wapThemeId", model.getWapThemeId());
73 jsonObj.put("wapColorSchemeId", model.getWapColorSchemeId());
74 jsonObj.put("css", model.getCss());
75 jsonObj.put("priority", model.getPriority());
76 jsonObj.put("dlFolderId", model.getDlFolderId());
77
78 return jsonObj;
79 }
80
81 public static JSONArray toJSONArray(
82 List<com.liferay.portal.model.Layout> models) {
83 JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
84
85 for (Layout model : models) {
86 jsonArray.put(toJSONObject(model));
87 }
88
89 return jsonArray;
90 }
91 }