Example #1
0
    public int countSearch(String criteria) {
      // if we have to be concerned with old stuff, we cannot let the db do the search and count
      if (m_checkOld) {
        List all = getAll();
        List rv = new Vector();

        for (Iterator i = all.iterator(); i.hasNext(); ) {
          Alias a = (Alias) i.next();
          if (StringUtil.containsIgnoreCase(a.getId(), criteria)
              || StringUtil.containsIgnoreCase(a.getTarget(), criteria)) {
            rv.add(a);
          }
        }

        return rv.size();
      }

      Object[] fields = new Object[2];
      fields[0] = "%" + criteria.toUpperCase() + "%";
      fields[1] = fields[0];
      int rv =
          super.countSelectedResources("UPPER(ALIAS_ID) LIKE ? OR UPPER(TARGET) LIKE ?", fields);

      return rv;
    }
Example #2
0
    public List search(String criteria, int first, int last) {
      // if we have to be concerned with old stuff, we cannot let the db do the search
      if (m_checkOld) {
        List all = getAll();
        List rv = new Vector();

        for (Iterator i = all.iterator(); i.hasNext(); ) {
          Alias a = (Alias) i.next();
          if (StringUtil.containsIgnoreCase(a.getId(), criteria)
              || StringUtil.containsIgnoreCase(a.getTarget(), criteria)) {
            rv.add(a);
          }
        }

        Collections.sort(rv);

        // subset by position
        if (first < 1) first = 1;
        if (last >= rv.size()) last = rv.size();

        rv = rv.subList(first - 1, last);

        return rv;
      }

      Object[] fields = new Object[2];
      fields[0] = "%" + criteria.toUpperCase() + "%";
      fields[1] = fields[0];
      List all =
          super.getSelectedResources(
              "UPPER(ALIAS_ID) LIKE ? OR UPPER(TARGET) LIKE ?", fields, first, last);

      return all;
    }
Example #3
0
    /**
     * Count all the aliases with id or target matching criteria.
     *
     * @param criteria The search criteria.
     * @return The count of all aliases with id or target matching criteria.
     */
    public int countSearch(String criteria) {
      List all = super.getAllResources();

      Vector rv = new Vector();
      for (Iterator i = all.iterator(); i.hasNext(); ) {
        Alias a = (Alias) i.next();
        if (StringUtil.containsIgnoreCase(a.getId(), criteria)
            || StringUtil.containsIgnoreCase(a.getTarget(), criteria)) {
          rv.add(a);
        }
      }

      return rv.size();
    }
Example #4
0
    /**
     * Search for aliases with id or target matching criteria, in range.
     *
     * @param criteria The search criteria.
     * @param first The first record position to return.
     * @param last The last record position to return.
     * @return The List (BaseAliasEdit) of all alias.
     */
    public List search(String criteria, int first, int last) {
      List all = super.getAllResources();

      List rv = new Vector();
      for (Iterator i = all.iterator(); i.hasNext(); ) {
        Alias a = (Alias) i.next();
        if (StringUtil.containsIgnoreCase(a.getId(), criteria)
            || StringUtil.containsIgnoreCase(a.getTarget(), criteria)) {
          rv.add(a);
        }
      }

      Collections.sort(rv);

      // subset by position
      if (first < 1) first = 1;
      if (last >= rv.size()) last = rv.size();

      rv = rv.subList(first - 1, last);

      return rv;
    }