@SuppressWarnings("unchecked") public ORecordTrackedSet setDirty() { if (status != STATUS.UNMARSHALLING && sourceRecord != null && !(sourceRecord.isDirty() && ORecordInternal.isContentChanged(sourceRecord))) sourceRecord.setDirty(); return this; }
@SuppressWarnings({ "unchecked" }) public OTrackedMap<T> setDirty() { if (status != STATUS.UNMARSHALLING && sourceRecord != null && !(sourceRecord.isDirty() && ORecordInternal.isContentChanged(sourceRecord))) sourceRecord.setDirty(); return this; }
@SuppressWarnings("unchecked") public OTrackedSet<T> setDirty() { if (status != STATUS.UNMARSHALLING && sourceRecord != null && !(sourceRecord.isDirty() && ORecordInternal.isContentChanged(sourceRecord))) sourceRecord.setDirty(); return this; }
@SuppressWarnings("unchecked") public <RET> RET setDirty() { if (status != STATUS.UNMARSHALLING && sourceRecord != null && !(sourceRecord.isDirty() && ORecordInternal.isContentChanged(sourceRecord))) sourceRecord.setDirty(); return (RET) this; }
private void doRollback() { storage.rollback(this); database.getLocalCache().clear(); for (ORecordOperation recordOperation : recordOperations.values()) { final ORecord record = recordOperation.record.getRecord(); if (record.isDirty()) if (record instanceof ODocument) { final ODocument document = (ODocument) record; if (document.isTrackingChanges()) document.undo(); } else record.unload(); } reset(); }
/** * Convert the item requested from record to link. * * @param iIndex Position of the item to convert * * @return <code>true</code> if conversion was successful. */ private boolean convertRecord2Link(final int iIndex) { if (contentType == MULTIVALUE_CONTENT_TYPE.ALL_RIDS) // PRECONDITIONS return true; final Object o = super.get(iIndex); if (o != null && o instanceof OIdentifiable && ((OIdentifiable) o).getIdentity().isPersistent()) { if (o instanceof ORecord && !((ORecord) o).isDirty()) { marshalling = true; try { super.set(iIndex, ((ORecord) o).getIdentity()); // CONVERTED return true; } catch (ORecordNotFoundException ignore) { // IGNORE THIS } finally { marshalling = false; } } else if (o instanceof ORID) // ALREADY CONVERTED return true; } return false; }
@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) //noinspection unchecked recordOperation.createdCallback = (ORecordCallback<Long>) createdCallback; if (updatedCallback != null) recordOperation.updatedCallback = updatedCallback; } return record; }
/** * Pushes record to cache. Identifier of record used as access key * * @param record * record that should be cached */ public void updateRecord(final ORecord record) { if (record.getIdentity().getClusterId() != excludedCluster && record.getIdentity().isValid() && !record.isDirty() && !ORecordVersionHelper.isTombstone(record.getVersion())) { if (underlying.get(record.getIdentity()) != record) underlying.put(record); } }
/** * This method is internal, it can be subject to signature change or be removed, do not use. * * @Internal */ public <RET extends ORecord> RET executeSaveRecord(final ORecord record, String clusterName, final int ver, final OPERATION_MODE mode, boolean forceCreate, final ORecordCallback<? extends Number> recordCreatedCallback, ORecordCallback<Integer> recordUpdatedCallback) { checkOpenness(); checkIfActive(); if (!record.isDirty()) return (RET) record; final ORecordId rid = (ORecordId) record.getIdentity(); if (rid == null) throw new ODatabaseException( "Cannot create record because it has no identity. Probably is not a regular record or contains projections of fields rather than a full record"); final OMicroTransaction microTx = beginMicroTransaction(); try { microTx.saveRecord(record, clusterName, mode, forceCreate, recordCreatedCallback, recordUpdatedCallback); } catch (Exception e) { endMicroTransaction(false); throw e; } endMicroTransaction(true); return (RET) record; }
public void bindToCache(ODatabaseDocumentInternal db) { if (isRecord()) { ORecord rec = element.getRecord(); ORecord cached = db.getLocalCache().findRecord(rec.getIdentity()); if (cached != null) { if (!cached.isDirty()) { cached.fromStream(rec.toStream()); } element = cached; } else { db.getLocalCache().updateRecord(rec); } } } }
if (record.isDirty() && clusterId == ORID.CLUSTER_ID_INVALID && record instanceof ODocument) { throw new OStorageException("Impossible to commit a transaction with not valid rid in pre-allocated commit"); } else if (rec.isDirty() && !rec.getIdentity().isPersistent()) { final ORecordId rid = (ORecordId) rec.getIdentity().copy(); final ORecordId oldRID = rid.copy();
final ORecord rec = txEntry.getRecord(); if (!rec.getIdentity().isPersistent()) { if (rec.isDirty()) {
if (!originalSaved && iRecord.isDirty()) { final byte operation = iForceCreate ? ORecordOperation.CREATED :
private void commitEntry(final ORecordOperation txEntry, final OPhysicalPosition allocated, final ORecordSerializer serializer) { if (txEntry.type != ORecordOperation.DELETED && !rec.isDirty())