1
14
15 package com.liferay.portal.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 import com.liferay.portal.model.Layout;
21
22 import java.util.List;
23
24
40 public class LayoutJSONSerializer {
41 public static JSONObject toJSONObject(Layout model) {
42 JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
43
44 jsonObj.put("plid", model.getPlid());
45 jsonObj.put("groupId", model.getGroupId());
46 jsonObj.put("companyId", model.getCompanyId());
47 jsonObj.put("privateLayout", model.getPrivateLayout());
48 jsonObj.put("layoutId", model.getLayoutId());
49 jsonObj.put("parentLayoutId", model.getParentLayoutId());
50 jsonObj.put("name", model.getName());
51 jsonObj.put("title", model.getTitle());
52 jsonObj.put("description", model.getDescription());
53 jsonObj.put("type", model.getType());
54 jsonObj.put("typeSettings", model.getTypeSettings());
55 jsonObj.put("hidden", model.getHidden());
56 jsonObj.put("friendlyURL", model.getFriendlyURL());
57 jsonObj.put("iconImage", model.getIconImage());
58 jsonObj.put("iconImageId", model.getIconImageId());
59 jsonObj.put("themeId", model.getThemeId());
60 jsonObj.put("colorSchemeId", model.getColorSchemeId());
61 jsonObj.put("wapThemeId", model.getWapThemeId());
62 jsonObj.put("wapColorSchemeId", model.getWapColorSchemeId());
63 jsonObj.put("css", model.getCss());
64 jsonObj.put("priority", model.getPriority());
65 jsonObj.put("layoutPrototypeId", model.getLayoutPrototypeId());
66 jsonObj.put("dlFolderId", model.getDlFolderId());
67
68 return jsonObj;
69 }
70
71 public static JSONArray toJSONArray(
72 com.liferay.portal.model.Layout[] models) {
73 JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
74
75 for (Layout model : models) {
76 jsonArray.put(toJSONObject(model));
77 }
78
79 return jsonArray;
80 }
81
82 public static JSONArray toJSONArray(
83 com.liferay.portal.model.Layout[][] models) {
84 JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
85
86 for (Layout[] model : models) {
87 jsonArray.put(toJSONArray(model));
88 }
89
90 return jsonArray;
91 }
92
93 public static JSONArray toJSONArray(
94 List<com.liferay.portal.model.Layout> models) {
95 JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
96
97 for (Layout model : models) {
98 jsonArray.put(toJSONObject(model));
99 }
100
101 return jsonArray;
102 }
103 }