public interface EntitySyncHelper<I extends Info>
Modifier and Type | Method and Description |
---|---|
void |
createOrUpdateEntityFromInfo(I info)
Method should update corresponding entity from info (entity could be located by identifier from info)
or create entity if client has no entity with such identifier.
|
void |
download(Downloader<I> downloader)
Method should store all new Infos, received from server via downloader, to local storage as entities.
|
void |
uploadCreatedOrUpdated(Uploader<I> uploader)
Method should process all not deleted and not synced entities from local storage:
convert each entity to Info pass each Info to uploader.upload - it will take care about posting info to server if uploader returned new identifier for item, store it to local entity (that means entity is new and was created on server with new identifier) mark uploaded entity as synced (to not sync it again until it will be changed) store updated entity to local db. |
void |
uploadDeleted(Uploader<I> uploader)
Method should process all deleted and not synced entities from local storage:
convert each entity to Info pass each Info to uploader.upload - it will take care about deleting info to server mark uploaded entity as synced (to not sync it again until it will be changed) store updated entity to local db if needed. |
void uploadDeleted(Uploader<I> uploader)
Method should process all deleted and not synced entities from local storage:
uploader
- Uploader
void uploadCreatedOrUpdated(Uploader<I> uploader)
Method should process all not deleted and not synced entities from local storage:
uploader
- Uploader
void download(Downloader<I> downloader)
Method should store all new Infos, received from server via downloader, to local storage as entities.
Downloader has two methods:
downloader
- Downloader
void createOrUpdateEntityFromInfo(I info)
Method should update corresponding entity from info (entity could be located by identifier from info) or create entity if client has no entity with such identifier.
info
- Copyright © 2016. All rights reserved.