cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Change audit framework
Date Tue, 29 Sep 2015 14:21:43 GMT
Correct, that was a typo :)

> On Sep 29, 2015, at 5:18 PM, Michael Gentry <mgentry@masslight.net> wrote:
> 
> Is L1.class supposed to be L.class?
> 
> mrg
> 
> 
> On Tue, Sep 29, 2015 at 5:46 AM, Andrus Adamchik <andrus@objectstyle.org>
> wrote:
> 
>> I just sent a pull request with the first cut of the implementation. My
>> plan is to try this new implementation with my audit system and if it works
>> well, apply it to master (hopefully by then CAY-2028 will also be ready).
>> The implementation I ended up with does not have JSON serialization. Just
>> pure objects. Here is how it works:
>> 
>> 1. Write a listener (currently requires an interface, but if needed we can
>> easily switch to annotations) :
>> 
>> public class L implements PostCommitListener {
>> 
>>   @Override
>>   public void onPostCommit(ObjectContext originatingContext, ChangeMap
>> changes) {
>>      // do something with your changes
>>   }
>> }
>> 
>> 2. Configure Cayenne stack with "PostCommit" module:
>> 
>> Module m = PostCommitModuleBuilder.builder().listener(L1.class);
>> ServerRuntime r = ServerRuntimeBuilder
>>   .builder()
>>   .addConfig("cayenne-lifecycle.xml")
>>   .addModule(m)
>>   .build();
>> 
>> 
>> PostCommitModuleBuilder supports a few non-default options, such as
>> excluding entities, entity properties, and hiding "confidential" property
>> values, such as passwords using the existing @Auditable annotation. Or you
>> can write a custom PostCommitEntityFactory to support your own annotations.
>> 
>> TODO: there is not support for @AuditableChild yet. Need to think how to
>> better handle this one.
>> 
>> Comments are welcomed.
>> 
>> Andrus


Mime
View raw message