Class DatasetService

java.lang.Object
com.gooddata.sdk.service.AbstractService
com.gooddata.sdk.service.dataset.DatasetService

public class DatasetService
extends AbstractService
Service to work with datasets, manifests and dataset uploads.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.gooddata.sdk.service.AbstractService

    AbstractService.OutputStreamResponseExtractor
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static org.springframework.web.util.UriTemplate UPLOADS_INFO_TEMPLATE  

    Fields inherited from class com.gooddata.sdk.service.AbstractService

    mapper, restTemplate
  • Constructor Summary

    Constructors 
    Constructor Description
    DatasetService​(org.springframework.web.client.RestTemplate restTemplate, DataStoreService dataStoreService, GoodDataSettings settings)  
  • Method Summary

    Modifier and Type Method Description
    com.gooddata.sdk.model.dataset.DatasetManifest getDatasetManifest​(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId)
    Obtains manifest from given project by given datasetId
    com.gooddata.sdk.model.dataset.Upload getLastUploadForDataset​(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId)
    Returns last upload for the dataset with given identifier in the given project.
    com.gooddata.sdk.model.dataset.UploadStatistics getUploadStatistics​(com.gooddata.sdk.model.project.Project project)
    Returns global upload statistics for the given project.
    java.util.Collection<com.gooddata.sdk.model.gdc.AboutLinks.Link> listDatasetLinks​(com.gooddata.sdk.model.project.Project project)
    Lists datasets (links) in project.
    java.util.Collection<com.gooddata.sdk.model.dataset.Upload> listUploadsForDataset​(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId)
    Lists all uploads for the dataset with the given identifier in the given project.
    FutureResult<java.lang.Void> loadDataset​(com.gooddata.sdk.model.project.Project project, com.gooddata.sdk.model.dataset.DatasetManifest manifest, java.io.InputStream dataset)
    Loads dataset into platform.
    FutureResult<java.lang.Void> loadDataset​(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId, java.io.InputStream dataset)
    FutureResult<java.lang.Void> loadDatasets​(com.gooddata.sdk.model.project.Project project, com.gooddata.sdk.model.dataset.DatasetManifest... datasets)  
    FutureResult<java.lang.Void> loadDatasets​(com.gooddata.sdk.model.project.Project project, java.util.Collection<com.gooddata.sdk.model.dataset.DatasetManifest> datasets)
    Loads datasets into platform.
    FutureResult<java.lang.Void> optimizeSliHash​(com.gooddata.sdk.model.project.Project project)
    Optimize SLI hash.
    FutureResult<java.lang.Void> updateProjectData​(com.gooddata.sdk.model.project.Project project, java.lang.String maqlDml)
    Update project data with the given update script (MAQL).

    Methods inherited from class com.gooddata.sdk.service.AbstractService

    extractData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • UPLOADS_INFO_TEMPLATE

      public static final org.springframework.web.util.UriTemplate UPLOADS_INFO_TEMPLATE
  • Constructor Details

  • Method Details

    • getDatasetManifest

      public com.gooddata.sdk.model.dataset.DatasetManifest getDatasetManifest​(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId)
      Obtains manifest from given project by given datasetId
      Parameters:
      project - project to which manifest belongs
      datasetId - id of dataset
      Returns:
      manifest for dataset
      Throws:
      com.gooddata.sdk.model.dataset.DatasetNotFoundException - when manifest can't be found (doesn't exist)
      DatasetException - in case the API call failure
    • loadDataset

      public FutureResult<java.lang.Void> loadDataset​(com.gooddata.sdk.model.project.Project project, com.gooddata.sdk.model.dataset.DatasetManifest manifest, java.io.InputStream dataset)
      Loads dataset into platform. Uploads given dataset and manifest to staging area and triggers ETL pull. The call is asynchronous returning FutureResult to let caller wait for results. Uploaded files are deleted from staging area when finished.
      Parameters:
      project - project to which dataset belongs
      manifest - dataset manifest
      dataset - dataset to upload
      Returns:
      FutureResult of the task, which can throw DatasetException in case the ETL pull task fails
      Throws:
      DatasetException - if there is a problem to serialize manifest or upload dataset
    • loadDataset

      public FutureResult<java.lang.Void> loadDataset​(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId, java.io.InputStream dataset)
      Parameters:
      project - project to which dataset belongs
      datasetId - datasetId to obtain a manifest
      dataset - dataset to upload
      Returns:
      FutureResult of the task
    • loadDatasets

      public FutureResult<java.lang.Void> loadDatasets​(com.gooddata.sdk.model.project.Project project, com.gooddata.sdk.model.dataset.DatasetManifest... datasets)
    • loadDatasets

      public FutureResult<java.lang.Void> loadDatasets​(com.gooddata.sdk.model.project.Project project, java.util.Collection<com.gooddata.sdk.model.dataset.DatasetManifest> datasets)
      Loads datasets into platform. Uploads given datasets and their manifests to staging area and triggers ETL pull. The call is asynchronous returning FutureResult to let caller wait for results. Uploaded files are deleted from staging area when finished.
      Parameters:
      project - project to which dataset belongs
      datasets - map dataset manifests
      Returns:
      FutureResult of the task, which can throw DatasetException in case the ETL pull task fails
      Throws:
      DatasetException - if there is a problem to serialize manifest or upload dataset
      See Also:
      batch upload reference
    • listDatasetLinks

      public java.util.Collection<com.gooddata.sdk.model.gdc.AboutLinks.Link> listDatasetLinks​(com.gooddata.sdk.model.project.Project project)
      Lists datasets (links) in project. Returns empty list in case there are no datasets.
      Parameters:
      project - project to list datasets in
      Returns:
      collection of dataset links or empty list
    • optimizeSliHash

      public FutureResult<java.lang.Void> optimizeSliHash​(com.gooddata.sdk.model.project.Project project)
      Optimize SLI hash. This feature is useful only if data warehouse was reduced somehow. Remove unused values from the existing SLI hash.
      Parameters:
      project - project to optimize SLI hash in
      Returns:
      FutureResult of the task
    • updateProjectData

      public FutureResult<java.lang.Void> updateProjectData​(com.gooddata.sdk.model.project.Project project, java.lang.String maqlDml)
      Update project data with the given update script (MAQL). This method can be used for data manipulation only, for model changes use ModelService.updateProjectModel(com.gooddata.sdk.model.project.Project, com.gooddata.sdk.model.project.model.ModelDiff).
      Parameters:
      project - project to be updated
      maqlDml - update script to be executed in the project
      Returns:
      poll result
      See Also:
      ModelService.updateProjectModel(com.gooddata.sdk.model.project.Project, com.gooddata.sdk.model.project.model.ModelDiff)
    • listUploadsForDataset

      public java.util.Collection<com.gooddata.sdk.model.dataset.Upload> listUploadsForDataset​(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId)
      Lists all uploads for the dataset with the given identifier in the given project. Returns empty list if there are no uploads for the given dataset.
      Parameters:
      project - GoodData project
      datasetId - dataset identifier
      Returns:
      collection of Upload objects or empty list
    • getLastUploadForDataset

      public com.gooddata.sdk.model.dataset.Upload getLastUploadForDataset​(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId)
      Returns last upload for the dataset with given identifier in the given project. Returns null if the last upload doesn't exist.
      Parameters:
      project - GoodData project
      datasetId - dataset identifier
      Returns:
      last dataset upload or null if the upload doesn't exist
    • getUploadStatistics

      public com.gooddata.sdk.model.dataset.UploadStatistics getUploadStatistics​(com.gooddata.sdk.model.project.Project project)
      Returns global upload statistics for the given project.
      Parameters:
      project - GoodData project
      Returns:
      UploadStatistics object with project's upload statistics