本文整理汇总了Java中com.orientechnologies.orient.core.id.ORID.getRecord方法的典型用法代码示例。如果您正苦于以下问题:Java ORID.getRecord方法的具体用法?Java ORID.getRecord怎么用?Java ORID.getRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.orientechnologies.orient.core.id.ORID
的用法示例。
在下文中一共展示了ORID.getRecord方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testClassChange
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Test
@Ignore
public void testClassChange()
{
ODatabaseDocument db = wicket.getTester().getDatabase();
OSchema schema = db.getMetadata().getSchema();
OClass classA = schema.createClass("TestClassChangeA");
OClass classB = schema.createClass("TestClassChangeB");
ODocument doc = new ODocument(classA);
doc.save();
doc = doc.getIdentity().getRecord();
doc.setClassName(classB.getName());
assertEquals(classB.getName(), doc.getClassName());
doc = doc.getIdentity().getRecord();
assertEquals(classB.getName(), doc.getClassName());
ORID id = doc.getIdentity();
db.commit(true);
db.close();
db = wicket.getTester().getDatabase();
doc = id.getRecord();
assertEquals(classB.getName(), doc.getClassName());
}
示例2: getRecord
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
protected ORecord getRecord(ORID id) {
try {
return id.getRecord();
} catch (ORecordNotFoundException e) {
throw new NoSuchElementException(
"The " + getClass().getSimpleName().toLowerCase() + " with id " + id + " of type " + id.getClass().getSimpleName()
+ " does not exist in the graph");
}
}
示例3: testTransactions
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Test
public void testTransactions() throws Exception {
ODatabaseDocument db = wicket.getTester().getDatabase();
try {
assertFalse(db.getTransaction().isActive());
OSchema schema = db.getMetadata().getSchema();
OClass classA = schema.createClass("TransA");
classA.createProperty("name", OType.STRING);
ODocument doc = new ODocument(classA);
doc.field("name", "test1");
doc.save();
ORID orid = doc.getIdentity();
db.begin();
assertTrue(db.getTransaction().isActive());
doc = orid.getRecord();
assertEquals("test1", doc.field("name"));
doc.field("name", "test2");
doc = orid.getRecord();
assertEquals("test2", doc.field("name"));
//There is NO SAVE!
db.commit();
db.getLocalCache().clear();
/* COMMENT START */
//db.close();
//db = wicket.getTester().getDatabase();
/* COMMENT STOP */
doc = orid.getRecord();
assertEquals("test1", doc.field("name"));
} finally {
db.commit();
}
}
示例4: testTransactions2
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Test
@Ignore
public void testTransactions2() throws Exception {
ODatabaseDocument db = wicket.getTester().getDatabase();
try {
assertFalse(db.getTransaction().isActive());
OSchema schema = db.getMetadata().getSchema();
OClass classA = schema.createClass("TransB");
classA.createProperty("name", OType.STRING);
ODocument doc = new ODocument(classA);
doc.field("name", "test1");
doc.save();
ORID orid = doc.getIdentity();
db.begin();
assertTrue(db.getTransaction().isActive());
doc = orid.getRecord();
assertEquals("test1", doc.field("name"));
doc.field("name", "test2");
doc.save();
doc = orid.getRecord();
assertEquals("test2", doc.field("name"));
doc.field("name", "test3");
assertEquals("test3", doc.field("name"));
//There is NO SAVE!
db.commit();
db.getLocalCache().clear();
/* COMMENT START */
//db.close();
//db = wicket.getTester().getDatabase();
/* COMMENT STOP */
doc = orid.getRecord();
assertEquals("test2", doc.field("name"));
} finally {
db.commit();
}
}
示例5: testLoosingLinkedClass
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Test
@Ignore
public void testLoosingLinkedClass() throws Exception
{
ODatabaseDocument db = wicket.getTester().getDatabase();
OSchema schema = wicket.getTester().getSchema();
OClass mainClass = schema.createClass("LMainClass");
OClass embeddedClass = schema.createClass("LEmbeddedClass");
mainClass.createProperty("name", OType.STRING);
mainClass.createProperty("embedded", OType.EMBEDDED).setLinkedClass(embeddedClass);
embeddedClass.createProperty("name", OType.STRING);
db.begin();
ODocument main = new ODocument(mainClass);
main.field("name", "main");
ODocument embedded = new ODocument(embeddedClass);
//embedded.field("name", "embedded");
main.field("embedded", embedded);
//NO Save here!
db.commit();
db.close();
main.fromStream(main.toStream());
db = wicket.getTester().getDatabase();
db.begin();
assertEmbeddedIsCorrect(main);
main.save();
ORID recordId = main.getIdentity();
db.commit();
db.close();
db = wicket.getTester().getDatabase();
db.begin();
main = recordId.getRecord();
assertEmbeddedIsCorrect(main);
db.commit();
}
示例6: testConverters
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Test
public void testConverters() throws Exception
{
OSchema schema = wicket.getTester().getSchema();
testConverter(OClassClassNameConverter.INSTANCE, schema.getClass("OUser"), "OUser");
testConverter(OPropertyFullNameConverter.INSTANCE, schema.getClass("Ouser").getProperty("name"), "OUser.name");
testConverter(OIndexNameConverter.INSTANCE, schema.getClass("Ouser").getClassIndex("OUser.name"), "OUser.name");
ORID orid = new ORecordId("#5:0"); //Admin ORID
ODocument document = orid.getRecord();
testConverter(ODocumentORIDConverter.INSTANCE, document, orid);
}
示例7: testDocumentWrapper
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Test
public void testDocumentWrapper() throws Exception
{
ORID orid = new ORecordId("#5:0"); //Admin ORID
ODocument adminDocument = orid.getRecord();
OUser admin = wicket.getTester().getMetadata().getSecurity().getUser("admin");
DocumentWrapperTransformer<OUser> transformer = new DocumentWrapperTransformer<OUser>(OUser.class);
assertEquals(admin, transformer.apply(adminDocument));
}
示例8: testDocumentConverter
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Test
public void testDocumentConverter() throws Exception
{
ORID orid = new ORecordId("#5:0"); //Admin ORID
ODocument adminDocument = orid.getRecord();
ODocumentConverter converter = new ODocumentConverter();
assertEquals(adminDocument, converter.convertToObject("#5:0", Locale.getDefault()));
assertEquals(orid, converter.convertToOIdentifiable("#5:0", Locale.getDefault()));
assertEquals("#5:0", converter.convertToString(adminDocument, Locale.getDefault()));
}
示例9: doBackward
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Override
protected ODocument doBackward(ORID b) {
return b.getRecord();
}
示例10: testOFunctions
import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Test
public void testOFunctions() throws Exception
{
ODatabaseDocument db = wicket.getTester().getDatabase();
ODocument doc = new ODocument(OFunction.CLASS_NAME);
doc.field("name", "testResurection");
doc.field("language", "JavaScript");
doc.field("idempotent", true);
doc.save();
ORID orid = doc.getIdentity();
for(int i=0;i<10;i++)
{
db = wicket.getTester().getDatabase();
String signature = "signature"+RANDOM.nextLong();
boolean isGoodCall = (i+1)%3 != 0;
db.begin();
doc = orid.getRecord();
String code = isGoodCall?"return \""+signature+"\";":"return nosuchvar;";
doc.field("code", code);
doc.save();
db.commit();
db.close();
if(isGoodCall)
{
String result;
for(int j=0; j<3;j++)
{
result = wicket.getTester().executeUrl("orientdb/function/db/testResurection", "GET", null);
assertContains(signature, result);
}
}
else
{
try
{
wicket.getTester().executeUrl("orientdb/function/db/testResurection", "GET", null);
assertFalse("We should be there, because function should have 400 response", true);
} catch (Exception e)
{
//NOP
}
}
}
}