try { progress.setProgressMax(3); progress.progress(0, "Connection to Amazon Bucket with accessKey '" + accessKey + "'"); AmazonS3 client = amazonBucketClient.getClient(accessKey, secretKey, region); progress.progress(1, "downloading..."); File file = amazonBucketClient.downloadFile( progress.progress(2, "Importing..."); ImportService importService = importServiceFactory.getImportService(file.getName()); File renamed = repositoryCollection, MetadataAction.UPSERT, DataAction.ADD_UPDATE_EXISTING, null); progress.status("Download and import from Amazon Bucket done."); progress.progress( 3, "Successfully imported "
@Override @Transactional public long applyMappings( String mappingProjectId, String entityTypeId, Boolean addSourceAttribute, String packageId, String label, Progress progress) { MappingProject mappingProject = getMappingProject(mappingProjectId); MappingTarget mappingTarget = mappingProject.getMappingTargets().get(0); progress.setProgressMax(calculateMaxProgress(mappingTarget)); progress.progress(0, format("Checking target repository [%s]...", entityTypeId)); EntityType targetMetadata = createTargetMetadata(mappingTarget, entityTypeId, packageId, label, addSourceAttribute); Repository<Entity> targetRepo = getTargetRepository(entityTypeId, targetMetadata); return applyMappingsInternal(mappingTarget, targetRepo, progress, mappingProject.getDepth()); }
/** * Imports a csv file defined in the fileIngest entity * * @see FileIngestJobExecutionMetaData */ public FileMeta ingest( String entityTypeId, String url, String loader, String jobExecutionID, Progress progress) { if (!"CSV".equals(loader)) { throw new FileIngestException("Unknown loader '" + loader + "'"); } progress.setProgressMax(2); progress.progress(0, "Downloading url '" + url + "'"); File file = fileStoreDownload.downloadFile(url, jobExecutionID, entityTypeId + ".csv"); progress.progress(1, "Importing..."); FileRepositoryCollection repoCollection = fileRepositoryCollectionFactory.createFileRepositoryCollection(file); ImportService importService = importServiceFactory.getImportService(file, repoCollection); EntityImportReport report = importService.doImport(repoCollection, MetadataAction.UPSERT, ADD_UPDATE_EXISTING, null); progress.status("Ingestion of url '" + url + "' done."); Integer count = report.getNrImportedEntitiesMap().get(entityTypeId); count = count != null ? count : 0; progress.progress(2, "Successfully imported " + count + " " + entityTypeId + " entities."); FileMeta fileMeta = createFileMeta(jobExecutionID, file); FileIngestJobExecution fileIngestJobExecution = (FileIngestJobExecution) progress.getJobExecution(); fileIngestJobExecution.setFile(fileMeta); dataService.add(FILE_META, fileMeta); return fileMeta; }
if (entityType != null) { if (indexAction.getEntityId() != null) { progress.progress( progressCount, format("Indexing {0}.{1}", entityType.getId(), indexAction.getEntityId())); rebuildIndexOneEntity(entityTypeId, indexAction.getEntityId()); } else { progress.progress(progressCount, format("Indexing {0}", entityType.getId())); final Repository<Entity> repository = dataService.getRepository(entityType.getId()); indexService.rebuildIndex(repository); entityType = getEntityType(indexAction); if (indexService.hasIndex(entityType)) { progress.progress( progressCount, format("Dropping entityType with id: {0}", entityType.getId())); indexService.deleteIndex(entityType); progress.progress( progressCount, format("Skip index entity {0}.{1}", entityType.getId(), indexAction.getEntityId()));
progress.progress(counter.get(), "Processed " + counter + " input terms."); dataService.add(resultRepositoryName, entitiesToAdd.stream()); progress.progress(counter.get(), "Processed " + counter + " input terms."); progress.setResultUrl( menuReaderService.getMenu().findMenuItemPath(SortaController.ID)
private void copyResources(ResourceCollection resourceCollection, CopyState state) { Progress progress = state.progress(); progress.setProgressMax(calculateMaxProgress(resourceCollection)); progress.progress(0, contextMessageSource.getMessage("progress-copy-started")); copyPackages(resourceCollection.getPackages(), state); copyEntityTypes(resourceCollection.getEntityTypes(), state); progress.status(contextMessageSource.getMessage("progress-copy-success")); }