@Override public ORecord fromStream(final byte[] iSource, ORecord iRecord, final String[] iFields) { if (iSource == null || iSource.length == 0) return iRecord; if (iRecord == null) iRecord = new ODocument(); else if (iRecord instanceof OBlob) { iRecord.fromStream(iSource); return iRecord; } else if (iRecord instanceof ORecordFlat) { iRecord.fromStream(iSource); return iRecord; } final BytesContainer container = new BytesContainer(iSource).skip(1); try { if (iFields != null && iFields.length > 0) serializerByVersion[iSource[0]].deserializePartial((ODocument) iRecord, container, iFields); else serializerByVersion[iSource[0]].deserialize((ODocument) iRecord, container); } catch (RuntimeException e) { e.printStackTrace(); OLogManager.instance() .warn(this, "Error deserializing record with id %s send this data for debugging: %s ", iRecord.getIdentity().toString(), Base64.getEncoder().encodeToString(iSource)); throw e; } return iRecord; }
@Override public ORecord fromStream(final byte[] iSource, ORecord iRecord, final String[] iFields) { if (iSource == null || iSource.length == 0) return iRecord; if (iRecord == null) iRecord = new ODocument(); else if (iRecord instanceof OBlob) { iRecord.fromStream(iSource); return iRecord; } else if (iRecord instanceof ORecordFlat) { iRecord.fromStream(iSource); return iRecord; } BytesContainer container = new BytesContainer(iSource); container.skip(1); try { if (iFields != null && iFields.length > 0) serializerByVersion[iSource[0]].deserializePartial((ODocument) iRecord, container, iFields); else serializerByVersion[iSource[0]].deserialize((ODocument) iRecord, container); } catch (RuntimeException e) { OLogManager.instance().warn(this, "Error deserializing record with id %s send this data for debugging: %s ", iRecord.getIdentity().toString(), Base64.getEncoder().encodeToString(iSource)); throw e; } return iRecord; }
@Override public ORecord fromStream(byte[] iSource, ORecord iRecord, String[] iFields) { if (iSource == null || iSource.length == 0) return iRecord; if (iRecord == null) { iRecord = new ODocument(); } else if (iRecord instanceof OBlob) { iRecord.fromStream(iSource); return iRecord; } else if (iRecord instanceof ORecordFlat) { iRecord.fromStream(iSource); return iRecord; } ORecordInternal.setRecordSerializer(iRecord, this); BytesContainer container = new BytesContainer(iSource); try { if (iFields != null && iFields.length > 0) deserializePartial((ODocument) iRecord, container, iFields); else deserialize((ODocument) iRecord, container); } catch (RuntimeException e) { OLogManager.instance() .warn(this, "Error deserializing record with id %s send this data for debugging: %s ", iRecord.getIdentity().toString(), Base64.getEncoder().encodeToString(iSource)); throw e; } return iRecord; }
@Override public <RET extends ORecord> RET reload(ORecord record, String fetchPlan, boolean ignoreCache, boolean force) { checkIfActive(); final ORecord loadedRecord = currentTx.reloadRecord(record.getIdentity(), record, fetchPlan, ignoreCache, force); if (loadedRecord != null && record != loadedRecord) { record.fromStream(loadedRecord.toStream()); ORecordInternal.setVersion(record, loadedRecord.getVersion()); } else if (loadedRecord == null) { throw new ORecordNotFoundException(record.getIdentity()); } return (RET) record; }
iRecord.fromStream(OCommonConst.EMPTY_BYTE_ARRAY); else if (iRecord instanceof OBlob) { iRecord.fromStream(Base64.getDecoder().decode(fieldValueAsString)); } else if (iRecord instanceof ORecordStringable) { ((ORecordStringable) iRecord).value(fieldValueAsString);
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); } } } }
iRecord.fromStream(record.toStream()); ORecordInternal.setVersion(iRecord, record.getVersion()); record = iRecord; return null; iRecord.fromStream(recordBuffer.buffer);