I'm having a bit of a hard time figuring this out. I have a model (which you can see in the image below) this model can be changed (it won't happen often, but it can). When it changes I do not get the changes I get the ENTIRE data set, I get this set in the following order (don't know if it's relevant): First i get all the labels, then i get all the stations, then the filters, then the types and finally the messages.
Updating the properties of these classes is no problem, I'm getting stuck when i need to update the hierarchy, since they are all connected with one another.
I have made an overly complicated web of update methods for all the models where they would notify those who have a record of them that they are being removed but the further i got with this the more i got lost in the code I was writing. So i decided to take a step back and think of a more simplified way. Unfortunatly I do not know of a easy-to-read way to update this model.
The hard tihng is with the active messages and procedures. If a label (trigger of the message and enabled of the filter) have become active the message needs to become an ActiveMessage. This active message needs to be handeled according to a procedure. when the message becomes active I create a stateful procedure which keeps track of which steps have been completed.
When i updated the model i need to keep in mind i cannot delete old active messages which still need to be handled and I need to check if because of the changes new messages have been activated. A message can also be deactivated if the enabled label of the filter has become inactive or the reset label of the messages has become active. So with all these dependencies I'm at a loss.
Can someone help me figure out a proper way to update this?