apidocs / com.srv4pos.server.api.sync / EntitySyncAdapter / upload

upload

abstract fun upload(uploader: Uploader<I>): Unit

Method should process all not synced entities from local storage:

  1. convert each entity to Info
  2. pass each Info to uploader.upload - it will take care about posting info to server
  3. 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)
  4. mark uploaded entity as synced (to not sync it again until it will be changed)
  5. store updated entity to local db

To keep data consistancy you should process all not synced entities - both undeleted and deleted. Event if an entity was created and immediatelly deleted in local shorage it is highly recommended to upload it to the server in "deleted" state, receive from server unique identifier for entity and store it locally for future reference. Especially it is important for entities which are linked to other entities (e.g. for commodities, categories, products, taxes).

Parameters

uploader -

See Also

Uploader