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.xml.Document;
019    import com.liferay.portal.kernel.xml.XPath;
020    import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
021    import com.liferay.portlet.dynamicdatamapping.storage.Fields;
022    
023    import java.util.List;
024    import java.util.Locale;
025    
026    /**
027     * @author Bruno Basto
028     * @author Brian Wing Shun Chan
029     */
030    public interface DDMXML {
031    
032            public String formatXML(Document document);
033    
034            public String formatXML(String xml);
035    
036            public Fields getFields(DDMStructure structure, String xml)
037                    throws PortalException;
038    
039            public Fields getFields(
040                            DDMStructure structure, XPath xPath, String xml,
041                            List<String> fieldNames)
042                    throws PortalException;
043    
044            public String getXML(Document document, Fields fields);
045    
046            public String getXML(Fields fields);
047    
048            public String updateXMLDefaultLocale(
049                    String xml, Locale contentDefaultLocale,
050                    Locale contentNewDefaultLocale);
051    
052            public String validateXML(String xml) throws PortalException;
053    
054    }