Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 81216

Comparing two objects and showing the changed attributes

$
0
0

I will try to explain my use case through an example:

Lets assume a Person object which is changed by mutations I receive. The mutation contains two Person objects, the old and the new one. The new one will simply overwrite the old one.

The mutations are stored and should contain the information about the attributes which are changed, something like:

attribute name | old value | new value

age | 30 | 31

surname | Smit | Smith

I was thinking about an entity ChangedAttribute in which I store the name, old value and new value so I can easily display them. Of course I can check each attribute when I process the mutation and create the ChangedAttribute objects, but I need a more generic solution.

The only thing I could think of was a Java action which takes two objects as input, do some reflection magic to iterate over the attributes of the objects, compare them and return a list of ChangedAttribute objects.

Since I'm not that eager to create this I was wondering if there were any existing solutions which I can use or use as example. 

Or are there better ways to handle this in Mendix?


Viewing all articles
Browse latest Browse all 81216

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>