=== Editing

: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#editing[editing()] element determines whether a domain object's properties and collections are not editable (are read-only).

The default is `AS_CONFIGURED`, meaning that the xref:refguide:config:sections/causeway.applib.adoc#causeway.applib.annotation.domain-object.editing[causeway.applib.annotation.domain-object.editing]
configuration property is used to determine the whether the object is modifiable:

* `true`
+
the object's properties and collections are modifiable.

* `false`
+
the object's properties and collections are read-only, ie _not_ modifiable.

If there is no configuration property in `application.properties` then object are assumed to be modifiable.

[TIP]
====
In other words, editing can be disabled globally by setting the xref:refguide:config:sections/causeway.applib.adoc#causeway.applib.annotation.domain-object.editing[causeway.applib.adoc#causeway.applib.annotation.domain-object.editing] configuration property:

[source,ini]
----
causeway.applib.annotation.domain-object.editing=false
----

We recommend this setting; it will help drive out the underlying business operations (processes and procedures) that require objects to change; these can then be captured as business actions.
====

This default can be overridden on an object-by-object basis; if `editing()` is set to `ENABLED` then the object's properties and collections are editable irrespective of the configured value; if set to `DISABLED` then the object's properties and collections are not editable irrespective of the configured value.

For example:

[source,java]
----
@DomainObject(
    editing=Editing.DISABLED,
    editingDisabledReason="Reference data, so cannot be modified"
)
public class Country {
    ...
}
----

