|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Documented @Target(value=METHOD) @Retention(value=RUNTIME) public @interface Sync
Specifies that a ClientSyncWorker
should be created with the given query and query
parameters, and that s sync worker will be started when this bean is first created and stopped
when this bean is destroyed.
The annotated method needs to have exactly one parameter of type SyncResponses
and will
be called each time a data synch operation has completed. All sync operations passed to the
method will have already been applied to the local EntityManager, with conflicts resolved in
favour of the server's version of the data. The original client values are available in the
SyncResponses
object, which gives you a chance to implement a different conflict
resolution policy.
Example usage:
public class ExampleBean { private long id; private String name; private SyncResponsesresponses; @Sync
(query = "simpleEntitiesByIdAndString", params = {@SyncParam
(name = "id", val = "{id}"),@SyncParam
(name = "string", val = "{name}"),@SyncParam
(name = "literal", val = "literalValue") }) private void onSyncResponse(SyncResponses<SimpleEntity>
responses) { // enjoy } }
Required Element Summary | |
---|---|
String |
query
The name of the named query that will be used for the sync operation. |
Optional Element Summary | |
---|---|
SyncParam[] |
params
The optional parameters of the query. |
Element Detail |
---|
public abstract String query
public abstract SyncParam[] params
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |