001/* 002 * (C) Copyright 2006-2008 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Nuxeo - initial API and implementation 018 * 019 * $Id$ 020 */ 021 022package org.nuxeo.ecm.platform.importer.factories; 023 024import java.io.IOException; 025 026import org.nuxeo.ecm.core.api.CoreSession; 027import org.nuxeo.ecm.core.api.DocumentModel; 028import org.nuxeo.ecm.platform.importer.base.GenericThreadedImportTask; 029import org.nuxeo.ecm.platform.importer.source.SourceNode; 030 031/** 032 * Interface for DocumentModel factory 033 * 034 * @author Thierry Delprat 035 * @author Antoine Taillefer 036 */ 037public interface ImporterDocumentModelFactory { 038 039 public boolean isTargetDocumentModelFolderish(SourceNode node); 040 041 public DocumentModel createFolderishNode(CoreSession session, DocumentModel parent, SourceNode node) throws IOException; 042 043 public DocumentModel createLeafNode(CoreSession session, DocumentModel parent, SourceNode node) throws IOException; 044 045 /** 046 * Defines the process to execute when a folderish node creation error occurs. 047 * <p> 048 * This method is called by 049 * {@link GenericThreadedImportTask#doCreateFolderishNode(DocumentModel parent, SourceNode node)} if an exception is 050 * thrown by {@link #createFolderishNode(CoreSession, DocumentModel, SourceNode)}. 051 * </p> 052 * 053 * @return true if the global import task should continue after processing the error, false if it should be stopped 054 * immediately after processing the error. 055 */ 056 public boolean processFolderishNodeCreationError(CoreSession session, DocumentModel parent, SourceNode node); 057 058 /** 059 * Defines the process to execute when a leaf node creation error occurs. 060 * <p> 061 * This method is called by {@link GenericThreadedImportTask#doCreateLeafNode(DocumentModel parent, SourceNode node)} 062 * if an exception is thrown by {@link #createLeafNode(CoreSession, DocumentModel, SourceNode)}. 063 * </p> 064 * 065 * @return true if the global import task should continue after processing the error, false if it should be stopped 066 * immediately after processing the error. 067 */ 068 public boolean processLeafNodeCreationError(CoreSession session, DocumentModel parent, SourceNode node); 069 070}