public Map < Change , PatchSet > getChanges ( GerritQueryHandler gerritQueryHandler ) { if ( StringUtils . isEmpty ( name ) ) { logger . error ( "Topic name can not be empty" ) ; return Collections . emptyMap ( ) ; } if ( changes == null ) { Map < Change , PatchSet > temp = new HashMap < Change , PatchSet > ( ) ; try { List < JSONObject > jsonList = gerritQueryHandler . queryCurrentPatchSets ( "topic:{" + name + "}" ) ; for ( JSONObject json : jsonList ) { if ( json . has ( "type" ) && "stats" . equalsIgnoreCase ( json . getString ( "type" ) ) ) { continue ; } if ( json . has ( "currentPatchSet" ) ) { JSONObject currentPatchSet = json . getJSONObject ( "currentPatchSet" ) ; temp . put ( new Change ( json ) , new PatchSet ( currentPatchSet ) ) ; } } changes = temp ; } catch ( IOException e ) { logger . error ( "IOException occured. " , e ) ; } catch ( GerritQueryException e ) { logger . error ( "Bad query. " , e ) ; } } return changes ; }
Gets all change - patchset pairs related to this topic . After first call data is cached .