com.supermap.services

Class DataUploadService



  • public class DataUploadService
    extends ServiceBase
    Data upload class, used to upload local data to iServer. Users need to set related callback setResponseCallback, which can get the operation result and server response, etc.
    • Constructor Summary

      Constructors 
      Constructor and Description
      DataUploadService(java.lang.String url)
      Create a new DataUploadService object according to the given url.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addDataset(java.lang.String fullUrl, java.lang.String datasetName, DatasetType datasetType)
      Adds the dataset to the specified datasource.
      void addDataset(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName, DatasetType datasetType)
      Add dataset according to the given dataset name and data type.
      void addDataset(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String destDatasetName, java.lang.String srcDatasourceName, java.lang.String srcDatasetName)
      Add dataset to the server by copy the specified dataset in a specified datasource.
      void addFeature(java.lang.String fullUrl, Feature feature)
      Adds the objects to the specified data address.
      void addFeature(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName, Feature feature)
      Add objects to iServer.
      void addRecordset(java.lang.String fullUrl, Recordset recordset)
      Adds the recordset to the specified data address.
      boolean addRecordset(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName, Recordset recordset)
      Add recordset to the given dataset in the given datasource in given server.
      void commitDataset(java.lang.String urlDataset, DatasetVector dataset)
      Submit the data that are modified, deleted and added in local dataset to the corresponding dataset.
      void deleteDataset(java.lang.String fullUrl)
      Delete dataset.
      void deleteDataset(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName)
      Delete dataset.
      void deleteFeature(java.lang.String featureUri)
      Delete the objects in iServer according to the given feature uri.
      void deleteFeature(java.lang.String fullUrl, int[] featureIDs)
      Deletes the objects in the specified data service address.
      void deleteFeature(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName, int[] featureIDs)
      Delete the objects in iServer according to the given ID array.
      void modifyFeature(java.lang.String fullUrl, int featureID, Feature feature)
      Modifies the objects in the specified address.
      void modifyFeature(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName, int featureID, Feature feature)
      Edit object when the given ID.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DataUploadService

        public DataUploadService(java.lang.String url)
        Create a new DataUploadService object according to the given url.
        Parameters:
        url - specified url address.
    • Method Detail

      • addFeature

        public void addFeature(java.lang.String serviceName,
                               java.lang.String datasourceName,
                               java.lang.String datasetName,
                               Feature feature)
        Add objects to iServer.
        Parameters:
        serviceName - service name.
        datasourceName - datasource name.
        datasetName - dataset name.
        feature - add objects.
        Example:
        The following codes show how to upload the data to the server.
         public void UpService() {
                                //Example URL: http://192.168.170.59:8090/iserver/services/data-testmap/rest/data/datasources/testmap/datasets/point
                                DataUploadService uploadService = new DataUploadService("http://192.168.170.59:8090");
                                String serviceName = "data-testmap/rest";
                                String datasourceName = "testmap";
                                String datasetName = "point";
                                uploadService.setResponseCallback(new ResponseCallback() {
                                        
                                        @Override
                                        public void requestSuccess() {
                                                // TODO Auto-generated method stub
                                                System.out.println("Request Success");  
                                        }
                                        
                                        @Override
                                        public void requestFailed(String arg0) {
                                                // TODO Auto-generated method stub
                                                System.out.println("Request Failed");
                                        }
                                        
                                        @Override
                                        public void receiveResponse(FeatureSet featureSet) {
                                                // TODO Auto-generated method stub
                                                System.out.println("Receive Response");
                                        }
                                });
                                String[] fieldNames = {"Name4","Name6"};
                                String[] fieldValues = {"Name4","Name6"};
                                GeoPoint geopoint = new GeoPoint();
                                Feature feature = new Feature(fieldNames, fieldValues, geopoint);
                                uploadService.addFeature(serviceName, datasourceName, datasetName, feature);
            }
         
      • addFeature

        public void addFeature(java.lang.String fullUrl,
                               Feature feature)
        Adds the objects to the specified data address.
        Parameters:
        fullUrl - The specified data service address. e.g., http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes
        feature - The object to be added.
      • deleteFeature

        public void deleteFeature(java.lang.String serviceName,
                                  java.lang.String datasourceName,
                                  java.lang.String datasetName,
                                  int[] featureIDs)
        Delete the objects in iServer according to the given ID array.
        Parameters:
        serviceName - service name.
        datasourceName - datasource name.
        datasetName - dataset name.
        featureIDs - Object ID array.
      • deleteFeature

        public void deleteFeature(java.lang.String fullUrl,
                                  int[] featureIDs)
        Deletes the objects in the specified data service address.
        Parameters:
        fullUrl - The specified data service address. e.g., http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes
        featureIDs - Object ID array.
      • deleteFeature

        public void deleteFeature(java.lang.String featureUri)
        Delete the objects in iServer according to the given feature uri.
        Parameters:
        featureUri - The specified resource locator.
      • modifyFeature

        public void modifyFeature(java.lang.String serviceName,
                                  java.lang.String datasourceName,
                                  java.lang.String datasetName,
                                  int featureID,
                                  Feature feature)
        Edit object when the given ID.
        Parameters:
        serviceName - service name.
        datasourceName - datasource name.
        datasetName - dataset name.
        featureID - Object ID to be modified.
        feature - result objects.
      • modifyFeature

        public void modifyFeature(java.lang.String fullUrl,
                                  int featureID,
                                  Feature feature)
        Modifies the objects in the specified address.
        Parameters:
        fullUrl - The object service url to be modified. e.g., http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes.
        featureID - Object ID to be modified.
        feature - Modified value.
      • addRecordset

        public boolean addRecordset(java.lang.String serviceName,
                                    java.lang.String datasourceName,
                                    java.lang.String datasetName,
                                    Recordset recordset)
        Add recordset to the given dataset in the given datasource in given server.
        Parameters:
        serviceName - service name.
        datasourceName - datasource name.
        datasetName - dataset name.
        recordset - The recordset to be added.
        Returns:
        A boolean, Indicates whether the recordset is added successfully, return true if added successfully,Otherwise it returns false.
      • addRecordset

        public void addRecordset(java.lang.String fullUrl,
                                 Recordset recordset)
        Adds the recordset to the specified data address.
        Parameters:
        fullUrl - The specified data service address. e.g., http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes.
        recordset - The recordsets to be added.
      • addDataset

        public void addDataset(java.lang.String serviceName,
                               java.lang.String datasourceName,
                               java.lang.String datasetName,
                               DatasetType datasetType)
        Add dataset according to the given dataset name and data type.
        Parameters:
        serviceName - service name.
        datasourceName - datasource name.
        datasetName - dataset name.
        datasetType - dataset type.
      • addDataset

        public void addDataset(java.lang.String serviceName,
                               java.lang.String datasourceName,
                               java.lang.String destDatasetName,
                               java.lang.String srcDatasourceName,
                               java.lang.String srcDatasetName)
        Add dataset to the server by copy the specified dataset in a specified datasource.
        Parameters:
        serviceName - service name.
        datasourceName - datasource name.
        destDatasetName - destdataset name.
        srcDatasourceName - srcdatasource name.
        srcDatasetName - srcdataset name.
      • addDataset

        public void addDataset(java.lang.String fullUrl,
                               java.lang.String datasetName,
                               DatasetType datasetType)
        Adds the dataset to the specified datasource.
        Parameters:
        fullUrl - The specified datasource address. e.g., http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World.
        datasetName - dataset name.
        datasetType - dataset type.
      • deleteDataset

        public void deleteDataset(java.lang.String serviceName,
                                  java.lang.String datasourceName,
                                  java.lang.String datasetName)
        Delete dataset.
        Parameters:
        serviceName - service name.
        datasourceName - datasource name.
        datasetName - dataset name.
      • deleteDataset

        public void deleteDataset(java.lang.String fullUrl)
        Delete dataset.
        Parameters:
        fullUrl - The dataset url to be deleted. e.g., http://192.168.120.1:8090/iserver/services/data-world/rest/data/datasources/World/datasets/Lakes.
      • commitDataset

        public void commitDataset(java.lang.String urlDataset,
                                  DatasetVector dataset)
        Submit the data that are modified, deleted and added in local dataset to the corresponding dataset. It requires that the local and server have this dataset and the corresponding attributes. At the same time, the local dataset version can not higher than the server version (local Max[SmUserID] can not larger than server Max[SMID]), or can not be submitted. Now the dataset suports point, line and region datasets. If faild to submit, it will call the requestFaild () method in ResponseCallback; If successsful, it will call requestSuccess() method.
        Parameters:
        urlDataset - The address of the dataset is on the server.
        dataset - Local dataset, which can be a point, line, or region dataset.

        urlDataset example: http://192.168.0.131:8090/iserver/services/data-changchun/rest/data/datasources/Changchun/datasets/Edit_Line.