public static Table<URI,String,List<Volume>> groupVPlexVolumesByRG(List<Volume> vplexVolumes,List<Volume> volumesNotInRG,List<Volume> volumesInRG,DbClient dbClient){
  Table<URI,String,List<Volume>> groupVolumes=HashBasedTable.create();
  for (  Volume volume : vplexVolumes) {
    Volume backedVol=VPlexUtil.getVPLEXBackendVolume(volume,true,dbClient);
    if (backedVol != null) {
      URI backStorage=backedVol.getStorageController();
      String replicaGroup=backedVol.getReplicationGroupInstance();
      if (NullColumnValueGetter.isNotNullValue(replicaGroup)) {
        List<Volume> volumeList=groupVolumes.get(backStorage,replicaGroup);
        if (volumeList == null) {
          volumeList=new ArrayList<Volume>();
          groupVolumes.put(backStorage,replicaGroup,volumeList);
        }
        volumeList.add(volume);
        if (volumesInRG != null) {
          volumesInRG.add(volume);
        }
      }
 else {
        if (volumesNotInRG != null) {
          volumesNotInRG.add(volume);
        }
      }
    }
  }
  return groupVolumes;
}

public static Table < URI , String , List < Volume > > groupVPlexVolumesByRG ( List < Volume > vplexVolumes , List < Volume > volumesNotInRG , List < Volume > volumesInRG , DbClient dbClient ) { Table < URI , String , List < Volume > > groupVolumes = HashBasedTable . create ( ) ; for ( Volume volume : vplexVolumes ) { Volume backedVol = VPlexUtil . getVPLEXBackendVolume ( volume , true , dbClient ) ; if ( backedVol != null ) { URI backStorage = backedVol . getStorageController ( ) ; String replicaGroup = backedVol . getReplicationGroupInstance ( ) ; if ( NullColumnValueGetter . isNotNullValue ( replicaGroup ) ) { List < Volume > volumeList = groupVolumes . get ( backStorage , replicaGroup ) ; if ( volumeList == null ) { volumeList = new ArrayList < Volume > ( ) ; groupVolumes . put ( backStorage , replicaGroup , volumeList ) ; } volumeList . add ( volume ) ; if ( volumesInRG != null ) { volumesInRG . add ( volume ) ; } } else { if ( volumesNotInRG != null ) { volumesNotInRG . add ( volume ) ; } } } } return groupVolumes ; }
groups vplex volumes into a table indexed by : 1 . the backend storage controller of the vplex backend volume 2 . the backend replica group of the vplex backend volume 3 . and a list of all vplex volumes that have backend volumes in that backend replica group optional : will also populate two lists dividing the volumes in an rg and not in an rg if those lists are passed in as not null .
