public Integer getCurrentVersionID() throws AmbariException, SQLException {
    if (!dbAccessor.tableExists(CLUSTER_VERSION_TABLE)) {
      return null;
    }
    List<Integer> currentVersionList = dbAccessor.getIntColumnValues(CLUSTER_VERSION_TABLE, REPO_VERSION_ID_COLUMN,
        new String[]{STATE_COLUMN}, new String[]{CURRENT}, false);
    if (currentVersionList.isEmpty()) {
      List<Integer> allVersionList = dbAccessor.getIntColumnValues(CLUSTER_VERSION_TABLE, REPO_VERSION_ID_COLUMN, null, null,false);
      if (allVersionList.isEmpty()){
        return null;
      } else {
        throw new AmbariException("Unable to find any CURRENT repositories.");
      }
    } else if (currentVersionList.size() != 1) {
      throw new AmbariException("The following repositories were found to be CURRENT: ".concat(StringUtils.join(currentVersionList, ",")));
    }
    return currentVersionList.get(0);
  }
get {@value #REPO_VERSION_ID_COLUMN} value from {@value #CLUSTER_VERSION_TABLE}
where {@value #STATE_COLUMN} = {@value #CURRENT}
and validate it

@return current version ID or null if no cluster versions do exist
@throws AmbariException if cluster versions are present, but current is not selected
@throws SQLException
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java