As many of you know,  to get the “required” & “reported” hours of a  Tempo Timesheet Team (in JIRA), don’t exists a REST Web Service interface to get these values…

But, exist and “old” “hack”-trick to do this using the mystical “CURL” (in this example case calling cull in the bash shell, running the process inside the server ).

Very easy, see this groovy example code:


def sout = new StringBuilder(), serr = new StringBuilder()
//def proc = "curl -D- -u user:pass -X GET https://jira.xxxx.com/secure/TempoTeamBoard%21timesheet.jspa?team=%1".execute()
//IS NOT ELEGANT SEE USER/PASS IN CODE... BETTER INSIDE A SHELL SCRIPT
def proc = "/bin/jira_tempo_capture_required_team_hours.sh teamid".execute()
 proc.consumeProcessOutput(sout, serr)
 proc.waitFor();
 def texto = sout.toString();
 position_ini = texto.indexOf("
<th>Required</th>
");
 position_end = texto.indexOf("
<td class=", position_ini);
 //capture required team hours...
 planning_hours = texto.substring(position_ini+21, position_end - 5).trim();
 //removing <td> and</td>
int i = 4;
 def res = "";
 while ( i &lt; planning_hours.length() -5 ) {
 res = res + planning_hours[i]
 i++
 }
 int resullt = res.toInteger()

 

 

 

Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s