private boolean checkIfVplexVolumeHasActiveAssociatedVolumes(Volume volume){
  boolean activeAssociatedVolumes=false;
  if (volume != null && volume.getAssociatedVolumes() != null) {
    for (    String associatedVolumeUri : volume.getAssociatedVolumes()) {
      Volume associatedVolume=_dbClient.queryObject(Volume.class,URI.create(associatedVolumeUri));
      if (associatedVolume != null && !associatedVolume.getInactive()) {
        _log.warn("volume {} has active associated volume {}",volume.getLabel(),associatedVolume.getLabel());
        if (associatedVolume.getNativeId() == null) {
          _log.warn("associated volume with Id {} has no native Id. Native Id is {}. So mark this volume for deletion. ",associatedVolume.getId(),associatedVolume.getNativeId());
          _dbClient.markForDeletion(associatedVolume);
        }
 else {
          activeAssociatedVolumes=true;
        }
      }
    }
  }
  return activeAssociatedVolumes;
}

private boolean checkIfVplexVolumeHasActiveAssociatedVolumes ( Volume volume ) { boolean activeAssociatedVolumes = false ; if ( volume != null && volume . getAssociatedVolumes ( ) != null ) { for ( String associatedVolumeUri : volume . getAssociatedVolumes ( ) ) { Volume associatedVolume = _dbClient . queryObject ( Volume . class , URI . create ( associatedVolumeUri ) ) ; if ( associatedVolume != null && ! associatedVolume . getInactive ( ) ) { _log . warn ( "volume {} has active associated volume {}" , volume . getLabel ( ) , associatedVolume . getLabel ( ) ) ; if ( associatedVolume . getNativeId ( ) == null ) { _log . warn ( "associated volume with Id {} has no native Id. Native Id is {}. So mark this volume for deletion. " , associatedVolume . getId ( ) , associatedVolume . getNativeId ( ) ) ; _dbClient . markForDeletion ( associatedVolume ) ; } else { activeAssociatedVolumes = true ; } } } } return activeAssociatedVolumes ; }
this method is used during delete volume to check if a volume has active associated volumes with nativeid . todo : this method can be moved to some utility class post 2 . 0 , once we figure out which class is suitable for this .
