public String generateGroupName(String policyName,Set<String> existingGroupNames,String parentGroupName){
  int count=0;
  String format=null;
  while (count <= existingGroupNames.size()) {
    if (0 == count) {
      format=String.format("SG_%s",policyName);
    }
 else {
      format=String.format("SG_%s_%d",policyName,count);
    }
    String generatedGroupName=generate(parentGroupName,format,SmisConstants.MASK_NAME_DELIMITER,SmisConstants.MAX_STORAGE_GROUP_NAME_LENGTH);
    if (!existingGroupNames.contains(generatedGroupName)) {
      return generatedGroupName;
    }
    count++;
  }
  return generate(parentGroupName,String.format("SG1_%s",policyName),SmisConstants.MASK_NAME_DELIMITER,SmisConstants.MAX_STORAGE_GROUP_NAME_LENGTH);
}

public String generateGroupName ( String policyName , Set < String > existingGroupNames , String parentGroupName ) { int count = 0 ; String format = null ; while ( count <= existingGroupNames . size ( ) ) { if ( 0 == count ) { format = String . format ( "SG_%s" , policyName ) ; } else { format = String . format ( "SG_%s_%d" , policyName , count ) ; } String generatedGroupName = generate ( parentGroupName , format , SmisConstants . MASK_NAME_DELIMITER , SmisConstants . MAX_STORAGE_GROUP_NAME_LENGTH ) ; if ( ! existingGroupNames . contains ( generatedGroupName ) ) { return generatedGroupName ; } count ++ ; } return generate ( parentGroupName , String . format ( "SG1_%s" , policyName ) , SmisConstants . MASK_NAME_DELIMITER , SmisConstants . MAX_STORAGE_GROUP_NAME_LENGTH ) ; }
todo : vmax3 customized names generate group names which doesn ' t exist in array already .
