001package org.nuxeo.ecm.platform.importer.xml.parser; 002 003import java.io.File; 004import java.io.IOException; 005import java.io.InputStream; 006import java.util.List; 007import java.util.Map; 008 009import org.nuxeo.ecm.core.api.DocumentModel; 010 011/** 012 * Interface for importer service 013 * 014 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a> 015 */ 016public interface XMLImporterService { 017 018 /** 019 * Imports {@link DocumentModel} in Nuxeo from an XML or a Zip archive. 020 * 021 * @param root target container {@link DocumentModel} 022 * @param source source file, can be XML or Zip with XML index 023 * @return 024 */ 025 public List<DocumentModel> importDocuments(DocumentModel root, File source) throws IOException; 026 027 028 /** 029 * Imports {@link DocumentModel} in Nuxeo from an XML Stream. 030 * 031 * @param root target container {@link DocumentModel} 032 * @param xmlStream stream source for Xml contnt 033 * @return 034 */ 035 public List<DocumentModel> importDocuments(DocumentModel root, InputStream xmlStream) throws IOException; 036 037 /** 038 * Same as {@link #importDocuments(DocumentModel, File)} with map injected into mvel contexts used during parsing 039 * 040 * @param root target container {@link DocumentModel} 041 * @param source source file, can be XML or Zip with XML index 042 * @param mvelContext Context added each time a mvel expression is resolved 043 * @return 044 */ 045 public List<DocumentModel> importDocuments(DocumentModel root, File source, Map<String, Object> mvelContext) 046 throws IOException; 047 048 /** 049 * Same as {@link #importDocuments(DocumentModel, InputStream)} with map injected into mvel contexts used during 050 * parsing 051 * 052 * @param root target container {@link DocumentModel} 053 * @param xmlStream stream source for Xml contnt 054 * @param mvelContext Context added each time a mvel expression is resolved 055 * @return 056 */ 057 public List<DocumentModel> importDocuments(DocumentModel root, InputStream xmlStream, 058 Map<String, Object> mvelContext) throws IOException; 059 060 public List<DocumentModel> importDocuments(DocumentModel root, File source, Map<String, Object> mvelContext, 061 boolean deferSave) throws IOException; 062 063 /** 064 * Imports {@link DocumentModel} in Nuxeo from an XML or a Zip archive. 065 * 066 * @param root target container {@link DocumentModel} 067 * @param source source file, can be XML or Zip with XML index 068 * @param deferSave if true, do not save docs in docsStack during processing, save them after full parse of xml doc 069 * @since 7.4 070 * @return 071 */ 072 public List<DocumentModel> importDocuments(DocumentModel root, File source, boolean deferSave) throws IOException; 073 074}