/**
   * Set the Software to query.
   *
   * @param x The Software of the SoftwareCandidate to query.
   * @param exact to use matches or not
   * @exception DataObjectException If a database access error occurs.
   */
  public void setQuerySoftware(jobmatch.data.SoftwareDO x, boolean exact)
      throws DataObjectException, QueryException {
    // Remove from cacheHits any DOs that do not meet this
    // setQuery requirement.
    for (int i = 0; i < cacheHits.size() && !hitDb; i++) {
      SoftwareCandidateDO DO = (SoftwareCandidateDO) cacheHits.elementAt(i);
      if (null == DO) continue;
      boolean equals = true;

      // DOs are compared by their handles..
      jobmatch.data.SoftwareDO m = DO.getSoftware();
      if (null == m && null == x) {
        equals = true;
      } else if (null == m || null == x) {
        equals = false;
      } else {
        equals = (DO.getSoftware().getOId().toString().equals(x.getOId().toString()));
        if (equals && m != x) {
          System.err.println("\n----------------------------------------------------------");
          System.err.println("m =" + m);
          System.err.println("x =" + x);
        }
      }

      if (!equals) cacheHits.removeElementAt(i--);
    }

    // Also prepare the SQL needed to query the database
    // in case there is no cache, or the query involves other tables.
    if (partialCache || hitDb)
      builder.addWhereClause(
          "Software", x, "DECIMAL(19,0)", QueryBuilder.NOT_NULL, exactFlag(exact));
  }
 /** Reset the query parameters. */
 public void reset() {
   cacheHits = new Vector();
   DOs = null;
   uniqueInstance = false;
   needToRun = true;
   builder.reset();
 }
  /**
   * Set the OID to query. WARNING! This method assumes that table <CODE>SoftwareCandidate</CODE>
   * has a column named <CODE>"oid"</CODE>. This method is called from the DO classes to retrieve an
   * object by id.
   *
   * @param oid The object id to query.
   */
  public void setQueryOId(ObjectId oid) {
    // Remove from cacheHits any DOs that do not meet this
    // setQuery requirement.
    if (null == oid) return;
    requireUniqueInstance();
    for (int i = 0; i < cacheHits.size(); i++) {
      SoftwareCandidateDO DO = (SoftwareCandidateDO) cacheHits.elementAt(i);
      if (null == DO) continue;
      boolean equals = true;
      ObjectId id = DO.getOId();
      if (null == id || !id.equals(oid)) cacheHits.removeElementAt(i--);
    }

    // Also prepare the SQL needed to query the database
    // in case there is no cache, or the query involves other tables.
    builder.addWhereClause("oid", oid.toBigDecimal(), QueryBuilder.NOT_NULL);
  }
  /**
   * Set the LeafNumber to query.
   *
   * @param x The LeafNumber of the OperatingsystemProfile to query.
   * @param exact to use matches or not
   * @exception DataObjectException If a database access error occurs.
   */
  public void setQueryLeafNumber(int x, boolean exact) throws DataObjectException, QueryException {
    // Remove from cacheHits any DOs that do not meet this
    // setQuery requirement.
    for (int i = 0; i < cacheHits.size() && !hitDb; i++) {
      OperatingsystemProfileDO DO = (OperatingsystemProfileDO) cacheHits.elementAt(i);
      if (null == DO) continue;
      boolean equals = true;

      // primitive types are compared using the == operator.
      equals = (DO.getLeafNumber() == x);

      if (!equals) cacheHits.removeElementAt(i--);
    }

    // Also prepare the SQL needed to query the database
    // in case there is no cache, or the query involves other tables.
    if (partialCache || hitDb)
      builder.addWhereClause("LeafNumber", x, "INTEGER", QueryBuilder.NULL_OK, exactFlag(exact));
  }
 /**
  * Add Software to the ORDER BY clause.
  *
  * @param direction_flag True for ascending order, false for descending
  */
 public void addOrderBySoftware(boolean direction_flag) {
   builder.addOrderByColumn("Software", (direction_flag) ? "ASC" : "DESC");
 }
 /**
  * Add LeafNumber to the ORDER BY clause.
  *
  * @param direction_flag True for ascending order, false for descending
  */
 public void addOrderByLeafNumber(boolean direction_flag) {
   builder.addOrderByColumn("LeafNumber", (direction_flag) ? "ASC" : "DESC");
 }
 /** Add Capability to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderByCapability() {
   builder.addOrderByColumn("Capability", "ASC");
 }
 /**
  * Add Capability to the ORDER BY clause.
  *
  * @param direction_flag True for ascending order, false for descending
  */
 public void addOrderByCapability(boolean direction_flag) {
   builder.addOrderByColumn("Capability", (direction_flag) ? "ASC" : "DESC");
 }
 /** Add Candidate to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderByCandidate() {
   builder.addOrderByColumn("Candidate", "ASC");
 }
 /**
  * Add Candidate to the ORDER BY clause.
  *
  * @param direction_flag True for ascending order, false for descending
  */
 public void addOrderByCandidate(boolean direction_flag) {
   builder.addOrderByColumn("Candidate", (direction_flag) ? "ASC" : "DESC");
 }
 /**
  * Place an open parenthesis in the <CODE>WHERE</CODE> clause. Example usage: find all the Bobs
  * and Roberts who are 5 or 50 years old: <CODE>
  *    PersonQuery pq = new PersonQuery();
  *    pq.openParen();
  *       pq.setQueryFirstName( "Bob" );
  *       pq.or();
  *       pq.setQueryFirstName( "Robert" );
  *    pq.closeParen();
  *    // AND automatically inserted here.
  *    pq.openParen();
  *       pq.setQueryAge( 5 );
  *       pq.or();
  *       pq.setQueryAge( 50 );
  *    pq.closeParen();
  * </CODE>
  *
  * @see QueryBuilder to construct more elaborate queries.
  * @author Jay Gunter
  */
 public void openParen() {
   builder.addWhereOpenParen();
 }
 /** Public constructor. */
 public SoftwareCandidateQuery() {
   builder = new QueryBuilder("SoftwareCandidate", "SoftwareCandidate.*");
   builder.setDatabaseVendor("Standard");
   builder.setStringMatchDetails("MATCHES", "*");
   reset();
 }
 /** Add Software to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderBySoftware() {
   builder.addOrderByColumn("Software", "ASC");
 }
 /**
  * Add OperatingSystem to the ORDER BY clause. This convenience method assumes ascending order.
  */
 public void addOrderByOperatingSystem() {
   builder.addOrderByColumn("OperatingSystem", "ASC");
 }
 /**
  * Add OperatingSystem to the ORDER BY clause.
  *
  * @param direction_flag True for ascending order, false for descending
  */
 public void addOrderByOperatingSystem(boolean direction_flag) {
   builder.addOrderByColumn("OperatingSystem", (direction_flag) ? "ASC" : "DESC");
 }
 /** Add Profile to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderByProfile() {
   builder.addOrderByColumn("Profile", "ASC");
 }
 /**
  * Add Profile to the ORDER BY clause.
  *
  * @param direction_flag True for ascending order, false for descending
  */
 public void addOrderByProfile(boolean direction_flag) {
   builder.addOrderByColumn("Profile", (direction_flag) ? "ASC" : "DESC");
 }
 /** Add LeafNumber to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderByLeafNumber() {
   builder.addOrderByColumn("LeafNumber", "ASC");
 }
 /**
  * Insert an <CODE>OR</CODE> between <CODE>WHERE</CODE> clauses. Example: find all the persons
  * named Bob or Robert: <CODE>
  *    PersonQuery pq = new PersonQuery();
  *    pq.setQueryFirstName( "Bob" );
  *    pq.or();
  *    pq.setQueryFirstName( "Robert" );
  * </CODE> Note: Calls to <CODE>setQueryXxx</CODE> methods are implicitly <CODE>AND</CODE>ed
  * together, so the following example will always return nothing: <CODE>
  *    PersonQuery pq = new PersonQuery();
  *    pq.setQueryFirstName( "Bob" );
  *    // AND automatically inserted here.
  *    pq.setQueryFirstName( "Robert" );
  * </CODE>
  *
  * @see QueryBuilder to construct more elaborate queries.
  * @author Jay Gunter
  */
 public void or() {
   builder.addWhereOr();
 }
 /**
  * Method to query objects from the database. The following call in runQuery() dbQuery.query( this
  * ); causes the dbQuery object to invoke executeQuery()
  *
  * @param conn Handle to database connection.
  * @exception java.sql.SQLException If a database access error occurs.
  */
 public ResultSet executeQuery(DBConnection conn) throws SQLException {
   resultSet = builder.executeQuery(conn);
   return resultSet;
 }
 /**
  * Place a closing parenthesis in the <CODE>WHERE</CODE> clause.
  *
  * @see openParen
  * @author Jay Gunter
  */
 public void closeParen() {
   builder.addWhereCloseParen();
 }
 /** Public constructor. */
 public OperatingsystemProfileQuery() {
   builder = new QueryBuilder("OperatingsystemProfile", "OperatingsystemProfile.*");
   builder.setDatabaseVendor("Standard");
   builder.setStringMatchDetails("MATCHES", "*");
   reset();
 }