Java Code Examples for com.orientechnologies.orient.core.db.document.ODatabaseDocument#delete()

The following examples show how to use com.orientechnologies.orient.core.db.document.ODatabaseDocument#delete() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestNotificationFactories.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@After
@Sudo
public void destroy() {
  ODatabaseDocument db = ODatabaseRecordThreadLocal.instance().get();
  for (int i = 1; i <= 10; i++) {
    try {
      db.begin();
      db.delete(testNotification.getDocument());
      db.commit();
      break;
    } catch (Exception e) {
      if (i == 10) {
        throw new IllegalStateException(e);
      }
    }
  }
}
 
Example 2
Source File: TestNotificationLifecycle.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@After
@Sudo
public void destroy() {
  ODatabaseDocument db = ODatabaseRecordThreadLocal.instance().get();
  for (int i = 0; i < 10; i++) {
    try {
      db.delete(testNotification.getDocument());
      break;
    } catch (Exception e) {
      testNotification.reload();
    }
  }

}
 
Example 3
Source File: TestSendMailNotification.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@After
@Sudo
public void destroy() {
  ODatabaseDocument db = ODatabaseRecordThreadLocal.instance().get();
  for (int i = 0; i < 10; i++) {
    try {
      db.delete(notification.getDocument());
      break;
    } catch (Exception e) {
      notification.reload();
    }
  }
}
 
Example 4
Source File: AbstractEntityHandler.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
public void delete(T entity, OPersistenceSession session) {
	ODatabaseDocument db = session.getDatabase();
	String id = entity.getId();
	String oid = (String) convertValueFromEntity("id", id);
	OIdentifiable oIdentifiable = session.lookupOIdentifiableForIdInCache(oid);
	if(oIdentifiable!=null) {
		db.delete(oIdentifiable.getIdentity());
	} else {
		db.command(new OCommandSQL("delete from "+getSchemaClass()+" where "+getPkField()+" = ?")).execute(oid);
	}
}