-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete serialisation for saved searches #4
Comments
A better alternative to the ParameterAssembler visitor concept in 17e5a01 might be to just put the Create/Restore functions in each DTO with abstract Create/Restore on the ParameterDTO so the ParameterAssembler just calls the objects func and returns that. It's still within the realms of concern for the DTO to do this. Since one of the main reasons for the visitor pattern is to add additional functionality without requiring changes to the types it operates on, and I really don't need to be adding any more functionality and it can be solved using standard polymorphism, then just use standard polymorphism. |
I started to investigate polymorphism for restore/create but it starts coming unstuck when either process requires further knowledge that is not the concern of the DTO being created (e.g. restoring a FieldPath needs a FieldPathAssembler which has its own requirements and is definitely nothing to do with a ParameterDTO). After beginning to implement the Visitor pattern in 1090f72 it's also become evident this is a flawed approach. The Visitor pattern has some serious limitations.
Thinking of the problem trying to be solved is this: we're trying to serialize an IParameter composite type to XML.
Using our own serializer limits us to a specific implementation of serialization (in this case, XML). We'd have to rewrite all this code if we were to serialize to another format. If we use DTO's we separate the concern of transforming the data to persisting it which is good, but how do we cleanly manage the transformations?
For now, we'll attempt the chain of responsibility pattern. The caveat of runtime type-checking is unfortunate, but it's easily extended (no modifying of existing classes or issues of black box behaviour from inheriting the assembler and providing further logic in create/restore), and doesn't require modification of any other classes which keeps them decoupled. |
As per documentation in #4, Visitor pattern is unacceptable and we'll be using Chain of Responsibility instead. This commit contains some of the classes and structure required to implement this behaviour.
After discussion, the only way to truly serialize what a user sees on screen and restore it successfully is to persist the state of the UI, not the final parameter (which undergoes parsing which transforms it's shape). To do this, we'd need to persist:
Issues to overcome are:
In addition, we could still persist the final parameter set just in case we can't restore the parameters to the UI. The user could be offered the option to perform the search even though it can't be displayed. Or it could be used as a sanity check to ensure the current UI and parsers generate the same search structure as the original (maybe not values though as a date field with "last week" would generate a different value if opened in the future). |
Add a project version number (alongside ID, configuration and connections). When a search is serialised it can save this version number too, so if either get out of date we'll know that the saved search is may no longer be valid. |
Merged to master at 8521d66 |
Provide base code for serialisation of an
IParameter
graph in the Standalone project based on XML. Protocol Buffers is nice to have for using over RESTful APIs, but for now it just needs to work locally.Current implementation being developed under
Standalone.Serialization.DTO.Criterion
. The existing DTOs are heavily tied to protobuf so move these to their own namespace and redesign the classes for use with standard XML serialization.The text was updated successfully, but these errors were encountered: