Unable to find differences between two versions using ArcObjects SDK for JAVA

2883
2
Jump to solution
05-12-2016 04:46 AM
Vara_PrasadM_S
Occasional Contributor II

Hi All,

I am trying to fetch the differences between a child version and its parent version which is the Default Version through ArcObjects SDK for JAVA. I am not getting any results into objectIDs and differenceRows when I called "differences" function as below...

....

differenceCursor = versionedTable.differences(commonAncestorTable, esriDifferenceType.esriDifferenceTypeInsert, null);

.....

differenceCursor.next(objectIDs, differenceRows);

....

Followed the sample code given in below help document. We are using V 10.2.1

ArcObjects 10 .NET SDK Help

However, when I used "Versioning" tool bar and used "Version Changes" tool, I am able to see the changes. Could some one please help me with this.

Thanks & Regards,

Vara Prasad.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Vara_PrasadM_S
Occasional Contributor II

I could able to solve this. By assigning empty arrays to out parameters of "next" method instead of null object.

Thanks & Regards,

Vara Prasad.

View solution in original post

2 Replies
Vara_PrasadM_S
Occasional Contributor II

Here is my code in JAVA. I tried same approach in .NET and it worked perfect. However, in JAVA ArcObjects, I am not getting any results, always giving 'null' for both "objectID" and "differenceRow". Could someone please help me.

IVersionedWorkspace versionedWorkspace = new VersionedWorkspace(workspace);

              IVersion childVersion = versionedWorkspace.findVersion("SDE.Test");

              IVersion parentVersion = versionedWorkspace.getDefaultVersion();

              // Cast to the IVersion2 interface to find the common ancestor.

              IVersion2 childVersion2 = new IVersion2Proxy(childVersion);

              commonAncestorVersion = childVersion2.getCommonAncestor(parentVersion);

            

                  // Cast the child version to IFeatureWorkspace and open the table.

              IFeatureWorkspace childFWS = new IFeatureWorkspaceProxy(childVersion);

              ITable childTable = childFWS.openTable(tableName);

              // Cast the common ancestor version to IFeatureWorkspace and open the table.

              commonAncestorFWS =  new IFeatureWorkspaceProxy(commonAncestorVersion);

              commonAncestorTable = commonAncestorFWS.openTable(tableName);

              // Cast to the IVersionedTable interface to create a difference cursor.

              IVersionedTable versionedTable =  new IVersionedTableProxy(childTable);

              differenceCursor = versionedTable.differences(commonAncestorTable, esriDifferenceType.esriDifferenceTypeInsert, null);            

              int countChildRecords = childTable.rowCount(null);

              int countParentRecords = commonAncestorTable.rowCount(null);

            

              // Create output variables for the IDifferenceCursor.Next method and a FID set.

              IFIDSet fidSet = new FIDSet();

              IRow[] differenceRow = null;

              int[] objectID = null;

              // Step through the cursor, showing the ID of each modified row.

              differenceCursor.next(objectID, differenceRow);

Thanks & Regards,

Vara Prasad.

0 Kudos
Vara_PrasadM_S
Occasional Contributor II

I could able to solve this. By assigning empty arrays to out parameters of "next" method instead of null object.

Thanks & Regards,

Vara Prasad.