Opened 8 years ago
Last modified 4 years ago
#13036 new enhancement
More validation for commands — at Version 12
Reported by: | michael2402 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | gsoc-core command | Cc: | Don-vip, bastiK, stoecker |
Description (last modified by )
Currently, the command class does only few validation of the layer the command works for.
I suggest:
Enforce thatlayer
may not be null. Make command construction fail if it is.- Always set the layer/dataset the command is working on.
- Check that all primitives of that command belong to the layer
layer
(for add/move/delete/... commands).- if plugins want to change this, we can provide them with the means to extend the commands. They have to take care of the problems that occur then, e.g. handle data integrity.
Change History (12)
comment:1 by , 8 years ago
Milestone: | 16.07 → 16.08 |
---|
comment:2 by , 8 years ago
Milestone: | 16.08 → 16.09 |
---|
comment:3 by , 8 years ago
Milestone: | 16.09 → 16.10 |
---|
comment:4 by , 8 years ago
Milestone: | 16.10 → 16.11 |
---|
comment:6 by , 7 years ago
Milestone: | 16.12 |
---|
comment:9 by , 7 years ago
Replying to michael2402:
- Enforce that
layer
may not be null. Make command construction fail if it is.
If I remember correctly I have put a great effort to make sure a null layer is allowed, in order to work only with a dataset. Plugins rely on it.
follow-up: 11 comment:10 by , 7 years ago
Milestone: | → 17.06 |
---|
If dataset is forced now, all command constructors must be checked/updated. I have fixed in r12386 the problem that caused opendata plugin unit test to fail, but I think all constructors from DeleteCommand that don't take a Layer or a DataSet as parameter will cause errors when executed.
comment:11 by , 7 years ago
Replying to Don-vip:
If dataset is forced now, all command constructors must be checked/updated. I have fixed in r12386 the problem that caused opendata plugin unit test to fail, but I think all constructors from DeleteCommand that don't take a Layer or a DataSet as parameter will cause errors when executed.
Not necessarily. All commands that modify the edit data set (the one while they are created) are fine. Undo/Redo respects the layer that was used during the command construction.
The problem with unit tests is that they do not correctly set the edit layer during the test - this is why they fail. If we get errors in plugins, the plugin is using commands to modify a layer that is not the edit layer.
... but I agree: We should try to always add dataset information to our utility functions - it will make them more universal and allow them to be used on a data set that is not in any layer. I fixed this for the right/left hand traffic computations.
comment:12 by , 7 years ago
Description: | modified (diff) |
---|
Milestone renamed