Class ProjectArchiverHelper.ProjectImporter
java.lang.Object
org.ametys.plugins.workspaces.archive.ProjectArchiverHelper.ProjectImporter
- All Implemented Interfaces:
UnitaryImporter<Project>
- Enclosing class:
ProjectArchiverHelper
protected class ProjectArchiverHelper.ProjectImporter
extends Object
implements UnitaryImporter<Project>
Inner class to leverage the logic from UnitaryImporter
-
Constructor Summary
ConstructorsConstructorDescriptionProjectImporter(Path zipPath, javax.jcr.Node projectsNode, Merger merger, ImportReport report) Build an new importer -
Method Summary
Modifier and TypeMethodDescriptionCreates the object with the given id and XML properties file.getPropertiesXml(Path projectPath) Gets the properties XML file from its ZIP pathTheImportReportThe name for the object to import in error logsretrieveId(Document propertiesXml) Retrieves the id of the object to import from the XML fileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.plugins.contentio.archive.UnitaryImporter
unitaryImport, unitaryImportFinalize
-
Constructor Details
-
ProjectImporter
public ProjectImporter(Path zipPath, javax.jcr.Node projectsNode, Merger merger, ImportReport report) throws ParserConfigurationException Build an new importer- Parameters:
zipPath- the path to the archive ZIPprojectsNode- the node where the data will be importedmerger- the mergerreport- the report- Throws:
ParserConfigurationException- if an error occurred
-
-
Method Details
-
objectNameForLogs
Description copied from interface:UnitaryImporterThe name for the object to import in error logs- Specified by:
objectNameForLogsin interfaceUnitaryImporter<Project>- Returns:
- The name for the object to import in error logs
-
getPropertiesXml
Description copied from interface:UnitaryImporterGets the properties XML file from its ZIP path- Specified by:
getPropertiesXmlin interfaceUnitaryImporter<Project>- Parameters:
projectPath- The ZIP entry path of the XML file- Returns:
- The properties XML file
- Throws:
Exception- if an error occurs
-
retrieveId
Description copied from interface:UnitaryImporterRetrieves the id of the object to import from the XML file- Specified by:
retrieveIdin interfaceUnitaryImporter<Project>- Parameters:
propertiesXml- The properties XML file- Returns:
- The id of the object to import
- Throws:
Exception- if an error occurs
-
create
public Project create(Path projectZipPath, String id, Document propertiesXml) throws Archivers.AmetysObjectNotImportedException, ImportGlobalFailException, Exception Description copied from interface:UnitaryImporterCreates the object with the given id and XML properties file.
Note that the implementation must create the object with the given id, but it can also create sub-objects for this unitary object (for instance a Resource as an attachment for a Content, etc.).- Specified by:
createin interfaceUnitaryImporter<Project>- Parameters:
projectZipPath- The ZIP entry path of the XML fileid- The id of the object to importpropertiesXml- The properties XML file- Returns:
- The created object
- Throws:
Archivers.AmetysObjectNotImportedException- If the object was not imported due to an exception (for instance an attribute is missing in the XML file). Then the object is ignored and the import will continue to the next object.ImportGlobalFailException- If the global import process must stop due to any fatal exception.Exception- if another unexpected error occurs
-
getReport
Description copied from interface:UnitaryImporterTheImportReport- Specified by:
getReportin interfaceUnitaryImporter<Project>- Returns:
- The
ImportReport
-