/**
   * Method declaration
   *
   * @param con
   * @param fatherIds
   * @param pk
   * @return
   * @throws SQLException
   * @see
   */
  public static Collection<String> selectByFatherIds(
      Connection con, List<Integer> fatherIds, CoordinatePK pk) throws SQLException {
    // get all points corresponding to fatherIds
    List<CoordinatePoint> points = selectCoordinatePointsByNodeIds(con, fatherIds, pk);
    List<CoordinatePoint> toCheck = new ArrayList<CoordinatePoint>(points); // toCheck always
    // contains points
    List<String> coordinatePKs = new ArrayList<String>();
    int nbAxis = fatherIds.size(); // number of axis
    int currentCoordinateId;
    int nbMatchingPoints = 0;
    int i = 0;

    // check all points
    while (i < points.size()) {
      CoordinatePoint point = points.get(i);
      currentCoordinateId = point.getCoordinateId();
      if (point.getNodeId() == fatherIds.get(0).intValue()) {
        // verifie que les n-1 axes de la BD correspondent aux axes de fatherIds
        nbMatchingPoints = getNbMatchingCoordinates(currentCoordinateId, fatherIds, toCheck, i + 1);
        if (nbMatchingPoints == (nbAxis - 1)) {
          coordinatePKs.add(String.valueOf(currentCoordinateId));
          i = i + nbMatchingPoints;
        }
      }
      i++;
    }
    return coordinatePKs;
  }
 /**
  * Method declaration
  *
  * @param con
  * @param pk
  * @param point
  * @throws SQLException
  * @see
  */
 public static void addPointToAllCoordinates(
     Connection con, CoordinatePK pk, CoordinatePoint point) throws SQLException {
   int maxDisplayOrder = getMaxDisplayOrder(con, pk);
   point.setOrder(maxDisplayOrder + 1);
   Collection<String> coordinateIds = getCoordinateIds(con, pk);
   for (String id : coordinateIds) {
     int coordinateId = Integer.parseInt(id);
     addCoordinatePoint(con, pk, point, coordinateId);
   }
 }
 /**
  * Method declaration
  *
  * @param con
  * @param pk
  * @param point
  * @param coordinateId
  * @throws SQLException
  * @see
  */
 private static void addCoordinatePoint(
     Connection con, CoordinatePK pk, CoordinatePoint point, int coordinateId)
     throws SQLException {
   PreparedStatement prepStmt = null;
   try {
     prepStmt = con.prepareStatement(INSERT_COORDINATE);
     prepStmt.setInt(1, coordinateId);
     prepStmt.setInt(2, point.getNodeId());
     if (point.isLeaf()) {
       prepStmt.setString(3, "1");
     } else {
       prepStmt.setString(3, "0");
     }
     prepStmt.setInt(4, point.getOrder());
     prepStmt.setString(5, pk.getComponentName());
     prepStmt.executeUpdate();
   } finally {
     DBUtil.close(prepStmt);
   }
 }
  /**
   * Method declaration
   *
   * @param currentCoordinateId
   * @param fatherIds
   * @param toCheck
   * @param begin
   * @return
   * @see
   */
  private static int getNbMatchingCoordinates(
      int currentCoordinateId, List<Integer> fatherIds, List<CoordinatePoint> toCheck, int begin) {
    int i = begin; // toCheck indice
    int f = 1; // fatherIds indice
    boolean coordinateMatch = true;
    int nbMatchingCoordinates = 0;

    while (i < toCheck.size() && coordinateMatch) {
      CoordinatePoint coordinatePoint = toCheck.get(i);
      int currentRId = coordinatePoint.getCoordinateId();
      int currentNId = coordinatePoint.getNodeId();
      if (currentRId == currentCoordinateId && currentNId == (fatherIds.get(f)).intValue()) {
        nbMatchingCoordinates++;
        f++;
        i++;
      } else {
        coordinateMatch = false;
      }
    }
    return nbMatchingCoordinates;
  }