class ProductPictureSyncHelper extends Object implements EntitySyncHelper<PictureInfo>
Modifier and Type | Field and Description |
---|---|
private MemoryLocalStorage |
storage |
Constructor and Description |
---|
ProductPictureSyncHelper(MemoryLocalStorage storage) |
Modifier and Type | Method and Description |
---|---|
void |
download(Downloader<PictureInfo> downloader)
Method should store all new Infos, received from server via downloader, to local storage as entities.
|
void |
upload(Uploader<PictureInfo> uploader)
Method should process all 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. |
private final MemoryLocalStorage storage
ProductPictureSyncHelper(MemoryLocalStorage storage)
public void upload(Uploader<PictureInfo> uploader)
EntitySyncHelper
Method should process all not synced entities from local storage:
upload
in interface EntitySyncHelper<PictureInfo>
Uploader
public void download(Downloader<PictureInfo> downloader)
EntitySyncHelper
Method should store all new Infos, received from server via downloader, to local storage as entities.
Downloader has two methods:
download
in interface EntitySyncHelper<PictureInfo>
Downloader
Copyright © 2015. All rights reserved.