public T generate()

in streampipes-data-export/src/main/java/org/apache/streampipes/export/dataimport/ImportGenerator.java [49:129]


  public T generate(InputStream inputStream) throws IOException {
    Map<String, byte[]> previewFiles = new ZipFileExtractor(inputStream).extractZipToMap();

    var manifest = getManifest(previewFiles);

    for (String assetId : manifest.getAssets()) {
      try {
        handleAsset(previewFiles, assetId);
      } catch (DocumentConflictException | IOException e) {
        LOG.warn("Skipping import of asset model {} (already present with the same id)", assetId);
      }
    }

    for (String adapterId : manifest.getAdapters()) {
      try {
        handleAdapter(asString(previewFiles.get(adapterId)), adapterId);
      } catch (DocumentConflictException e) {
        LOG.warn("Skipping import of adapter {} (already present with the same id)", adapterId);
      }
    }

    for (String chartId : manifest.getDataViewWidgets()) {
      try {
        handleChart(asString(previewFiles.get(chartId)), chartId);
      } catch (DocumentConflictException e) {
        LOG.warn("Skipping import of chart {} (already present with the same id)", chartId);
      }
    }

    for (String dataSourceId : manifest.getDataSources()) {
      try {
        handleDataSource(asString(previewFiles.get(dataSourceId)), dataSourceId);
      } catch (DocumentConflictException e) {
        LOG.warn("Skipping import of data source {} (already present with the same id)", dataSourceId);
      }
    }

    for (String pipelineId : manifest.getPipelines()) {
      try {
        handlePipeline(asString(previewFiles.get(pipelineId)), pipelineId);
      } catch (DocumentConflictException e) {
        LOG.warn("Skipping import of pipeline {} (already present with the same id)", pipelineId);
      }
    }

    for (String measurementId : manifest.getDataLakeMeasures()) {
      try {
        handleDataLakeMeasure(asString(previewFiles.get(measurementId)), measurementId);
      } catch (DocumentConflictException e) {
        LOG.warn("Skipping import of data lake measure {} (already present with the same id)", measurementId);
      }
    }

    for (String dashboardId : manifest.getDashboards()) {
      try {
        handleDashboard(asString(previewFiles.get(dashboardId)), dashboardId);
      } catch (DocumentConflictException e) {
        LOG.warn("Skipping import of dashboard {} (already present with the same id)", dashboardId);
      }
    }

    for (String fileMetadataId : manifest.getFiles()) {
      try {
        handleFile(asString(previewFiles.get(fileMetadataId)), fileMetadataId, previewFiles);
      } catch (DocumentConflictException e) {
        LOG.warn("Skipping import of file {} (already present with the same id)", fileMetadataId);
      }
    }

    for (String documentId : manifest.getGenericStorageDocuments()) {
      try {
        handleGenericStorageDocument(asString(previewFiles.get(documentId)), documentId);
      } catch (DocumentConflictException e) {
        LOG.warn("Skipping import of generic storage doc {} (already present with the same id)", documentId);
      }
    }

    afterResourcesCreated();

    return getReturnObject();
  }