public List < FogbugzEvent > getEventsForCase ( int id ) { try { HashMap < String , String > params = new HashMap < String , String > ( ) ; // Hashmap defaults to <String, String> params . put ( "cmd" , "search" ) ; params . put ( "q" , Integer . toString ( id ) ) ; params . put ( "cols" , "events" ) ; Document doc = this . getFogbugzDocument ( params ) ; List < FogbugzEvent > eventList = new ArrayList < FogbugzEvent > ( ) ; NodeList eventsNodeList = doc . getElementsByTagName ( "event" ) ; if ( eventsNodeList != null && eventsNodeList . getLength ( ) != 0 ) { for ( int i = 0 ; i < eventsNodeList . getLength ( ) ; i ++ ) { Element currentNode = ( Element ) eventsNodeList . item ( i ) ; // Construct event object from retrieved data. eventList . add ( new FogbugzEvent ( Integer . parseInt ( currentNode . getElementsByTagName ( "ixBugEvent" ) . item ( 0 ) . getTextContent ( ) ) , // eventid id , // caseid currentNode . getElementsByTagName ( "sVerb" ) . item ( 0 ) . getTextContent ( ) , // verb Integer . parseInt ( currentNode . getElementsByTagName ( "ixPerson" ) . item ( 0 ) . getTextContent ( ) ) , // person Integer . parseInt ( currentNode . getElementsByTagName ( "ixPersonAssignedTo" ) . item ( 0 ) . getTextContent ( ) ) , // personAssignedTo DatatypeConverter . parseDateTime ( currentNode . getElementsByTagName ( "dt" ) . item ( 0 ) . getTextContent ( ) ) . getTime ( ) , // dateTime currentNode . getElementsByTagName ( "evtDescription" ) . item ( 0 ) . getTextContent ( ) , // evtDescription currentNode . getElementsByTagName ( "sPerson" ) . item ( 0 ) . getTextContent ( ) // sPerson ) ) ; } } return eventList ; } catch ( Exception e ) { FogbugzManager . log . log ( Level . SEVERE , "Exception while fetching case " + Integer . toString ( id ) , e ) ; } return null ; }
Retrieves all events for a certain case .