@Override
public ORecord saveRecord(ORecord record, String clusterName, ODatabase.OPERATION_MODE operationMode, boolean forceCreation,
ORecordCallback<? extends Number> createdCallback, ORecordCallback<Integer> updatedCallback) {
if (!active)
throw error("Inactive micro-transaction on record save");
if (record == null)
return null;
if (!record.isDirty())
return record;
final ORecordOperation recordOperation;
if (forceCreation || !record.getIdentity().isValid())
recordOperation = addRecordOperation(record, ORecordOperation.CREATED, clusterName);
else
recordOperation = addRecordOperation(record, ORecordOperation.UPDATED, clusterName);
if (recordOperation != null) {
if (createdCallback != null)
recordOperation.createdCallback = (ORecordCallback<Long>) createdCallback;
if (updatedCallback != null)
recordOperation.updatedCallback = updatedCallback;
}
return record;
}