Пример #1
0
 /**
  * Load the actual DO data if necessary. Called by get/set methods.
  *
  * @exception DataObjectException If a data access error occurs.
  */
 private void checkLoad() throws DataObjectException {
   if (null == data)
     try {
       loadData();
     } catch (Exception e) {
       throw new DataObjectException(
           "Unable to load data for TreeLeafDO id=" + getOId() + ", error = " + e.getMessage());
     }
 }
Пример #2
0
 /**
  * Set Pensum of the EmployerCandidateDO
  *
  * @param Pensum of the EmployerCandidateDO
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setPensum(int Pensum) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   DO.setPensum(Pensum);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #3
0
 /**
  * Set Employer of the EmployerCandidateDO
  *
  * @param Employer of the EmployerCandidateDO
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setEmployer(jobmatch.data.EmployerDO Employer) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   DO.setEmployer(Employer);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #4
0
 /**
  * Set EndDate of the EmployerCandidateDO
  *
  * @param EndDate of the EmployerCandidateDO
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setEndDate(java.sql.Date EndDate) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   DO.setEndDate(EndDate);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #5
0
 /**
  * Set Candidate of the EmployerCandidateDO
  *
  * @param Candidate of the EmployerCandidateDO
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setCandidate(jobmatch.data.CandidateDO Candidate) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   DO.setCandidate(Candidate);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #6
0
 /**
  * Set Mandatory of the NewDBTable
  *
  * @param Mandatory of the NewDBTable
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setMandatory(boolean Mandatory) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   checkLoad();
   data.Mandatory = markNewValue(data.Mandatory, Mandatory);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #7
0
 /**
  * Set Profile of the NewDBTable
  *
  * @param Profile of the NewDBTable
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setProfile(jobmatch.data.ProfileDO Profile) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   checkLoad();
   data.Profile = (jobmatch.data.ProfileDO) markNewValue(data.Profile, Profile);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #8
0
 /**
  * Set LeafNumber of the NewDBTable
  *
  * @param LeafNumber of the NewDBTable
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setLeafNumber(int LeafNumber) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   checkLoad();
   data.LeafNumber = markNewValue(data.LeafNumber, LeafNumber);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #9
0
 /**
  * Set Sex of the PersonalProfile
  *
  * @param Sex of the PersonalProfile
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setSex(String Sex) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   checkLoad();
   data.Sex = markNewValue(data.Sex, Sex, 0, 32, true);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #10
0
 /**
  * Set Nationality of the PersonalProfile
  *
  * @param Nationality of the PersonalProfile
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setNationality(jobmatch.data.CountryDO Nationality) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   checkLoad();
   data.Nationality = (jobmatch.data.CountryDO) markNewValue(data.Nationality, Nationality);
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #11
0
  /**
   * Prepares the statement used to insert this object into the database.
   *
   * @param conn the database connection.
   * @return the insert statement.
   * @exception java.sql.SQLException if an error occurs.
   */
  public PreparedStatement getInsertStatement(DBConnection conn) throws SQLException {
    /*
     * It would probably be better to have CoreDO implement
     * 	void addToCache(CoreDO DO) {}
     * and have each DO that has caching enabled override it as
     *      void addToCache(CoreDO DO) { cache.put( DO.getOId(), DO ); }
     * and change CoreDO to invoke addToCache()
     * when it invokes getInsertStatement().
     */

    ObjectId oid;

    PreparedStatement stmt =
        conn.prepareStatement(
            "insert into PersonalProfile ( LeafNumber, Profile, Mandatory, MinAge, MaxAge, Nationality, Sex, "
                + getOIdColumnName()
                + ", "
                + getVersionColumnName()
                + " ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ? )");

    param = new int[1];
    param[0] = 1;
    // writeMemberStuff uses the JDBCsetCalls.template
    // to build up the value for this tag:
    // the value is a series of calls to setPrepStmtParam_TYPE methods.
    // Those methods are defined in GenericDO.
    try {
      setPrepStmtParam_int(stmt, param, getLeafNumber());
      setPrepStmtParam_DO(stmt, param, getProfile());
      setPrepStmtParam_boolean(stmt, param, getMandatory());
      setPrepStmtParam_int(stmt, param, getMinAge());
      setPrepStmtParam_int(stmt, param, getMaxAge());
      setPrepStmtParam_DO(stmt, param, getNationality());
      setPrepStmtParam_String(stmt, param, getSex());

      /* The order of the values being inserted must match
       * the order of the columns listed in the CREATE TABLE command
       * that appears in the .sql file for this DO.
       * Since the id and version number are always the last columns
       * listed in the CREATE TABLE command, their values are added
       * to the PreparedStatement after all other values.
       */
      setPrepStmtParam_BigDecimal(stmt, param, getOId().toBigDecimal());
      setPrepStmtParam_int(stmt, param, getNewVersion());

    } catch (Exception e) {
      throw new SQLException("Data Object error: " + e.getMessage());
    }

    return stmt;
  }
