/**
 * 
 */
package routines;

import java.util.EnumSet;

import org.dom4j.Document;
import org.dom4j.DocumentException;

import routines.LcagXmlTools4.UpdateMode;

/**
 * @author U401455
 *
 */
public class LcagXmlTools3_5 extends LcagXmlTools4 {
    /**
     * Same as diffXMLAndCreateChangeList.  Only difference: Elements that are empty in the resultXML are not updated and not listed in the Change List.
     * 
     * Note: Parameters of type Object allow the XML representations as String, File name, Talend Document, Dom4J Document or Dom4J Element.  
     * 
     * {talendTypes} Document
     *
     * {Category} LCAG-XML Tools
     *
     * {param} object resultXml: If not null it contains the XML with added Change List as Item list with path, newValue and oldValue Tags in tag Update
     * 							  If null, the functions only the change list as result  
     *
     * {param} string resultInsertChangeListXp: XPath to compare to and where to insert the Change List calculated by this function
     * 
     * {param} object existingXml: usually an XML representing an existing entity in MDM DB or a MDM UI XML
     *
     * {param} string excludeCSV:   CSV list of pathes to exclude from comparison  
	 *
     * {example} findXMLUpdatesAndCreateChangeList(resultXml, "exchange/report/Update", existingXml, "Id;LastupdateTimeStamp")
     */
    public static Document findXMLUpdatesAndCreateChangeList(Object resultXml, String resultInsertChangeListXp, final Object existingXml, String excludeCSV) throws DocumentException 
    {
    	Document  result = null;
		
		result = _xpathUpdate(resultXml, existingXml, EnumSet.of(UpdateMode.UPDATE, UpdateMode.DIFF_ONLY), excludeCSV, resultInsertChangeListXp);
    	
    	return result;
    }
}
