[#auditing]
=== Auditing

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:

The xref:refguide:applib:index/annotation/DomainObject.adoc#entityChangePublishing[entityChangePublishing()] element indicates that if the object is modified, then each of its changed properties should be submitted to the registered xref:refguide:applib:index/services/publishing/spi/EntityPropertyChangeSubscriber.adoc[EntityPropertyChangeSubscriber](s).

The default value for the element is `AS_CONFIGURED`, meaning that the xref:refguide:config:sections/causeway.applib.adoc#causeway.applib.annotation.domain-object.entity-change-publishing[causeway.applib.annotation.domain-object.entity-change-publishing] configuration property is used to determine the whether the action is audited:

* `all` +
+
all changed properties of objects are audited

* `none` +
+
no changed properties of objects are audited

If there is no configuration property in `application.properties` then auditing is automatically enabled for domain objects.

This default can be overridden on an object-by-object basis; if `entityChangePublishing()` is set to `ENABLED` then changed properties of instances of the domain class are audited irrespective of the configured value; if set to `DISABLED` then the changed properties of instances are _not_ audited, again irrespective of the configured value.

For example:

[source,java]
----
@DomainObject(
    entityChangePublishing=Publishing.ENABLED  // <.>
)
public class Customer {
    ...
}
----
<.> because set to enabled, will be audited irrespective of the configured value.



