本文整理汇总了Java中com.orientechnologies.orient.core.record.impl.ODocumentInternal类的典型用法代码示例。如果您正苦于以下问题:Java ODocumentInternal类的具体用法?Java ODocumentInternal怎么用?Java ODocumentInternal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ODocumentInternal类属于com.orientechnologies.orient.core.record.impl包,在下文中一共展示了ODocumentInternal类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRawDocument
import com.orientechnologies.orient.core.record.impl.ODocumentInternal; //导入依赖的package包/类
protected ODocument getRawDocument(ORecord record) {
if (record == null) throw new NoSuchElementException();
if (record instanceof OIdentifiable)
record = record.getRecord();
ODocument currentDocument = (ODocument) record;
if (currentDocument.getInternalStatus() == ODocument.STATUS.NOT_LOADED)
currentDocument.load();
if (ODocumentInternal.getImmutableSchemaClass(currentDocument) == null)
throw new IllegalArgumentException(
"Cannot determine the graph element type because the document class is null. Probably this is a projection, use the EXPAND() function");
return currentDocument;
}
示例2: importGeometry
import com.orientechnologies.orient.core.record.impl.ODocumentInternal; //导入依赖的package包/类
protected void importGeometry(ODatabaseDocumentTx db, String file, final String clazz, String geomClazz) throws IOException {
OClass points = db.getMetadata().getSchema().createClass(clazz);
points.createProperty("geometry", OType.EMBEDDED, db.getMetadata().getSchema().getClass(geomClazz));
final ByteArrayOutputStream out = new ByteArrayOutputStream();
OIOUtils.copyStream(new FileInputStream(new File(file)), out, -1);
ODocument doc = new ODocument().fromJSON(out.toString(), "noMap");
List<ODocument> collection = doc.field("collection");
// OShapeFactory builder = OShapeFactory.INSTANCE;
final AtomicLong atomicLong = new AtomicLong(0);
TimerTask task = new TimerTask() {
@Override
public void run() {
OLogManager.instance().info(this, clazz + " per second [%d]", atomicLong.get());
atomicLong.set(0);
}
};
Orient.instance().scheduleTask(task, 1000, 1000);
for (ODocument entries : collection) {
ODocumentInternal.removeOwner(entries, doc);
ODocumentInternal.removeOwner(entries, (ORecordElement) collection);
entries.setClassName(clazz);
String wkt = entries.field("GeometryWkt");
try {
// ODocument location = builder.toDoc(wkt);
// entries.field("geometry", location, OType.EMBEDDED);
// db.save(entries);
//
// atomicLong.incrementAndGet();
} catch (Exception e) {
}
}
task.cancel();
}