001    /**
002     * Copyright (c) 2000-2012 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.kernel.xml.Element;
021    import com.liferay.portal.service.ServiceContext;
022    import com.liferay.portal.theme.ThemeDisplay;
023    import com.liferay.portlet.dynamicdatalists.model.DDLRecord;
024    import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet;
025    
026    import java.util.List;
027    import java.util.Map;
028    
029    import javax.portlet.RenderRequest;
030    import javax.portlet.RenderResponse;
031    
032    import javax.servlet.http.HttpServletRequest;
033    import javax.servlet.http.HttpServletResponse;
034    
035    /**
036     * @author Eduardo Lundgren
037     */
038    public interface DDL {
039    
040            public void addAllReservedEls(
041                    Element rootElement, Map<String, String> tokens,
042                    DDLRecordSet recordSet);
043    
044            public JSONObject getRecordJSONObject(DDLRecord record) throws Exception;
045    
046            public JSONObject getRecordJSONObject(
047                            DDLRecord record, boolean latestRecordVersion)
048                    throws Exception;
049    
050            public List<DDLRecord> getRecords(Hits hits) throws Exception;
051    
052            public JSONArray getRecordSetJSONArray(DDLRecordSet recordSet)
053                    throws Exception;
054    
055            public JSONArray getRecordsJSONArray(DDLRecordSet recordSet)
056                    throws Exception;
057    
058            public JSONArray getRecordsJSONArray(List<DDLRecord> records)
059                    throws Exception;
060    
061            public JSONArray getRecordsJSONArray(
062                            List<DDLRecord> records, boolean latestRecordVersion)
063                    throws Exception;
064    
065            public String getTemplateContent(
066                            long ddmTemplateId, DDLRecordSet recordSet,
067                            ThemeDisplay themeDisplay, RenderRequest renderRequest,
068                            RenderResponse renderResponse)
069                    throws Exception;
070    
071            public void sendRecordFileUpload(
072                            HttpServletRequest request, HttpServletResponse response,
073                            DDLRecord record, String fieldName)
074                    throws Exception;
075    
076            public void sendRecordFileUpload(
077                            HttpServletRequest request, HttpServletResponse response,
078                            long recordId, String fieldName)
079                    throws Exception;
080    
081            public DDLRecord updateRecord(
082                            long recordId, long recordSetId, boolean mergeFields,
083                            boolean checkPermission, ServiceContext serviceContext)
084                    throws Exception;
085    
086            public DDLRecord updateRecord(
087                            long recordId, long recordSetId, boolean mergeFields,
088                            ServiceContext serviceContext)
089                    throws Exception;
090    
091            public String uploadRecordFieldFile(
092                            DDLRecord record, String fieldName, ServiceContext serviceContext)
093                    throws Exception;
094    
095    }