@Throws(Exception::class) private fun checkUserExists(entidad: String) { val count: Int val table = UsersTable() val dbConn = DbConnection() try { dbConn.open(DBSessionManager.getSession()) count = if (_id === ISicresAdminDefsKeys.NULL_ID) DbSelectFns.selectCount( dbConn, table.getBaseTableName(), table.getCountNameQual(_name) ) else DbSelectFns.selectCount( dbConn, table.getBaseTableName(), table.getCountNameIdQual(_id, _name) ) if (count > 0) ISicresAdminBasicException.throwException(ISicresAdminUserKeys.EC_USER_EXISTS_NAME) } catch (e: Exception) { _logger.error(e) throw e } finally { dbConn.close() } }
Comprueba que el usuario tiene distinto nombre a los que ya existen .