It's all about the answers!

Ask a question

Using the Java API, how does one determine if a build is 'Overdue'?

Todd Strangio (52610) | asked Jan 31 '13, 3:44 p.m.
I can get the start time of a build, then the current time, and calculate how long it's been running, but I'm hoping there's an easier, pre-canned solution.

Thanks in advance.

Accepted answer

permanent link
Scott Crouch (48532326) | answered Jan 31 '13, 5:07 p.m.
 I'm pretty sure the overdue flag is based on the idea that a build is overdue if it's past the average build time of that build. You can get the average build time using the below code (shamelessly stolen example code from: 

IItemManager itemManager = repo.itemManager()
IBuildAverageDataHandle buildAverageData = definition.getBuildAverageData();
IBuildAverageData data = (IBuildAverageData)itemManager.fetchCompleteItem(buildAverageData, IItemManager.DEFAULT, myProgressMonitor);

/* The average build time is not available from the handle. It has to be fetched from the server. */
long averageBuildTime = data.getAverageBuildTimeTaken();
Todd Strangio selected this answer as the correct answer

Todd Strangio commented Feb 01 '13, 1:49 p.m.

  Thanks Scott - this is exactly what I was looking for.  Appreciate the help.

Your answer

Register or to post your answer.