001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
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.service.ServiceContext;
023    import com.liferay.portal.theme.ThemeDisplay;
024    import com.liferay.portlet.dynamicdatalists.model.DDLRecord;
025    import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet;
026    
027    import java.util.List;
028    
029    import javax.portlet.PortletPreferences;
030    import javax.portlet.RenderRequest;
031    import javax.portlet.RenderResponse;
032    
033    import javax.servlet.http.HttpServletRequest;
034    import javax.servlet.jsp.PageContext;
035    
036    /**
037     * @author Eduardo Lundgren
038     * @author Marcellus Tavares
039     */
040    @ProviderType
041    public interface DDL {
042    
043            public JSONObject getRecordJSONObject(DDLRecord record) throws Exception;
044    
045            public JSONObject getRecordJSONObject(
046                            DDLRecord record, boolean latestRecordVersion)
047                    throws Exception;
048    
049            public List<DDLRecord> getRecords(Hits hits) throws Exception;
050    
051            public JSONArray getRecordSetJSONArray(DDLRecordSet recordSet)
052                    throws Exception;
053    
054            public JSONArray getRecordsJSONArray(DDLRecordSet recordSet)
055                    throws Exception;
056    
057            public JSONArray getRecordsJSONArray(List<DDLRecord> records)
058                    throws Exception;
059    
060            public JSONArray getRecordsJSONArray(
061                            List<DDLRecord> records, boolean latestRecordVersion)
062                    throws Exception;
063    
064            public String getTemplateContent(
065                            long ddmTemplateId, DDLRecordSet recordSet,
066                            ThemeDisplay themeDisplay, RenderRequest renderRequest,
067                            RenderResponse renderResponse)
068                    throws Exception;
069    
070            /**
071             * Taglib (JSTL) support in templates requires a {@link PageContext}
072             * instance; if it's <code>null</code>, objects for taglib support are not
073             * available in the template context.
074             */
075            public String getTemplateContent(
076                            PageContext pageContext, long ddmTemplateId, DDLRecordSet recordSet,
077                            ThemeDisplay themeDisplay, RenderRequest renderRequest,
078                            RenderResponse renderResponse)
079                    throws Exception;
080    
081            /**
082             * @deprecated As of 7.0.0, with no direct replacement
083             */
084            @Deprecated
085            public boolean isEditable(
086                            HttpServletRequest request, String portletId, long groupId)
087                    throws Exception;
088    
089            /**
090             * @deprecated As of 7.0.0, with no direct replacement
091             */
092            @Deprecated
093            public boolean isEditable(
094                            PortletPreferences preferences, String portletId, long groupId)
095                    throws Exception;
096    
097            public DDLRecord updateRecord(
098                            long recordId, long recordSetId, boolean mergeFields,
099                            boolean checkPermission, ServiceContext serviceContext)
100                    throws Exception;
101    
102            public DDLRecord updateRecord(
103                            long recordId, long recordSetId, boolean mergeFields,
104                            ServiceContext serviceContext)
105                    throws Exception;
106    
107    }