Additions needed for offline entity updates #749
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Blocked by #748This adds new features to JavaRosa to allow clients to handle offline updates to Entities:
update
action are now exposed from theEntities
extra onFormEntryModel
Entity
now has aversion
field that is set to 1 for created Entitiesentity
element'sbaseVersion
attribute incremented by 1create
andupdate
) expose anEntity
as an update (version isbaseVersion
+ 1)baseVersion
expose anEntity
as a create (version is set to 1)label
node for the Entity, expose anEntity
with anull
label so clients know not to override an existing label if they have itWhat has been done to verify that this works as intended?
New tests and verified with new Collect features at getodk/collect#5982.
Why is this the best possible solution? Were any other approaches considered?
I did consider leaving the version incrementing to clients, but that would mean them making a decision about how to deal with the "upsert" cases. It felt more natural to me for JavaRosa to be the one making decisions about how to interpret the spec.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
We now care a lot more about the
entity
element at finalization as we parse more out of it. I think this probably means that there is more scope for crashes during form finalization due to incorrect forms. I think we should collect those cases and handle in a follow up rather than holding this up however as we're mostly concerned right now with getting an experimental version of offline entities together (and the feature will still be opt in). It also feels easier to me to play with bad forms once we're able to do it Collect.