Class ArcGISFeatureTable

java.lang.Object
com.esri.arcgisruntime.data.FeatureTable
com.esri.arcgisruntime.data.ArcGISFeatureTable
All Implemented Interfaces:
Loadable, PopupSource
Direct Known Subclasses:
GeodatabaseFeatureTable, ServiceFeatureTable

public abstract class ArcGISFeatureTable extends FeatureTable
A table of features that typically represent real-world objects created from an ArcGIS feature service or an ArcGIS geodatabase.

This is the base class for the ArcGIS specific feature tables GeodatabaseFeatureTable and ServiceFeatureTable. You can create instances of these subclasses using their constructors.

If FeatureTable.hasGeometry() is true, you can display the features in an ArcGISMap or ArcGISScene. To do this create a FeatureLayer from the feature table and add it to the map or scene's collection of operational layers (GeoModel.getOperationalLayers()). The ArcGISFeatureTable can also contain features that do not have a geometry (FeatureTable.hasGeometry() is false).

ArcGISFeatureTable provides methods for querying related features (for example, ArcGISFeatureTable.queryRelatedFeaturesAsync(ArcGISFeature)), and methods to create new features based on a FeatureSubtype or a FeatureTemplate.

Features from an ArcGISFeatureTable will be instances of the ArcGISFeature class, these have additional ArcGIS specific capabilities such as attachments. ArcGISFeatures implement loadable, see the ArcGISFeature class for full details.

