@Override
 public ArrayList<TareaBean> getPage(
     int intRegsPerPag,
     int intPage,
     ArrayList<FilterBeanHelper> hmFilter,
     HashMap<String, String> hmOrder,
     Integer expand)
     throws Exception {
   strSQL += SqlBuilder.buildSqlWhere(hmFilter);
   strSQL += SqlBuilder.buildSqlOrder(hmOrder);
   strSQL += SqlBuilder.buildSqlLimit(oMysql.getCount(strSQL), intRegsPerPag, intPage);
   ArrayList<TareaBean> arrTarea = new ArrayList<>();
   try {
     ResultSet oResultSet = oMysql.getAllSql(strSQL);
     if (oResultSet != null) {
       while (oResultSet.next()) {
         TareaBean oTareaBean = new TareaBean();
         arrTarea.add(oTareaBean.fill(oResultSet, oConnection, expand));
       }
     }
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
   }
   return arrTarea;
 }
 public ArrayList<ComentarioBean> getPagexidusuario(
     int id_usuario,
     int intRegsPerPag,
     int intPage,
     ArrayList<FilterBeanHelper> hmFilter,
     HashMap<String, String> hmOrder,
     Integer expand)
     throws Exception {
   // strSQL += SqlBuilder.buildSqlWhere(hmFilter);
   // strSQL += SqlBuilder.buildSqlOrder(hmOrder);
   strSQL =
       "select comentario.id, comentario.texto, comentario.fecha, comentario.id_amistad from comentario, amistad, usuario where ( usuario.id= amistad.id_usuario2) AND amistad.id = comentario.id_amistad AND usuario.id="
           + id_usuario;
   strSQL += SqlBuilder.buildSqlLimit(oMysql.getCount(strSQL), intRegsPerPag, intPage);
   ArrayList<ComentarioBean> arrComentario = new ArrayList<>();
   try {
     ResultSet oResultSet = oMysql.getAllSql(strSQL);
     if (oResultSet != null) {
       while (oResultSet.next()) {
         ComentarioBean oComentarioBean = new ComentarioBean();
         arrComentario.add(oComentarioBean.fill(oResultSet, oConnection, expand));
       }
     }
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
   }
   return arrComentario;
 }
 public ArrayList<ComentarioBean> getAllporusuario(
     int id_usuario,
     ArrayList<FilterBeanHelper> alFilter,
     HashMap<String, String> hmOrder,
     Integer expand)
     throws Exception {
   strSQL =
       "SELECT comentario.* from comentario, amistad where comentario.id_amistad= amistad.id and amistad.id_usuario2="
           + id_usuario;
   strSQL += SqlBuilder.buildSqlOrder(hmOrder);
   ArrayList<ComentarioBean> arrComentario = new ArrayList<>();
   try {
     ResultSet oResultSet = oMysql.getAllSql(strSQL);
     if (oResultSet != null) {
       while (oResultSet.next()) {
         ComentarioBean oComentarioBean = new ComentarioBean();
         arrComentario.add(oComentarioBean.fill(oResultSet, oConnection, expand));
       }
     }
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
   }
   return arrComentario;
 }
 @Override
 public Integer remove(Integer id) throws Exception {
   int result = 0;
   try {
     result = oMysql.removeOne(id, strTable);
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":remove ERROR: " + ex.getMessage()));
   }
   return result;
 }
 @Override
 public int getCount(ArrayList<FilterBeanHelper> hmFilter) throws Exception {
   strSQL += SqlBuilder.buildSqlWhere(hmFilter);
   int pages = 0;
   try {
     pages = oMysql.getCount(strSQL);
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getCount ERROR: " + ex.getMessage()));
   }
   return pages;
 }
  public Integer removeOnCascade(Integer id) throws Exception {
    int result = 0;
    String strSQLUsuarioTarea = "DELETE FROM usuariotarea WHERE usuariotarea.id_tarea=" + id;

    try {
      result = oMysql.removeOnCascade(strSQLUsuarioTarea);

    } catch (Exception ex) {
      ExceptionBooster.boost(
          new Exception(this.getClass().getName() + ":remove ERROR: " + ex.getMessage()));
    }
    return result;
  }
  @Override
  public Integer set(TareaBean oTareaBean) throws Exception {
    Integer iResult = null;
    try {
      if (oTareaBean.getId() == 0) {
        strSQL = "INSERT INTO " + strTable + " ";
        strSQL += "(" + oTareaBean.getColumns() + ")";
        strSQL += "VALUES(" + oTareaBean.getValues() + ")";
        iResult = oMysql.executeInsertSQL(strSQL);
      } else {
        strSQL = "UPDATE " + strTable + " ";
        strSQL += " SET " + oTareaBean.toPairs();
        strSQL += " WHERE id=" + oTareaBean.getId();
        iResult = oMysql.executeUpdateSQL(strSQL);
      }

    } catch (Exception ex) {
      ExceptionBooster.boost(
          new Exception(this.getClass().getName() + ":set ERROR: " + ex.getMessage()));
    }
    return iResult;
  }
 public int getCountxidusuario(int id_usuario, ArrayList<FilterBeanHelper> hmFilter)
     throws Exception {
   // strSQL += SqlBuilder.buildSqlWhere(hmFilter);
   int pages = 0;
   try {
     pages =
         oMysql.getCount(
             "select comentario.id, comentario.texto, comentario.fecha, comentario.id_amistad from comentario, amistad, usuario where (usuario.id= amistad.id_usuario OR usuario.id= amistad.id_usuario2) AND amistad.id = comentario.id_amistad AND usuario.id="
                 + id_usuario);
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getCount ERROR: " + ex.getMessage()));
   }
   return pages;
 }
 public ArrayList<TareaBean> getAllTareaXCurso(Integer intTarea, Integer expand) throws Exception {
   strSQL += " AND tarea.id_asignaturaevaluacion = " + intTarea;
   ArrayList<TareaBean> arrTarea = new ArrayList<>();
   try {
     ResultSet oResultSet = oMysql.getAllSql(strSQL);
     if (oResultSet != null) {
       while (oResultSet.next()) {
         TareaBean oTareaBean = new TareaBean();
         arrTarea.add(oTareaBean.fill(oResultSet, oConnection, expand));
       }
     }
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
   }
   return arrTarea;
 }
 @Override
 public TareaBean get(TareaBean oTareaBean, Integer expand) throws Exception {
   if (oTareaBean.getId() > 0) {
     try {
       ResultSet oResultSet = oMysql.getAllSql(strSQL + " And id= " + oTareaBean.getId() + " ");
       if (oResultSet != null) {
         while (oResultSet.next()) {
           oTareaBean = oTareaBean.fill(oResultSet, oConnection, expand);
         }
       }
     } catch (Exception ex) {
       ExceptionBooster.boost(
           new Exception(this.getClass().getName() + ":get ERROR: " + ex.getMessage()));
     }
   } else {
     oTareaBean.setId(0);
   }
   return oTareaBean;
 }
  public int getAmistad(int id_usuario, int id_usuario2) throws Exception {
    int num = 0;

    String consulta =
        "select * from amistad where (id_usuario="
            + id_usuario
            + " and id_usuario2="
            + id_usuario2
            + ")";

    ResultSet oResultSet = oMysql.getAllSql(consulta);

    if (oResultSet != null) {
      while (oResultSet.next()) {
        num = oResultSet.getInt("id");
      }
    }
    return num;
  }
  public int getmensajesnuevos(int id_usuario) throws Exception {

    int num = 0;

    strSQL =
        "select count(*) as total from comentario, amistad, usuario where usuario.id= amistad.id_usuario AND amistad.id = comentario.id_amistad AND amistad.id_usuario2="
            + id_usuario
            + " and comentario.leido=0";
    try {
      ResultSet oResultSet = oMysql.getAllSql(strSQL);
      if (oResultSet != null) {
        while (oResultSet.next()) {
          num = oResultSet.getInt("total");
        }
      }
    } catch (Exception ex) {
      ExceptionBooster.boost(
          new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
    }
    return num;
  }