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