Using the Java StarTeam API, how can I find which revisions of a StarTeam Item have a certain label?

StackOverflow https://stackoverflow.com/questions/10321278

  •  03-06-2021
  •  | 
  •  

Domanda

I'm using the StarTeam java API (v10.4).

I am having a heckuva time trying to find which specific revisions a Label is applied to. What makes this tricky is that there seems to be no method on the Label object which provides a list of what that label is applied to.

So you (seemingly) need to go backwards and find a list of items that you want to check for a particular Label, e.g.

int[] check_these_items = new int[]{ item_to_check.getID() };
int[] labelledItems = myLabel.getLabeledItemIDs(check_these_items)

First, that's kind of convoluted because you need to have a Label in the first place when really what I wanted was to get a list of labels attached to a single revision. But ok, let's go with that for now. So now I need to find a single revision from the history. Let's make this simple and say I want to get the third (or fourth) revision:

Item specific_child = item_to_check.getHistory()[3];

Now the problem is that this new child from history has the same ID (via getID()) as the parent so using getLabeledItemIds(check_these_items) will return the same labels and essentially, we haven't gotten anywhere.

I did find a question related to finding past revisions but it wasn't pertaining to finding labels on past revisions.

Of course, I checked Borland's API documentation but have not come up with the solution.

I know the UI can do it so certainly there is way, I'm just having a time finding it.

Any suggestions even at a high-level would be greatly appreciated!

È stato utile?

Soluzione

Once you have the Item and the Label at hand, use getFromHistoryByLabelID(int)
to "Returns the specified version of this item based on the given label ID"

Altri suggerimenti

This still doesn't seem like the right answer, but eventually I had to move on and ended up using a workaround of finding the revision date/time of the label I wanted and then comparing the item revision to that. So by that type of reverse logic, I was able to check each label attached to the element and find which revisions had that label.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top