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.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 getFileUploadPath(BaseModel<?> baseModel);
052    
053            public OrderByComparator getStructureOrderByComparator(
054                    String orderByCol, String orderByType);
055    
056            public OrderByComparator getTemplateOrderByComparator(
057                    String orderByCol, String orderByType);
058    
059            public Fields mergeFields(Fields newFields, Fields existingFields);
060    
061            public void sendFieldFile(
062                            HttpServletRequest request, HttpServletResponse response,
063                            Field field, int valueIndex)
064                    throws Exception;
065    
066            public void uploadFieldFile(
067                            long structureId, long storageId, BaseModel<?> baseModel,
068                            String fieldName, ServiceContext serviceContext)
069                    throws Exception;
070    
071            public void uploadFieldFile(
072                            long structureId, long storageId, BaseModel<?> baseModel,
073                            String fieldName, String fieldNamespace,
074                            ServiceContext serviceContext)
075                    throws Exception;
076    
077    }