001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    
035    /**
036     * @author Eduardo Lundgren
037     * @author Marcellus Tavares
038     */
039    @ProviderType
040    public interface DDL {
041    
042            public JSONObject getRecordJSONObject(DDLRecord record) throws Exception;
043    
044            public JSONObject getRecordJSONObject(
045                            DDLRecord record, boolean latestRecordVersion)
046                    throws Exception;
047    
048            public List<DDLRecord> getRecords(Hits hits) throws Exception;
049    
050            public JSONArray getRecordSetJSONArray(DDLRecordSet recordSet)
051                    throws Exception;
052    
053            public JSONArray getRecordsJSONArray(DDLRecordSet recordSet)
054                    throws Exception;
055    
056            public JSONArray getRecordsJSONArray(List<DDLRecord> records)
057                    throws Exception;
058    
059            public JSONArray getRecordsJSONArray(
060                            List<DDLRecord> records, boolean latestRecordVersion)
061                    throws Exception;
062    
063            public String getTemplateContent(
064                            long ddmTemplateId, DDLRecordSet recordSet,
065                            ThemeDisplay themeDisplay, RenderRequest renderRequest,
066                            RenderResponse renderResponse)
067                    throws Exception;
068    
069            /**
070             * @deprecated As of 7.0.0, with no direct replacement
071             */
072            @Deprecated
073            public boolean isEditable(
074                            HttpServletRequest request, String portletId, long groupId)
075                    throws Exception;
076    
077            /**
078             * @deprecated As of 7.0.0, with no direct replacement
079             */
080            @Deprecated
081            public boolean isEditable(
082                            PortletPreferences preferences, String portletId, long groupId)
083                    throws Exception;
084    
085            public DDLRecord updateRecord(
086                            long recordId, long recordSetId, boolean mergeFields,
087                            boolean checkPermission, ServiceContext serviceContext)
088                    throws Exception;
089    
090            public DDLRecord updateRecord(
091                            long recordId, long recordSetId, boolean mergeFields,
092                            ServiceContext serviceContext)
093                    throws Exception;
094    
095    }