title: Using the Java StarTeam API, how can I find which revisions of a StarTeam Item have a certain label?
body: <p>I'm using the StarTeam java API (v10.4).</p>
  
  <p>I am having a heckuva time trying to find which <em>specific</em> 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.</p>
  
  <p>So you (seemingly) need to go backwards and find a list of items that you want to check for a particular Label, e.g.</p>
  
  <pre><code>int[] check_these_items = new int[]{ item_to_check.getID() };
  int[] labelledItems = myLabel.getLabeledItemIDs(check_these_items)
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>Item specific_child = item_to_check.getHistory()[3];
  </code></pre>
  
  <p>Now the problem is that this new child from history has the same ID (via <code>getID()</code>) as the parent so using <code>getLabeledItemIds(check_these_items)</code> will return the same labels and essentially, we haven't gotten anywhere. </p>
  
  <p>I did find a <a href="https://stackoverflow.com/questions/4812359/finding-past-revisions-of-files-in-starteam-w-net-sdk-c-sharp">question</a> related to finding past revisions but it wasn't pertaining to finding labels <em>on</em> past revisions.</p>
  
  <p>Of course, I checked <a href="http://techpubs.borland.com/starteam/2009/en/sdk_documentation/api/com/starbase/starteam/Item.html" rel="nofollow noreferrer">Borland</a>'s API documentation but have not come up with the solution.</p>
  
  <p>I know the UI can do it so certainly there is way, I'm just having a time finding it.</p>
  
  <p>Any suggestions even at a high-level would be greatly appreciated!</p>