本文整理汇总了Java中com.orientechnologies.orient.core.record.impl.ODocument.getSchemaClass方法的典型用法代码示例。如果您正苦于以下问题:Java ODocument.getSchemaClass方法的具体用法?Java ODocument.getSchemaClass怎么用?Java ODocument.getSchemaClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.orientechnologies.orient.core.record.impl.ODocument
的用法示例。
在下文中一共展示了ODocument.getSchemaClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recordEvent
import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
private boolean recordEvent(final ODocument document, final EventKind eventKind) {
final OClass schemaType = document.getSchemaClass();
if (schemaType != null) {
final EntityAdapter adapter = recordingAdapters.get(schemaType);
if (adapter != null) {
final ODatabaseInternal db = ODatabaseRecordThreadLocal.INSTANCE.get();
if (db != null) {
// workaround OrientDB 2.1 issue where in-TX dictionary updates are not replicated
if (db.getStorage().isDistributed() && adapter instanceof SingletonEntityAdapter) {
((SingletonEntityAdapter) adapter).singleton.replicate(document, eventKind);
}
Map<ODocument, EventKind> events = dbEvents.get(db);
if (events == null) {
events = new LinkedHashMap<>();
dbEvents.put(db, events);
}
// replace mapping after merge so key always points to the latest document instance
// (avoids a risk that the original key became disconnected/detached at this point)
EventKind updatedEventKind = updateEventKind(events.remove(document), eventKind);
if (updatedEventKind != null) {
events.put(document, updatedEventKind);
}
return true;
}
}
}
return false;
}
示例2: onRecordBeforeUpdate
import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
@Override
public RESULT onRecordBeforeUpdate(final ODocument doc) {
if (doc.getSchemaClass() != null && doc.getSchemaClass().isSubClassOf(TIMESTAMPED_CLASS)) {
doc.field(Timestamped.Field.updated_on.name(), System.currentTimeMillis());
return RESULT.RECORD_CHANGED;
}
return RESULT.RECORD_NOT_CHANGED;
}
示例3: onRecordBeforeCreate
import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
@Override
public RESULT onRecordBeforeCreate(final ODocument doc) {
if (doc.getSchemaClass() != null && doc.getSchemaClass().isSubClassOf(TIMESTAMPED_CLASS)) {
final long createdOn = System.currentTimeMillis();
doc.field(Timestamped.Field.created_on.name(), createdOn);
doc.field(Timestamped.Field.updated_on.name(), createdOn);
return RESULT.RECORD_CHANGED;
}
return RESULT.RECORD_NOT_CHANGED;
}