com.supermap.services.providers

Class RestDataProvider

    • Constructor Detail

      • RestDataProvider

        public RestDataProvider(RestDataProviderSetting setting)
        

        The constructor.

        Parameters:
        setting - The parameter object for setting Rest data service provider.
      • RestDataProvider

        public RestDataProvider()
        

        The constructor.

    • Method Detail

      • createDataset

        public boolean createDataset(java.lang.String datasourceName,
                            DatasetInfo datasetInfo)
        

        Creates a new dataset in a specified datasource according to the dataset information.

        Specified by:
        createDataset in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetInfo - The dataset information.
        Returns:
        true if the dataset is successfully created; false otherwise.
      • deleteDataset

        public boolean deleteDataset(java.lang.String datasourceName,
                            java.lang.String datasetName)
        

        Removes the specified dataset in the specified datasource.

        Specified by:
        deleteDataset in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        Returns:
        true if the dataset is successfully deleted; false otherwise.
      • containsDataset

        public boolean containsDataset(java.lang.String datasourceName,
                              java.lang.String datasetName)
        

        Determines whether a specified datasource contains a specified dataset.

        Specified by:
        containsDataset in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        Returns:
        true if the given datasource contains the specified dataset; false otherwise.
      • renameDataset

        public boolean renameDataset(java.lang.String datasourceName,
                            java.lang.String oldName,
                            java.lang.String newName)
        

        Modifies the name of a specified dataset.

        Specified by:
        renameDataset in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        oldName - The name of the dataset to be modified.
        newName - New name.
        Returns:
        true if the dataset is successfully modified; false otherwise.
      • copyDataset

        public boolean copyDataset(java.lang.String srcDatasourceName,
                          java.lang.String srcDatasetName,
                          java.lang.String destDatasourceName,
                          java.lang.String destDatasetName)
        

        Copies a replication of a specified dataset.

        Copies a replication of a specified dataset from specified datasource to target datasource and saves it with a specified name.

        Specified by:
        copyDataset in interface DataProvider
        Parameters:
        srcDatasourceName - The name of the source datasource.
        srcDatasetName - The name of the source dataset.
        destDatasourceName - The target datasource name.
        destDatasetName - The target dataset name.
        Returns:
        true if the dataset is successfully copied; false otherwise.
      • addFeatures

        public EditResult addFeatures(java.lang.String datasourceName,
                             java.lang.String datasetName,
                             java.util.List<Feature> targetFeatures)
        

        Adds a set of features of the same type to a specified dataset.

        Every dataset in SuperMap has a type (DatasetType). A dataset can be a point, a line, or a region dataset. The features in a dataset are of the same type with the dataset. For instance, the features stored in a point dataset must be point features. Therefore, a feature added to a dataset must be of the same type with that dataset.

        Specified by:
        addFeatures in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        targetFeatures - The list of features to be added. The features must be of the same type.
        Returns:
        The edited result.
      • deleteFeatures

        public EditResult deleteFeatures(java.lang.String datasourceName,
                                java.lang.String datasetName,
                                int[] ids)
        

        Deletes features from a specified dataset.

        Specified by:
        deleteFeatures in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        ids - The IDs of the features to be deleted.
        Returns:
        The edited result.
      • getFeature

        public java.util.List<Feature> getFeature(java.lang.String datasourceName,
                                         java.lang.String datasetName,
                                         Rectangle2D bounds,
                                         java.lang.String attributeFilter,
                                         java.lang.String[] fields)
        

        Gets the features that fall within a specified space and meet a certain attribute filter condition.

        Specified by:
        getFeature in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        bounds - The specified query bounds.
        attributeFilter - The attribute filter condition. For example, fieldValue < 100, name like '%Hotel%'
        fields - The array of fields to be returned. All the fields are returned if this parameter is null.
        Returns:
        The list of features.
      • updateFeatures

        public EditResult updateFeatures(java.lang.String datasourceName,
                                java.lang.String datasetName,
                                java.util.List<Feature> targetFeatures)
        

        Updates features in a specified dataset.

        targetFeatures is used to set the expected features after update, of which the IDs should be identical with the IDs of the features to be updated. The update process is finding out the feature to be updated with the ID from the targetFeatures first, then updating the source feature with the targetFeature.

        Specified by:
        updateFeatures in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        targetFeatures - The list of new features whose IDs are the same with those of the features to be updated.
        Returns:
        The edited result.
      • clearFeatures

        public boolean clearFeatures(java.lang.String datasourceName,
                            java.lang.String datasetName)
        

        Clears the features in a specified dataset.

        Specified by:
        clearFeatures in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        Returns:
        true if the features are successfully cleared; false otherwise.
      • getFeature

        public java.util.List<Feature> getFeature(java.lang.String datasourceName,
                                         java.lang.String datasetName,
                                         int[] ids,
                                         java.lang.String[] fields)
        

        Gets features with specified IDs in a specified dataset.

        Specified by:
        getFeature in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        ids - The feature IDs.
        fields - The array of fields to be returned. All the fields are returned if this parameter is null.
        Returns:
        The list of features.
      • getFeature

        public java.util.List<Feature> getFeature(java.lang.String datasourceName,
                                         java.lang.String datasetName,
                                         Geometry geometry,
                                         double distance,
                                         java.lang.String attributeFilter,
                                         java.lang.String[] fields)
        

        Gets the features that fall within a buffer of a specified geometric object and meet a certain attribute filter condition.

        Specified by:
        getFeature in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        geometry - The geometric object.
        distance - The radius of the buffer.
        attributeFilter - The attribute filter condition. For example, fieldValue < 100, name like '%Hotel%'
        fields - The array of fields to be returned. All the fields are returned if this parameter is null.
        Returns:
        The list of features.
      • getFeature

        public java.util.List<Feature> getFeature(java.lang.String datasourceName,
                                         java.lang.String datasetName,
                                         Geometry geometry,
                                         SpatialQueryMode spatialQueryMode,
                                         java.lang.String attributeFilter,
                                         java.lang.String[] fields)
        

        Gets the features that satisfy certain spatial query mode on a specified geometric object and meet a certain attribute filter condition.

        Specified by:
        getFeature in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        geometry - The geometric object.
        spatialQueryMode - The spatial query mode.
        attributeFilter - The attribute filter condition. For example, fieldValue < 100, name like '%Hotel%'
        fields - The array of fields to be returned. All the fields are returned if this parameter is null.
        Returns:
        The list of features.
      • getFeature

        public java.util.List<Feature> getFeature(java.lang.String datasourceName,
                                         QueryParameter queryParam)
        

        Gets features by a SQL query condition.

        Specified by:
        getFeature in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        queryParam - Query parameter.
        Returns:
        The list of features.
      • getFeature

        public java.util.List<Feature> getFeature(java.lang.String datasourceName,
                                         QueryParameter queryParam,
                                         int maxFeatures)
        

        Gets features by a SQL query condition.

        Specified by:
        getFeature in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        queryParam - Query parameter.
        maxFeatures - The maximum features to be returned.
        Returns:
        The list of features.
      • getFeature

        public java.util.List<Feature> getFeature(java.lang.String datasourceName,
                                         QueryParameter queryParam,
                                         int maxFeatures,
                                         int fromIndex,
                                         int toIndex)
        
      • getDatasourceInfos

        public java.util.List<DatasourceInfo> getDatasourceInfos()
        

        Gets information about all the datasources corresponding to the current data service provider.

        Specified by:
        getDatasourceInfos in interface DataProvider
        Returns:
        The list of datasource information.
      • getDatasourceInfo

        public DatasourceInfo getDatasourceInfo(java.lang.String datasourceName)
        

        Gets information about a specified datasource.

        Specified by:
        getDatasourceInfo in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        Returns:
        Datasource info.
      • updateDatasourceInfo

        public void updateDatasourceInfo(java.lang.String datasourceName,
                                DatasourceInfo newDatasourceInfo)
        

        Updates the original datasource info with new datasource info.

        Specified by:
        updateDatasourceInfo in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        newDatasourceInfo - The new datasource info.
      • getDatasetInfos

        public java.util.List<DatasetInfo> getDatasetInfos(java.lang.String datasourceName)
        

        Gets information about all the datasets in a specified datasource.

        Specified by:
        getDatasetInfos in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        Returns:
        The list of dataset information.
      • getDatasetInfo

        public DatasetInfo getDatasetInfo(java.lang.String datasourceName,
                                 java.lang.String datasetName)
        

        Gets the information of a specified dataset in a given datasource.

        Specified by:
        getDatasetInfo in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        Returns:
        The dataset information.
      • updateDatasetInfo

        public void updateDatasetInfo(java.lang.String datasourceName,
                             java.lang.String datasetName,
                             DatasetInfo newDatasetInfo)
        

        Updates information about a specified dataset in a given datasource.

        Specified by:
        updateDatasetInfo in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The name of the dataset to be updated.
        newDatasetInfo - The dataset information.
      • getDomainInfos

        public java.util.List<DomainInfo> getDomainInfos(java.lang.String datasourceName,
                                                java.lang.String datasetName)
        

        Gets the domain info of the specified dataset.

        Specified by:
        getDomainInfos in interface DataProvider
        Parameters:
        datasourceName - The datasource name.
        datasetName - The dataset name.
        Returns:
        The list of domain infos.
      • getFieldInfos

        public java.util.List<FieldInfo> getFieldInfos(java.lang.String datasourceName,
                                              java.lang.String datasetName)
        

        Get all the field info of the specified dataset.

        Specified by:
        getFieldInfos in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        Returns:
        Field info list.
      • updateFieldInfos

        public void updateFieldInfos(java.lang.String datasourceName,
                            java.lang.String datasetName,
                            java.util.List<FieldInfo> newFieldInfos)
        

        A field can be added, deleted, or modified by using this method.All the fields (except the SuperMap system fields) in a dataset are replaced with new fields.

        If SuperMap data are used, the alias of the SuperMap system fields cannot be updated.

        Specified by:
        updateFieldInfos in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        newFieldInfos - The new field information. If SuperMap data are used, the SuperMap system fields cannot be included in this information list.
      • statistic

        public double statistic(java.lang.String datasourceName,
                       java.lang.String datasetName,
                       int fieldIndex,
                       StatisticMode statisticMode)
        

        Calculates statistics on a specified field of a dataset based on a specified statistical mode.

        Specified by:
        statistic in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        fieldIndex - The field index.
        statisticMode - The statistical mode.
        Returns:
        The statistic result.
      • statistic

        public double statistic(java.lang.String datasourceName,
                       java.lang.String datasetName,
                       java.lang.String fieldName,
                       StatisticMode statisticMode)
        

        Calculates statistics on a specified field of a dataset based on a specified statistical mode.

        Specified by:
        statistic in interface DataProvider
        Parameters:
        datasourceName - The list of datasource names.
        datasetName - The dataset name.
        fieldName - The name of the specified field.
        statisticMode - The statistical mode.
        Returns:
        The statistic result.
      • sendCreateDatasetRequest

        protected java.lang.String sendCreateDatasetRequest(java.lang.String createDatasetUrl,
                                                DatasetInfo datasetInfo)
        
      • sendDeleteDatasetRequest

        protected void sendDeleteDatasetRequest(java.lang.String url)
        
      • sendCopyDatasetRequest

        protected void sendCopyDatasetRequest(java.lang.String connection,
                                  java.lang.String srcDatasourceName,
                                  java.lang.String srcDatasetName,
                                  java.lang.String destDatasetName)
        
      • sendAddFeaturesRequest

        protected java.lang.String sendAddFeaturesRequest(java.lang.String url,
                                              java.util.List<Feature> targetFeatures)
        
      • sendDeleteFeaturesRequest

        protected void sendDeleteFeaturesRequest(java.lang.String url)
        
      • sendDeleteFeaturesRequest

        protected java.lang.String sendDeleteFeaturesRequest(java.lang.String url,
                                                 java.lang.String text)
        
        Rewrites the sendDeleteFeaturesRequest method, using POST method to simulate DELET to solve the problem calling clearFeature interface wrongly.
      • sendUpdateFeaturesRequest

        protected void sendUpdateFeaturesRequest(java.lang.String url,
                                     java.util.List<Feature> targetFeatures)
        
      • sendupdateDatasourceInfoRequest

        protected void sendupdateDatasourceInfoRequest(java.lang.String url,
                                           DatasourceInfo newDatasourceInfo)
        
      • sendGetupdateDatasetInfoRequest

        protected void sendGetupdateDatasetInfoRequest(java.lang.String url)
        
      • sendupdateDatasetInfoRequest

        protected void sendupdateDatasetInfoRequest(java.lang.String url,
                                        DatasetInfo newDatasetInfo)
        
      • deleteFeatures

        public EditResult deleteFeatures(java.lang.String datasourceName,
                                QueryParameter parameters)
        
        Description copied from interface: DataProvider

        Specifies the data source to remove the feature via sql.

        Specified by:
        deleteFeatures in interface DataProvider
        Parameters:
        datasourceName - the name of the datasource.
        parameters - Query parameter.
        Returns:
        Edits the results.
      • getDatasetNames

        public java.util.List<java.lang.String> getDatasetNames(java.lang.String datasourceName)
        
        Description copied from interface: DataProvider

        Gets all dataset names for the current data source.

        Specified by:
        getDatasetNames in interface DataProvider
        Parameters:
        datasourceName - the data source name.
        Returns:
        A list of dataset names.
      • getFeature

        public java.util.List<Feature> getFeature(java.lang.String datasourceName,
                                         java.lang.String datasetName,
                                         int[] ids,
                                         java.lang.String[] fields,
                                         int fromIndex,
                                         int toIndex)
        
        Description copied from interface: DataProvider

        Gets the feature in the specified data set according to the specified feature ID in the way of supporting paging.

        Specified by:
        getFeature in interface DataProvider
        Parameters:
        datasourceName - the name of the datasource.
        datasetName - the dataset name.
        ids - Feature ID.
        fields - An array of fields to be returned. When the parameter is null, all fields are returned.
        fromIndex - The minimum index number for the result of the paging
        toIndex - The maximum index number for the result of the paging
        Returns:
        Feature lists.