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;
         
         
        Parameters:
        bufferFactor - the buffer factor to be used. Default is 2.0.
        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
        See Also:
        GeodatabaseFeatureTable
      • 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 feature, each result includes attachment results for that feature.

        Uploads any changes to the local table to the feature service.

        ServiceFeatureTable.applyEditsAsync() is meant to be used for single table workflows or tables without database behavior (see below). If an edit on this table can cause an edit to another table due to database behavior, it is highly recommended to use ServiceGeodatabase.applyEditsAsync() instead to prevent data inconsistency, so that dependent edits are all applied or none are (if an error occurs).

        For example, when tables have a composite relationship, applying the delete of a destination feature in a composite relationship deletion will only delete the destination feature on the server, therefore causing inconsistency in the data.

        Areas which have database behavior:

        • Composite relationships
        • Annotation feature layers
        • Utility network association deletion semantics
        • Attribute rules
        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)
        Queries the feature service and places the resulting features in the local table, which is cached for the duration of the session. The ServiceFeatureTable must have its ServiceFeatureTable.FeatureRequestMode set to ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE.

        This method is useful for non-geographic data. It's also helpful when you want to avoid accessing the service for a feature whose geometry is in the current extent of the map or scene.

        Parameters:
        query - options for controlling the operation
        clearCache - if true, then clearCache(boolean) will be called before populating the local table. If false, the resulting features will be appended to the local table.
        outFields - each string is the name of a field to be used when populating the cache. If the iterable contains the single element "*", then all fields will be used. If the ObjectID field string name is not provided as part of the iterable, no features will be returned for this method.
        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)
        Asynchronously 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)
        Asynchronously queries features from this table's cache and/or from the feature service used to create this table.

        If the request mode of the table is ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE, then the query is always performed on the local table.

        If the mode is ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE, then the query is performed on the local cache, provided that the geometries of the features are within an extent that has been cached; otherwise, the query is performed on the server.

        If the mode is ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_NO_CACHE, the query is always performed on the server.

        The ServiceFeatureTable.QueryFeatureFields constants control which fields will be included with the returned features.

        • A table whose feature request mode is MANUAL_CACHE contains all fields that you specified in the third parameter when calling populateFromServiceAsync(QueryParameters, boolean, Iterable<String>)
        • A table whose feature request mode is ON_INTERACTION_CACHE or ON_INTERACTION_NO_CACHE initially contains features with a minimum set of attribute required for rendering. You must load a feature to access all its attributes. The convenience constant ServiceFeatureTable.QueryFeatureFields.LOAD_ALL automatically loads the returned features into the local table, which makes all attributes available.
        Note that you can query on any attribute defined by the feature service's table. If the attribute is not in the minimum set of attributes in your local table, the query will be performed on the server.
        Parameters:
        queryParameters - options for controlling the operation.
        queryFields - options for controlling what fields are in the features of the query result
        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)
        Queries for related features in this service feature table using the provided parameters and query feature fields. See queryFeaturesAsync(QueryParameters, QueryFeatureFields) for more details.
        Parameters:
        feature - feature for which to query related features
        relatedQueryParameters - related query parameters to be used
        queryFields - enumeration indicating which fields to return from the query
        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
      • 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
        See Also:
        setDefinitionExpression(String)
      • 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
        See Also:
        ServiceFeatureTable(PortalItem, long)
      • 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 not loaded 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.

        Loads all attributes and geometries for unloaded features, and refetches attributes and geometries for previously loaded features. All features loaded or refreshed by this method will have m values if defined by the service. Note that an m value might be NaN.

        Features you get from queryFeaturesAsync(QueryParameters, QueryFeatureFields) or queryRelatedFeaturesAsync(ArcGISFeature, RelatedQueryParameters, QueryFeatureFields) might be in the minimally loaded state (minimum attributes required for rendering and no m values). To load all attributes, pass an Iterable of the Features to this method.

        Any feature requested, but not returned by the server will have its object id cleared (set to an invalid negative value) to indicate it is no longer associated with the service feature table.

        After calling this method, any non-applied edits on the table will be lost.

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

        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
      • getServiceGeodatabase

        public ServiceGeodatabase getServiceGeodatabase()
        Gets the ServiceGeodatabase this service feature table is part of.
        Returns:
        the ServiceGeodatabase this service feature table is part of, or null
        Since:
        100.9.0