コード例 #1
0
  /**
   * 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));
  }
コード例 #2
0
 /** Reset the query parameters. */
 public void reset() {
   cacheHits = new Vector();
   DOs = null;
   uniqueInstance = false;
   needToRun = true;
   builder.reset();
 }
コード例 #3
0
  /**
   * 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);
  }
コード例 #4
0
  /**
   * 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));
  }
コード例 #5
0
 /**
  * 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");
 }
コード例 #6
0
 /**
  * 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");
 }
コード例 #7
0
 /** Add Capability to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderByCapability() {
   builder.addOrderByColumn("Capability", "ASC");
 }
コード例 #8
0
 /**
  * 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");
 }
コード例 #9
0
 /** Add Candidate to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderByCandidate() {
   builder.addOrderByColumn("Candidate", "ASC");
 }
コード例 #10
0
 /**
  * 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");
 }
コード例 #11
0
 /**
  * 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();
 }
コード例 #12
0
 /** Public constructor. */
 public SoftwareCandidateQuery() {
   builder = new QueryBuilder("SoftwareCandidate", "SoftwareCandidate.*");
   builder.setDatabaseVendor("Standard");
   builder.setStringMatchDetails("MATCHES", "*");
   reset();
 }
コード例 #13
0
 /** Add Software to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderBySoftware() {
   builder.addOrderByColumn("Software", "ASC");
 }
コード例 #14
0
 /**
  * Add OperatingSystem to the ORDER BY clause. This convenience method assumes ascending order.
  */
 public void addOrderByOperatingSystem() {
   builder.addOrderByColumn("OperatingSystem", "ASC");
 }
コード例 #15
0
 /**
  * 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");
 }
コード例 #16
0
 /** Add Profile to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderByProfile() {
   builder.addOrderByColumn("Profile", "ASC");
 }
コード例 #17
0
 /**
  * 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");
 }
コード例 #18
0
 /** Add LeafNumber to the ORDER BY clause. This convenience method assumes ascending order. */
 public void addOrderByLeafNumber() {
   builder.addOrderByColumn("LeafNumber", "ASC");
 }
コード例 #19
0
 /**
  * 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();
 }
コード例 #20
0
 /**
  * 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;
 }
コード例 #21
0
 /**
  * Place a closing parenthesis in the <CODE>WHERE</CODE> clause.
  *
  * @see openParen
  * @author Jay Gunter
  */
 public void closeParen() {
   builder.addWhereCloseParen();
 }
コード例 #22
0
 /** Public constructor. */
 public OperatingsystemProfileQuery() {
   builder = new QueryBuilder("OperatingsystemProfile", "OperatingsystemProfile.*");
   builder.setDatabaseVendor("Standard");
   builder.setStringMatchDetails("MATCHES", "*");
   reset();
 }