/**
  * Eliminar un registro.
  *
  * @param inTproc Object - Objeto procesado
  * @throws PersistenciaException - capa de persistencia
  * @return Object - identificador de objeto
  */
 public Object delete(Object Par_Ldap) throws PersistenciaException {
   PreparedStatement stmt = null;
   Connection connection = null;
   StringBuffer sqlString = new StringBuffer();
   Par_LdapTO Par_LdapTO = (Par_LdapTO) Par_Ldap;
   sqlString.append(" DELETE FROM siga_parametros.Par_Ldap");
   sqlString.append(" WHERE PAR_ID=?");
   try {
     synchronized (this) {
       connection = super.getConnection(this.objDataSession);
       stmt = connection.prepareStatement(sqlString.toString());
       int i = 1;
       setLong(stmt, (Long) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_ID), i++);
       stmt.executeUpdate();
     }
     return "Ok";
   } catch (SQLException ex) {
     System.err.println("error Par_LdapDAO.delete: " + ex.toString());
     throw new PersistenciaException(ex.getMessage(), ex);
   } finally {
     try {
       super.cerrarConexiones(connection, stmt, null, this.objDataSession);
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
 }
  /**
   * Inserta un registro.
   *
   * @param inTproc Object - Objeto procesado
   * @throws PersistenciaException - capa de persistencia
   * @return Object - identificador de objeto
   */
  public Object insert(Object Par_Ldap) throws PersistenciaException {
    PreparedStatement stmt = null;
    Connection connection = null;
    StringBuffer sqlString = new StringBuffer();
    Par_LdapTO Par_LdapTO = (Par_LdapTO) Par_Ldap;
    int i = 0;
    Long sequence = new Long(0);
    sqlString.append(" INSERT INTO siga_parametros.Par_Ldap ");
    sqlString.append("    (ldap_id ");
    sqlString.append("    ,ldap_ip ");
    sqlString.append("    ,ldap_puerto");
    sqlString.append("    ,ldap_basedn");
    sqlString.append("    ,ldap_usuario ");
    sqlString.append("    ,ldap_administrador ");
    sqlString.append("    ,ldap_password ");

    sqlString.append(" )VALUES (?,?,?,?,?,?,?) ");
    try {
      synchronized (this) {
        connection = super.getConnection(this.objDataSession);
        sequence = getNextSequential("Par_Ldap", "PAR_ID", connection);
        Par_LdapTO.setAttribute(Par_LdapTO.LDAP_ID, sequence);
        stmt = connection.prepareStatement(sqlString.toString());
        i = 1;
        setLong(stmt, (Long) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_ID), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_IP), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_PUERTO), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_BASEDN), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_USUARIO), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_ADMINISTRADOR), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_PASSWORD), i++);

        stmt.executeUpdate();
      }
      return "Ok";
    } catch (SQLException ex) {
      System.err.println("error Par_LdapDAO.insert: " + ex.toString());
      throw new PersistenciaException(ex.getMessage(), ex);
    } finally {
      try {
        super.cerrarConexiones(connection, stmt, null, this.objDataSession);
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    }
  }
  /**
   * Actualizar un registro.
   *
   * @param inTproc Object - Objeto procesado.
   * @throws PersistenciaException - capa de persistencia.
   * @return Object - identificador de objeto
   */
  public Object update(Object Par_Ldap) throws PersistenciaException {
    PreparedStatement stmt = null;
    Connection connection = null;
    StringBuffer sqlString = new StringBuffer();
    Par_LdapTO Par_LdapTO = (Par_LdapTO) Par_Ldap;
    sqlString.append(" UPDATE siga_parametros.Par_Ldap ");
    sqlString.append(" SET LDAP_ID = ? ");
    sqlString.append(" , LDAP_IP = ? ");
    sqlString.append(" , LDAP_PUERTO = ? ");
    sqlString.append(" , LDAP_BASEDN = ? ");
    sqlString.append(" , LDAP_USUARIO = ? ");
    sqlString.append("     ,LDAP_ADMINISTRADOR = ? ");
    sqlString.append("     ,LDAP_PASSWORD = ? ");

    sqlString.append(" WHERE LDAP_ID = ? ");
    try {
      synchronized (this) {
        connection = super.getConnection(this.objDataSession);
        stmt = connection.prepareStatement(sqlString.toString());
        int i = 1;

        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_IP), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_PUERTO), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_BASEDN), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_USUARIO), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_ADMINISTRADOR), i++);
        setString(stmt, (String) Par_LdapTO.getAttribute(Par_LdapTO.LDAP_PASSWORD), i++);
        setLong(stmt, (Long) Par_LdapTO.getAttribute(1), i++);
        stmt.executeUpdate();
      }
      return "Ok";
    } catch (SQLException ex) {
      System.err.println("error Par_LdapDAO.update: " + ex.toString());
      throw new PersistenciaException(ex.getMessage(), ex);
    } finally {
      try {
        cerrarConexiones(connection, stmt, null, this.objDataSession);
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    }
  }