private List<DbObject> retrieveObjects(Set<String> types) throws SQLException {
    if (this.monitor != null) {
      monitor.setMonitorType(RowActionMonitor.MONITOR_PLAIN);
      monitor.setCurrentObject(ResourceMgr.getString("MsgRetrievingTables"), -1, -1);
    }
    List<DbObject> result = CollectionUtil.sizedArrayList(50);

    String[] typeNames = new String[types.size()];
    int i = 0;
    for (String type : types) {
      if (type != null) {
        // the JDBC calls all use upper-case type names, even
        // if the DBMS stores them lower case
        typeNames[i] = type.toUpperCase();
        i++;
      }
    }

    for (String schema : schemas) {
      for (String name : names) {
        if (cancelSearch) return null;
        List<TableIdentifier> objects =
            connection.getMetadata().getObjectList(name, schema, typeNames);
        result.addAll(objects);
      }
    }
    return result;
  }
  private void searchList(
      List<DbObject> toSearch,
      List<String> searchValues,
      boolean matchAll,
      boolean ignoreCase,
      boolean useRegex) {
    if (monitor != null) {
      monitor.setMonitorType(RowActionMonitor.MONITOR_PROCESS);
    }
    int total = toSearch.size();
    int current = 1;

    for (DbObject object : toSearch) {
      numSearched++;
      if (cancelSearch) return;

      if (monitor != null) {
        monitor.setCurrentObject(object.getObjectName(), current, total);
      }

      try {
        CharSequence source = null;
        if (connection.getMetadata().isTableType(object.getObjectType())) {
          ((TableIdentifier) object).setRetrieveFkSource(true);
        }

        ProcedureDefinition def = null;
        if (object instanceof ProcedureDefinition) {
          def = (ProcedureDefinition) object;
        }

        String key = getObjectKey(object);
        if (!searchedObjects.contains(key)) {
          source = object.getSource(connection);
          if (StringUtil.isBlank(source)) {
            LogMgr.logWarning(
                "ObjectSourceSearcher.searchObjects()",
                "Empty source returned for " + object.toString());
          }

          if (StringUtil.containsWords(source, searchValues, matchAll, ignoreCase, useRegex)) {
            searchResult.add(object);
          }
          searchedObjects.add(key);
        }
      } catch (SQLException sql) {
        LogMgr.logError(
            "ObjectSourceSearcher.searchObjects()", "Error retrieving object source", sql);
      }
      current++;
    }
  }
 private List<DbObject> retrieveTriggers() throws SQLException {
   if (this.monitor != null) {
     monitor.setMonitorType(RowActionMonitor.MONITOR_PLAIN);
     monitor.setCurrentObject(ResourceMgr.getString("MsgRetrievingTriggers"), -1, -1);
   }
   TriggerReader trgReader = TriggerReaderFactory.createReader(connection);
   List<DbObject> result = CollectionUtil.sizedArrayList(50);
   for (String schema : schemas) {
     if (cancelSearch) return null;
     List<TriggerDefinition> triggers = trgReader.getTriggerList(null, schema, null);
     result.addAll(triggers);
   }
   return result;
 }
  private List<DbObject> retrieveProcedures() throws SQLException {
    if (this.monitor != null) {
      monitor.setMonitorType(RowActionMonitor.MONITOR_PLAIN);
      monitor.setCurrentObject(ResourceMgr.getString("MsgRetrievingProcedures"), -1, -1);
    }
    List<DbObject> result = CollectionUtil.sizedArrayList(50);
    ProcedureReader reader = connection.getMetadata().getProcedureReader();
    if (reader == null) return result;

    for (String schema : schemas) {
      for (String name : names) {
        if (cancelSearch) return null;
        List<ProcedureDefinition> procs = reader.getProcedureList(null, schema, name);
        result.addAll(procs);
      }
    }
    return result;
  }