[[introduction]]
= Introduction

: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:

When a domain object is rendered in the UI or the end-user interacts with the domain object through the UI, the framework applies a series of precondition business rules to each object member.

* is the object member visible?
+
Members that are not visible are simply omitted from the page.
If all the members in a fieldset (property group) are hidden, then the fieldset is not shown.
If all the members in a tab are hidden, then the tab is not shown.
If all the members of the object are hidden, then a "404" style message ("no such object") is returned to the user.

* if the object member is visible, is the object member enabled?
+
An enabled property can be edited (otherwise it is read-only), and an enabled action can be invoked (otherwise it's button is "greyed-out").
Note that collections are always read-only.

* for enabled object members, if the user then interacts with that member, are the supplied values valid (can the user "do it").
+
For an editable property this means validating the proposed new value of the property.
For an invokable action this means validating that arguments being used to invoke the action.

These can be summarised as *"see it, use it, do it"*.


.See it, use it, do it
****

* is the object member visible?

* if so, is the object member enabled?

* if so, are the supplied values valid? (can the user "do" it)?
****

The framework provides a multitude of ways to implement these business rules.

The simplest mechanism is to just implement the business rules imperatively in the domain object, or in a xref:mixins.adoc[mixin] for the object.

A more sophisticated approach, useful for decoupling functionality, is using xref:userguide:ROOT:events.adoc#domain-events[domain events].
The domain event is emitted multiple times, for the various types of precondition checks (and if not vetoed, they are also emitted on the execution of the action itself).
