require(["esri/versionManagement/VersionManagementService"], (VersionManagementService) => { /* code goes here */ });
import VersionManagementService from "@arcgis/core/versionManagement/VersionManagementService.js";
esri/versionManagement/VersionManagementService
This class contains metadata about the version management service. The class can be constructed via a url to a version management service. The VersionManagementService grants users to plethora of functionality. The VersionManagementService contains methods for creating a new version, deleting a version, altering a version, changing a version on layers, start/stop reading, start/stop editing, reconciling, posting, and getting version infos. These methods simplify versioning on the api.
- See also
// Change the version of two FeatureLayers
const layer1 = await new FeatureLayer({
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/12"
});
const layer2 = await new FeatureLayer({
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/13"
});
const layers = [layer1, layer2];
versionManagementService.changeVersion(
layers,
{ name: "sde.DEFAULT", guid: "{13DEDC17-5867-4DBC-9855-0736C4C57162}"},
{ name: "admin.version", guid: "{422D1B63-D795-4478-A4B1-AD6109377074}"}
);
Constructors
-
new VersionManagementService(properties)
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Example// Create a Version Management Service from a url const versionManagementService = new VersionManagementService({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/VersionManagementServer" });
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
VersionManagementServiceCapabilities | Describes the version management service's supported capabilities. more details | VersionManagementService | |
VersionIdentifier | Contains the value for the default version's name and GUID. more details | VersionManagementService | |
Boolean | Indicates whether the instance has loaded. more details | VersionManagementService | |
Error | The Error object returned if an error occurred while loading. more details | VersionManagementService | |
String | Represents the status of a load operation. more details | VersionManagementService | |
String | The name of the version management service. more details | VersionManagementService | |
String | The absolute URL of the REST endpoint for the version management service. more details | VersionManagementService |
Property Details
-
capabilities VersionManagementServiceCapabilities
-
Describes the version management service's supported capabilities.
-
defaultVersionIdentifier VersionIdentifier
-
Contains the value for the default version's name and GUID.
-
loaded Booleanreadonly
-
Indicates whether the instance has loaded. When
true
, the properties of the object can be accessed. A WebMap is considered loaded when its layers and basemap are created, but not yet loaded.- Default Value:false
-
loadError Errorreadonly
-
The Error object returned if an error occurred while loading.
- Default Value:null
-
loadStatus Stringreadonly
-
Represents the status of a load operation.
Value Description not-loaded The object's resources have not loaded. loading The object's resources are currently loading. loaded The object's resources have loaded without errors. failed The object's resources failed to load. See loadError for more details. Possible Values:"not-loaded"|"loading"|"failed"|"loaded"
- Default Value:not-loaded
-
name String
-
The name of the version management service.
-
url String
-
The absolute URL of the REST endpoint for the version management service. The URL may either point to a resource on ArcGIS Enterprise or ArcGIS Online.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Promise<boolean> | The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions. more details | VersionManagementService | |
Promise<boolean> | Method used to change a layer's version/moment or network's version/moment. more details | VersionManagementService | |
Promise<VersionInfoExtendedJSON> | Creates a new version given the following parameters. more details | VersionManagementService | |
Promise<boolean> | Deletes a version given the following parameters. more details | VersionManagementService | |
String | Returns the current client lock type on a given version. more details | VersionManagementService | |
VersionIdentifier | This method will return the versionIdentifier given the guid of the version. more details | VersionManagementService | |
VersionIdentifier | This method will return the versionIdentifier given the name of the version. more details | VersionManagementService | |
Promise<VersionInfoJSON[]> | Returns information about a version or versions. more details | VersionManagementService | |
Promise<VersionInfoExtendedJSON> | Method used to get extended information about a version. more details | VersionManagementService | |
Promise | Triggers the loading of the version management service instance. more details | VersionManagementService | |
Promise<PostResult> | The Post operation allows the client to post the changes in their version to the default version. more details | VersionManagementService | |
Promise<ReconcileResult> | Use the reconcile operation to reconcile a branch version with the default version. more details | VersionManagementService | |
This method redos the last edit made while in an edit session. more details | VersionManagementService | ||
Promise<boolean> | Using the specified session ID an exclusive lock is obtained for the session on the version. more details | VersionManagementService | |
Promise<boolean> | Using the specified client generated session ID, a shared lock is obtained for the session if the version is not already being edited by another user/session. more details | VersionManagementService | |
Promise<boolean> | Using the specified session id, the exclusive lock for the version is downgraded to a shared lock. more details | VersionManagementService | |
Promise<boolean> | The shared lock is released on the version. more details | VersionManagementService | |
This method undos the last edit made while in an edit session. more details | VersionManagementService |
Method Details
-
The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions.
License
- This method requires the feature service and version management service to be published with ArcGIS Enterprise version 11.2 or higher.
- Organization members must be assigned a license for the ArcGIS Advanced Editing user type extension to use this method.
ParametersSpecificationversionIdentifier VersionIdentifierIdentifier for a version.
props ObjectContains properties that will be altered.
SpecificationownerName StringoptionalThe new owner name of the version.
versionName StringoptionalThe new name for the version.
description StringoptionalThe new description for the version.
access StringoptionalThe new access permissions of the version.
Possible Values:"hidden"|"private"|"protected"|"public"
ReturnsType Description Promise<boolean> - Returns true if version was altered successfully.
Exampleconst result = await versionManagementService.alterVersion( { name: "newVersion", guid: "{49C6AC87-CDA8-46D4-A79B-449105981209}" }, { versionName: "versionName", ownerName: "newOwner", description: "newDescription", access: "public" } );
-
Method used to change a layer's version/moment or network's version/moment. Method allows changing version from named version to named version, or from default version to a moment and vice versa.
ParametersInput used to change version on layers or network.
fromVersion Date|VersionIdentifierCurrent Version or Date moment.
toVersion Date|VersionIdentifierIncoming Version or Date.
ReturnsType Description Promise<boolean> - When resolved, response is
true
if change version was successful.
Exampleconst layer1 = await new FeatureLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/12" }); const layer2 = await new FeatureLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/13" }); const layers = [layer1, layer2]; await versionManagementService.changeVersion( layers, { name: "sde.DEFAULT", guid: "{13DEDC17-5867-4DBC-9855-0736C4C57162}"}, { name: "admin.version", guid: "{422D1B63-D795-4478-A4B1-AD6109377074}"} );
- When resolved, response is
-
createVersion(props){Promise<VersionInfoExtendedJSON>}
-
Creates a new version given the following parameters.
ParametersSpecificationprops ObjectoptionalContains properties required to create a version.
SpecificationversionName StringThe name of the new version.
description StringoptionalThe description of the new version.
access StringoptionalThe access type of the new version.
Possible Values:"hidden"|"private"|"protected"|"public"
ReturnsType Description Promise<VersionInfoExtendedJSON> - Contains information about newly created version.
Exampleconst version = await versionManagementService.createVersion({ versionName: "versionName", description: "description", access: "public" });
-
Deletes a version given the following parameters.
License
- This method requires the feature service and version management service to be published with ArcGIS Enterprise version 11.2 or higher.
- Organization members must be assigned a license for the ArcGIS Advanced Editing user type extension to use this method.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
ReturnsType Description Promise<boolean> - Specifies if the selected version was deleted.
ExampleversionManagementService.deleteVersion({ name: "versionName", guid: "{422D1B63-D795-4478-A4B1-AD6109377075}" });
-
getLockType(versionIdentifier){String}
-
Returns the current client lock type on a given version.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
ReturnsType Description String - Specifies the lock type on the version. Returns either
"edit"
,"none"
, or"read"
.
ExampleversionManagementService.getLockType({ name: "newVersion", guid: "{49C6AC87-CDA8-46D4-A79B-449105981209}"});
- Specifies the lock type on the version. Returns either
-
getVersionIdentifierFromGuid(guid){VersionIdentifier}
-
This method will return the versionIdentifier given the guid of the version.
Parameterguid StringGUID of version.
ReturnsType Description VersionIdentifier - Returns VersionIdentifier.
-
getVersionIdentifierFromName(name){VersionIdentifier}
-
This method will return the versionIdentifier given the name of the version.
Parametername StringName of version.
ReturnsType Description VersionIdentifier - Returns VersionIdentifier.
-
getVersionInfos(props){Promise<VersionInfoJSON[]>}
-
Returns information about a version or versions. If no parameters are passed, all versions will be returned.
ParametersSpecificationprops ObjectoptionalSpecificationownerFilter StringFilter to query versions by owner name.
includeHidden BooleanSpecifies whether to include hidden versions. This is
false
by default.ReturnsType Description Promise<VersionInfoJSON[]> - Contains info of versions.
Exampleconst versions = await versionManagementService.getVersionInfos({ ownerFilter: "publisher1", includeHidden: true });
-
getVersionInfosExtended(versionIdentifier){Promise<VersionInfoExtendedJSON>}
-
Method used to get extended information about a version.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
ReturnsType Description Promise<VersionInfoExtendedJSON> - Contains extended info about given version.
Exampleconst version = await versionManagementService.getVersionInfoExtended({ guid: "{422D1B63-D795-4478-A4B1-AD6109377075}", name: "versionName" });
-
load(){Promise}
-
Triggers the loading of the version management service instance.
Fully loads the Version Management Service definition.
ReturnsType Description Promise Resolves when the Feature Service is loaded.
-
post(versionIdentifier){Promise<PostResult>}
-
The Post operation allows the client to post the changes in their version to the default version. A reconcile operation must be performed prior to post.
License
- This method requires the feature service and version management service to be published with ArcGIS Enterprise version 11.2 or higher.
- Organization members must be assigned a license for the ArcGIS Advanced Editing user type extension to use this method.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
ReturnsType Description Promise<PostResult> - Returns the result of the post.
Exampleconst postResult = await versionManagementService.post({ guid: "{422D1B63-D795-4478-A4B1-AD6109377075}", name: "versionName" });
-
reconcile(versionIdentifier, props){Promise<ReconcileResult>}
-
Use the reconcile operation to reconcile a branch version with the default version. The reconcile operation requires that you are the only user currently editing the version and remain so throughout the reconcile process until you save or post your edits. You must have full permissions to all the feature classes that have been modified in the version being edited. This operation detects differences between the branch version and the default version and flags these differences as conflicts.
License
- This method requires the feature service and version management service to be published with ArcGIS Enterprise version 11.2 or higher.
- Organization members must be assigned a license for the ArcGIS Advanced Editing user type extension to use this method.
ParametersSpecificationversionIdentifier VersionIdentifierIdentifier for a version.
props ObjectProperties used for a reconcile.
SpecificationabortIfConflicts BooleanSpecifies whether the reconcile should be aborted if conflicts are found. The default is false
conflictDetection StringSpecifies the conditions required for conflicts to occur are defined by object (row) or attribute (column).
Possible Values:"by-attribute"|"by-object"
withPost BooleanSpecifies if post will occur after calling reconcile. Causes post to occur immediately after reconcile, fales by default.
ReturnsType Description Promise<ReconcileResult> - Returns the result of the reconcile.
Exampleconst reconcileResult = await versionManagementService.reconcile({ guid: "{422D1B63-D795-4478-A4B1-AD6109377075}", name: "versionName" }, { abortIfConflicts: true, conflictDetection: "by-object", withPost: false });
-
redo(versionIdentifier)
-
This method redos the last edit made while in an edit session.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
-
Using the specified session ID an exclusive lock is obtained for the session on the version. The exclusive lock can only be obtained if no other shared or exclusive locks are present and the session currently holds a shared lock. The exclusive lock ensures read and write isolation for the session holding the lock. The exclusive lock is downgraded to a shared lock by using the stopEditing operation.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
ReturnsType Description Promise<boolean> - Specifies if start editing was successful.
ExampleversionManagementService.startEditing({ name: "newVersion", guid: "{49C6AC87-CDA8-46D4-A79B-449105981209}"};
-
Using the specified client generated session ID, a shared lock is obtained for the session if the version is not already being edited by another user/session.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
ReturnsType Description Promise<boolean> - Specifies if start reading was successful.
ExampleversionManagementService.startReading({ name: "newVersion", guid: "{49C6AC87-CDA8-46D4-A79B-449105981209}"};
-
Using the specified session id, the exclusive lock for the version is downgraded to a shared lock. The saveEdits parameter specifies if the edits for the session should be saved (true) or discarded (false).
ParametersversionIdentifier VersionIdentifierIdentifier for a version.
saveEdits BooleanIf set to true edits will be saved, if false edits will not be saved.
ReturnsType Description Promise<boolean> - Specifies if stop editing was successful.
ExampleversionManagementService.stopEditing({ name: "newVersion", guid: "{49C6AC87-CDA8-46D4-A79B-449105981209}", saveEdits: true});
-
The shared lock is released on the version.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
ReturnsType Description Promise<boolean> - Specifies if stop reading was successful.
ExampleversionManagementService.stopReading({ name: "newVersion", guid: "{49C6AC87-CDA8-46D4-A79B-449105981209}"};
-
undo(versionIdentifier)
-
This method undos the last edit made while in an edit session.
ParameterversionIdentifier VersionIdentifierIdentifier for a version.
Type Definitions
-
PostResult Object
-
This contains information about the post result.
-
ReconcileResult Object
-
This contains information about the reconcile result.
-
VersionIdentifier Object
-
Holds the name and guid of a version.
-
VersionInfoExtendedJSON Object
-
This contains extended information about a given version.
- Properties
-
versionIdentifier Object
The layerId of the feature layer where features were edited.
description StringDescription of the version.
access StringThe access type permissions of the version.
Possible Values:"hidden"|"private"|"protected"|"public"
versionId StringThe id of the version that was edited.
creationDate NumberThe date the version was created on.
modifiedDate NumberThe date when the version was last modified or changed.
reconcileDate NumberThe date when the version was last reconciled with the parent version or the default version.
evaluationDate NumberThe date when the version was last evaluated for conflicts or discrepancies during the reconciliation process.
previousAncestorDate NumberThe date of the most recent ancestor version, if applicable.
commonAncestorDate NumberThe date of the common ancestor version, which is the shared ancestor between two or more versions during the reconciliation process.
isBeingEdited BooleanSpecifies if the version is currently being edited.
isBeingRead BooleanSpecifies if the version is currently being read.
hasConflicts BooleanSpecifies if the version is has conflicts.
hasUninspectedConflicts BooleanSpecifies if the version has UninspectedConflicts.
isLocked BooleanSpecifies if the version currenlty has a lock.
lockOwner StringSpecifies which user is the current lock owner.
lockDate NumberSpecifies the date at which the version was locked.
-
VersionInfoJSON Object
-
This contains basic information about a given version.
- Properties
-
versionIdentifier Object
The layerId of the feature layer where features were edited.
description StringDescription of the version.
access StringAccess type accepts values of private, public, hidden, and protected.
versionId StringThe id of the version that was edited.
creationDate NumberThe date the version was created on.
modifiedDate NumberThe date when the version was last modified or changed.
reconcileDate NumberThe date when the version was last reconciled with the parent version or the default version.
evaluationDate NumberThe date when the version was last evaluated for conflicts or discrepancies during the reconciliation process.
previousAncestorDate NumberThe date of the most recent ancestor version, if applicable.
commonAncestorDate NumberThe date of the common ancestor version, which is the shared ancestor between two or more versions during the reconciliation process.
-
VersionManagementServiceCapabilities Object
-
Describes the version management service's supported capabilities.
- Properties
-
supportsConflictDetectionByAttribute Boolean
Indicates whether the service supports conflict detection based on attribute values during editing operations.
supportsPartialPost BooleanIndicates whether the service supports partial posting, allowing users to post only a subset of edits instead of the entire set.
supportsDifferencesFromMoment BooleanIndicates whether the service supports retrieving differences in data from a specific moment in time.
supportsDifferencesWithLayers BooleanIndicates whether the service supports retrieving differences in data between different layers or feature classes.
supportsAsyncReconcile BooleanIndicates whether the service supports asynchronous reconcile operations, allowing users to reconcile conflicting edits asynchronously.
supportsAsyncPost BooleanIndicates whether the service supports asynchronous posting of edits, allowing users to post edits asynchronously.
supportsAsyncDifferences BooleanIndicates whether the service supports asynchronous retrieval of differences in data, allowing users to retrieve differences asynchronously.