Package com.gooddata.sdk.service.dataset
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.UriTemplateUPLOADS_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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.gooddata.sdk.model.dataset.DatasetManifestgetDatasetManifest(com.gooddata.sdk.model.project.Project project, java.lang.String datasetId)Obtains manifest from given project by given datasetIdcom.gooddata.sdk.model.dataset.UploadgetLastUploadForDataset(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.UploadStatisticsgetUploadStatistics(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)Gets DatasetManifest (usinggetDatasetManifest(Project, String)first and then callsloadDataset(Project, DatasetManifest, java.io.InputStream)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
-
-
-
-
Constructor Detail
-
DatasetService
public DatasetService(org.springframework.web.client.RestTemplate restTemplate, DataStoreService dataStoreService, GoodDataSettings settings)
-
-
Method Detail
-
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 belongsdatasetId- 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 returningFutureResultto let caller wait for results. Uploaded files are deleted from staging area when finished.- Parameters:
project- project to which dataset belongsmanifest- dataset manifestdataset- dataset to upload- Returns:
FutureResultof the task, which can throwDatasetExceptionin 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)
Gets DatasetManifest (usinggetDatasetManifest(Project, String)first and then callsloadDataset(Project, DatasetManifest, java.io.InputStream)- Parameters:
project- project to which dataset belongsdatasetId- datasetId to obtain a manifestdataset- dataset to upload- Returns:
FutureResultof 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 returningFutureResultto let caller wait for results. Uploaded files are deleted from staging area when finished.- Parameters:
project- project to which dataset belongsdatasets- map dataset manifests- Returns:
FutureResultof the task, which can throwDatasetExceptionin 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:
FutureResultof 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 useModelService.updateProjectModel(com.gooddata.sdk.model.project.Project, com.gooddata.sdk.model.project.model.ModelDiff).- Parameters:
project- project to be updatedmaqlDml- 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 projectdatasetId- dataset identifier- Returns:
- collection of
Uploadobjects 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 projectdatasetId- dataset identifier- Returns:
- last dataset upload or
nullif 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:
UploadStatisticsobject with project's upload statistics
-
-