Ejemplo n.º 1
0
  /**
   * ** Gets the DBRecord associated with this key ** @param reload If the record should be reloaded
   * before it is returned ** @return The DBRecord associated with this key
   */
  public gDBR getDBRecord(boolean reload) {
    // returns null if there is an error

    /* create record */
    if (this.record == null) {
      try {
        this.record = DBRecord._createDBRecord(this);
      } catch (DBException dbe) {
        // Implementation error (this should never occur)
        // an NPE will likely follow
        Print.logStackTrace("Implementation error - cant' create DB record", dbe);
        return null;
      }
    }

    /* reload */
    if (reload) {
      // 'reload' is ignored if key does not exist
      this.record.reload();
    }

    /* return record (never null) */
    return this.record;
  }