public boolean saveCase ( FogbugzCase fbCase , String comment ) { try { HashMap < String , String > params = new HashMap < String , String > ( ) ; // If id = 0, create new case. if ( fbCase . getId ( ) == 0 ) { params . put ( "cmd" , "new" ) ; params . put ( "sTitle" , fbCase . getTitle ( ) ) ; } else { params . put ( "cmd" , "edit" ) ; params . put ( "ixBug" , Integer . toString ( fbCase . getId ( ) ) ) ; } params . put ( "ixPersonAssignedTo" , Integer . toString ( fbCase . getAssignedTo ( ) ) ) ; params . put ( "ixPersonOpenedBy" , Integer . toString ( fbCase . getOpenedBy ( ) ) ) ; params . put ( "sTags" , fbCase . tagsToCSV ( ) ) ; if ( this . featureBranchFieldname != null && ! this . featureBranchFieldname . isEmpty ( ) ) { params . put ( this . featureBranchFieldname , fbCase . getFeatureBranch ( ) ) ; } if ( this . originalBranchFieldname != null && ! this . originalBranchFieldname . isEmpty ( ) ) { params . put ( this . originalBranchFieldname , fbCase . getOriginalBranch ( ) ) ; } if ( this . targetBranchFieldname != null && ! this . targetBranchFieldname . isEmpty ( ) ) { params . put ( this . targetBranchFieldname , fbCase . getTargetBranch ( ) ) ; } if ( this . approvedRevisionFieldname != null && ! this . approvedRevisionFieldname . isEmpty ( ) ) { params . put ( this . approvedRevisionFieldname , fbCase . getApprovedRevision ( ) ) ; } if ( this . ciProjectFieldName != null && ! this . ciProjectFieldName . isEmpty ( ) ) { params . put ( this . ciProjectFieldName , fbCase . getCiProject ( ) ) ; } params . put ( "sFixFor" , fbCase . getMilestone ( ) ) ; params . put ( "sEvent" , comment ) ; Document doc = this . getFogbugzDocument ( params ) ; FogbugzManager . log . info ( "Fogbugz response got when saving case: " + doc . toString ( ) ) ; // If we got this far, all is probably well. // TODO: parse XML that gets returned to check status furreal. return true ; } catch ( Exception e ) { FogbugzManager . log . log ( Level . SEVERE , "Exception while creating/saving case " + Integer . toString ( fbCase . getId ( ) ) , e ) ; } return false ; }
Saves a case to fogbugz using its API . Supports creating new cases by setting caseId to 0 on case object .