Since:
100.0.0
See Also:
  • Method Details

    • getServiceLayerId

      public long getServiceLayerId()
      Returns the layer ID in the feature service that this table was created from.
      Returns:
      the ID
      Since:
      100.0.0
    • getEditableAttributeFields

      public List<Field> getEditableAttributeFields()
      Gets a list of fields for which attribute values are editable. Does not include the geometry field; use FeatureTable.canEditGeometry() to determine if the geometry of features is editable. Also does not include managed editor tracking fields which are edited by the internals of this API.
      Returns:
      an unmodifiable list of the editable attribute fields, null if there are none
      Since:
      100.0.0
      See Also:
    • getContingentValuesDefinition

      public ContingentValuesDefinition getContingentValuesDefinition()
      Gets the table's contingent values definition.

      The contingent values definition must be loaded after the table has loaded. If the list of field groups is empty after loading, then no contingent values are defined for this table.

      Returns:
      the table's contingent values definition
      Since:
      100.13.0
    • getContingentValues

      public ContingentValuesResult getContingentValues(ArcGISFeature feature, String field)
      Returns possible values for the specified field, in the context of defined contingencies.

      This method iterates over all the field groups that the input field participates in. For each, it looks at the input feature's field values for the other fields participating in that field group. Contingencies that are satisfied by the other fields are identified, and their values for the input field are aggregated. These are returned in a ContingentValuesResult, which contains a map of field group names to an list of ContingentValue objects accessed via ContingentValuesResult.getContingentValuesByFieldGroup(), specifying possible values for the input field that will satisfy a contingency in that field group. If the feature participates in multiple field groups and there are values that will satisfy all groups, they will be returned by ContingentValuesResult.getContingentValuesAllGroups().

      Parameters:
      feature - the feature
      field - the name of the field for which to get possible values
      Returns:
      a ContingentValuesResult
      Throws:
      IllegalArgumentException - if feature is null
      IllegalArgumentException - if field is null
      Since:
      100.13.0
    • getLayerInfo

      public ArcGISFeatureLayerInfo getLayerInfo()
      Gets the information about the source this dataset originates from.

      Explore the editing capabilities of this feature table with ArcGISFeatureLayerInfo.getCapabilities() or the editor tracked fields with ArcGISFeatureLayerInfo.getEditFieldsInfo().

      Returns:
      ArcGISFeatureLayerInfo object
      Since:
      100.0.0
    • getFeatureTemplates

      public List<FeatureTemplate> getFeatureTemplates()
      Returns the list of feature templates for this table.
      Returns:
      an unmodifiable list of feature templates
      Since:
      100.0.0
    • getFeatureType

      public FeatureType getFeatureType(String typeName)
      Gets the feature type. Feature types represent a class of features (also known as sub-types) that can exist in this table.
      Parameters:
      typeName - the name of the feature type. Names can be found by using getFeatureTypes() or can be viewed in the service definition for this table.
      Returns:
      the feature type
      Throws:
      IllegalArgumentException - if input is null
      ArcGISRuntimeException - if the input type name is not valid
      Since:
      100.0.0
    • getFeatureTypes

      public List<FeatureType> getFeatureTypes()
      Gets all the feature types. Feature types represent a class of features (also known as sub-types) that can exist in this table.
      Returns:
      an unmodifiable list of all feature types in the table
      Since:
      100.0.0
    • getGlobalIdField

      public String getGlobalIdField()
      Gets the name of the global ID field. Global IDs uniquely identify features; you will never find the same Global ID in any other table or database.
      Returns:
      the name of the global ID field
      Since:
      100.0.0
    • getObjectIdField

      public String getObjectIdField()
      Gets the name of the object ID field. Object IDs uniquely identify features within a table; you may find the same object ID in another table.
      Returns:
      the name of the object ID field.
      Since:
      100.0.0
    • getTypeIdField

      public String getTypeIdField()
      Gets the name of the type ID field. This field is used to define the FeatureType of a feature.
      Returns:
      the name of the type ID field.
      Since:
      100.0.0
    • validateContingencyConstraints

      public List<ContingencyConstraintViolation> validateContingencyConstraints(ArcGISFeature feature)
      Returns an unmodifiable list of contingency constraint violations based on the input feature. An empty list indicates that all contingencies associated with the feature are valid.
      Parameters:
      feature - the feature
      Returns:
      an list of ContingencyConstraintViolation
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.13.0
    • hasAttachments

      public boolean hasAttachments()
      True if the features in this table have attachments, false otherwise.
      Returns:
      true if the features in this table have attachments, false otherwise
      Since:
      100.0.0
    • createFeature

      public ArcGISFeature createFeature(FeatureTemplate template)
      Creates a feature from the given feature template.
      Parameters:
      template - template to be used
      Returns:
      a feature
      Throws:
      IllegalArgumentException - if template is null
      Since:
      100.0.0
    • createFeature

      public ArcGISFeature createFeature(FeatureTemplate template, Geometry geometry)
      Creates a feature from the given feature template and the given geometry.
      Parameters:
      template - template to be used
      geometry - geometry of the feature
      Returns:
      a feature
      Throws:
      IllegalArgumentException - if template is null
      Since:
      100.0.0
    • createFeature

      public ArcGISFeature createFeature(FeatureType type)
      Creates a feature from the given feature type; using the first FeatureTemplate contained in the given type.
      Parameters:
      type - type to be used
      Returns:
      a feature
      Throws:
      IllegalArgumentException - if type is null
      Since:
      100.0.0
    • createFeature

      public ArcGISFeature createFeature(FeatureType type, Geometry geometry)
      Creates a feature with the given feature type and geometry.
      Parameters:
      type - type to be used
      geometry - geometry of the feature
      Returns:
      a feature
      Throws:
      IllegalArgumentException - if type is null
      Since:
      100.0.0
    • createFeature

      public ArcGISFeature createFeature(FeatureSubtype featureSubtype)
      Creates a feature based on the given feature subtype.
      Parameters:
      featureSubtype - the FeatureSubtype
      Returns:
      an ArcGISFeature
      Throws:
      IllegalArgumentException - if featureSubtype is null
      Since:
      100.3.0
    • createFeature

      public ArcGISFeature createFeature(FeatureSubtype featureSubtype, Geometry geometry)
      Creates a feature based on the given feature subtype and with the given geometry.
      Parameters:
      featureSubtype - the FeatureSubtype to be used
      geometry - the geometry of the feature
      Returns:
      an ArcGISFeature
      Throws:
      IllegalArgumentException - if featureSubtype is null
      Since:
      100.3.0
    • getAddedFeaturesAsync

      public ListenableFuture<FeatureQueryResult> getAddedFeaturesAsync()
      Asynchronously gets the features added. Add a done listener to the returned listenable future to know when the result is ready. For ServiceFeatureTables the result is an iterable of features added but not applied, or not successfully applied, using ServiceFeatureTable.applyEditsAsync().

      For mobile geodatabases created by ArcGIS Pro, this method returns no features because there is no concept of syncing.

      Returns:
      The task object representing the asynchronous retrieval of features added since last sync. It is a listenable future that will contain the FeatureQueryResult.
      Since:
      100.0.0
    • getAddedFeaturesCountAsync

      public ListenableFuture<Long> getAddedFeaturesCountAsync()
      Asynchronously gets the number of features added. Add a done listener to the returned listenable future to know when the result is ready. For ServiceFeatureTables the result is a count of features added but not applied, or not successfully applied, using ServiceFeatureTable.applyEditsAsync().

      For mobile geodatabases created by ArcGIS Pro, this method returns 0 because there is no concept of syncing.

      Returns:
      The task object representing the asynchronous retrieval of features added since last sync. It is a listenable future that will contain the number of features added.
      Since:
      100.0.0
    • getUnknownJson

      public Map<String,Object> getUnknownJson()
      Gets unknown data from the source JSON.

      Unknown JSON is a Map of values not defined in the ArcGIS specification used to create this object but found in the source JSON. If the object is written back to JSON, any unknown JSON data is not persisted. The ArcGIS specification may be for a web map, web scene, REST API, and so on.

      Returns:
      an unmodifiable map with string keys and object values of unknown data from the source JSON
      Since:
      100.8.0
    • getUnsupportedJson

      public Map<String,Object> getUnsupportedJson()
      Gets unsupported data from the source JSON.

      Unsupported JSON is a Map of values defined in the ArcGIS specification used to create this object but not currently used in this API. If the object is written back to JSON, any unsupported JSON data is persisted. The ArcGIS specification may be from a web map, web scene, REST API, and so on.

      Returns:
      an unmodifiable map with string keys and object values of unsupported data from the source JSON
      Since:
      100.8.0
    • getUpdatedFeaturesAsync

      public ListenableFuture<FeatureQueryResult> getUpdatedFeaturesAsync()
      Asynchronously gets the features updated. Add a done listener to the returned listenable future to know when the result is ready. For ServiceFeatureTables the result is an iterable of features updated but not applied, or not successfully applied, using ServiceFeatureTable.applyEditsAsync().

      For mobile geodatabases created by ArcGIS Pro, this method returns no features because there is no concept of syncing.

      Returns:
      The task object representing the asynchronous retrieval of features updated since last sync. It is a listenable future that will contain the FeatureQueryResult.
      Since:
      100.0.0
    • getUpdatedFeaturesCountAsync

      public ListenableFuture<Long> getUpdatedFeaturesCountAsync()
      Asynchronously gets the number of features updated. Add a done listener to the returned listenable future to know when the result is ready. For ServiceFeatureTables the result is a count of features updated but not applied, or not successfully applied, using ServiceFeatureTable.applyEditsAsync().

      For mobile geodatabases created by ArcGIS Pro, this method returns 0 because there is no concept of syncing.

      Returns:
      The task object representing the asynchronous retrieval of features updated since last sync. It is a listenable future that will contain the number of features updated.
      Since:
      100.0.0
    • getDeletedFeaturesAsync

      public ListenableFuture<FeatureQueryResult> getDeletedFeaturesAsync()
      Asynchronously gets the features deleted. Add a done listener to the returned listenable future to know when the result is ready. For ServiceFeatureTables the result is an iterable of features deleted but not applied, or not successfully applied, using ServiceFeatureTable.applyEditsAsync().

      For mobile geodatabases created by ArcGIS Pro, this method returns no features because there is no concept of syncing.

      Returns:
      The task object representing the aasynchronous retrieval of features deleted since the last sync. A listenable future that will contain the FeatureQueryResult.
      Since:
      100.0.0
    • getDeletedFeaturesCountAsync

      public ListenableFuture<Long> getDeletedFeaturesCountAsync()
      Asynchronously gets the number of features deleted. Add a done listener to the returned listenable future to know when the result is ready. For ServiceFeatureTables the result is a count of features deleted but not applied, or not successfully applied, using ServiceFeatureTable.applyEditsAsync().

      For mobile geodatabases created by ArcGIS Pro, this method returns 0 because there is no concept of syncing.

      Returns:
      The task object representing the asynchronous retrieval of features deleted since the last sync. A listenable future that will contain the number of features deleted.
      Since:
      100.0.0
    • getFeatureTemplate

      public FeatureTemplate getFeatureTemplate(String templateName)
      Gets the feature template for the given name.
      Parameters:
      templateName - the name of the feature template
      Returns:
      the feature template
      Throws:
      IllegalArgumentException - if input is null
      Since:
      100.0.0
    • isUseAdvancedSymbology

      public boolean isUseAdvancedSymbology()
      Indicates whether the Feature table is using advanced symbology.
      Returns:
      true if the table is using advanced symbology, false otherwise
      Since:
      100.0.0
    • setUseAdvancedSymbology

      public void setUseAdvancedSymbology(boolean useAdvancedSymbology)
      Sets whether the Feature table will use the advanced symbology. This method should be called before loading the Feature table.
      Parameters:
      useAdvancedSymbology - true to use advanced symbology, false otherwise
      Since:
      100.0.0
    • getUsername

      public String getUsername()
      Gets the username of the feature table.

      The username is used for ownership-based access control (OBAC) and editor tracking purposes.

      Returns:
      the username of the feature table
      Since:
      200.0.0
    • getRelatedTables

      public List<ArcGISFeatureTable> getRelatedTables(RelationshipInfo relationshipInfo)
      Gets an unmodifiable list containing any instances of the table related to this table by the given RelationshipInfo. This is because more than one instance of the same table can be added to the map and all of these instances must be returned. Only returns tables that have been added to the same ArcGISMap as this table.
      Parameters:
      relationshipInfo - the RelationshipInfo defining the relationship
      Returns:
      an unmodifiable list of tables
      Throws:
      IllegalArgumentException - if relationshipInfo is null
      Since:
      100.1.0
    • getRelatedTables

      public List<ArcGISFeatureTable> getRelatedTables()
      Gets an unmodifiable list of tables related to this table. Only returns tables that have been added to the same ArcGISMap as this table.
      Returns:
      an unmodifiable list of tables
      Since:
      100.1.0
    • queryRelatedFeaturesAsync

      public ListenableFuture<List<RelatedFeatureQueryResult>> queryRelatedFeaturesAsync(ArcGISFeature feature)
      Asynchronously queries for features related to the given ArcGISFeature. Only returns results from tables that have been added to the 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.
      Parameters:
      feature - feature for which to query related features
      Returns:
      a ListenableFuture representing the query result and indicating if the result java.util.concurrent.Future.isDone(); also allows cancellation.
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.1.0
    • queryRelatedFeatureCountAsync

      public ListenableFuture<Long> queryRelatedFeatureCountAsync(ArcGISFeature feature)
      Performs an asynchronous query that returns the number of features related to the supplied feature.

      The query result can be obtained by calling get() on the ListenableFuture, which may also throw an exception if the operation fails.

      Parameters:
      feature - the feature which should be queried for the number of related features
      Returns:
      A task that represents the asynchronous query of related feature count. It is a ListenableFuture for tracking when the asynchronous operation is done and getting a Long value.
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.2.0
    • queryRelatedFeaturesAsync

      public ListenableFuture<List<RelatedFeatureQueryResult>> queryRelatedFeaturesAsync(ArcGISFeature feature, RelatedQueryParameters relatedQueryParameters)
      Asynchronously queries for features related to the given ArcGISFeature and using the given RelatedQueryParameters. Only returns results from tables that have been added to the 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.
      Parameters:
      feature - feature for which to query related features
      relatedQueryParameters - the related query parameters
      Returns:
      a ListenableFuture representing the query result and indicating if the result java.util.concurrent.Future.isDone(); also allows cancellation.
      Throws:
      IllegalArgumentException - if feature or relatedQueryParameters are null
      Since:
      100.1.0
    • queryRelatedFeatureCountAsync

      public ListenableFuture<Long> queryRelatedFeatureCountAsync(ArcGISFeature feature, RelatedQueryParameters relatedQueryParameters)
      Performs an asynchronous query that returns the number of features related to the supplied feature based on the parameters.

      The query result can be obtained by calling get() on the ListenableFuture, which may also throw an exception if the operation fails.

      Parameters:
      feature - feature for which to query related features
      relatedQueryParameters - the related query parameters
      Returns:
      A task that represents the asynchronous query of related feature count. It is a ListenableFuture for tracking when the asynchronous operation is done and getting a Long value.
      Throws:
      IllegalArgumentException - if feature or relatedQueryParameters is null
      Since:
      100.2.0
    • getFeatureSubtypes

      public List<FeatureSubtype> getFeatureSubtypes()
      Gets an unmodifiable list of FeatureSubtype for this table.
      Returns:
      an unmodifiable list of FeatureSubtype for this table
      Since:
      100.3.0
    • getDefaultSubtypeCode

      public Object getDefaultSubtypeCode()
      Gets default subtype code for this table.

      Subtypes are implemented by coded values, which are integers. Those integer values each represent a feature in the subtype. For example, the following codes in a subtype named RoadClass could represent valid classes in a feature class for streets:

      • 0 - Local Streets
      • 1 - Secondary Streets
      • 2 - Main Streets
      If the Main Streets feature subtype is defined as the default, the Integer 2 will be returned as the default code.
      Returns:
      the table's default subtype code or null if no default subtype feature is defined
      Since:
      100.3.0
    • getSubtypeField

      public String getSubtypeField()
      Gets the name of this table's subtype field.
      Returns:
      the name of this table's subtype field or an empty string if the feature subtype is not defined
      Since:
      100.3.0
    • validateRelationshipConstraintsAsync

      public ListenableFuture<RelationshipConstraintViolation> validateRelationshipConstraintsAsync(ArcGISFeature feature)
      Checks for relationship violations that may exist with the given feature. The following are considered violations:
      • In a composite relationship, adding an orphan feature to the destination table without relating it to an origin feature.
      • Cardinality Violations:
        • In 1:1 relationships, if an origin feature is already related to a destination feature, relating another feature to either of them.
        • In 1:n relationships, relating a destination feature to more than one origin feature.

      To recover from an orphaned destination feature violation, simply relate it to a valid origin feature, using ArcGISFeature.relateFeature(ArcGISFeature) You can usually recover from a cardinality violation by removing the relationship between the appropriate features, using ArcGISFeature.unrelateFeature(ArcGISFeature).

      Note that edit operations do not error when there are constraint violations. This allows you to recover from violations in a back office operation after applying edits or syncing, if you choose to do so. See ArcGIS Desktop Validate Features process here.

      Note: This method makes network calls to query for the related features if they are not present locally.
      Parameters:
      feature - the feature to be checked
      Returns:
      A task that represents the asynchronous validation of relationship constraints operation.It is a ListenableFuture representing the validation result and indicating if the result java.util.concurrent.Future.isDone(); also allows cancellation.
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.1.0
    • hasLocalEdits

      public boolean hasLocalEdits()
      Gets whether the feature table has local edits.

      For ServiceFeatureTable, local edits are edits that have not yet been applied to the feature service. For GeodatabaseFeatureTable, local edits are edits that have been made since the last acknowledged upload. For mobile geodatabases created by ArcGIS Pro, this method returns false because there is no concept of uploading or applying edits. For mobile geodatabases, use GeodatabaseFeatureTable.hasLocalEditsSince(Calendar).

      Returns:
      true if the table has local edits, false otherwise
      Throws:
      ArcGISRuntimeException - if table is not change tracked
      Since:
      100.9.0
    • getLocalEditsAsync

      public ListenableFuture<LocalFeatureEditsResult> getLocalEditsAsync()
      Retrieves all the features that were added, updated or deleted since the last sync.

      Returns a result object containing a feature edit iterator. For mobile geodatabase created by ArcGIS Pro, the iterator in the result object is empty because there is no concept of syncing.

      Note that edits inside a transaction (between calls to Geodatabase.beginTransaction() and either Geodatabase.commitTransaction() or Geodatabase.rollbackTransaction()) share a common LocalFeatureEdit.getEditDateTime() and may not be returned in a consistent order.

      Returns:
      a LocalFeatureEditsResult containing an Iterator of LocalFeatureEdit objects
      Since:
      100.12.0
    • getLocalEditsCountAsync

      public ListenableFuture<Long> getLocalEditsCountAsync()
      Returns the number of features that were added, updated or deleted since the last sync.

      For mobile geodatabases created by ArcGIS Pro, this method returns a count of 0 because there is no concept of syncing.

      Returns:
      the number of features edited since the last sync
      Since:
      100.12.0