Пример #12
0
 /**
  * Set Employer of the EmployerCandidateDO
  *
  * @param BDO-wrapped Employer of the EmployerCandidateDO
  * @exception DataObjectException If the object is not found in the database.
  */
 public void setEmployer(jobmatch.data.EmployerBDO Employer) throws DataObjectException {
   try {
     // business actions/assertions prior to data assignment
     beforeAnySet();
   } catch (Exception e) {
     throw new DataObjectException("beforeAnySet: " + e.getMessage());
   }
   if (null == Employer) {
     if (false) DO.setEmployer(null);
     else throw new DataObjectException("EmployerCandidateBDO.setEmployer does not allow NULL.");
   } else {
     DO.setEmployer(Employer.getDO());
   }
   afterAnySet(); // business actions/assertions after data assignment
 }
Пример #13
0
  /**
   * Prepares the statement used to update this object in the database.
   *
   * @param conn the database connection
   * @return the update statement.
   * @exception java.sql.SQLException if an error occurs.
   */
  public PreparedStatement getUpdateStatement(DBConnection conn) throws SQLException {

    ObjectId oid;

    PreparedStatement stmt =
        conn.prepareStatement(
            "update PersonalProfile set "
                + getVersionColumnName()
                + " = ?, LeafNumber = ?, Profile = ?, Mandatory = ?, MinAge = ?, MaxAge = ?, Nationality = ?, Sex = ? "
                + "where "
                + getOIdColumnName()
                + " = ? and "
                + getVersionColumnName()
                + " = ?");

    param = new int[1];
    param[0] = 1;
    // int[] param = {1};
    // writeMemberStuff builds up the value for this tag:
    // the value is a series of calls to setPrepStmtParam_TYPE methods.
    // Those methods are defined below.
    try {
      setPrepStmtParam_int(stmt, param, getNewVersion());
      setPrepStmtParam_int(stmt, param, getLeafNumber());
      setPrepStmtParam_DO(stmt, param, getProfile());
      setPrepStmtParam_boolean(stmt, param, getMandatory());
      setPrepStmtParam_int(stmt, param, getMinAge());
      setPrepStmtParam_int(stmt, param, getMaxAge());
      setPrepStmtParam_DO(stmt, param, getNationality());
      setPrepStmtParam_String(stmt, param, getSex());

      /* When updating a persistent object, the UPDATE_WHERE_CLAUSE tag
       * used to build the SQL WHERE clause (above) uses the
       * DO's id and version number to locate the correct row in
       * the database table.
       */
      setPrepStmtParam_BigDecimal(stmt, param, getOId().toBigDecimal());
      setPrepStmtParam_int(stmt, param, getVersion());

    } catch (Exception e) {
      throw new SQLException("Data Object error: " + e.getMessage());
    }

    return stmt;
  }