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 com.liferay.portal.kernel.json.JSONArray;
018    import com.liferay.portal.kernel.json.JSONObject;
019    import com.liferay.portal.kernel.search.Hits;
020    import com.liferay.portal.service.ServiceContext;
021    import com.liferay.portal.theme.ThemeDisplay;
022    import com.liferay.portlet.dynamicdatalists.model.DDLRecord;
023    import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet;
024    
025    import java.util.List;
026    
027    import javax.portlet.PortletPreferences;
028    import javax.portlet.RenderRequest;
029    import javax.portlet.RenderResponse;
030    
031    import javax.servlet.http.HttpServletRequest;
032    
033    /**
034     * @author Eduardo Lundgren
035     * @author Marcellus Tavares
036     */
037    public interface DDL {
038    
039            public JSONObject getRecordJSONObject(DDLRecord record) throws Exception;
040    
041            public JSONObject getRecordJSONObject(
042                            DDLRecord record, boolean latestRecordVersion)
043                    throws Exception;
044    
045            public List<DDLRecord> getRecords(Hits hits) throws Exception;
046    
047            public JSONArray getRecordSetJSONArray(DDLRecordSet recordSet)
048                    throws Exception;
049    
050            public JSONArray getRecordsJSONArray(DDLRecordSet recordSet)
051                    throws Exception;
052    
053            public JSONArray getRecordsJSONArray(List<DDLRecord> records)
054                    throws Exception;
055    
056            public JSONArray getRecordsJSONArray(
057                            List<DDLRecord> records, boolean latestRecordVersion)
058                    throws Exception;
059    
060            public String getTemplateContent(
061                            long ddmTemplateId, DDLRecordSet recordSet,
062                            ThemeDisplay themeDisplay, RenderRequest renderRequest,
063                            RenderResponse renderResponse)
064                    throws Exception;
065    
066            public boolean isEditable(
067                            HttpServletRequest request, String portletId, long groupId)
068                    throws Exception;
069    
070            public boolean isEditable(
071                            PortletPreferences preferences, String portletId, long groupId)
072                    throws Exception;
073    
074            public DDLRecord updateRecord(
075                            long recordId, long recordSetId, boolean mergeFields,
076                            boolean checkPermission, ServiceContext serviceContext)
077                    throws Exception;
078    
079            public DDLRecord updateRecord(
080                            long recordId, long recordSetId, boolean mergeFields,
081                            ServiceContext serviceContext)
082                    throws Exception;
083    
084    }