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.json.JSONArray;
020    import com.liferay.portal.kernel.xml.Document;
021    import com.liferay.portal.kernel.xml.Element;
022    import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
023    import com.liferay.portlet.dynamicdatamapping.model.DDMTemplate;
024    import com.liferay.portlet.dynamicdatamapping.storage.Field;
025    import com.liferay.portlet.dynamicdatamapping.storage.Fields;
026    
027    import java.util.Locale;
028    
029    import javax.servlet.jsp.PageContext;
030    
031    /**
032     * @author Eduardo Lundgren
033     * @author Brian Wing Shun Chan
034     */
035    public interface DDMXSD {
036    
037            public String getFieldHTML(
038                            PageContext pageContext, Element element, Fields fields,
039                            String portletNamespace, String namespace, String mode,
040                            boolean readOnly, Locale locale)
041                    throws Exception;
042    
043            public String getFieldHTMLByName(
044                            PageContext pageContext, long classNameId, long classPK,
045                            String fieldName, Fields fields, String portletNamespace,
046                            String namespace, String mode, boolean readOnly, Locale locale)
047                    throws Exception;
048    
049            public String getHTML(
050                            PageContext pageContext, DDMStructure ddmStructure, Fields fields,
051                            String portletNamespace, String namespace, boolean readOnly,
052                            Locale locale)
053                    throws Exception;
054    
055            public String getHTML(
056                            PageContext pageContext, DDMTemplate ddmTemplate, Fields fields,
057                            String portletNamespace, String namespace, boolean readOnly,
058                            Locale locale)
059                    throws Exception;
060    
061            public String getHTML(
062                            PageContext pageContext, String xml, Fields fields,
063                            String portletNamespace, Locale locale)
064                    throws Exception;
065    
066            public String getHTML(
067                            PageContext pageContext, String xml, Fields fields,
068                            String portletNamespace, String namespace, boolean readOnly,
069                            Locale locale)
070                    throws Exception;
071    
072            public String getHTML(
073                            PageContext pageContext, String xml, Fields fields,
074                            String portletNamespace, String namespace, Locale locale)
075                    throws Exception;
076    
077            public String getHTML(
078                            PageContext pageContext, String xml, Fields fields,
079                            String portletNamespace, String namespace, String mode,
080                            boolean readOnly, Locale locale)
081                    throws Exception;
082    
083            public String getHTML(
084                            PageContext pageContext, String xml, String portletNamespace,
085                            Locale locale)
086                    throws Exception;
087    
088            public JSONArray getJSONArray(DDMStructure structure, String xsd)
089                    throws PortalException, SystemException;
090    
091            public JSONArray getJSONArray(Document document) throws PortalException;
092    
093            public JSONArray getJSONArray(Element element) throws PortalException;
094    
095            public JSONArray getJSONArray(String xml)
096                    throws PortalException, SystemException;
097    
098            public String getSimpleFieldHTML(
099                            PageContext pageContext, Element element, Field field,
100                            String portletNamespace, String namespace, String mode,
101                            boolean readOnly, Locale locale)
102                    throws Exception;
103    
104            public String getSimpleFieldHTMLByName(
105                            PageContext pageContext, long classNameId, long classPK,
106                            Field field, String portletNamespace, String namespace, String mode,
107                            boolean readOnly, Locale locale)
108                    throws Exception;
109    
110            public String getXSD(long classNameId, long classPK)
111                    throws PortalException, SystemException;
112    
113    }