public List < IvrZone > showIvrZones ( boolean active ) throws NetworkDeviceControllerException { List < IvrZone > zones = new ArrayList < IvrZone > ( ) ; SSHPrompt [ ] prompts = { SSHPrompt . POUND , SSHPrompt . GREATER_THAN } ; StringBuilder buf = new StringBuilder ( ) ; String cmdKey = active ? "MDSDialog.ivr.show.zone.active.cmd" : "MDSDialog.ivr.show.zone.cmd" ; sendWaitFor ( MDSDialogProperties . getString ( cmdKey ) , defaultTimeout , prompts , buf ) ; String [ ] lines = getLines ( buf ) ; IvrZone zone = null ; IvrZoneMember member = null ; String [ ] regex = { MDSDialogProperties . getString ( "MDSDialog.ivr.showZoneset.zone.name.match" ) , MDSDialogProperties . getString ( "MDSDialog.ivr.showZoneset.zone.member.match" ) } ; String [ ] groups = new String [ 10 ] ; for ( String line : lines ) { int index = match ( line , regex , groups ) ; switch ( index ) { case 0 : zone = new IvrZone ( groups [ 0 ] ) ; zones . add ( zone ) ; break ; case 1 : member = new IvrZoneMember ( groups [ 0 ] , Integer . valueOf ( groups [ 3 ] ) ) ; zone . getMembers ( ) . add ( member ) ; break ; } } return zones ; }
Get switch ivr zones