public boolean onEvent ( OLiveQueryPushRequest pushRequest ) { ODatabaseDocumentInternal old = ODatabaseRecordThreadLocal . instance ( ) . getIfDefined ( ) ; try { database . activateOnCurrentThread ( ) ; if ( pushRequest . getStatus ( ) == OLiveQueryPushRequest . ERROR ) { onError ( pushRequest . getErrorCode ( ) . newException ( pushRequest . getErrorMessage ( ) , null ) ) ; return true ; } else { for ( OLiveQueryResult result : pushRequest . getEvents ( ) ) { switch ( result . getEventType ( ) ) { case OLiveQueryResult . CREATE_EVENT : listener . onCreate ( database , result . getCurrentValue ( ) ) ; break ; case OLiveQueryResult . UPDATE_EVENT : listener . onUpdate ( database , result . getOldValue ( ) , result . getCurrentValue ( ) ) ; break ; case OLiveQueryResult . DELETE_EVENT : listener . onDelete ( database , result . getCurrentValue ( ) ) ; break ; } } if ( pushRequest . getStatus ( ) == OLiveQueryPushRequest . END ) { onEnd ( ) ; return true ; } } return false ; } finally { ODatabaseRecordThreadLocal . instance ( ) . set ( old ) ; } }
Return true if the push request require an unregister