public interface QueryListener
Interface to be implemented in order to handle the Query Lifecycle.
This interface is bound to queries created by
Context.makeQuery()
.
It may be retrieved by CommunicationLifeCycle.getListener()
.
Method Summary | |
---|---|
void |
onQueryCreate(QueryCreateEvent event)
Called when the server-answer to the Query.create() is
available. |
void |
onQueryDestroy(QueryDestroyEvent event)
Called when the server-answer to the Query.destroy() is
available. |
void |
onQueryNotify(QueryNotifyEvent event)
Called when an entity of a query result-set is available. |
void |
onQueryRows(QueryRowsEvent event)
Called when the server-answer to the Query.queryRows() is available. |
Method Detail |
---|
void onQueryCreate(QueryCreateEvent event)
Query.create()
is
available.
If the server result is
Event.RESULT_OK
,
then
Query.STATUS_CREATED
.
QueryCreateEvent.resultSetFollows()
is true
then the server starts to send
QueryNotifyEvent events
to notify the query
result.
QueryCreateEvent.resultSetFollows()
is false
then the server may now accept
Query.QueryRows()
on this query.
otherwise
Query.STATUS_DESTROYED
.
Query.QueryRows
on this query.
QueryNotifyEvent events
to notify the query
result.
In the latter case it is a good practice to
release
the
query associated to the event
parameter.
event
- the server-answer to the Query.create()
void onQueryRows(QueryRowsEvent event)
Query.queryRows()
is available.
If the server result is
Event.RESULT_OK
,
then
QueryNotifyEvent events
to notify the query
result.
otherwise
QueryNotifyEvent events
to notify the query
result.
In both cases the
query status remains
Query.STATUS_CREATED
.
event
- the server-answer to the
Query.queryRows()
void onQueryNotify(QueryNotifyEvent event)
If the query result-set computed by the server, as an aswer to a correct
Query.create()
or
Query.queryRows()
, is composed by N
entities then this method will be invoked (N+1) times: N times with each
of the N entities and one more time with the
EOQ indication.
In any case:
Event.RESULT_OK
.
Query.STATUS_CREATED
.
event
- event containing an entity of the query result-set or the
EOQ indication.void onQueryDestroy(QueryDestroyEvent event)
Query.destroy()
is
available.
If the server result is
Event.RESULT_OK
, then the server has destroyed the query
otherwise some unknow error occured.
In both cases:
Query.STATUS_DESTROYED
.
release
the
query associated to the event
parameter.
event
- the server-answer to the Query.destroy()