@ RequestMapping ( value = "api/servergroup" , method = RequestMethod . GET ) public @ ResponseBody HashMap < String , Object > getServerGroups ( Model model , @ RequestParam ( value = "profileId" , required = false ) Integer profileId , @ RequestParam ( value = "search" , required = false ) String search , @ RequestParam ( value = "profileIdentifier" , required = false ) String profileIdentifier ) throws Exception { if ( profileId == null && profileIdentifier == null ) { throw new Exception ( "profileId required" ) ; } if ( profileId == null ) { profileId = ProfileService . getInstance ( ) . getIdFromName ( profileIdentifier ) ; } List < ServerGroup > serverGroups = ServerRedirectService . getInstance ( ) . tableServerGroups ( profileId ) ; if ( search != null ) { Iterator < ServerGroup > iterator = serverGroups . iterator ( ) ; while ( iterator . hasNext ( ) ) { ServerGroup serverGroup = iterator . next ( ) ; if ( ! serverGroup . getName ( ) . toLowerCase ( ) . contains ( search . toLowerCase ( ) ) ) { iterator . remove ( ) ; } } } HashMap < String , Object > returnJson = Utils . getJQGridJSON ( serverGroups , "servergroups" ) ; return returnJson ; }
Obtains the collection of server groups defined for a profile