Class ServiceFeatureTable

    • Constructor Detail

      • ServiceFeatureTable

        public ServiceFeatureTable​(java.lang.String uri)
        Creates a new service feature table object from a given URI. To use a request configuration, call setRequestConfiguration(com.esri.arcgisruntime.io.RequestConfiguration) after this constructor and before loading this table. To use a credential, call setCredential(Credential) after this constructor and before loading this table.
        Parameters:
        uri - the URI of an individual layer or table in an ArcGIS map or feature service
        Throws:
        java.lang.IllegalArgumentException - if uri is null or empty
        Since:
        100.0.0
      • ServiceFeatureTable

        public ServiceFeatureTable​(ServiceFeatureTable table,
                                   RelationshipInfo relationshipInfo)
        Creates a ServiceFeatureTable instance that relates to the given table based on the given relationship information.
        Parameters:
        table - the related table
        relationshipInfo - the relationship information defining the relationship between this new table and the given table
        Throws:
        java.lang.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 - an ArcGIS feature service PortalItem
        layerId - the layer id of an individual layer in the ArcGIS feature service represented by the PortalItem
        Throws:
        java.lang.IllegalArgumentException - if portalItem is null
        Since:
        100.3.0
      • ServiceFeatureTable

        public ServiceFeatureTable​(PortalItem portalItem)
        Creates a new service feature table object from an ArcGIS feature service or feature layer portal item.

        If the portal item is a feature service, the ServiceFeatureTable will be created from the first layer on the service. If the portal item is a feature layer, the ServiceFeatureTable will be created from the feature layer.

        Parameters:
        portalItem - an ArcGIS feature service or feature layer PortalItem
        Throws:
        java.lang.IllegalArgumentException - if portalItem is null
        Since:
        100.14.0
        See Also:
        getItem()
    • Method Detail

      • getUri

        public java.lang.String getUri()
        Returns the URI used to create the table.
        Specified by:
        getUri in interface RemoteResource
        Returns:
        the URI 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 factor used to calculate a buffered extent around the current visible area when requesting features from a service.

        New features are requested from the service if the visible area of the MapView exceeds the buffered extent. A change in the visible area can result from any user interaction with the MapView, such as a pan or zoom action. The buffer factor is applied when the ServiceFeatureTable.FeatureRequestMode is in either ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE or ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_NO_CACHE.

        The default value is 2 (twice the current extent). The maximum value is 10. If it is set to 0 or 1, the buffered extent will equal the visible map area.

        Returns:
        the factor used to calculate a buffered extent around the current visible area when requesting features from a service
        Since:
        100.0.0
        See Also:
        setBufferFactor(double)
      • setBufferFactor

        public void setBufferFactor​(double bufferFactor)
        Sets the factor used to calculate a buffered extent around the current visible area when requesting features from a service.

        New features are requested from the service if the visible area of the MapView exceeds the buffered extent. A change in the visible area can result from any user interaction with the MapView, such as a pan or zoom action. The buffer factor is applied when the ServiceFeatureTable.FeatureRequestMode is in either ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE or ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_NO_CACHE.

        The maximum value is 10. If it is set to 0 or 1, the buffered extent will equal the visible map area.

        The buffered extent is calculated as:

         
         width = bufferFactor : extent.width; 
         height = bufferFactor : extent.height;
         
         
        Parameters:
        bufferFactor - the factor used to calculate a buffered extent around the current visible area when requesting features from a service
        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<java.util.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 geodatabase behavior (see below). If an edit on this table can cause an edit to another table due to geodatabase 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 geodatabase 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 you need to retain edits in the local cache
        Since:
        100.0.0
      • populateFromServiceAsync

        public ListenableFuture<FeatureQueryResult> populateFromServiceAsync​(QueryParameters query,
                                                                             boolean clearCache,
                                                                             java.lang.Iterable<java.lang.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.

        Specifying null or an empty List for outfields results in the minimum set of fields being used to populate the local table. This is the same set of fields described for ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE or ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_NO_CACHE.

        Parameters:
        query - options for controlling the operation
        clearCache - true, if you want to clear the local cache before populating the local table. False, if you want to append the features 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:
        java.lang.IllegalArgumentException - if the input is null
        ArcGISRuntimeException - if the query execution failed
        java.lang.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. The options are:

        Note that you can query any attribute defined by the feature service's table. If the attribute is not in the 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:
        java.lang.IllegalArgumentException - if the queryParameters or queryFields are null
        Since:
        100.0.0
      • queryRelatedFeaturesAsync

        public ListenableFuture<java.util.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:
        java.lang.IllegalArgumentException - if the feature, relatedQueryParameters, or queryFields are null
        Since:
        100.1.0
      • getDefinitionExpression

        public java.lang.String getDefinitionExpression()
        Gets an expression (SQL where clause) to filter 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 java.lang.String getGeodatabaseVersion()
        Gets the service geodatabase version name.

        This property is populated if the ServiceFeatureTable is provided by a layer or a table in a web map or if the ServiceFeatureTable is created using ServiceGeodatabase.getTable(long).

        The default geodatabase version has the string value "sde.DEFAULT".

        Returns:
        the service geodatabase version name
        Since:
        100.3.0
      • setGeodatabaseVersion

        public void setGeodatabaseVersion​(java.lang.String version)
        Sets the service geodatabase version name.
        Parameters:
        version - the service geodatabase version name
        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<java.lang.Void> undoLocalEditsAsync()
        Undoes all of the local edits since the last server acknowledgement.

        The ServiceFeatureTable.undoLocalEditsAsync() method is meant to be used for single table workflows or tables without geodatabase behavior (see below). If the service which the table belongs to has geodatabase behavior (see below), it is highly recommended to to use ServiceGeodatabase.undoLocalEditsAsync(). Undoing edits in one table can cause data inconsistencies between the local cache and the service if ServiceFeatureTable.undoLocalEditsAsync() is used.

        For example, when tables have a composite relationship, undoing only the origin feature would violate the composite relationship rule that an origin and destination feature must be either deleted together or not at all.

        Areas which have geodatabase behavior:

        • Composite relationships
        • Annotation feature layers
        • Utility network association deletion semantics
        • Attribute rules
        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<java.lang.Void> loadOrRefreshFeaturesAsync​(java.lang.Iterable<Feature> features)
        Loads all attributes and geometries for features that have not been loaded and fetches attributes and geometries for previously loaded features.

        Features returned from queryFeaturesAsync(QueryParameters, QueryFeatureFields) or queryRelatedFeaturesAsync(ArcGISFeature, RelatedQueryParameters, QueryFeatureFields) may 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.

        All features loaded or refreshed by this method will have m-values if defined by the service. Note that an m-value may be NaN.

        Parameters:
        features - the features to be loaded or refreshed
        Returns:
        a ListenableFuture to reload or refetch the features asynchronously. Add a listener to the Future to know when the task is done.
        Throws:
        java.lang.IllegalArgumentException - if features is null
        Since:
        100.3.0
      • getServiceGeodatabase

        public ServiceGeodatabase getServiceGeodatabase()
        Gets the ServiceGeodatabase this service feature table is part of.

        This property is populated if the ServiceFeatureTable is provided by a layer or a table in a web map or if the ServiceFeatureTable is created using ServiceGeodatabase.getTable(long).

        Returns:
        the ServiceGeodatabase this service feature table is part of, or null
        Since:
        100.9.0