Editor tracking

The ArcGIS Runtime SDK for Java supports the tracking of edits made to features. Editor tracking records:

A feature service which has edit tracking capabilities has 'Edit Fields Info' about the layer which matches the four properties above to a field name from the layer's 'Fields'. When the layer is initialized in a Java map application, this information is obtained from the service and can be queried from the initialized layer as in the code snippet below:

querying a feature layer's EditFieldsInfo

featureLayer.addLayerInitializeCompleteListener(new LayerInitializeCompleteListener() {
 public void layerInitializeComplete(LayerInitializeCompleteEvent e) {
  // get the EditFieldsInfo from the initialized feature layer
  EditFieldsInfo efinfo = featureLayer.getEditFieldsInfo();
  // the relevant editor tracking field names can be obtained/stored as below
  String creatorField = efinfo.getCreatorField();
  String creationDateField = efinfo.getCreationDateField();
  String editorField = efinfo.getEditorField();
  String editDateField = efinfo.getEditDateField();

In a secure feature service, meaning one which you can only access with a username and password, the relevant editor tracking fields will be populated automatically, with the editor and/or creator field matching the username. If no authenticated user is provided and anonymous access is enabled on the feature service, the creator and editor fields are left set to null. When you edit a feature in your Java application and apply the edits to the server, the time at which you have created or edited the feature gets stored in the relevant field.

Ownership-based access can be enabled on a feature service to for example limit the ability of users to update or delete features they did not create. For a given user and a given graphic, you can programatically have access to whether this user can create, update, or delete the graphic. You can then incorporate this into your editing workflow if desired. An example workflow is shown in the code below:

// user accesses the secure feature service as 'user1'
UserCredentials credentials = new UserCredentials();
credentials.setUserAccount("user1", password);

//Supply the credentials when you create the ArcGISFeatureLayer
ArcGISFeatureLayer featureLayer = new ArcGISFeatureLayer(

// Control the editing environment. For example, 'user1' selects 'graphic' via a mouse-click to delete it

if (featureLayer.getEditCapabilities(graphic).isDelete()) {
	// 'user1' is allowed to delete this graphic so delete the graphic
} else {
	// 'user1' is not allowed to delete this graphic so inform user of this restriction

To see edit tracking in action, please have a look at the interactive 'Editor Tracking' sample in the Java Sample Application, under the table of content heading 'Editing'.