Set the current record to this (new) record.
NOTE: In the thin model, it is not necessary to call edit() before set.
@exception Throws an exception if there is no current record.
764669
public void set(Rec record) throws DBException
    {
        if ((this.getRecord().getEditMode() != Constants.EDIT_CURRENT)
            && ((this.getRecord().getEditMode() != Constants.EDIT_IN_PROGRESS)))
                throw new DBException(Constants.INVALID_RECORD);
        m_record = (FieldList)record;
        this.fieldsToData(record);
        this.doSet(record);
        this.setDataSource(null);
        this.getRecord().setEditMode(Constants.EDIT_NONE);
    }
789071
@Override
	protected void initialize() throws Exception {
		super.initialize();

		// set the last output collector of this task to reflect the iteration intermediate state update
		// a) workset update
		// b) solution set update
		// c) none

		Collector<OT> delegate = getLastOutputCollector();
		if (isWorksetUpdate) {
			// sanity check: we should not have a solution set and workset update at the same time
			// in an intermediate task
			if (isSolutionSetUpdate) {
				throw new IllegalStateException("Plan bug: Intermediate task performs workset and solutions set update.");
			}

			Collector<OT> outputCollector = createWorksetUpdateOutputCollector(delegate);

			// we need the WorksetUpdateOutputCollector separately to count the collected elements
			if (isWorksetIteration) {
				worksetUpdateOutputCollector = (WorksetUpdateOutputCollector<OT>) outputCollector;
			}

			setLastOutputCollector(outputCollector);
		} else if (isSolutionSetUpdate) {
			setLastOutputCollector(createSolutionSetUpdateOutputCollector(delegate));
		}
	}
495672
@Override
	public void setCurrent(T stateful, State<T> current, State<T> next) throws StaleStateException {
		synchronized(stateful) {
			if (this.getCurrent(stateful).equals(current)) {
				this.setCurrent(stateful, next);
			} else {
				throw new StaleStateException();
			}
		}
	}
995351
public void
addRecord(Record r) {
	Name name = r.getName();
	int rtype = r.getRRsetType();
	synchronized (this) {
		RRset rrset = findRRset(name, rtype);
		if (rrset == null) {
			rrset = new RRset(r);
			addRRset(name, rrset);
		} else {
			rrset.addRR(r);
		}
	}
}
978678
public function save()
    {
        if (! $this->getOrigFieldValue(static::IDFIELD)) {
            throw new Exception("Cannot save an item without ID");
        }

        Observer::dispatch(Observer::EVENT_ITEM_SAVE_BEFORE, array(
            'item' => $this
        ));

        $this->{static::DATEUPDATEFIELD} = DateData::now();
        $update = new Update($this);

        $update->commit();

        $this->_origFields = $this->_fields;

        Observer::dispatch(Observer::EVENT_ITEM_SAVE_AFTER, array(
            'item' => $this
        ));

        return $this;
    }
114801
private void setRecordNumber(LinkedList<String> list)
   {
      try
      {
         String number = list.remove(0);
         m_recordNumber = Integer.valueOf(number);
      }
      catch (NumberFormatException ex)
      {
         // Malformed MPX file: the record number isn't a valid integer
         // Catch the exception here, leaving m_recordNumber as null
         // so we will skip this record entirely.
      }
   }
390330
void setException(Throwable theException) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "setException - Future object: " + this, theException);
        }

        // set exception, we are done
        ivException = theException;
        done(); // F743-11774
    }
773854
void setError(Exception error) {
    if (this.error != null) {
      throw new IllegalStateException(
          "Cannot reassign the error value of a response!");
    }
    this.error = error;
    this.complete = true;
    try {
      this.states.put(RESPONSE_COMPLETE);
    } catch (InterruptedException e) {
      log.error("Interrupted trying to indicate an error condition.", e);
    }
  }
750356
public void doSet(Record record) throws DBException
    {
        try   {
            m_pTable.set(this);
        } catch (DBException ex)    {
            throw DatabaseException.toDatabaseException(ex);
        }
    }
