use of org.alfresco.repo.bulkimport.ImportableItem in project alfresco-repository by Alfresco.
the class StripingBulkFilesystemImporter method bulkImportImpl.
/**
* Method that does the work of importing a filesystem using the BatchProcessor.
*
* @param bulkImportParameters The bulk import parameters to apply to this bulk import.
* @param nodeImporter The node importer implementation that will import each node.
* @param lockToken The lock token to use during the bulk import.
*/
@Override
protected void bulkImportImpl(final BulkImportParameters bulkImportParameters, final NodeImporter nodeImporter, final String lockToken) {
super.bulkImportImpl(bulkImportParameters, nodeImporter, lockToken);
final File sourceFolder = nodeImporter.getSourceFolder();
final int batchSize = getBatchSize(bulkImportParameters);
final int loggingInterval = getLoggingInterval(bulkImportParameters);
final StripingFilesystemTracker tracker = new StripingFilesystemTracker(directoryAnalyser, bulkImportParameters.getTarget(), sourceFolder, batchSize);
final BatchProcessor<ImportableItem> batchProcessor = getBatchProcessor(bulkImportParameters, tracker.getWorkProvider(), loggingInterval);
final BatchProcessor.BatchProcessWorker<ImportableItem> worker = getWorker(bulkImportParameters, lockToken, nodeImporter, tracker);
do {
batchProcessor.process(worker, true);
if (batchProcessor.getLastError() != null) {
throw new AlfrescoRuntimeException(batchProcessor.getLastError());
}
} while (tracker.moreLevels());
}
use of org.alfresco.repo.bulkimport.ImportableItem in project alfresco-repository by Alfresco.
the class DirectoryAnalyserImpl method addVersionFile.
private void addVersionFile(ImportableItem parent, AnalysedDirectory analysedDirectory, Path versionFile) {
Path parentContentFile = getParentOfVersionFile(versionFile);
boolean isContentVersion = false;
if (isMetadataFile(parentContentFile)) {
parentContentFile = getParentOfMetadatafile(parentContentFile);
isContentVersion = false;
} else {
isContentVersion = true;
}
ImportableItem importableItem = findOrCreateImportableItem(parent, analysedDirectory, parentContentFile);
int version = getVersionNumber(versionFile);
ImportableItem.VersionedContentAndMetadata versionEntry = findOrCreateVersionEntry(importableItem, version);
if (isContentVersion) {
versionEntry.setContentFile(versionFile);
} else {
versionEntry.setMetadataFile(versionFile);
}
}
use of org.alfresco.repo.bulkimport.ImportableItem in project alfresco-repository by Alfresco.
the class DirectoryAnalyserImpl method addParentFile.
private boolean addParentFile(ImportableItem parent, AnalysedDirectory analysedDirectory, Path contentFile) {
ImportableItem importableItem = findOrCreateImportableItem(parent, analysedDirectory, contentFile);
importableItem.getHeadRevision().setContentFile(contentFile);
return (importableItem.getHeadRevision().getContentFileType() == FileType.DIRECTORY);
}
use of org.alfresco.repo.bulkimport.ImportableItem in project alfresco-repository by Alfresco.
the class DirectoryAnalyserImpl method findImportableItem.
private ImportableItem findImportableItem(AnalysedDirectory analysedDirectory, Path contentFile) {
ImportableItem result = null;
if (contentFile == null) {
throw new IllegalStateException("Cannot call findOrCreateImportableItem with null key");
}
result = analysedDirectory.findImportableItem(contentFile);
return (result);
}
Aggregations