Пример #1
0
  public void load(int identificador, DbConnection db) throws ISicresRPAdminDAOException {
    DynamicTable tableInfo = new DynamicTable();
    DynamicRows rowsInfo = new DynamicRows();
    DynamicRow rowInfo = new DynamicRow();
    SicresUserPermisosTabla table = new SicresUserPermisosTabla();

    if (logger.isDebugEnabled()) {
      logger.debug("Obteniendo datos de scr_usrperms...");
    }

    try {
      tableInfo.setTableObject(table);
      tableInfo.setClassName(table.getClass().getName());
      tableInfo.setTablesMethod("getTableName");
      tableInfo.setColumnsMethod("getAllColumnNames");

      rowInfo.addRow(this);
      rowInfo.setClassName(this.getClass().getName());
      rowInfo.setValuesMethod("loadAllValues");
      rowsInfo.add(rowInfo);

      if (!DynamicFns.select(db, table.getById(identificador), tableInfo, rowsInfo)) {
        throw new ISicresRPAdminDAOException(ISicresRPAdminDAOException.SCR_USRPERMS_NOT_FOUND);
      }
      if (logger.isDebugEnabled()) {
        logger.debug("Datos de scr_usrperms obtenidos.");
      }
    } catch (Exception e) {
      if (e instanceof ISicresRPAdminDAOException)
        logger.warn("No se ha encontrado fila en scr_usrperms");
      else logger.error("Error obteniendo datos de scr_usrperms");
      throw new ISicresRPAdminDAOException(ISicresRPAdminDAOException.EXC_GENERIC_EXCEPCION, e);
    }
  }
Пример #2
0
  public void add(DbConnection db) throws ISicresRPAdminDAOException {
    DynamicTable tableInfo = new DynamicTable();
    DynamicRows rowsInfo = new DynamicRows();
    DynamicRow rowInfo = new DynamicRow();
    SicresUserPermisosTabla table = new SicresUserPermisosTabla();

    try {
      if (logger.isDebugEnabled()) {
        logger.debug("Añadiendo scr_usrperms...");
      }

      tableInfo.setTableObject(table);
      tableInfo.setClassName(table.getClass().getName());
      tableInfo.setTablesMethod("getTableName");
      tableInfo.setColumnsMethod("getAllColumnNames");

      rowInfo.addRow(this);
      rowInfo.setClassName(this.getClass().getName());
      rowInfo.setValuesMethod("insert");
      rowsInfo.add(rowInfo);

      DynamicFns.insert(db, tableInfo, rowsInfo);
      if (logger.isDebugEnabled()) {
        logger.debug("scr_usrperms añadida.");
      }
    } catch (Exception e) {
      logger.error("Error añadiendo scr_usrperms.", e);
      throw new ISicresRPAdminDAOException(ISicresRPAdminDAOException.SCR_USRPERMS_INSERT, e);
    }
  }
Пример #3
0
  public void update(DbConnection db) throws ISicresRPAdminDAOException {
    DynamicTable tableInfo = new DynamicTable();
    DynamicRows rowsInfo = new DynamicRows();
    DynamicRow rowInfo = new DynamicRow();
    SicresUserPermisosTabla table = new SicresUserPermisosTabla();

    try {
      if (logger.isDebugEnabled()) {
        logger.debug("Actualizando scr_usrperms.");
      }

      tableInfo.setTableObject(table);
      tableInfo.setClassName(table.getClass().getName());
      tableInfo.setTablesMethod("getTableName");
      tableInfo.setColumnsMethod("getUpdateColumnNames");

      rowInfo.addRow(this);
      rowInfo.setClassName(this.getClass().getName());
      rowInfo.setValuesMethod("update");
      rowsInfo.add(rowInfo);

      DynamicFns.update(db, table.getById(getIdUsr()), tableInfo, rowsInfo);
      if (logger.isDebugEnabled()) {
        logger.debug("Actualizado scr_usrperms.");
      }
    } catch (Exception e) {
      logger.error("Error actualizando scr_usrperms", e);
      throw new ISicresRPAdminDAOException(ISicresRPAdminDAOException.SCR_USRPERMS_UPDATE);
    }
  }