Ejemplo n.º 1
0
  /**
   * ** Sets the DBRecord for this node ** @param record The DBRecord to set ** @return True if the
   * DBRecord was successfully set, false otherwise
   */
  public boolean setDBRecord(DBRecord<?> record) {

    /* pre-checks */
    this.dbRecord = null;
    if (record == null) {
      return false;
    } else if (!this.hasDBFactory()) {
      // TODO: we probably could just retrieve the DBFactory from the DBRecord
      Print.logError("DBFactory is not defined!");
      return false;
    }

    /* check DBFactory */
    DBFactory<?> rcdFact = DBRecord.getFactory(record);
    if (!this.getDBFactory().equals(rcdFact)) {
      Print.logError("Invalid DBFactory for specified DBRecord!");
      return false;
    }

    /* set DBRecord */
    this.dbRecord = record;
    return true;
  }