1243263
def setCurrentRecord(self, record, autoAdd=False):
        
        if record is not None and not Table.recordcheck(record):
            return False
        
        # don't reassign the current record
        # clear the record
        if record is None:
            self._currentRecord = None
            blocked = self.signalsBlocked()
            self.blockSignals(True)
            self.setCurrentIndex(-1)
            self.blockSignals(blocked)
            
            if not blocked:
                self.currentRecordChanged.emit(None)
            
            return True
        
        elif record == self.currentRecord():
            return False
        
        self._currentRecord = record
        found = False
        
        blocked = self.signalsBlocked()
        self.blockSignals(True)
        for i in range(self.count()):
            stored = unwrapVariant(self.itemData(i, Qt.UserRole))
            if stored == record:
                self.setCurrentIndex(i)
                found = True
                break
        
        if not found and autoAdd:
            self.addRecord(record)
            self.setCurrentIndex(self.count() - 1)
        
        self.blockSignals(blocked)
        
        if not blocked:
            self.currentRecordChanged.emit(record)
        return False
1007354
public void init(Record record, Record recordSub, boolean bRestoreCurrentRecord)
    {
        m_recordSub = recordSub;
        m_bRestoreCurrentRecord = bRestoreCurrentRecord;
        super.init(record);
    }
766537
public void setRecordMetadata(String key, Object value) {
    if (_recordMetadata == null) {
      _recordMetadata = new HashMap<>();
    }

    _recordMetadata.put(key, value);
  }
1278377
def set_exception(self, exception):
        """"""
        if not self.is_done():
            raise TransferNotDoneError(
                'set_exception can only be called once the transfer is '
                'complete.')
        self._coordinator.set_exception(exception, override=True)
588455
public synchronized void set(FieldTable table) throws DBException
    {
        BaseBuffer bufferNew = (BaseBuffer)table.getDataSource(); // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
        if (table.getRecord().getEditMode() == Constants.EDIT_IN_PROGRESS)
        {
            PKeyArea vKeyArea = this.getPKeyArea(Constants.MAIN_KEY_AREA);
            KeyAreaInfo primaryKeyArea = table.getRecord().getKeyArea(Constants.MAIN_KEY_AREA);
            primaryKeyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);     // Move these keys back to the record
            BaseBuffer bufferOld = vKeyArea.doSeek("==", table, primaryKeyArea);    // Get the old record back
            if ((bufferOld == null) || (bufferOld.getPhysicalData() == null))
                throw new DBException(Constants.INVALID_RECORD);    // This record had been freed (deleted)

            for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
            {
                try   {
                    vKeyArea = this.getPKeyArea(iKeyArea);
                    KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
                    keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);        // Move these keys back to the record
                    if (keyArea.getUniqueKeyCode() != Constants.UNIQUE)   // The main key is part of the comparison
                        primaryKeyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);     // Move these keys back to the record
                    vKeyArea.doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
                    bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                    vKeyArea.doWrite(table, table.getRecord().getKeyArea(iKeyArea), bufferNew);
                } catch (DBException e)   {
                    if (e.getErrorCode() == Constants.DUPLICATE_KEY)
                    {
                        bufferOld.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                        this.getPKeyArea(iKeyArea).doWrite(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
                        iKeyArea--;     // Duplicate key, back out all keys added so far!!!
                        while (iKeyArea >= Constants.MAIN_KEY_AREA)
                        {
                            vKeyArea = this.getPKeyArea(iKeyArea);
                            KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
                            bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                            vKeyArea.doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferNew);
                            keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);        // Move these keys back to the record
                            if (keyArea.getUniqueKeyCode() != Constants.UNIQUE)   // The main key is part of the comparison
                                primaryKeyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);     // Move these keys back to the record
                            vKeyArea.doWrite(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
                            iKeyArea--;
                        }
                    }
                    throw e;
                }
            }
            if (bufferNew != bufferOld)
                bufferOld.free();   // Get rid of the old one
            bufferOld = null;
            // Restore the record before returing (key.doWrite probably changed it).
            bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
        }
        else
            throw new DBException(Constants.INVALID_RECORD);
    }
219541
public void doSet(Rec record) throws DBException
    {
        super.doSet(record);
        if (m_arrayCache != null)
            if (m_iLogicalIndex != NO_INDEX)
            {
                m_arrayCache.set(m_iLogicalIndex, this.getDataSource());    // Show the current record as deleted.
            }
    }
558286
public void remove() throws DBException
    {
        super.remove();
        Iterator<BaseTable> iterator = this.getTables();
        while (iterator.hasNext())
        {
            BaseTable table = iterator.next();
            if ((table != null) && (table != this.getNextTable()))
            {
                if ((table.getRecord().getEditMode() == Constants.EDIT_IN_PROGRESS) || (table.getRecord().getEditMode() == Constants.EDIT_CURRENT))
                    table.remove();
            }
        }
    }
21758
public void set(Rec fieldList) throws DBException
    {
        this.restoreMainRecord((Record)fieldList, true);
        super.set(fieldList);
    }