Audit information specified in a model … part 1


Almost any business application I delivered contains some kind of audit information. Depending on the size and the type of application this information is more or less sufficiently distinctive. Some typical information is almost always “who did what when?”. Sometimes a “why” would also be a justifiable question, but this is out of the scope for now.

So, by using a model driven software development approach along with OlivaNova, this is easy. Let’s say, I want to create a new customer in a small CRM system. The class I created for the customer looks like this:

So, the user can enter information for the first and the last name (very sophisticated, isn’t it?). If I only have a single role in the system and I want to store the login of the user in the “CreatedBy” field when the user creates a new entry (and accordingly in the “ChangedBy” field when the user updates some information), this is pretty straight forward. The service to create the new customer would look like this:

As you can see, this service uses the keyword “AGENT_DefaultUser” to access the role of the system. The role “DefaultUser” is also a class, but with specific properties. From the “DefaultUser” class it uses the “login” field to store in the “CreatedBy” field of the newly created customer. This is basically it. The “CreateDate” will automatically be filled with a standard function named “systemDateTime()“.

In the next part of this post, I will try to talk a little bit about how to deal with multiple application roles and how to implement a service like the above.

Leave a comment

Your email address will not be published. Required fields are marked *