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.dynamicdatamapping.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.OrderByComparator;
020    import com.liferay.portal.model.BaseModel;
021    import com.liferay.portal.service.ServiceContext;
022    import com.liferay.portlet.dynamicdatamapping.storage.Field;
023    import com.liferay.portlet.dynamicdatamapping.storage.Fields;
024    
025    import javax.servlet.http.HttpServletRequest;
026    import javax.servlet.http.HttpServletResponse;
027    
028    /**
029     * @author Eduardo Lundgren
030     */
031    public interface DDM {
032    
033            public Fields getFields(
034                            long ddmStructureId, long ddmTemplateId,
035                            ServiceContext serviceContext)
036                    throws PortalException, SystemException;
037    
038            public Fields getFields(
039                            long ddmStructureId, long ddmTemplateId, String fieldNamespace,
040                            ServiceContext serviceContext)
041                    throws PortalException, SystemException;
042    
043            public Fields getFields(long ddmStructureId, ServiceContext serviceContext)
044                    throws PortalException, SystemException;
045    
046            public Fields getFields(
047                            long ddmStructureId, String fieldNamespace,
048                            ServiceContext serviceContext)
049                    throws PortalException, SystemException;
050    
051            public String[] getFieldsDisplayValues(Field fieldsDisplayField)
052                    throws Exception;
053    
054            public String getFileUploadPath(BaseModel<?> baseModel);
055    
056            public OrderByComparator getStructureOrderByComparator(
057                    String orderByCol, String orderByType);
058    
059            public OrderByComparator getTemplateOrderByComparator(
060                    String orderByCol, String orderByType);
061    
062            public Fields mergeFields(Fields newFields, Fields existingFields);
063    
064            public void sendFieldFile(
065                            HttpServletRequest request, HttpServletResponse response,
066                            Field field, int valueIndex)
067                    throws Exception;
068    
069            public void uploadFieldFile(
070                            long structureId, long storageId, BaseModel<?> baseModel,
071                            String fieldName, ServiceContext serviceContext)
072                    throws Exception;
073    
074            public void uploadFieldFile(
075                            long structureId, long storageId, BaseModel<?> baseModel,
076                            String fieldName, String fieldNamespace,
077                            ServiceContext serviceContext)
078                    throws Exception;
079    
080    }