private static <T>int migrateAll(Migration<T> migration) throws Exception {
  int migrated=0;
  for (  T entity : migration.getAllEntities()) {
    try {
      if (migration.isMigrated(entity))       continue;
    }
 catch (    Exception x) {
      LOG.error("Couldn't check if the entity '{}' is migrated due to occurred error",entity);
      throw x;
    }
    try {
      migration.migrate(entity);
    }
 catch (    Exception x) {
      LOG.error("Error migrating the entity '{}",entity);
      throw x;
    }
    migrated++;
  }
  return migrated;
}

private static < T > int migrateAll ( Migration < T > migration ) throws Exception { int migrated = 0 ; for ( T entity : migration . getAllEntities ( ) ) { try { if ( migration . isMigrated ( entity ) ) continue ; } catch ( Exception x ) { LOG . error ( "Couldn't check if the entity '{}' is migrated due to occurred error" , entity ) ; throw x ; } try { migration . migrate ( entity ) ; } catch ( Exception x ) { LOG . error ( "Error migrating the entity '{}" , entity ) ; throw x ; } migrated ++ ; } return migrated ; }
migrates entities and skips those which are already migrated .
