001    /**
002     * Copyright (c) 2000-present 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.Field;
022    import com.liferay.portal.kernel.search.Hits;
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    /**
037     * @author Eduardo Lundgren
038     * @author Marcellus Tavares
039     */
040    @ProviderType
041    public interface DDL {
042    
043            public static final String[] SELECTED_FIELD_NAMES =
044                    {Field.COMPANY_ID, Field.ENTRY_CLASS_PK, Field.UID};
045    
046            public JSONObject getRecordJSONObject(DDLRecord record) throws Exception;
047    
048            public JSONObject getRecordJSONObject(
049                            DDLRecord record, boolean latestRecordVersion)
050                    throws Exception;
051    
052            public List<DDLRecord> getRecords(Hits hits) throws Exception;
053    
054            public JSONArray getRecordSetJSONArray(DDLRecordSet recordSet)
055                    throws Exception;
056    
057            public JSONArray getRecordsJSONArray(DDLRecordSet recordSet)
058                    throws Exception;
059    
060            public JSONArray getRecordsJSONArray(List<DDLRecord> records)
061                    throws Exception;
062    
063            public JSONArray getRecordsJSONArray(
064                            List<DDLRecord> records, boolean latestRecordVersion)
065                    throws Exception;
066    
067            public String getTemplateContent(
068                            long ddmTemplateId, DDLRecordSet recordSet,
069                            ThemeDisplay themeDisplay, RenderRequest renderRequest,
070                            RenderResponse renderResponse)
071                    throws Exception;
072    
073            /**
074             * @deprecated As of 7.0.0, with no direct replacement
075             */
076            @Deprecated
077            public boolean isEditable(
078                            HttpServletRequest request, String portletId, long groupId)
079                    throws Exception;
080    
081            /**
082             * @deprecated As of 7.0.0, with no direct replacement
083             */
084            @Deprecated
085            public boolean isEditable(
086                            PortletPreferences preferences, String portletId, long groupId)
087                    throws Exception;
088    
089            public DDLRecord updateRecord(
090                            long recordId, long recordSetId, boolean mergeFields,
091                            boolean checkPermission, ServiceContext serviceContext)
092                    throws Exception;
093    
094            public DDLRecord updateRecord(
095                            long recordId, long recordSetId, boolean mergeFields,
096                            ServiceContext serviceContext)
097                    throws Exception;
098    
099    }