001
014
015 package com.liferay.portlet.dynamicdatalists.util;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.json.JSONArray;
020 import com.liferay.portal.kernel.json.JSONObject;
021 import com.liferay.portal.kernel.search.Hits;
022 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
023 import com.liferay.portal.service.ServiceContext;
024 import com.liferay.portal.theme.ThemeDisplay;
025 import com.liferay.portlet.dynamicdatalists.model.DDLRecord;
026 import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet;
027
028 import java.util.List;
029
030 import javax.portlet.PortletPreferences;
031 import javax.portlet.RenderRequest;
032 import javax.portlet.RenderResponse;
033
034 import javax.servlet.http.HttpServletRequest;
035
036
040 @ProviderType
041 public class DDLUtil {
042
043 public static DDL getDDL() {
044 PortalRuntimePermission.checkGetBeanProperty(DDLUtil.class);
045
046 return _ddl;
047 }
048
049 public static JSONObject getRecordJSONObject(DDLRecord record)
050 throws Exception {
051
052 return getDDL().getRecordJSONObject(record);
053 }
054
055 public static JSONObject getRecordJSONObject(
056 DDLRecord record, boolean latestRecordVersion)
057 throws Exception {
058
059 return getDDL().getRecordJSONObject(record, latestRecordVersion);
060 }
061
062 public static List<DDLRecord> getRecords(Hits hits) throws Exception {
063 return getDDL().getRecords(hits);
064 }
065
066 public static JSONArray getRecordSetJSONArray(DDLRecordSet recordSet)
067 throws Exception {
068
069 return getDDL().getRecordSetJSONArray(recordSet);
070 }
071
072 public static JSONArray getRecordsJSONArray(List<DDLRecord> records)
073 throws Exception {
074
075 return getDDL().getRecordsJSONArray(records);
076 }
077
078 public static JSONArray getRecordsJSONArray(
079 List<DDLRecord> records, boolean latestRecordVersion)
080 throws Exception {
081
082 return getDDL().getRecordsJSONArray(records, latestRecordVersion);
083 }
084
085 public static String getTemplateContent(
086 long ddmTemplateId, DDLRecordSet recordSet,
087 ThemeDisplay themeDisplay, RenderRequest renderRequest,
088 RenderResponse renderResponse)
089 throws Exception {
090
091 return getDDL().getTemplateContent(
092 ddmTemplateId, recordSet, themeDisplay, renderRequest,
093 renderResponse);
094 }
095
096
099 @Deprecated
100 public static boolean isEditable(
101 HttpServletRequest request, String portletId, long groupId)
102 throws Exception {
103
104 return getDDL().isEditable(request, portletId, groupId);
105 }
106
107
110 @Deprecated
111 public static boolean isEditable(
112 PortletPreferences preferences, String portletId, long groupId)
113 throws Exception {
114
115 return getDDL().isEditable(preferences, portletId, groupId);
116 }
117
118 public static DDLRecord updateRecord(
119 long recordId, long recordSetId, boolean mergeFields,
120 boolean checkPermission, ServiceContext serviceContext)
121 throws Exception {
122
123 return getDDL().updateRecord(
124 recordId, recordSetId, mergeFields, checkPermission,
125 serviceContext);
126 }
127
128 public static DDLRecord updateRecord(
129 long recordId, long recordSetId, boolean mergeFields,
130 ServiceContext serviceContext)
131 throws Exception {
132
133 return getDDL().updateRecord(
134 recordId, recordSetId, mergeFields, serviceContext);
135 }
136
137 public void setDDL(DDL ddl) {
138 PortalRuntimePermission.checkSetBeanProperty(getClass());
139
140 _ddl = ddl;
141 }
142
143 private static DDL _ddl;
144
145 }