Class ServiceFeatureTable

    • Constructor Detail

      • ServiceFeatureTable

        public ServiceFeatureTable​(ServiceFeatureTable table,
                                   RelationshipInfo relationshipInfo)
        Creates a ServiceFeatureTable instance that relates to the given table based on the given relationship info.
        Parameters:
        table - the related table
        relationshipInfo - the relationship info defining the relationship between this new table and the given table
        Throws:
        IllegalArgumentException - if table or relationshipInfo are null
        Since:
        100.1.0
      • ServiceFeatureTable

        public ServiceFeatureTable​(PortalItem portalItem,
                                   long layerId)
        Creates a new service feature table instance from a feature service portal item.
        Parameters:
        portalItem - a feature service portal item
        layerId - the layer ID to use
        Throws:
        IllegalArgumentException - if portalItem is null
        Since:
        100.3.0
    • Method Detail

      • getUri

        public String getUri()
        Returns the URL used to create the table.
        Specified by:
        getUri in interface RemoteResource
        Returns:
        the URL used to create the table.
        Since:
        100.0.0
      • setRequestConfiguration

        public void setRequestConfiguration​(RequestConfiguration requestConfiguration)
        Sets configuration parameters used for network requests sent using this table object. The global RequestConfiguration is used if no RequestConfiguration is set or null is set
        Specified by:
        setRequestConfiguration in interface RemoteResource
        Parameters:
        requestConfiguration - object containing the parameters to use
        Since:
        100.0.0
      • getRequestConfiguration

        public RequestConfiguration getRequestConfiguration()
        Gets the RequestConfiguration object in use by this table. If null is returned, then that indicates that the global RequestConfiguration is used instead.
        Specified by:
        getRequestConfiguration in interface RemoteResource
        Returns:
        the RequestConfiguration object or null if none has been set
        Since:
        100.0.0
        See Also:
        RequestConfiguration
      • setCredential

        public void setCredential​(Credential credential)
        Sets the credential used to authenticate the user with the service feature table.
        Specified by:
        setCredential in interface RemoteResource
        Parameters:
        credential - the credential used to authenticate the user with the service feature table
        Since:
        100.0.0
      • getCredential

        public Credential getCredential()
        Gets the credential used to authenticate the user with the service feature table.
        Specified by:
        getCredential in interface RemoteResource
        Returns:
        the credential used to authenticate the user with the service feature table
        Since:
        100.0.0
      • getBufferFactor

        public double getBufferFactor()
        Gets the buffer factor.
        Returns:
        the buffer factor
        Since:
        100.0.0
        See Also:
        setBufferFactor(double)
      • setBufferFactor

        public void setBufferFactor​(double bufferFactor)
        Sets the factor used to calculate a buffered extent, within which features are automatically fetched and cached, if the FeatureRequestMode of the table is ON_INTERACTION_CACHE. By default it is 2.0 (two times the visible extent) The buffered extent is calculated as:
         
         width = bufferFactor : extent.width; 
         height = bufferFactor : extent.height;
         
         
        Since:
        100.0.0
      • getExtent

        public Envelope getExtent()
        Returns the extent that the table represents, this can be used to determine the extent within which data can be edited. ServiceFeatureTables in manual cache mode will return the extent of the features which have been cached, all other modes will return the extent of the layer/table defined by the service (from ArcGISFeatureLayerInfo.getExtent().
        Overrides:
        getExtent in class FeatureTable
        Returns:
        the extent
        Since:
        100.0.0
      • applyEditsAsync

        public ListenableFuture<List<FeatureEditResult>> applyEditsAsync()
        Applies edits that have been added to this table including attachment edits in one call. This returns edit results for each features, each result includes attachment results for that feature.
        Returns:
        a ListenableFuture representing the resulting list of edit results and indicating if the operation isDone(); also allows cancellation. Calling get() on the returned future may throw an ExecutionException with its cause set to IOException if a network request fails
        Since:
        100.0.0
      • clearCache

        public void clearCache​(boolean keepLocalEdits)
        Clears all the features in the local table. Caches will only exist in certain modes.
        Parameters:
        keepLocalEdits - true, if edited rows in the table should not be cleared, otherwise false
        Since:
        100.0.0
      • populateFromServiceAsync

        public ListenableFuture<FeatureQueryResult> populateFromServiceAsync​(QueryParameters query,
                                                                             boolean clearCache,
                                                                             Iterable<String> outFields)
        Executes an asynchronous method that populates the table with the results of a query. The table must be in ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE mode.
        Parameters:
        query - the query to execute
        clearCache - true if this table should be cleared when this method is called, false if the result of the query should be appended to this table
        outFields - the names of the fields to be populated or "*" for all fields
        Returns:
        a ListenableFuture represents the result of the query; the results will replace or be appended to this table. The ListenableFuture indicates if the query isDone(); also allows cancellation. Calling get() on the returned future may throw an ExecutionException with its cause set to IOException if a network request fails
        Throws:
        IllegalArgumentException - if the input is null
        ArcGISRuntimeException - if the query execution failed
        IllegalStateException - if the feature request mode is not MANUAL_CACHE
        Since:
        100.0.0
      • queryFeaturesAsync

        public ListenableFuture<FeatureQueryResult> queryFeaturesAsync​(QueryParameters query)
        Queries features from this table's cache and/or from the service used to create this table. If the FeatureRequestMode is MANUAL_CACHE then the query will always be performed locally. If the FeatureRequestMode is ON_INTERACTION_CACHE then queries that contain geometries which are within an extent that has been cached will be performed locally, otherwise they will be performed on the server. If the FeatureRequestMode is ON_INTERACTION_NOCACHE the query will always be performed on the server.
        Overrides:
        queryFeaturesAsync in class FeatureTable
        Parameters:
        query - query parameters to be used
        Returns:
        a ListenableFuture represents the result of the query. The ListenableFuture indicates if the query isDone(); also allows cancellation. Calling get() on the returned future may throw an ExecutionException with its cause set to IOException if a network request fails
        Throws:
        ArcGISRuntimeException - if the query execution failed
        Since:
        100.0.0
      • queryFeaturesAsync

        public ListenableFuture<FeatureQueryResult> queryFeaturesAsync​(QueryParameters queryParameters,
                                                                       ServiceFeatureTable.QueryFeatureFields queryFields)
        Queries features from this table's cache and/or from the service used to create this table.
        • This method does not need to be used if the table is in MANUAL_CACHE mode as the query will be performed locally and features will be returned fully loaded.
        • If the FeatureRequestMode is ON_INTERACTION_CACHE queries that only contain geometries which are within an extent that has been cached will be performed locally, otherwise they will be requested from the server.
        • If the FeatureRequestMode is ON_INTERACTION_NOCACHE the query will always be requested from the server. If the feature is to be edited or the attributes are shown in a UI (e.g. Popup) they should be loaded first.
        Note: for ServiceFeatureTable.QueryFeatureFields.MINIMUM and ServiceFeatureTable.QueryFeatureFields.IDS_ONLY only the minimum set of fields are queried, additional information is returned when features are loaded.
        Parameters:
        queryParameters - query parameters to be used
        queryFields - specifies what fields will be populated on returned Features
        Returns:
        a ListenableFuture representing the result of the query. The ListenableFuture indicates if the query operation isDone(); also allows cancellation. Calling get() on the returned future may throw an ExecutionException with its cause set to IOException if a network request fails
        Throws:
        IllegalArgumentException - if the queryParameters or queryFields are null
        Since:
        100.0.0
      • queryRelatedFeaturesAsync

        public ListenableFuture<List<RelatedFeatureQueryResult>> queryRelatedFeaturesAsync​(ArcGISFeature feature,
                                                                                           RelatedQueryParameters relatedQueryParameters,
                                                                                           ServiceFeatureTable.QueryFeatureFields queryFields)
        Asynchronously queries for features related to the given ArcGISFeature and using the given RelatedQueryParameters. Only returns results from tables that have been added to same ArcGISMap as this table. As there can be more than one instance of the same table or layer on the map with different scale level visibility, definition expression, and so on, a list of results are returned. In such cases, results from all instances are returned, one per related table containing features related to the queried feature, and RelatedFeatureQueryResult.getRelatedTable() is used to distinguish between them.
        • This method does not need to be used if the table is in MANUAL_CACHE mode as the query will be performed locally and features will be returned fully loaded.
        • If the FeatureRequestMode is ON_INTERACTION_CACHE queries that only contain geometries which are within an extent that has been cached will be performed locally, otherwise they will be requested from the server.
        • If the FeatureRequestMode is ON_INTERACTION_NOCACHE the query will always be requested from the server. If the feature is to be edited or the attributes are shown in a UI (e.g. Popup) they should be loaded first.
        Note: for ServiceFeatureTable.QueryFeatureFields.MINIMUM and ServiceFeatureTable.QueryFeatureFields.IDS_ONLY only the minimum set of fields are queried, additional information is returned when features are loaded.
        Parameters:
        feature - feature for which to query related features
        relatedQueryParameters - related query parameters to be used
        queryFields - specifies what fields will be populated on returned Features
        Returns:
        a ListenableFuture representing the resulting list of RelatedFeatureQueryResults and indicating if the query operation isDone(); also allows cancellation. Calling get() on the returned future may throw an ExecutionException with its cause set to IOException if a network request fails
        Throws:
        IllegalArgumentException - if the feature, relatedQueryParameters, or queryFields are null
        Since:
        100.1.0
      • setDefinitionExpression

        public void setDefinitionExpression​(String definitionExpression)
        Sets a definition expression which is a SQL statement where clause to filter out the features to be queried. Once a valid definition expression is set, it will be applied in the all subsequent queries. The FeatureLayer being created from the service table will inherit the same definition expression. Any changes applied on the definition expression of the feature layer is immediately applied to the table and vice versa. In the ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE mode, the definition expression will be appended to the QueryParameters' where clause when populateFromServiceAsync(QueryParameters, boolean, Iterable) is called.
        Parameters:
        definitionExpression - an expression which is a SQL statement where clause to filter out the features to be queried, it can be null
        Since:
        100.2.0
        See Also:
        FeatureLayer.setDefinitionExpression(String)
      • getDefinitionExpression

        public String getDefinitionExpression()
        Gets the definition expression for filtering the features queried in this table.
        Returns:
        the definition expression for filtering the features queried in this table; or empty if it is set to null
        Since:
        100.2.0
      • getGeodatabaseVersion

        public String getGeodatabaseVersion()
        Gets the geodatabase version.
        Returns:
        the geodatabase version, or an empty string if there is no version
        Since:
        100.3.0
      • setGeodatabaseVersion

        public void setGeodatabaseVersion​(String version)
        Sets the geodatabase version.
        Parameters:
        version - the version, can be null or empty
        Since:
        100.3.0
      • getItem

        public Item getItem()
        Gets the item associated with this table.
        Returns:
        the associated item or null if there is no associated item
        Since:
        100.3.0
      • undoLocalEditsAsync

        public ListenableFuture<Void> undoLocalEditsAsync()
        Undoes all of the local edits since the last server acknowledgement.
        Returns:
        a ListenableFuture to undo all of the local edits asynchronously. Add a listener to the Future to know when the task is done.
        Since:
        100.3.0
      • loadOrRefreshFeaturesAsync

        public ListenableFuture<Void> loadOrRefreshFeaturesAsync​(Iterable<Feature> features)
        Loads all attributes and geometries for unloaded features, and refetches attributes and geometry from already-loaded features. In the latter case, Geometries previously retrieved from features may be out of date and Feature.getGeometry() needs to be called again to get the correct Geometry.

        This method will not refresh feature attachments. Use ArcGISFeature.fetchAttachmentsAsync() to retrieve attachments.

        This method makes network requests in order to fetch the data from the remote service.

        Parameters:
        features - the features to be reloaded or refetched
        Returns:
        a ListenableFuture to reload or refetch the features asynchronously. Add a listener to the Future to know when the task is done.
        Throws:
        IllegalArgumentException - if features is null
        Since:
        100.3.0