How do I find "move from" location using RTC-4 Java API?
How does the Eclipse RTC-4 Extension (Plug-In) know the location from which it was moved? I would like to create Java code using the RTC-4 plain Java API to get the same information.
I created a Work Item with a Change Set that moved an item.
-
I used Eclipse RTC-4 Extension (Plug-In) to open the Work Item view, Open the Change Set, open the Change Explorer. The moved item shows in the list, with a parenthesized note stating the location from which it was moved. This is as expected.
-
I then used a Java program using the RTC-4 Java API. I drilled down into a Build, based on a Stream that accepted the Change Set that moved the item. I found the Work Item, Change Set, and Change for the item. It shows as kind: 10 (MODIFY REPARENT). The Versionable’s change.beforeState() versionable ancestors path shows the location it was moved to. The Versionable’s change.beforeState() versionable ancestors in history path also shows the location it was moved to. I was expecting them both to show the location it was moved from.
-
I then used a Java program using the RTC-4 Java API to drill down to find all Change Sets with the moved item, and found the original Change Set that added the item just moved. It’s change shows as kind: 1 (ADD). The Versionable had no change.beforeState() as expected. The Versionable’s change.afterState() versionable ancestors path shows the location it was moved to. The Versionable’s change.afterState() versionable ancestors in history path also shows the location it was moved to. I was expecting it to show the location it was moved from.
-
The beforeState on the change that moved the item shows the location to which it moved, not the location from which it moved. Why?
-
The afterState on the change that originally added the item no longer has the location to which it was originally added. Why?
-
Where can I find the location to which it was originally, which would also be the location from which it was moved? The Change Explorer seems to find it.
To make sure my understanding and coding was sound, I also tested an item add, and an item delete.
I created a Work Item with a Change Set that added an item.
-
I used Eclipse RTC-4 Extension (Plug-In) to open the Work Item view, Open the Change Set, open the Change Explorer. The added item shows in the list. Double clicking it shows it is there after the change, but was not there before the change. This is as expected.
-
I then used the Java program using the RTC-4 Java API. I drilled down into a Build, based on a Stream that accepted the Change Set that added the item. I found the Work Item, Change Set, and Change for the item. It shows as kind: 1 (ADD). The Versionable’s change.beforeState() did not exist, as expected. The Versionable’s change.afterState() versionable ancestors path shows the location it was added to, as expected. The Versionable’s change.afterState() versionable ancestors in history path also shows the location it was added to, as expected.
I created a Work Item with a Change Set that deleted an item.
-
I used Eclipse RTC-4 Extension (Plug-In) to open the Work Item view, Open the Change Set, open the Change Explorer. The deleted item shows in the list. Double clicking it shows it is there before the change, but not there after the change. This is as expected.
-
I then used the Java program using the RTC-4 Java API. I drilled down into a Build, based on a Stream that accepted the Change Set that deleted the item. I found the Work Item, Change Set, and Change for the item. It shows as kind: 16 (DELETE). The Versionable’s change.beforeState() versionable ancestors path is empty. The Versionable’s change.beforeState() versionable ancestors in history path also shows the location it was deleted from, as expected. The Versionable’s change.afterState() did not exist, as expected.
-
I then used the Java program using the RTC-4 Java API to drill down to find all Change Sets with the deleted item, and found the original Change Set that added the item just deleted. It’s change shows as kind: 1 (ADD). The Versionable had no change.beforeState() as expected. The Versionable’s change.afterState() versionable ancestors path is empty. The Versionable’s change.afterState() versionable ancestors in history path shows the location it was deleted from, as expected.
One answer
The answer can be found in post "