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.dynamicdatamapping.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.util.OrderByComparator;
019    import com.liferay.portal.service.ServiceContext;
020    import com.liferay.portal.theme.ThemeDisplay;
021    import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
022    import com.liferay.portlet.dynamicdatamapping.model.DDMTemplate;
023    import com.liferay.portlet.dynamicdatamapping.storage.Field;
024    import com.liferay.portlet.dynamicdatamapping.storage.Fields;
025    
026    import java.io.Serializable;
027    
028    /**
029     * @author Eduardo Lundgren
030     * @author Marcellus Tavares
031     */
032    public interface DDM {
033    
034            public DDMDisplay getDDMDisplay(ServiceContext serviceContext);
035    
036            public Serializable getDisplayFieldValue(
037                            ThemeDisplay themeDisplay, Serializable fieldValue, String type)
038                    throws Exception;
039    
040            public Fields getFields(
041                            long ddmStructureId, long ddmTemplateId,
042                            ServiceContext serviceContext)
043                    throws PortalException;
044    
045            public Fields getFields(
046                            long ddmStructureId, long ddmTemplateId, String fieldNamespace,
047                            ServiceContext serviceContext)
048                    throws PortalException;
049    
050            public Fields getFields(long ddmStructureId, ServiceContext serviceContext)
051                    throws PortalException;
052    
053            public Fields getFields(
054                            long ddmStructureId, String fieldNamespace,
055                            ServiceContext serviceContext)
056                    throws PortalException;
057    
058            public String[] getFieldsDisplayValues(Field fieldsDisplayField)
059                    throws Exception;
060    
061            public Serializable getIndexedFieldValue(
062                            Serializable fieldValue, String type)
063                    throws Exception;
064    
065            public OrderByComparator<DDMStructure> getStructureOrderByComparator(
066                    String orderByCol, String orderByType);
067    
068            public OrderByComparator<DDMTemplate> getTemplateOrderByComparator(
069                    String orderByCol, String orderByType);
070    
071            public Fields mergeFields(Fields newFields, Fields existingFields);
072    
073    }