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.json.JSONArray;
019    import com.liferay.portal.kernel.util.OrderByComparator;
020    import com.liferay.portal.service.ServiceContext;
021    import com.liferay.portal.theme.ThemeDisplay;
022    import com.liferay.portlet.dynamicdatamapping.model.DDMForm;
023    import com.liferay.portlet.dynamicdatamapping.model.DDMFormLayout;
024    import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
025    import com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion;
026    import com.liferay.portlet.dynamicdatamapping.model.DDMTemplate;
027    import com.liferay.portlet.dynamicdatamapping.storage.Field;
028    import com.liferay.portlet.dynamicdatamapping.storage.Fields;
029    
030    import java.io.Serializable;
031    
032    import javax.portlet.PortletRequest;
033    
034    /**
035     * @author Eduardo Lundgren
036     * @author Marcellus Tavares
037     * @author Leonardo Barros
038     */
039    public interface DDM {
040    
041            public DDMDisplay getDDMDisplay(long classNameId) throws PortalException;
042    
043            public DDMForm getDDMForm(long classNameId, long classPK)
044                    throws PortalException;
045    
046            public DDMForm getDDMForm(PortletRequest portletRequest)
047                    throws PortalException;
048    
049            public JSONArray getDDMFormFieldsJSONArray(
050                    DDMStructure ddmStructure, String script);
051    
052            public JSONArray getDDMFormFieldsJSONArray(
053                    DDMStructureVersion ddmStructureVersion, String script);
054    
055            public DDMPermissionHandler getDDMPermissionHandler(long classNameId);
056    
057            public DDMFormLayout getDefaultDDMFormLayout(DDMForm ddmForm);
058    
059            public Serializable getDisplayFieldValue(
060                            ThemeDisplay themeDisplay, Serializable fieldValue, String type)
061                    throws Exception;
062    
063            public Fields getFields(
064                            long ddmStructureId, long ddmTemplateId,
065                            ServiceContext serviceContext)
066                    throws PortalException;
067    
068            public Fields getFields(
069                            long ddmStructureId, long ddmTemplateId, String fieldNamespace,
070                            ServiceContext serviceContext)
071                    throws PortalException;
072    
073            public Fields getFields(long ddmStructureId, ServiceContext serviceContext)
074                    throws PortalException;
075    
076            public Fields getFields(
077                            long ddmStructureId, String fieldNamespace,
078                            ServiceContext serviceContext)
079                    throws PortalException;
080    
081            public String[] getFieldsDisplayValues(Field fieldsDisplayField)
082                    throws Exception;
083    
084            public Serializable getIndexedFieldValue(
085                            Serializable fieldValue, String type)
086                    throws Exception;
087    
088            public OrderByComparator<DDMStructure> getStructureOrderByComparator(
089                    String orderByCol, String orderByType);
090    
091            public OrderByComparator<DDMTemplate> getTemplateOrderByComparator(
092                    String orderByCol, String orderByType);
093    
094            public Fields mergeFields(Fields newFields, Fields existingFields);
095    
096    }