@Test void doImportAddUpdateExisting() { RepositoryCollection source = mock(RepositoryCollection.class); String defaultPackage = "package"; assertThrows( IllegalArgumentException.class, () -> vcfImporterService.doImport( source, MetadataAction.ADD, DataAction.ADD_UPDATE_EXISTING, defaultPackage)); }
@Transactional @Override public EntityImportReport doImport( RepositoryCollection source, MetadataAction metadataAction, DataAction dataAction, @Nullable @CheckForNull String packageId) { if (dataAction != DataAction.ADD) { throw new IllegalArgumentException("Only ADD is supported"); } Package importPackage = null; if (packageId != null) { importPackage = metaDataService .getPackage(packageId) .orElseThrow(() -> new UnknownEntityException(PACKAGE, packageId)); } List<EntityType> addedEntities = new ArrayList<>(); EntityImportReport report; Iterator<String> it = source.getEntityTypeIds().iterator(); if (it.hasNext()) { try (Repository<Entity> repo = source.getRepository(it.next())) { report = importVcf(repo, addedEntities, importPackage); } catch (IOException e) { throw new MolgenisDataException(e); } } else { report = new EntityImportReport(); } return report; }
VcfImporterService implements ImportService { @Transactional @Override public EntityImportReport doImport( RepositoryCollection source, MetadataAction metadataAction, DataAction dataAction, @Nullable @CheckForNull String packageId) { if (dataAction != DataAction.ADD) { throw new IllegalArgumentException("Only ADD is supported"); } Package importPackage = null; if (packageId != null) { importPackage = metaDataService .getPackage(packageId) .orElseThrow(() -> new UnknownEntityException(PACKAGE, packageId)); } List<EntityType> addedEntities = new ArrayList<>(); EntityImportReport report; Iterator<String> it = source.getEntityTypeIds().iterator(); if (it.hasNext()) { try (Repository<Entity> repo = source.getRepository(it.next())) { report = importVcf(repo, addedEntities, importPackage); } catch (IOException e) { throw new MolgenisDataException(e); } } else { report = new EntityImportReport(); } return report; } }
VcfImporterService implements ImportService { @Transactional @Override public EntityImportReport doImport( RepositoryCollection source, MetadataAction metadataAction, DataAction dataAction, @Nullable @CheckForNull String packageId) { if (dataAction != DataAction.ADD) { throw new IllegalArgumentException("Only ADD is supported"); } Package importPackage = null; if (packageId != null) { importPackage = metaDataService .getPackage(packageId) .orElseThrow(() -> new UnknownEntityException(PACKAGE, packageId)); } List<EntityType> addedEntities = new ArrayList<>(); EntityImportReport report; Iterator<String> it = source.getEntityTypeIds().iterator(); if (it.hasNext()) { try (Repository<Entity> repo = source.getRepository(it.next())) { report = importVcf(repo, addedEntities, importPackage); } catch (IOException e) { throw new MolgenisDataException(e); } } else { report = new EntityImportReport(); } return report; } VcfImporterService(
      DataService dataService,
      PermissionSystemService permissionSystemService,
      MetaDataService metaDataService); }
VcfImporterService implements ImportService { @Transactional @Override public EntityImportReport doImport( RepositoryCollection source, MetadataAction metadataAction, DataAction dataAction, @Nullable @CheckForNull String packageId) { if (dataAction != DataAction.ADD) { throw new IllegalArgumentException("Only ADD is supported"); } Package importPackage = null; if (packageId != null) { importPackage = metaDataService .getPackage(packageId) .orElseThrow(() -> new UnknownEntityException(PACKAGE, packageId)); } List<EntityType> addedEntities = new ArrayList<>(); EntityImportReport report; Iterator<String> it = source.getEntityTypeIds().iterator(); if (it.hasNext()) { try (Repository<Entity> repo = source.getRepository(it.next())) { report = importVcf(repo, addedEntities, importPackage); } catch (IOException e) { throw new MolgenisDataException(e); } } else { report = new EntityImportReport(); } return report; } VcfImporterService(
      DataService dataService,
      PermissionSystemService permissionSystemService,
      MetaDataService metaDataService); @Transactional @Override EntityImportReport doImport(
      RepositoryCollection source,
      MetadataAction metadataAction,
      DataAction dataAction,
      @Nullable @CheckForNull String packageId); @Override EntitiesValidationReport validateImport(RepositoryCollection source); @Override boolean canImport(File file, RepositoryCollection source); @Override int getOrder(); @Override List<MetadataAction> getSupportedMetadataActions(); @Override List<DataAction> getSupportedDataActions(); @Override boolean getMustChangeEntityName(); @Override Set<String> getSupportedFileExtensions(); @Override Map<String, Boolean> determineImportableEntities(
      MetaDataService metaDataService,
      RepositoryCollection repositoryCollection,
      String defaultPackage); @Override MetadataAction getMetadataAction(RepositoryCollection source); }
VcfImporterService implements ImportService { @Transactional @Override public EntityImportReport doImport( RepositoryCollection source, MetadataAction metadataAction, DataAction dataAction, @Nullable @CheckForNull String packageId) { if (dataAction != DataAction.ADD) { throw new IllegalArgumentException("Only ADD is supported"); } Package importPackage = null; if (packageId != null) { importPackage = metaDataService .getPackage(packageId) .orElseThrow(() -> new UnknownEntityException(PACKAGE, packageId)); } List<EntityType> addedEntities = new ArrayList<>(); EntityImportReport report; Iterator<String> it = source.getEntityTypeIds().iterator(); if (it.hasNext()) { try (Repository<Entity> repo = source.getRepository(it.next())) { report = importVcf(repo, addedEntities, importPackage); } catch (IOException e) { throw new MolgenisDataException(e); } } else { report = new EntityImportReport(); } return report; } VcfImporterService(
      DataService dataService,
      PermissionSystemService permissionSystemService,
      MetaDataService metaDataService); @Transactional @Override EntityImportReport doImport(
      RepositoryCollection source,
      MetadataAction metadataAction,
      DataAction dataAction,
      @Nullable @CheckForNull String packageId); @Override EntitiesValidationReport validateImport(RepositoryCollection source); @Override boolean canImport(File file, RepositoryCollection source); @Override int getOrder(); @Override List<MetadataAction> getSupportedMetadataActions(); @Override List<DataAction> getSupportedDataActions(); @Override boolean getMustChangeEntityName(); @Override Set<String> getSupportedFileExtensions(); @Override Map<String, Boolean> determineImportableEntities(
      MetaDataService metaDataService,
      RepositoryCollection repositoryCollection,
      String defaultPackage); @Override MetadataAction getMetadataAction(RepositoryCollection source);  }