You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2020/03/21 12:48:10 UTC

[isis] 01/10: ISIS-2062: userguide docs

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 20955431d3289ac1093f335d0f0d0bde2af04aaf
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Mar 21 08:47:18 2020 +0000

    ISIS-2062: userguide docs
---
 antora/supplemental-ui/css/site-custom.css         |   4 +
 .../building-blocks/types-of-domain-objects.adoc   |   2 +-
 .../modules/fun/pages/programming-model.adoc       |  32 --
 .../pages/programming-model/domain-services.adoc   | 253 ++++++++
 .../domain-services/event-subscribers.adoc         |  35 --
 .../domain-services/initialization.adoc            |  19 -
 .../programming-model/domain-services/menu.adoc    |  73 ---
 .../domain-services/organizing-services.adoc       |  20 -
 .../domain-services/registering.adoc               |  35 --
 .../domain-services/repository-and-factory.adoc    |  45 --
 .../domain-services/scoped-services.adoc           |  24 -
 .../fun/pages/programming-model/mixins.adoc        | 163 ++++++
 .../mixins/contributed-action.adoc                 |  31 -
 .../mixins/contributed-collection.adoc             |  38 --
 .../mixins/contributed-property.adoc               |  35 --
 .../programming-model/mixins/inferred-name.adoc    |  38 --
 .../mixins/nested-static-classes.adoc              |  41 --
 .../mixins/programmatic-usage.adoc                 |  19 -
 .../fun/pages/programming-model/view-models.adoc   | 638 +++++++++++++++++++++
 .../pages/programming-model/view-models/dto.adoc   |  63 --
 .../view-models/dto/dto-consumers.adoc             |  31 -
 .../view-models/dto/generating-xsds.adoc           | 170 ------
 .../view-models/dto/versioning.adoc                | 105 ----
 .../pages/programming-model/view-models/jaxb.adoc  |  68 ---
 .../view-models/jaxb/joda-datatypes.adoc           |  73 ---
 .../jaxb/referencing-domain-entities.adoc          |  63 --
 .../programming-model/view-models/non-jaxb.adoc    |  80 ---
 27 files changed, 1059 insertions(+), 1139 deletions(-)

diff --git a/antora/supplemental-ui/css/site-custom.css b/antora/supplemental-ui/css/site-custom.css
index 96010f4..b7e4744 100644
--- a/antora/supplemental-ui/css/site-custom.css
+++ b/antora/supplemental-ui/css/site-custom.css
@@ -3,6 +3,10 @@
     font-weight: 500;
 }
 
+.doc h3:not(.discrete) {
+    font-weight: 500;
+}
+
 .doc .sidebarblock.float-left {
     min-width: 400px;
     margin-right: 30px;
diff --git a/api/adoc/userguide/modules/fun/pages/building-blocks/types-of-domain-objects.adoc b/api/adoc/userguide/modules/fun/pages/building-blocks/types-of-domain-objects.adoc
index edc8351..e361f41 100644
--- a/api/adoc/userguide/modules/fun/pages/building-blocks/types-of-domain-objects.adoc
+++ b/api/adoc/userguide/modules/fun/pages/building-blocks/types-of-domain-objects.adoc
@@ -66,7 +66,7 @@ However, a service cannot have (persisted) properties, nor can it have (persiste
 A very common type of domain service is a repository, that is used to look up existing instances of a domain entity.
 For example, for the `Customer` entity there may be a `CustomerRepository`, while for `Order` entity there may be an `OrderRepository`.
 
-Similarly, entities might also have a corresponding factory service: a `CustomerFactory` or an `OrderFactory`; Evans' link:http://books.google.com/books/about/Domain_Driven_Design.html?id=hHBf4YxMnWMC[Domain Driven Design], draws a clear distinction between a factory (that creates object) and a repository (that is used to find existing objects).
+Similarly, entities might also have a corresponding factory service: a `CustomerFactory` or an `OrderFactory`; Evans' link:http://books.google.com/books/about/Domain_Driven_Design.html?id=hHBf4YxMnWMC[Domain Driven Design], draws a clear distinction between a factory (that creates object) and a repository (that is used to find existing objecpts).
 
 On the other hand, from an end-users' perspective the act of finding an existing object vs creating a new one are quite closely related.
 For this reason, in Apache Isis it's therefore quite common to have a single domain service that acts as both a factory and a repository (and is usually called just a "repository").
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model.adoc b/api/adoc/userguide/modules/fun/pages/programming-model.adoc
index f50981c..51b42a1 100644
--- a/api/adoc/userguide/modules/fun/pages/programming-model.adoc
+++ b/api/adoc/userguide/modules/fun/pages/programming-model.adoc
@@ -75,46 +75,14 @@ Alternatively, these UI hints can be defined in a supplementary xref:vw:ROOT:lay
 
 
 include::programming-model/domain-entities.adoc[leveloffset=+1]
-
-
 include::programming-model/domain-services.adoc[leveloffset=+1]
-include::programming-model/domain-services/organizing-services.adoc[leveloffset=+2]
-include::programming-model/domain-services/repository-and-factory.adoc[leveloffset=+2]
-include::programming-model/domain-services/menu.adoc[leveloffset=+2]
-include::programming-model/domain-services/event-subscribers.adoc[leveloffset=+2]
-include::programming-model/domain-services/scoped-services.adoc[leveloffset=+2]
-include::programming-model/domain-services/registering.adoc[leveloffset=+2]
-include::programming-model/domain-services/initialization.adoc[leveloffset=+2]
-
-
-
 include::programming-model/properties.adoc[leveloffset=+1]
 include::programming-model/collections.adoc[leveloffset=+1]
 include::programming-model/actions.adoc[leveloffset=+1]
 include::programming-model/properties-vs-parameters.adoc[leveloffset=+1]
 include::programming-model/inject-services.adoc[leveloffset=+1]
-
-
-
 include::programming-model/view-models.adoc[leveloffset=+1]
-include::programming-model/view-models/jaxb.adoc[leveloffset=+2]
-include::programming-model/view-models/jaxb/referencing-domain-entities.adoc[leveloffset=+3]
-include::programming-model/view-models/jaxb/joda-datatypes.adoc[leveloffset=+3]
-include::programming-model/view-models/dto.adoc[leveloffset=+2]
-include::programming-model/view-models/dto/versioning.adoc[leveloffset=+3]
-include::programming-model/view-models/dto/generating-xsds.adoc[leveloffset=+3]
-include::programming-model/view-models/dto/dto-consumers.adoc[leveloffset=+3]
-include::programming-model/view-models/non-jaxb.adoc[leveloffset=+2]
-
-
-
 include::programming-model/mixins.adoc[leveloffset=+1]
-include::programming-model/mixins/contributed-collection.adoc[leveloffset=+2]
-include::programming-model/mixins/contributed-property.adoc[leveloffset=+2]
-include::programming-model/mixins/contributed-action.adoc[leveloffset=+2]
-include::programming-model/mixins/inferred-name.adoc[leveloffset=+2]
-include::programming-model/mixins/nested-static-classes.adoc[leveloffset=+2]
-include::programming-model/mixins/programmatic-usage.adoc[leveloffset=+2]
 
 
 
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services.adoc
index 8e3747c..56b1263 100644
--- a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services.adoc
+++ b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services.adoc
@@ -6,3 +6,256 @@
 
 This section looks at the programming model for writing your own domain services.
 
+== Nature of Service
+
+Apache Isis uses Spring Boot to instantiate and manage the dependency injection of domain services.
+The vast majority of these are singleton (application) scoped; a smaller number are request scoped (using the xref:refguide:applib-ant:IsisSessionScope.adoc[`@IsisSessionScope`] annotation).
+
+Accordingly, all domain services are annotated or meta-annotated using Spring's link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Component.html[`@Component`] annotation.
+
+For domain services to be visible in the Apache Isis UI, they must be annotated with xref:refguide:applib-ant:DomainService.adoc[`@DomainService`].
+Its xref:refguide:applib-ant:DomainService.adoc#nature[`#nature()`] attribute is either:
+
+* `VIEW` (the default if not specified)
++
+which indicates that the actions should appear on the menu of the xref:vw:ROOT:about.adoc[Wicket viewer], and as top-level actions for the REST API provided by the xref:vro:ROOT:about.adoc[Restful Objects viewer].
+
+* `REST`
++
+which indicates that the actions should appear in the REST API provided by the xref:vro:ROOT:about.adoc[Restful Objects viewer], but not rendered by the xref:vw:ROOT:about.adoc[Wicket viewer].
+
+It's also possible to define a "programmatic" domain service, meaning one that is instantiated and injected by Spring Boot, but is not visible in the UI or REST API.
+For example, the xref:subdomains:docx:about.adoc[Docx Library] provides a domain service that performs mail merge using MS Word, but this domain service is not intended to appear in the UI.
+Such programmatic services are usually annotated with Spring's link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Service.html[`@Service`] annotation or link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Repository.html[`@Repository`].
+
+== Repository and Factory
+
+The repository/factory uses an injected xref:refguide:applib-svc:RepositoryService.adoc[`RepositoryService`] to both instantiate new objects and to query the database for existing objects of a given entity type.
+Generally these services are not visible in UI, and so are annotated with link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Repository.html[`@Repository`]
+
+For example:
+
+[source,java]
+----
+@Repository                                                     // <.>
+@lombok.RequiredArgsConstructor(onConstructor_ = {@Inject} )    // <.>
+public CustomerRepository {
+
+    private final RepositoryService repositoryService;
+
+    public List<Customer> findByName(String name) {
+        return repositoryService.allMatches(                    // <.>
+                new QueryDefault<>(Customer.class,
+                            "findByName", "name", name);
+    }
+
+    public Customer newCustomer(...) {
+        Customer Customer =
+            repositoryService.detachedEntity(Customer.class);   // <.>
+        ...
+        return repositoryService.persistAndFlush(Customer);     // <.>
+    }
+
+    public List<Customer> allCustomers() {                      // <.>
+        return repositoryService.allInstances(Customer.class);
+    }
+}
+----
+
+<.> Detected and managed by Spring Boot.
+<.> Lombok annotation for dependency injection of xref:refguide:applib-svc:RepositoryService.adoc[`RepositoryService`] through generated constructor.
+<.> uses injected `RepositoryService` to query via JDOQL.
+<.> uses injected `RepositoryService` to instantiate a not-yet-persisted domain entity ...
+<.> \... and then save into the database a new `Customer` instance.
+<.> Returns all instances (useful for prototyping, probably not for production).
+
+There is no need to annotate the actions; they are implicitly hidden because of the domain service's nature.
+
+[TIP]
+====
+JDO/Datanucleus also supports link:http://www.datanucleus.org:15080/products/accessplatform_5_2/jdo/query.html#jdoql_typed[type-safe queries].
+These can be executed through the xref:pjdo:ROOT:services/IsisJdoSupport.adoc[`IsisJdoSupport`] domain service.
+====
+
+== Menu
+
+Menu services provide actions to be rendered on the menu.
+
+For the xref:vw:ROOT:about.adoc[Wicket Viewer], each service's actions appear as a collection of menu items of a named menu, and this menu is on one of the three menu bars provided by the Wicket viewer.
+Although these can be organised using annotations, it's usually easier to use a xref:vw:ROOT:menubars-layout.adoc#file-based[file-based layout file] (`menubars.layout.xml`).
+
+For the xref:vro:ROOT:about.adoc[Restful Objects Viewer], all menu services are shown in the services representation.
+
+[source,java]
+----
+@DomainService(nature = NatureOfService.VIEW)                   // <.>
+@lombok.RequiredArgsConstructor(onConstructor_ = {@Inject} )    // <.>
+public class Customers {
+
+    @Inject
+    protected final CustomerRepository customerRepository;      // <.>
+
+    @Action(semantics = SemanticsOf.SAFE)
+    @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
+    public List<Customer> findByName(                           // <.>
+            @ParameterLayout(named="Name")                      // <.>
+            final String name ) {
+        return customerRepository.findByName(name);             // <.>
+    }
+
+    @Action(semantics = SemanticsOf.NON_IDEMPOTENT)
+    public Customer newCustomer(...) {
+        return customerRepository.newCustomer(...);
+    }
+
+    @Action( semantics = SemanticsOf.SAFE,
+             restrictTo = RestrictTo.PROTOTYPING )              // <.>
+    public List<Customer> listAll() {
+        return customerRepository.listAll();
+    }
+}
+----
+
+<.> Identify the class as a domain service, to render in the menu.
+
+<.> Rendered in the UI as a "Find By Name" menu item underneath the "Customers" menu.
+
+<.> The xref:refguide:applib-ant:ParameterLayout.adoc[`@ParameterLayout`] provides metadata for the parameter itself, in this case its name.
++
+[TIP]
+====
+There's no need to name the action parameters if the code is compiled using the `-parameters` flag to the Java compiler (javac); the framework will then use the name of the parameter itself.
+====
+
+<.> the action implementation delegates to an injected repository.
+The framework can inject into not just other domain services but will also automatically into domain entities and view models.
+There is further discussion of service injection xref:userguide:fun:programming-model.adoc#inject-services[below].
+
+<.> xref:refguide:applib-ant:Action.adoc#restrictTo[Prototype] actions are rendered only in prototyping mode.
+A "list all" action such as this can be useful when exploring the domain with a small dataset.
+
+<.> Menu services typically delegate to an underlying repository/ies specific to the domain (rather than use `RepositoryService` directly, for example).
+
+Whether you separate out menu services from repository services is to some extent a matter of style.
+One perspective is that these two closely related domain services nevertheless have different responsibilities, and so could be kept separate.
+An alternative perspective is that the duplication is just unnecessary boilerplate, and conflicts with the naked objects philosophy.
+
+== Event Subscribers
+
+Domain services acting as event subscribers can subscribe to xref:userguide:fun:building-blocks.adoc#lifecycle-events[lifecycle] events, influencing the rendering and behaviour of other objects.
+Behind the scenes this uses Spring's (in-memory) link:https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#context-functionality-events-annotation[event bus].
+
+[source,java]
+----
+import org.springframework.context.event.EventListener;
+
+@Service                                                        // <.>
+@lombok.RequiredArgsConstructor(onConstructor_ = {@Inject} )
+public class OnCustomerDeletedCascadeDeleteOrders {
+
+    @Inject
+    private final OrderRepository orderRepository;
+
+    @EventListener(Customer.DeletedEvent.class)                 // <.>
+    public void on(final Customer.DeletedEvent ev) {            // <.>
+        Customer customer = ev.getSource();
+        orderRepository.delete(customer);
+    }
+}
+----
+
+<.> subscriptions do not appear in the UI at all
+
+<.> use Spring Framework's link:https://javadoc.io/doc/org.springframework/spring-context/latest/org/springframework/context/event/EventListener.html[`@EventListener`]
+
+<.> the parameter type of the method corresponds to the event emitted on the event bus.
+The actual method name does not matter (though it must have `public` visibility).
+
+== Scoped services
+
+By default all domain services are application-scoped, in other words singletons.
+Such domain services are required to be thread-safe, usually satisfied by being intrinsically stateless.
+
+Sometimes though a service's lifetime is applicable only to a single (http) request.
+The framework has a number of such services, including a xref:refguide:applib-svc:Scratchpad.adoc[`Scratchpad`] service (to share adhoc data between methods), and xref:refguide:applib-svc:QueryResultsCache.adoc[`QueryResultsCache`], which as its name suggests will cache query results.
+Such services _do_ hold state, but that state is scoped per (possibly concurrent) request and should be removed afterwards.
+
+The requirement for request-scoped services is supported using Apache Isis' own xref:refguide:applib-ant:IsisSessionScope.adoc[`@IsisSessionScope`] annotation (named because a short-lived `IsisSession` is created for each request).
+This is used by the framework services and can also be used for user-defined services.
+
+For example:
+
+[source,java]
+----
+@Service
+@IsisSessionScope
+public class MyService {
+    ...
+    public void doSomething() { ... }
+}
+----
+
+Unlike application-scoped services, these request-scoped services must be injected using a slightly different idiom (borrowed from CDI), using a `javax.inject.Provider`.
+For example:
+
+[source,java]
+----
+import javax.inject.Provider;
+
+public class SomeClient {
+    ...
+    @Inject
+    Provider<MyService> myServiceProvider;  // <.>
+
+    public void someMethod() {
+        myServiceProvider.get()             // <.>
+                         .doSomething();
+}
+----
+<.> Inject using `Provider`
+<.> Obtain an instance using `Provider#get()`
+
+
+== Registering
+
+The easiest way to register domain services with the framework is to use Spring's link:http://localhost:5000[`@ComponentScan`] annotation on an owning link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/Configuration.html[`@Configuration`].
+
+The xref:docs:starters:simpleapp.adoc[simpleapp starter apps] illustrates the idiom:
+
+* for each Maven module, we have 
+
+
+[source,ini]
+----
+public class MyAppManifest implements AppManifest {
+    public List<Class<?>> getModules() {
+        return Arrays.asList(
+                TodoAppDomainModule.class,
+                TodoAppFixtureModule.class,
+                TodoAppAppModule.class,
+                org.isisaddons.module.audit.AuditModule.class);
+    }
+    ...
+}
+----
+
+will load all services in the packages underneath the four modules listed.
+
+Examples of framework-provided services (as defined in the applib) include clock, auditing, publishing, exception handling, view model support, snapshots/mementos, and user/application settings management; see the xref:refguide:applib-svc:about.adoc[domain services] reference guide for further details.
+
+== Initialization
+
+WARNING: TODO: v2: support for init with a Map is no longer supported, I suspect...?
+Instead, can x-ref Spring's strongly typed configuration beans
+
+Services can optionally declare lifecycle callbacks to initialize them (when the app is deployed) and to shut them down (when the app is undeployed).
+
+An Apache Isis session _is_ available when initialization occurs (so services can interact with the object store, for example).
+
+The framework will call any `public` method annotated with xref:refguide:applib-ant:PostConstruct.adoc[`@PostConstruct`] with either no arguments of an argument of type `Map<String,String>`.
+In the latter case, the framework passes in the configuration.
+
+Shutdown is similar; the framework will call any method annotated with xref:refguide:applib-ant:PreDestroy.adoc[`@PreDestroy`].
+
+
+
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/event-subscribers.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/event-subscribers.adoc
deleted file mode 100644
index bab37f9..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/event-subscribers.adoc
+++ /dev/null
@@ -1,35 +0,0 @@
-= Event Subscribers
-
-: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 ag [...]
-:page-partial:
-
-
-WARNING: TODO: v2: update for Spring events rather than axon/guava
-
-Domain services acting as event subscribers can subscribe to xref:userguide:fun:building-blocks.adoc#lifecycle-events[lifecycle] events, influencing the rendering and behaviour of other objects.
-
-We suggest naming such classes `XxxSubscriptions`, for example:
-
-[source,java]
-----
-import org.springframework.context.event.EventListener;
-
-@DomainService( nature=NatureOfService.DOMAIN )         // <.>
-public class CustomerOrderSubscriptions {
-
-    @EventListener(Customer.DeletedEvent.class)         // <.>
-    public void on(final Customer.DeletedEvent ev) {    // <.>
-        Customer customer = ev.getSource();
-        orderRepository.delete(customer);
-    }
-
-    @Inject
-    OrderRepository orderRepository;
-}
-----
-<.> subscriptions do not appear in the UI at all
-<.> use Spring Frameworkr's `@EventListener`
-<.> the parameter type of the method corresponds to the event emitted on the event bus.
-The actual method name does not matter (though it must have `public` visibility).
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/initialization.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/initialization.adoc
deleted file mode 100644
index 4bba3a9..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/initialization.adoc
+++ /dev/null
@@ -1,19 +0,0 @@
-= Initialization
-
-: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 ag [...]
-:page-partial:
-
-
-WARNING: TODO: v2: support for init with a Map is no longer supported, I suspect...?  Instead, can x-ref Spring's strongly typed configuration beans
-
-Services can optionally declare lifecycle callbacks to initialize them (when the app is deployed) and to shut them down (when the app is undeployed).
-
-An Apache Isis session _is_ available when initialization occurs (so services can interact with the object store, for example).
-
-The framework will call any `public` method annotated with xref:refguide:applib-ant:PostConstruct.adoc[`@PostConstruct`] with either no arguments of an argument of type `Map<String,String>`.
-In the latter case, the framework passes in the configuration.
-
-Shutdown is similar; the framework will call any method annotated with xref:refguide:applib-ant:PreDestroy.adoc[`@PreDestroy`].
-
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/menu.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/menu.adoc
deleted file mode 100644
index e6ac8dd..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/menu.adoc
+++ /dev/null
@@ -1,73 +0,0 @@
-= Menu
-
-: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 ag [...]
-:page-partial:
-
-
-Menu services provide actions to be rendered on the menu.
-
-For the Wicket viewer, each service's actions appear as a collection of menu items of a named menu, and this menu is on one of the three menu bars provided by the Wicket viewer.
-Although these can be organised using annotations, it's usually easier to use a xref:vw:ROOT:menubars-layout.adoc#file-based[`menubars.layout.xml`] file.
-
-For the Restful Objects viewer, all menu services are shown in the services representation.
-
-We suggest naming such classes `XxxMenu`, eg:
-
-
-[source,java]
-----
-@DomainService(                                                 // <1>
-    nature = NatureOfService.VIEW
-)
-public class CustomerMenu {
-
-    @Action(semantics = SemanticsOf.SAFE)
-    @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
-    public List<Customer> findByName(                           // <2>
-            @ParameterLayout(named="Name")                      // <3>
-            final String name
-    ) {
-        return customerRepository.findByName(name);             // <4>
-    }
-
-    @Action(
-            semantics = SemanticsOf.NON_IDEMPOTENT
-    )
-    public Customer newCustomer(...) {
-        return customerRepository.newCustomer(...);
-    }
-
-    @Action(
-            semantics = SemanticsOf.SAFE,
-            restrictTo = RestrictTo.PROTOTYPING                 // <5>
-    )
-    public List<Customer> listAll() {
-        return customerRepository.listAll();
-    }
-
-    @Inject
-    protected CustomerRepository customerRepository;            // <6>
-}
-----
-<1> The (Apache Isis) xref:refguide:applib-ant:DomainService.adoc[`@DomainService`] annotation is used to identify the class as a domain service.
-Apache Isis scans the classpath looking for classes with this annotation, so there very little configuration other than to tell the framework which packages to scan underneath.
-The `VIEW` nature indicates that this service's actions should be exposed as menu items.
-<2> The `findByName` method is annotated with various Apache Isis annotations (xref:refguide:applib-ant:Action.adoc[`@Action`], xref:refguide:applib-ant:ActionLayout.adoc[`@ActionLayout`] and xref:refguide:applib-ant:MemberOrder.adoc[`@MemberOrder`] and is itself rendered in the UI as a "Find By Name" menu item underneath the "Simple Objects" menu.
-<3> The xref:refguide:applib-ant:ParameterLayout.adoc[`@ParameterLayout`] provides metadata for the parameter itself, in this case its name.
-+
-[TIP]
-====
-There's no need to name the action parameters if the code is compiled using the `-parameters` flag to the Java compiler (javac); the framework will then use the name of the parameter itself.
-====
-
-<4> the action implementation delegates to an injected repository.
-The framework can inject into not just other domain services but will also automatically into domain entities and view models.
-There is further discussion of service injection xref:userguide:fun:programming-model.adoc#inject-services[below].
-<5> xref:refguide:applib-ant:Action.adoc#restrictTo[Prototype] actions are rendered only in prototyping mode.
-A "list all" action such as this can be useful when exploring the domain with a small dataset.
-<6> Menu services typically delegate to an underlying repository/ies specific to the domain (rather than use `RepositoryService` directly, for example).
-
-
-
-Not every action on the repository need to be delegated to of course (the above example does but only because it is very simple).
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/organizing-services.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/organizing-services.adoc
deleted file mode 100644
index 78c2658..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/organizing-services.adoc
+++ /dev/null
@@ -1,20 +0,0 @@
-= Organizing Services
-
-: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 ag [...]
-:page-partial:
-
-
-
-In larger applications we have found it worthwhile to ensure that our domain services only act aligned with these responsibilities, employing a naming convention so that it is clear what the responsibilities of each domain service is.
-
-The application provides the `@DomainService(nature=...)` annotation that helps distinguish some of these responsibilities:
-
-* `VIEW` indicates that the actions should appear on the menu of the xref:vw:ROOT:about.adoc[Wicket viewer], and as top-level actions for the REST API provided by the xref:vro:ROOT:about.adoc[Restful Objects viewer]
-
-* `DOMAIN` indicates that the actions are for other domain objects to invoke (either directly or indirectly through the event bus), but in any case should not be rendered at all in the UI
-
-* `VIEW_REST_ONLY` indicates that the actions should appear in the REST API provided by the xref:vro:ROOT:about.adoc[Restful Objects viewer], but not rendered by the xref:vw:ROOT:about.adoc[Wicket viewer].
-
-If the domain service nature is not specified (or is left to its default, `VIEW`), then the service's actions will appear in the UI.
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/registering.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/registering.adoc
deleted file mode 100644
index 10e4f6c..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/registering.adoc
+++ /dev/null
@@ -1,35 +0,0 @@
-= Registering
-
-: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 ag [...]
-:page-partial:
-
-
-WARNING: TODO: v2: this is out of date, need to xref Spring Boot mechanism instead.
-
-
-The easiest way to register domain services with the framework is to use an xref:refguide:applib-cm:classes/AppManifest-bootstrapping.adoc[`AppManifest`].
-This specifies the modules which contain xref:refguide:applib-ant:DomainService.adoc[`@DomainService`]-annotated classes.
-
-For example:
-
-[source,ini]
-----
-public class MyAppManifest implements AppManifest {
-    public List<Class<?>> getModules() {
-        return Arrays.asList(
-                TodoAppDomainModule.class,
-                TodoAppFixtureModule.class,
-                TodoAppAppModule.class,
-                org.isisaddons.module.audit.AuditModule.class);
-    }
-    ...
-}
-----
-
-will load all services in the packages underneath the four modules listed.
-
-
-Examples of framework-provided services (as defined in the applib) include clock, auditing, publishing, exception handling, view model support, snapshots/mementos, and user/application settings management; see the xref:refguide:applib-svc:about.adoc[domain services] reference guide for further details.
-
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/repository-and-factory.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/repository-and-factory.adoc
deleted file mode 100644
index ec912e4..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/repository-and-factory.adoc
+++ /dev/null
@@ -1,45 +0,0 @@
-= Repository and Factory
-
-: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 ag [...]
-:page-partial:
-
-
-
-The repository/factory uses an injected xref:refguide:applib-svc:RepositoryService.adoc[`RepositoryService`] to both instantiate new objects and to query the database for existing objects of a given entity type.
-It is not visible in UI, rather other services delegate to it.
-
-We suggest naming such classes `XxxRepository`, eg:
-
-
-[source,java]
-----
-@DomainService(
-    nature=NatureOfService.DOMAIN                               // <1>
-)
-public CustomerRepository {
-    public List<Customer> findByName(String name) {
-        return repositoryService.allMatches(                    // <2>
-                new QueryDefault<>(Customer.class,
-                            "findByName", "name", name);
-    }
-    public Customer newCustomer(...) {
-        Customer Customer =
-            repositoryService.instantiate(Customer.class);      // <3>
-        ...
-        repositoryService.persist(Customer);                    // <3>
-        return Customer;
-    }
-    public List<Customer> allCustomers() {
-        return repositoryService.allInstances(Customer.class);
-    }
-    @Inject
-    RepositoryService repositoryService;
-}
-----
-<1> interacted with only programmatically by other objects in the domain layer.
-<2> uses injected `RepositoryService` to query via JDOQL.
-<3> uses injected `RepositoryService` to first instantiate and then save into the database a new `Customer` instance.
-
-There is no need to annotate the actions; they are implicitly hidden because of the domain service's nature.
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/scoped-services.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/scoped-services.adoc
deleted file mode 100644
index f11b72c..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/domain-services/scoped-services.adoc
+++ /dev/null
@@ -1,24 +0,0 @@
-= Scoped services
-
-: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 ag [...]
-:page-partial:
-
-WARNING: TODO: v2: extend this/fix for Spring Boot scopes; does it support CDI annotation? which other scopes are supported?
-
-By default all domain services are considered to be singletons, and thread-safe.
-
-Sometimes though a service's lifetime is applicable only to a single request; in other words it is request-scoped.
-
-The CDI annotation xref:refguide:applib-ant:RequestScoped.adoc[`@javax.enterprise.context.RequestScoped`] is used to indicate this fact:
-
-[source,java]
-----
-@javax.enterprise.context.RequestScoped
-public class MyService extends AbstractService {
-    ...
-}
-----
-
-The framework provides a number of request-scoped services, including a xref:refguide:applib-svc:Scratchpad.adoc[`Scratchpad`] service and a query results caching through the xref:refguide:applib-svc:QueryResultsCache.adoc[`QueryResultsCache`].
-See the xref:refguide:applib-svc:about.adoc[domain services] reference guide for further details.
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/mixins.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/mixins.adoc
index 8da90e9..01fb211 100644
--- a/api/adoc/userguide/modules/fun/pages/programming-model/mixins.adoc
+++ b/api/adoc/userguide/modules/fun/pages/programming-model/mixins.adoc
@@ -38,6 +38,169 @@ This could also be an interface.
 <4> Indicates that the action should be interpreted as a collection.
 This requires that the action has safe semantics, ie does not alter state/no side-effects.
 
+== Contributed Collection
 
+The example below shows how to contribute a collection:
 
+[source,java]
+----
+@Mixin(method="coll")                                           // <1>
+public class DocumentHolder_documents {
+
+    private final DocumentHolder holder;
+    public DocumentHolderDocuments(DocumentHolder holder) { this.holder = holder; }
+
+    @Action(semantics=SemanticsOf.SAFE)                         // <2>
+    @ActionLayout(contributed = Contributed.AS_ASSOCIATION)     // <3>
+    @CollectionLayout(defaultView="table")
+    public List<Document> coll() {                              // <4>
+        ...
+    }
+    public boolean hideColl() { /* ... */ }                           // <5>
+}
+----
+<1> indicates this is a mixin, and in this case nominates the method name.
+The recommended name for collections is "coll" (if none is specified the default name is "$$").
+<2> required; actions that have side-effects cannot be contributed as collections
+<3> required; otherwise the mixin will default to being rendered as an action
+<4> method (which must match `@Mixin#method` above), must accept no arguments.
+The mixin is a collection rather than a property because the return type is a collection, not a scalar.
+<5> supporting methods follow the usual naming conventions.
+(That said, in the case of collections, because the collection is derived/read-only, the only supporting method that is relevant is `hideColl()`).
+
+The above will result in a contributed collection "documents" for all types that implement/extend from `DocumentHolder`.
+
+== Contributed Property
+
+Contributed properties are defined similarly, for example:
+
+[source,java]
+----
+@Mixin(method="prop")                                           // <1>
+public class DocumentHolder_mostRecentDocument {
+
+    private final DocumentHolder holder;
+    public DocumentHolderDocuments(DocumentHolder holder) { this.holder = holder; }
+
+    @Action(semantics=SemanticsOf.SAFE)                         // <2>
+    @ActionLayout(contributed = Contributed.AS_ASSOCIATION)     // <3>
+    public Document prop() {                                    // <4>
+        ...
+    }
+    public boolean hiderProp() { /* ... */ }                          // <5>
+}
+----
+<1> indicates this is a mixin, and in this case nominates the method name.
+The recommended name for properties is "prop" (if none is specified the default name is "$$").
+<2> required; actions that have side-effects cannot be contributed as collections
+<3> required; otherwise the mixin will default to being rendered as an action
+<4> method (which must match `@Mixin#method` above), must accept no arguments.
+The mixin is a property rather than a collection because the return type is a scalar.
+<5> supporting methods follow the usual naming conventions.
+(That said, in the case of properties, because the property is derived/read-only, the only supporting method that is relevant is `hideProp()`).
+
+== Contributed Action
+
+Contributed actions are defined similarly, for example:
+
+[source,java]
+----
+@Mixin(method="act")                                            // <1>
+public class DocumentHolder_addDocument {
+
+    private final DocumentHolder holder;
+    public DocumentHolderDocuments(DocumentHolder holder) { this.holder = holder; }
+
+    @Action()
+    @ActionLayout(contributed = Contributed.AS_ACTION)          // <2>
+    public Document> act(Document doc) {                        // <3>
+        ...
+    }
+    public boolean hideAct() { /* ... */ }                            // <4>
+}
+----
+<1> indicates this is a mixin, and in this case nominates the method name.
+The recommended name for properties is "prop" (if none is specified the default name is "$$").
+<2> recommended
+<3> method must match `@Mixin#method` above.
+Unlike contributed properties and collections, contributed actions can accept parameters.
+<4> supporting methods follow the usual naming conventions.
+
+== Inferred Name
+
+Where the mixin follows the naming convention `SomeType_mixinName` then the method name can be abbreviated, and the name of the member being contributed is inferred from the name of the class itself, being everything after the last '_'.
+
+For example:
+
+[source,java]
+----
+@Mixin(method="act")
+public class DocumentHolder_documents {
+
+    private final DocumentHolder holder;
+    public DocumentHolder_documents(DocumentHolder holder) { this.holder = holder; }
+
+    @Action(semantics=SemanticsOf.SAFE)
+    @ActionLayout(contributed = Contributed.AS_ASSOCIATION)
+    @CollectionLayout(defaultView="table")
+    public List<Document> act() {
+        ...
+    }
+    public boolean hideAct() { /* ... */ }
+}
+----
+
+The examples above (for xref:userguide:fun:programming-model.adoc#contributed-action[action]) demonstrate this.
+
+The character "$" is also recognized as a separator between the mixin type and mixin name.
+This is useful for mixins implemented as nested static types, discussed xref:userguide:fun:programming-model.adoc#nested-static-classes[below].
+
+[[nested-static-classes]]
+== As Nested Static Classes
+
+As noted in the introduction, while mixins were originally introduced as a means of allowing contributions from one module to the types of another module, they are also a convenient mechanism for grouping functionality/behaviour against a concrete type.
+All the methods and supporting methods end up in a single construct, and the dependency between that functionality and the rest of the object is made more explicit.
+
+When using mixins in this fashion, it is idiomatic to write the mixin as a nested static class, using the naming convention described above to reduce duplication.
+
+For example:
+
+[source,java]
+----
+public class Customer {
+
+    @Mixin(method="act")
+    public static class placeOrder {                                            // <1>
+
+        private final Customer customer;
+        public placeOrder(Customer customer) { this.customer = customer; }      // <2>
+
+        @Action
+        @ActionLayout(contributed = Contributed.AS_ACTION)
+        public List<Order> act(Product p, int quantity) {                        // <3>
+            ...
+        }
+        public boolean hideAct() { /* ... */ }                                         // <4>
+        public String validate0Act(Product p) { ...  }
+    }
+}
+----
+<1> By convention, start with a lower case, though will also work fine if capitalized.
+<2> typically contributed to concrete class, ie the outer class
+<3> implementation as usual
+<4> supporting methods as usual
+
+== Programmatic usage
+
+When a domain object is rendered, the framework will automatically instantiate all required mixins and delegate to them dynamically.
+If writing integration tests or fixtures, or (sometimes) just regular domain logic, then you may need to instantiate mixins directly.
+
+For this you can use the xref:refguide:applib-svc:FactoryService.adoc[`FactoryService#mixin(...)`] method.
+
+For example:
+
+[source,java]
+----
+DocumentHolder_documents mixin = factoryService.mixin(DocumentHolder_documents.class, customer);
+----
 
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-action.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-action.adoc
deleted file mode 100644
index a8e7379..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-action.adoc
+++ /dev/null
@@ -1,31 +0,0 @@
-= Contributed Action
-
-: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 ag [...]
-:page-partial:
-
-
-Contributed actions are defined similarly, for example:
-
-[source,java]
-----
-@Mixin(method="act")                                            // <1>
-public class DocumentHolder_addDocument {
-
-    private final DocumentHolder holder;
-    public DocumentHolderDocuments(DocumentHolder holder) { this.holder = holder; }
-
-    @Action()
-    @ActionLayout(contributed = Contributed.AS_ACTION)          // <2>
-    public Document> act(Document doc) {                        // <3>
-        ...
-    }
-    public boolean hideAct() { /* ... */ }                            // <4>
-}
-----
-<1> indicates this is a mixin, and in this case nominates the method name.
-The recommended name for properties is "prop" (if none is specified the default name is "$$").
-<2> recommended
-<3> method must match `@Mixin#method` above.
-Unlike contributed properties and collections, contributed actions can accept parameters.
-<4> supporting methods follow the usual naming conventions.
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-collection.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-collection.adoc
deleted file mode 100644
index 5f26b1f..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-collection.adoc
+++ /dev/null
@@ -1,38 +0,0 @@
-= Contributed Collection
-
-: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 ag [...]
-:page-partial:
-
-
-
-The example below shows how to contribute a collection:
-
-[source,java]
-----
-@Mixin(method="coll")                                           // <1>
-public class DocumentHolder_documents {
-
-    private final DocumentHolder holder;
-    public DocumentHolderDocuments(DocumentHolder holder) { this.holder = holder; }
-
-    @Action(semantics=SemanticsOf.SAFE)                         // <2>
-    @ActionLayout(contributed = Contributed.AS_ASSOCIATION)     // <3>
-    @CollectionLayout(defaultView="table")
-    public List<Document> coll() {                              // <4>
-        ...
-    }
-    public boolean hideColl() { /* ... */ }                           // <5>
-}
-----
-<1> indicates this is a mixin, and in this case nominates the method name.
-The recommended name for collections is "coll" (if none is specified the default name is "$$").
-<2> required; actions that have side-effects cannot be contributed as collections
-<3> required; otherwise the mixin will default to being rendered as an action
-<4> method (which must match `@Mixin#method` above), must accept no arguments.
-The mixin is a collection rather than a property because the return type is a collection, not a scalar.
-<5> supporting methods follow the usual naming conventions.
-(That said, in the case of collections, because the collection is derived/read-only, the only supporting method that is relevant is `hideColl()`).
-
-The above will result in a contributed collection "documents" for all types that implement/extend from `DocumentHolder`.
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-property.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-property.adoc
deleted file mode 100644
index 274255c..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/contributed-property.adoc
+++ /dev/null
@@ -1,35 +0,0 @@
-= Contributed Property
-
-: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 ag [...]
-:page-partial:
-
-
-
-Contributed properties are defined similarly, for example:
-
-[source,java]
-----
-@Mixin(method="prop")                                           // <1>
-public class DocumentHolder_mostRecentDocument {
-
-    private final DocumentHolder holder;
-    public DocumentHolderDocuments(DocumentHolder holder) { this.holder = holder; }
-
-    @Action(semantics=SemanticsOf.SAFE)                         // <2>
-    @ActionLayout(contributed = Contributed.AS_ASSOCIATION)     // <3>
-    public Document prop() {                                    // <4>
-        ...
-    }
-    public boolean hiderProp() { /* ... */ }                          // <5>
-}
-----
-<1> indicates this is a mixin, and in this case nominates the method name.
-The recommended name for properties is "prop" (if none is specified the default name is "$$").
-<2> required; actions that have side-effects cannot be contributed as collections
-<3> required; otherwise the mixin will default to being rendered as an action
-<4> method (which must match `@Mixin#method` above), must accept no arguments.
-The mixin is a property rather than a collection because the return type is a scalar.
-<5> supporting methods follow the usual naming conventions.
-(That said, in the case of properties, because the property is derived/read-only, the only supporting method that is relevant is `hideProp()`).
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/inferred-name.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/mixins/inferred-name.adoc
deleted file mode 100644
index 2c305b4..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/inferred-name.adoc
+++ /dev/null
@@ -1,38 +0,0 @@
-= Inferred Name
-
-: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 ag [...]
-:page-partial:
-
-
-
-
-Where the mixin follows the naming convention `SomeType_mixinName` then the method name can be abbreviated, and the name of the member being contributed is inferred from the name of the class itself, being everything after the last '_'.
-
-
-For example:
-
-[source,java]
-----
-@Mixin(method="act")
-public class DocumentHolder_documents {
-
-    private final DocumentHolder holder;
-    public DocumentHolder_documents(DocumentHolder holder) { this.holder = holder; }
-
-    @Action(semantics=SemanticsOf.SAFE)
-    @ActionLayout(contributed = Contributed.AS_ASSOCIATION)
-    @CollectionLayout(defaultView="table")
-    public List<Document> act() {
-        ...
-    }
-    public boolean hideAct() { /* ... */ }
-}
-----
-
-
-The examples above (for xref:userguide:fun:programming-model.adoc#contributed-action[action]) demonstrate this.
-
-
-The character "$" is also recognized as a separator between the mixin type and mixin name.
-This is useful for mixins implemented as nested static types, discussed xref:userguide:fun:programming-model.adoc#nested-static-classes[below].
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/nested-static-classes.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/mixins/nested-static-classes.adoc
deleted file mode 100644
index a2504e2..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/nested-static-classes.adoc
+++ /dev/null
@@ -1,41 +0,0 @@
-[[nested-static-classes]]
-= As Nested Static Classes
-
-: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 ag [...]
-:page-partial:
-
-
-
-As noted in the introduction, while mixins were originally introduced as a means of allowing contributions from one module to the types of another module, they are also a convenient mechanism for grouping functionality/behaviour against a concrete type.
-All the methods and supporting methods end up in a single construct, and the dependency between that functionality and the rest of the object is made more explicit.
-
-When using mixins in this fashion, it is idiomatic to write the mixin as a nested static class, using the naming convention described above to reduce duplication.
-
-For example:
-
-[source,java]
-----
-public class Customer {
-
-    @Mixin(method="act")
-    public static class placeOrder {                                            // <1>
-
-        private final Customer customer;
-        public placeOrder(Customer customer) { this.customer = customer; }      // <2>
-
-        @Action
-        @ActionLayout(contributed = Contributed.AS_ACTION)
-        public List<Order> act(Product p, int quantity) {                        // <3>
-            ...
-        }
-        public boolean hideAct() { /* ... */ }                                         // <4>
-        public String validate0Act(Product p) { ...  }
-    }
-}
-----
-<1> By convention, start with a lower case, though will also work fine if capitalized.
-<2> typically contributed to concrete class, ie the outer class
-<3> implementation as usual
-<4> supporting methods as usual
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/programmatic-usage.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/mixins/programmatic-usage.adoc
deleted file mode 100644
index e5781b8..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/mixins/programmatic-usage.adoc
+++ /dev/null
@@ -1,19 +0,0 @@
-= Programmatic usage
-
-: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 ag [...]
-:page-partial:
-
-
-
-When a domain object is rendered, the framework will automatically instantiate all required mixins and delegate to them dynamically.
-If writing integration tests or fixtures, or (sometimes) just regular domain logic, then you may need to instantiate mixins directly.
-
-For this you can use the xref:refguide:applib-svc:FactoryService.adoc[`FactoryService#mixin(...)`] method.
-
-For example:
-
-[source,java]
-----
-DocumentHolder_documents mixin = factoryService.mixin(DocumentHolder_documents.class, customer);
-----
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models.adoc
index 4a6b091..7347d44 100644
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models.adoc
+++ b/api/adoc/userguide/modules/fun/pages/programming-model/view-models.adoc
@@ -23,3 +23,641 @@ This could be a factor for example in a dashboard/home page that references many
 In the sections below we consider JAXB view models both as "regular" view models, and also when using them to act as DTOs.
 
 
+
+[[jaxb]]
+== JAXB View Models
+
+
+Here's a typical example of a JAXB view model, to allow (certain properties of) two ``Customer``s to be compared:
+
+[source,java]
+----
+@XmlRootElement(name = "compareCustomers")          // <1>
+@XmlType(
+        propOrder = {                               // <2>
+            "customer1",
+            "customer2"
+        }
+)
+@XmlAccessorType(XmlAccessType.FIELD)               // <3>
+public class CompareCustomers {
+
+    @XmlElement(required = true)                    // <4>
+    @Getter @Setter
+    Customer customer1;
+
+    @XmlElement(required = true)                    // <4>
+    @Getter @Setter
+    Customer customer2;
+
+    @XmlTransient                                   // <5>
+    public String getCustomer1Name() {
+        return getCustomer1().getName();
+    }
+
+    @XmlTransient                                   // <5>
+    public String getCustomer2Name() {
+        return getCustomer2().getName();
+    }
+
+    ...
+}
+----
+<1> The JAXB `@XmlRootElement` annotation indicates this is a view model to Apache Isis, which then uses JAXB to serialize the state of the view model between interactions
+
+<2> Optionally, the properties of the view model can be listed using the `XmlType#propOrder` attribute.
++
+This is an all-or-nothing affair: either all properties must be listed, or else the annotation omitted.
+
+<3> Specifying field accessor type allows the Lombok `@Getter` and `@Setter` annotations to be used.
+<4> The `@XmlElement` indicates the property is part of the view model's state.
+For collections, the `@XmlElementWrapper` would also typically be used.
+<5> The `@XmlTransient` indicates that the property is derived and should be ignored by JAXB.
++
+The derived properties could also have been implemented using xref:userguide:fun:building-blocks.adoc#mixins[mixins].
+
+
+[IMPORTANT]
+====
+Be aware that all the state will become the DTO's memento, ultimately converted into a URL-safe form, by way of the xref:refguide:applib-svc:UrlEncodingService.adoc[`UrlEncodingService`].
+
+There are limits to the lengths of URLs, however.
+If the URL does exceed limits or contains invalid characters, then provide a custom implementation of xref:refguide:applib-svc:UrlEncodingService.adoc[`UrlEncodingService`] to handle the memento string in some other fashion (eg substituting it with a GUID, with the memento cached somehow on the server).
+a URL.
+====
+
+
+
+
+
+
+=== Referencing Domain Entities
+
+
+It's quite common for view models to be "backed by" (be projections of) some underlying domain entity.
+For example, the `CompareCustomers` view model described xref:userguide:fun:programming-model.adoc#jaxb[above] actually references two underlying ``Customer`` entities.
+
+It wouldn't make sense to serialize out the state of a persistent entity.
+However, the identity of the underlying entity is well defined; Apache Isis defines the xref:refguide:schema:common.adoc[common schema] which defines the `<oid-dto>` element (and corresponding `OidDto` class): the object's type and its identifier.
+This is basically a formal XML equivalent to the `Bookmark` object obtained from the xref:refguide:applib-svc:BookmarkService.adoc[`BookmarkService`].
+
+There is only one requirement to make this work: every referenced domain entity must be annotated with xref:refguide:applib-ant:XmlJavaTypeAdapter.adoc[`@XmlJavaTypeAdapter`], specifying the framework-provided `PersistentEntityAdapter`.
+And this class is similar to the xref:refguide:applib-svc:BookmarkService.adoc[`BookmarkService`]: it knows how to create an `OidDto` from an object reference.
+
+Thus, in our view model we can legitimately write:
+
+[source,java]
+----
+public class CompareCustomers {
+
+    @XmlElement(required = true)
+    @Getter @Setter
+    Customer customer1;
+    ...
+}
+----
+
+All we need to do is remember to add that `@XmlJavaTypeAdapter` annotation to the referenced entity:
+
+[source,java]
+----
+@XmlJavaTypeAdapter(PersistentEntityAdapter.class)
+public class Customer ...  {
+    ...
+}
+----
+
+
+It's also possible for a DTO view models to hold collections of objects.
+These can be of any type, either simple properties, or references to other objects.
+The only bit of boilerplate that is required is the `@XmlElementWrapper` annotation.
+This instructs JAXB to create an XML element (based on the field name) to contain each of the elements.
+(If this is omitted then the contents of the collection are at the same level as the properties; almost certainly not what is required).
+
+For example, we could perhaps generalize the view model to hold a set of ``Customer``s to be compared:
+
+[source,java]
+----
+public class CompareCustomers {
+    ...
+    @XmlElementWrapper
+    @XmlElement(name = "customers")
+    @Getter @Setter
+    protected List<Customer> customersToCompare = Lists.newArrayList();
+}
+----
+
+This capability is particularly useful when the JAXB view model is being used as a xref:userguide:fun:programming-model.adoc#dto[DTO].
+
+
+
+[[joda-datatypes]]
+=== JODA Time Datatypes
+
+
+If your JAXB view model contains fields using the JODA datatypes (`LocalDate` and so on), then `@XmlJavaTypeAdapter` additional annotations in order to "teach" JAXB how to serialize out the state.
+
+The Apache Isis applib provides a number of adapters to use out-of-the-box.
+For example:
+
+
+[source,java]
+----
+@XmlRootElement(name = "categorizeIncomingInvoice")
+@XmlType(
+        propOrder = {
+                ...
+                "dateReceived",
+                ...
+        }
+)
+@XmlAccessorType(XmlAccessType.FIELD)
+public class IncomingInvoiceViewModel extends IncomingOrderAndInvoiceViewModel {
+
+    @XmlJavaTypeAdapter(JodaLocalDateStringAdapter.ForJaxb.class)
+    private LocalDate dateReceived;
+
+    ...
+}
+----
+
+The full list of adapter classes are:
+
+
+
+.JAXB adapters
+[cols="1a,2a", options="header"]
+|===
+
+| JODA datatype
+| Adapter
+
+.2+| `org.joda.time.DateTime`
+| `JodaDateTimeStringAdapter.ForJaxb`
+| `JodaDateTimeXMLGregorianCalendarAdapter.ForJaxb`
+
+.2+| `org.joda.time.LocalDate`
+| `JodaLocalDateStringAdapter.ForJaxb`
+| `JodaLocalDateXMLGregorianCalendarAdapter.ForJaxb`
+
+.2+| `org.joda.time.LocalDateTime`
+| `JodaLocalDateTimeStringAdapter.ForJaxb`
+| `JodaLocalDateTimeXMLGregorianCalendarAdapter.ForJaxb`
+
+
+.2+| `org.joda.time.LocalTime`
+| `JodaLocalTimeStringAdapter.ForJaxb`
+| `JodaLocalTimeXMLGregorianCalendarAdapter.ForJaxb`
+
+| `java.sql.Timestamp`
+| `JavaSqlTimestampXmlGregorianCalendarAdapter.ForJaxb`
+
+
+|===
+
+
+[TIP]
+====
+If you want to roll-your-own, take a look at link:http://blog.bdoughan.com/2011/05/jaxb-and-joda-time-dates-and-times.html[this blog post].
+====
+
+
+
+[[dto]]
+== DTOs
+
+
+JAXB view models can also be used as DTOs.
+The examples in this section uses the DTO for `ToDoItem`, taken from the http://github.com/apache/isis-app-todoapp[TodoApp].
+
+This DTO is defined as follows:
+
+[source,java]
+----
+package todoapp.app.viewmodels.todoitem.v1;                         // <1>
+@XmlRootElement(name = "toDoItemDto")                               // <2>
+@XmlType(
+        propOrder = {                                               // <3>
+            "majorVersion", "minorVersion",
+            "description", "category", ...
+            "toDoItem", "similarItems"
+        }
+)
+@DomainObjectLayout(
+        titleUiEvent = TitleUiEvent.Doop.class                      // <4>
+)
+public class ToDoItemV1_1 implements Dto {                          // <5>
+    @XmlElement(required = true, defaultValue = "1")                // <6>
+    public final String getMajorVersion() { return "1"; }
+    @XmlElement(required = true, defaultValue = "1")                // <7>
+    public String getMinorVersion() { return "1"; }
+
+    @XmlElement(required = true)                                    // <8>
+    @Getter @Setter
+    protected String description;
+    @XmlElement(required = true)
+    @Getter @Setter
+    protected String category;
+    ...
+
+    @Getter @Setter                                                 // <9>
+    protected ToDoItem toDoItem;
+    @XmlElementWrapper                                              // <10>
+    @XmlElement(name = "todoItem")
+    @Getter @Setter
+    protected List<ToDoItem> similarItems = Lists.newArrayList();
+}
+----
+<1> package name encodes major version; see discussion on xref:userguide:fun:programming-model.adoc#versioning[versioning]
+<2> identifies this class as a view model and defines the root element for JAXB serialization
+<3> all properties in the class must be listed; (they can be ignored using `@XmlTransient`)
+<4> demonstrating use of UI events for a subscriber to provide the DTO's title; see xref:refguide:applib-ant:DomainObjectLayout.adoc#titleUiEvent[`@DomainObjectLayout#titleUiEvent()`].
+<5> class name encodes (major and) minor version; see discussion on xref:userguide:fun:programming-model.adoc#versioning[versioning]
+<6> again, see discussion on xref:userguide:fun:programming-model.adoc#versioning[versioning]
+<7> again, see discussion on xref:userguide:fun:programming-model.adoc#versioning[versioning]
+<8> simple scalar properties
+<9> reference to a persistent entity; discussed xref:userguide:fun:programming-model.adoc#referencing-domain-entities[here]
+<10> reference to a collection of persistent entities; again discussed xref:userguide:fun:programming-model.adoc#referencing-domain-entities[here]
+
+
+
+
+=== Versioning
+
+
+The whole point of using DTOs (in Apache Isis, at least) is to define a formal contact between two inter-operating but independent applications.
+Since the only thing we can predicate about the future with any certainty is that it one or both of these applications will change, we should version DTOs from the get-go.
+This allows us to make changes going forward without unnecessarily breaking existing consumers of the data.
+
+[NOTE]
+====
+There are several ways that versioning might be accomplished; we base our guidelines on this link:http://www.xfront.com/Versioning.pdf[article] taken from Roger Costello's blog, well worth a read.
+====
+
+We can distinguish two types of changes:
+
+* backwardly compatible changes
+* breaking changes.
+
+We can immediately say that the XSD namespace should change only when there is a major/breaking change.
+If following link:http://semver.org[semantic versioning] that means when we bump the major version number v1, v2, etc.
+
+XML namespaces correspond (when using JAXB) to Java packages.
+We should therefore place our DTOs in a package that contains only the major number; this package will eventually contain a range of DTOs that are intended to be backwardly compatible with one another.
+The package should also have a `package-info.java`; it is this that declares the XSD namespace:
+
+[source,java]
+----
+@javax.xml.bind.annotation.XmlSchema(
+        namespace = "http://viewmodels.app.todoapp/todoitem/v1/Dto.xsd",        // <1>
+        xmlns = {
+                @javax.xml.bind.annotation.XmlNs(
+                        namespaceURI = "http://isis.apache.org/schema/common",
+                        prefix = "com"
+                )
+        },
+        elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED
+)
+package todoapp.app.viewmodels.todoitem.v1;                                     // <2>
+----
+<1> the namespace URI, used by the DTO residing in this package.
+<2> the package in which the DTO resides.  Note that this contains only the major version.
+
+Although there is no requirement for the namespace URI to correspond to a physical URL, it should be unique.
+This usually means including a company domain name within the string.
+
+As noted above, this package will contain multiple DTO classes all with the same namespace; these represent a set of minor versions of the DTO, each subsequent one intended to be backwardly compatible with the previous.
+Since these DTO classes will all be in the same package (as per the advice above), the class should therefore include the minor version name:
+
+[source,java]
+----
+package todoapp.app.viewmodels.todoitem.v1;     // <1>
+...
+public class ToDoItemV1_1 implements Dto {      // <2>
+    ...
+}
+----
+<1> package contains the major version only
+<2> DTO class contains the (major and) minor version
+
+
+We also recommend that each DTO instance should also specify the version of the XSD schema that it is logically compatible with.
+Probably most consumers will not persist the DTOs; they will be processed and then discarded.
+However, it would be wrong to assume that is the case in all cases; some consumers might choose to persist the DTO (eg for replay at some later state).
+
+Thus:
+
+[source,java]
+----
+public class ToDoItemV1_1 implements Dto {
+    @XmlElement(required = true, defaultValue = "1")
+    public final String getMajorVersion() { return "1"; }   // <1>
+    @XmlElement(required = true, defaultValue = "1")
+    public String getMinorVersion() { return "1"; }         // <2>
+    ...
+}
+----
+<1> returns the major version (in sync with the package)
+<2> returns the minor version (in sync with the class name)
+
+These methods always return a hard-coded literal.
+Any instances serialized from these classes will implicitly "declare" the (major and) minor version of the schema with which they are compatible.
+If a consumer has a minimum version that it requires, it can therefore inspect the XML instance itself to determine if it is able to consume said XML.
+
+If a new (minor) version of a DTO is required, then we recommend copying-and-pasting the previous version, eg:
+
+[source,java]
+----
+public class ToDoItemV1_2 implements Dto {
+    @XmlElement(required = true, defaultValue = "1")
+    public final String getMajorVersion() { return "1"; }
+    @XmlElement(required = true, defaultValue = "2")
+    public String getMinorVersion() { return "2"; }
+    ...
+}
+----
+
+Obviously, only changes made must be backward compatible, eg new members must be optional.
+
+Alternatively, you might also consider simply editing the source file, ie renaming the class and bumping up the value returned by `getMinorVersion()`.
+
+We also _don't_ recommend using inheritance (ie `ToDoItemV1_2` should not inherit from `ToDoItemV1_1`; this creates unnecessary complexity downstream if generating XSDs and DTOs for the downstream consumer.
+
+
+
+[[generating-xsds]]
+=== Generating XSDs and DTOs
+
+
+
+
+In the section xref:userguide:fun:programming-model.adoc#referencing-domain-entities[above] it was explained how a view model DTO can transparently reference any "backing" entities; these references are converted to internal object identifiers.
+
+However, if the consumer of the XML is another Java process (eg running within an Apache Camel route), then you might be tempted/expect to be able to use the same DTO within that Java process.
+But of course you cannot; the consumer runs in a different process space, and will not have references to the entity types themselves.
+
+For integration scenarios you'll therefore generally want to define a DTO in a technology independent fashion, for example using XSD schema.
+This can be generated as a DTO for use within Apache Isis, while still allowing XML instances of the schema to be consumed by any other client.
+
+The http://github.com/apache/isis-app-todoapp[TodoApp] demonstrates how use an XSD to generate a DTO; it's mostly just boilerplate.
+In the todoapp it can be found in the `todoapp-xsd` Maven module, whose `pom.xml` is structured as two profiles:
+
+[source,xml]
+----
+<project ... >
+    <artifactId>todoapp-xsd</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>todoapp-app</artifactId>
+        </dependency>
+    </dependencies>
+    <profiles>
+        <profile>
+            <id>isis-xsd</id>
+            <activation>
+                <property>
+                    <name>!skip.isis-xsd</name>
+                </property>
+            </activation>
+            ...
+        </profile>
+        <profile>
+            <id>xjc</id>
+            <activation>
+                <property>
+                    <name>!skip.xjc</name>
+                </property>
+            </activation>
+            ...
+        </profile>
+    </profiles>
+</project>
+----
+
+The `isis-xsd` profile generates the XSD using the xref:refguide:mvn:xsd.adoc[`xsd` goal] of Isis' maven plugin:
+
+[source,xml]
+----
+<build>
+    <plugins>
+        <plugin>
+            <groupId>org.apache.isis.tool</groupId>
+            <artifactId>isis-maven-plugin</artifactId>
+            <version>${isis.version}</version>
+            <configuration>
+                <appManifest>todoapp.dom.TodoAppDomManifest</appManifest>
+                <jaxbClasses>
+                    <jaxbClass>todoapp.app.viewmodels.todoitem.v1.ToDoItemV1_1</jaxbClass>
+                </jaxbClasses>
+                <separate>false</separate>
+                <commonSchemas>false</commonSchemas>
+            </configuration>
+            <dependencies>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>todoapp-dom</artifactId>
+                    <version>${project.version}</version>
+                </dependency>
+                <dependency>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                    <version>16.0.1</version>
+                </dependency>
+            </dependencies>
+            <executions>
+                <execution>
+                    <phase>generate-sources</phase>
+                    <goals>
+                        <goal>xsd</goal>
+                    </goals>
+                </execution>
+            </executions>
+        </plugin>
+        <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <version>2.5.3</version>
+            <configuration>
+                <descriptor>src/assembly/dep.xml</descriptor>
+            </configuration>
+            <executions>
+                <execution>
+                    <id>create-archive</id>
+                    <phase>package</phase>
+                    <goals>
+                        <goal>single</goal>
+                    </goals>
+                </execution>
+            </executions>
+        </plugin>
+    </plugins>
+</build>
+----
+
+The `todoapp.dom.TodoAppDomManifest` is a cut-down version of the app manifest that identifies only the `dom` domain services.
+
+The `xjc` profile, meanwhile, uses the `maven-jaxb2-plugin` (a wrapper around the `schemagen` JDK tool) to generate a DTO from the XSD generated by the preceding profile:
+
+[source,xml]
+----
+<build>
+    <plugins>
+        <plugin>
+            <groupId>org.jvnet.jaxb2.maven2</groupId>
+            <artifactId>maven-jaxb2-plugin</artifactId>
+            <version>0.12.3</version>
+            <executions>
+                <execution>
+                    <id>xjc-generate</id>
+                    <phase>generate-sources</phase>
+                    <goals>
+                        <goal>generate</goal>
+                    </goals>
+                </execution>
+            </executions>
+            <configuration>
+                <removeOldOutput>true</removeOldOutput>
+                <schemaDirectory>
+                    target/generated-resources/isis-xsd/viewmodels.app.todoapp
+                </schemaDirectory>
+                <schemaIncludes>
+                    <schemaInclude>todoitem/v1/Dto.xsd</schemaInclude>
+                </schemaIncludes>
+                <bindingDirectory>src/main/resources</bindingDirectory>
+                <bindingIncludes>
+                    <bindingInclude>binding.xml</bindingInclude>
+                </bindingIncludes>
+                <catalog>src/main/resources/catalog.xml</catalog>
+            </configuration>
+        </plugin>
+        <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <version>1.9.1</version>
+            <executions>
+                <execution>
+                    <id>add-source</id>
+                    <phase>generate-sources</phase>
+                    <goals>
+                        <goal>add-source</goal>
+                    </goals>
+                    <configuration>
+                    <sources>
+                        <source>target/generated-sources/xjc</source>
+                    </sources>
+                    </configuration>
+                </execution>
+            </executions>
+        </plugin>
+    </plugins>
+</build>
+----
+
+
+
+=== DTO Consumers
+
+
+
+The actual consumers of DTOs will generally obtain the XML of the view models either by requesting the XML directly, eg using the xref:vro:ROOT:about.adoc[RestfulObjects viewer], or may have the XML sent to them asynchronously using an ESB such as Apache Camel.
+
+In the former case, the consumer requests the DTO by calling the REST API with the appropriate HTTP `Accept` header.
+An appropriate implementation of xref:refguide:applib-svc:ContentMappingService.adoc[`ContentMappingService`] can then be used to return the appropriate DTO (as XML).
+
+For the latter case, one design is simply for the application to instantiate the view model, then call the xref:refguide:applib-svc:JaxbService.adoc[`JaxbService`] to obtain its corresponding XML.  This can then be published onto the ESB, for example using an http://activemq.apache.org[Apache ActiveMQ (TM)] queue.
+
+However, rather than try to push all the data that might be needed by any of these external systems in a single XML event (which would require anticipating all the requirements, likely a hopeless task), a better design is to publish only the fact that something of note has changed - ie, that an action on a domain object has been invoked - and then let the consumers call back to obtain other information if required.
+This can once again be done by calling the REST API with an appropriate HTTP `Accept` header.
+
+[TIP]
+====
+This is an example of the link:https://leanpub.com/camel-design-patterns[VETRO pattern] (validate, enrich, transform, route, operate).
+In our case we focus on the validation (to determine the nature of the inbound message, ie which action was invoked), and the enrich (callback to obtain a DTO with additional information required by the consumer).
+====
+
+The (non-ASF) link:https://platform.incode.org[Incode Platform^]'s publishmq module provides an out-of-the-box solution of this design.
+It provides an implementation of the xref:refguide:applib-svc:PublisherService.adoc[`PublisherService`], but which simply publishes instances of xref:refguide:schema:ixn.adoc[`InteractionDto`] to an ActiveMQ queue.
+Camel (or similar) can then be hooked up to consume these events from this queue, and use a processor to parse the action memento to determine what has changed on the source system.
+Thereafter, a subsequent Camel processor can then call back to the source - via the xref:vro:ROOT:about.adoc[Restful Objects viewer] - to enrich the message with additional details using a DTO.
+
+
+
+
+
+[[non-jaxb]]
+== Non-JAXB View Models
+
+
+Instead of using JAXB to specify a view model, it is also possible to use Apache Isis-specific annotations.
+
+As was explained xref:userguide:fun:programming-model.adoc#view-models[earlier], the approach is described here is neither as flexible nor as powerful as using the JAXB-style of view models.
+It is however likely to be faster.
+
+WARNING: TODO: v2: I think we should only support programmatic API (ViewModel), and JAXB.
+//  So let's get rid of all these other natures that, under the covers, are all our original poor-man's JAXB (ie, EXTERNAL_ENTITY, INMEMORY_ENTITY, VIEW_MODEL, and @ViewModel itself).
+
+
+While the underlying technique is the same irrespective of use case, the programming model provides various ways of defining a view model so that the original intent is not lost.
+They are:
+
+.View model programming model
+[cols="1a,4a,2a", options="header"]
+|===
+
+| Use case
+| Code
+| Description
+
+
+| External entity
+|[source,java]
+----
+@DomainObject(nature=Nature.EXTERNAL_ENTITY)
+public class CustomerRecordOnSAP { /* ... */ }
+----
+|Annotated with xref:refguide:applib-ant:DomainObject.adoc#nature[`@DomainObject#nature`] and a nature of `EXTERNAL_ENTITY`, with memento derived automatically from the properties of the domain object.  Collections are ignored, as are any properties annotated as xref:refguide:applib-ant:Property.adoc#mementoSerialization[memento serialization].
+
+| In-memory entity
+|[source,java]
+----
+@DomainObject(nature=Nature.INMEMORY_ENTITY)
+public class Log4JAppender { /* ... */ }
+----
+|As preceding, but using a nature of `INMEMORY_ENTITY`.
+
+|Application view model
+|[source,java]
+----
+@DomainObject(nature=Nature.VIEW_MODEL)
+public class Dashboard { /* ... */ }
+----
+|As preceding, but using a nature of `VIEW_MODEL`.
+
+|Application view model
+|
+[source,java]
+----
+@ViewModel
+public class Dashboard { /* ... */ }
+----
+
+|Annotated with xref:refguide:applib-ant:ViewModel.adoc[`@ViewModel`] annotation (effectively just an alias)' memento is as preceding: from "persisted" properties, collections ignored
+
+|Application view model
+|
+[source,java]
+----
+public class ExcelUploadManager implements ViewModel {
+  public String viewModelMemento() { /* ... */ }
+  public void viewModelInit(String memento) { /* ... */ }
+}
+----
+|Implement xref:refguide:applib-cm:classes/super.adoc#ViewModel[`ViewModel`] interface.  The memento is as defined by the
+interface's methods: the programmer has full control (but also full responsibility) for the string memento.
+
+|===
+
+
+
+
+
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto.adoc
deleted file mode 100644
index c2731f1..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto.adoc
+++ /dev/null
@@ -1,63 +0,0 @@
-[[dto]]
-= DTOs
-
-: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 ag [...]
-:page-partial:
-
-
-JAXB view models can also be used as DTOs.
-The examples in this section uses the DTO for `ToDoItem`, taken from the http://github.com/apache/isis-app-todoapp[TodoApp].
-
-This DTO is defined as follows:
-
-[source,java]
-----
-package todoapp.app.viewmodels.todoitem.v1;                         // <1>
-@XmlRootElement(name = "toDoItemDto")                               // <2>
-@XmlType(
-        propOrder = {                                               // <3>
-            "majorVersion", "minorVersion",
-            "description", "category", ...
-            "toDoItem", "similarItems"
-        }
-)
-@DomainObjectLayout(
-        titleUiEvent = TitleUiEvent.Doop.class                      // <4>
-)
-public class ToDoItemV1_1 implements Dto {                          // <5>
-    @XmlElement(required = true, defaultValue = "1")                // <6>
-    public final String getMajorVersion() { return "1"; }
-    @XmlElement(required = true, defaultValue = "1")                // <7>
-    public String getMinorVersion() { return "1"; }
-
-    @XmlElement(required = true)                                    // <8>
-    @Getter @Setter
-    protected String description;
-    @XmlElement(required = true)
-    @Getter @Setter
-    protected String category;
-    ...
-
-    @Getter @Setter                                                 // <9>
-    protected ToDoItem toDoItem;
-    @XmlElementWrapper                                              // <10>
-    @XmlElement(name = "todoItem")
-    @Getter @Setter
-    protected List<ToDoItem> similarItems = Lists.newArrayList();
-}
-----
-<1> package name encodes major version; see discussion on xref:userguide:fun:programming-model.adoc#versioning[versioning]
-<2> identifies this class as a view model and defines the root element for JAXB serialization
-<3> all properties in the class must be listed; (they can be ignored using `@XmlTransient`)
-<4> demonstrating use of UI events for a subscriber to provide the DTO's title; see xref:refguide:applib-ant:DomainObjectLayout.adoc#titleUiEvent[`@DomainObjectLayout#titleUiEvent()`].
-<5> class name encodes (major and) minor version; see discussion on xref:userguide:fun:programming-model.adoc#versioning[versioning]
-<6> again, see discussion on xref:userguide:fun:programming-model.adoc#versioning[versioning]
-<7> again, see discussion on xref:userguide:fun:programming-model.adoc#versioning[versioning]
-<8> simple scalar properties
-<9> reference to a persistent entity; discussed xref:userguide:fun:programming-model.adoc#referencing-domain-entities[here]
-<10> reference to a collection of persistent entities; again discussed xref:userguide:fun:programming-model.adoc#referencing-domain-entities[here]
-
-
-
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/dto-consumers.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/dto-consumers.adoc
deleted file mode 100644
index 4759ca8..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/dto-consumers.adoc
+++ /dev/null
@@ -1,31 +0,0 @@
-= DTO Consumers
-
-: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 ag [...]
-:page-partial:
-
-
-
-The actual consumers of DTOs will generally obtain the XML of the view models either by requesting the XML directly, eg using the xref:vro:ROOT:about.adoc[RestfulObjects viewer], or may have the XML sent to them asynchronously using an ESB such as Apache Camel.
-
-In the former case, the consumer requests the DTO by calling the REST API with the appropriate HTTP `Accept` header.
-An appropriate implementation of xref:refguide:applib-svc:ContentMappingService.adoc[`ContentMappingService`] can then be used to return the appropriate DTO (as XML).
-
-For the latter case, one design is simply for the application to instantiate the view model, then call the xref:refguide:applib-svc:JaxbService.adoc[`JaxbService`] to obtain its corresponding XML.  This can then be published onto the ESB, for example using an http://activemq.apache.org[Apache ActiveMQ (TM)] queue.
-
-However, rather than try to push all the data that might be needed by any of these external systems in a single XML event (which would require anticipating all the requirements, likely a hopeless task), a better design is to publish only the fact that something of note has changed - ie, that an action on a domain object has been invoked - and then let the consumers call back to obtain other information if required.
-This can once again be done by calling the REST API with an appropriate HTTP `Accept` header.
-
-[TIP]
-====
-This is an example of the link:https://leanpub.com/camel-design-patterns[VETRO pattern] (validate, enrich, transform, route, operate).
-In our case we focus on the validation (to determine the nature of the inbound message, ie which action was invoked), and the enrich (callback to obtain a DTO with additional information required by the consumer).
-====
-
-The (non-ASF) link:https://platform.incode.org[Incode Platform^]'s publishmq module provides an out-of-the-box solution of this design.
-It provides an implementation of the xref:refguide:applib-svc:PublisherService.adoc[`PublisherService`], but which simply publishes instances of xref:refguide:schema:ixn.adoc[`InteractionDto`] to an ActiveMQ queue.
-Camel (or similar) can then be hooked up to consume these events from this queue, and use a processor to parse the action memento to determine what has changed on the source system.
-Thereafter, a subsequent Camel processor can then call back to the source - via the xref:vro:ROOT:about.adoc[Restful Objects viewer] - to enrich the message with additional details using a DTO.
-
-
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/generating-xsds.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/generating-xsds.adoc
deleted file mode 100644
index a78163e..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/generating-xsds.adoc
+++ /dev/null
@@ -1,170 +0,0 @@
-[[generating-xsds]]
-= Generating XSDs and DTOs
-
-: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 ag [...]
-:page-partial:
-
-
-
-
-In the section xref:userguide:fun:programming-model.adoc#referencing-domain-entities[above] it was explained how a view model DTO can transparently reference any "backing" entities; these references are converted to internal object identifiers.
-
-However, if the consumer of the XML is another Java process (eg running within an Apache Camel route), then you might be tempted/expect to be able to use the same DTO within that Java process.
-But of course you cannot; the consumer runs in a different process space, and will not have references to the entity types themselves.
-
-For integration scenarios you'll therefore generally want to define a DTO in a technology independent fashion, for example using XSD schema.
-This can be generated as a DTO for use within Apache Isis, while still allowing XML instances of the schema to be consumed by any other client.
-
-The http://github.com/apache/isis-app-todoapp[TodoApp] demonstrates how use an XSD to generate a DTO; it's mostly just boilerplate.
-In the todoapp it can be found in the `todoapp-xsd` Maven module, whose `pom.xml` is structured as two profiles:
-
-[source,xml]
-----
-<project ... >
-    <artifactId>todoapp-xsd</artifactId>
-    <dependencies>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>todoapp-app</artifactId>
-        </dependency>
-    </dependencies>
-    <profiles>
-        <profile>
-            <id>isis-xsd</id>
-            <activation>
-                <property>
-                    <name>!skip.isis-xsd</name>
-                </property>
-            </activation>
-            ...
-        </profile>
-        <profile>
-            <id>xjc</id>
-            <activation>
-                <property>
-                    <name>!skip.xjc</name>
-                </property>
-            </activation>
-            ...
-        </profile>
-    </profiles>
-</project>
-----
-
-The `isis-xsd` profile generates the XSD using the xref:refguide:mvn:xsd.adoc[`xsd` goal] of Isis' maven plugin:
-
-[source,xml]
-----
-<build>
-    <plugins>
-        <plugin>
-            <groupId>org.apache.isis.tool</groupId>
-            <artifactId>isis-maven-plugin</artifactId>
-            <version>${isis.version}</version>
-            <configuration>
-                <appManifest>todoapp.dom.TodoAppDomManifest</appManifest>
-                <jaxbClasses>
-                    <jaxbClass>todoapp.app.viewmodels.todoitem.v1.ToDoItemV1_1</jaxbClass>
-                </jaxbClasses>
-                <separate>false</separate>
-                <commonSchemas>false</commonSchemas>
-            </configuration>
-            <dependencies>
-                <dependency>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>todoapp-dom</artifactId>
-                    <version>${project.version}</version>
-                </dependency>
-                <dependency>
-                    <groupId>com.google.guava</groupId>
-                    <artifactId>guava</artifactId>
-                    <version>16.0.1</version>
-                </dependency>
-            </dependencies>
-            <executions>
-                <execution>
-                    <phase>generate-sources</phase>
-                    <goals>
-                        <goal>xsd</goal>
-                    </goals>
-                </execution>
-            </executions>
-        </plugin>
-        <plugin>
-            <artifactId>maven-assembly-plugin</artifactId>
-            <version>2.5.3</version>
-            <configuration>
-                <descriptor>src/assembly/dep.xml</descriptor>
-            </configuration>
-            <executions>
-                <execution>
-                    <id>create-archive</id>
-                    <phase>package</phase>
-                    <goals>
-                        <goal>single</goal>
-                    </goals>
-                </execution>
-            </executions>
-        </plugin>
-    </plugins>
-</build>
-----
-
-The `todoapp.dom.TodoAppDomManifest` is a cut-down version of the app manifest that identifies only the `dom` domain services.
-
-The `xjc` profile, meanwhile, uses the `maven-jaxb2-plugin` (a wrapper around the `schemagen` JDK tool) to generate a DTO from the XSD generated by the preceding profile:
-
-[source,xml]
-----
-<build>
-    <plugins>
-        <plugin>
-            <groupId>org.jvnet.jaxb2.maven2</groupId>
-            <artifactId>maven-jaxb2-plugin</artifactId>
-            <version>0.12.3</version>
-            <executions>
-                <execution>
-                    <id>xjc-generate</id>
-                    <phase>generate-sources</phase>
-                    <goals>
-                        <goal>generate</goal>
-                    </goals>
-                </execution>
-            </executions>
-            <configuration>
-                <removeOldOutput>true</removeOldOutput>
-                <schemaDirectory>
-                    target/generated-resources/isis-xsd/viewmodels.app.todoapp
-                </schemaDirectory>
-                <schemaIncludes>
-                    <schemaInclude>todoitem/v1/Dto.xsd</schemaInclude>
-                </schemaIncludes>
-                <bindingDirectory>src/main/resources</bindingDirectory>
-                <bindingIncludes>
-                    <bindingInclude>binding.xml</bindingInclude>
-                </bindingIncludes>
-                <catalog>src/main/resources/catalog.xml</catalog>
-            </configuration>
-        </plugin>
-        <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>build-helper-maven-plugin</artifactId>
-            <version>1.9.1</version>
-            <executions>
-                <execution>
-                    <id>add-source</id>
-                    <phase>generate-sources</phase>
-                    <goals>
-                        <goal>add-source</goal>
-                    </goals>
-                    <configuration>
-                    <sources>
-                        <source>target/generated-sources/xjc</source>
-                    </sources>
-                    </configuration>
-                </execution>
-            </executions>
-        </plugin>
-    </plugins>
-</build>
-----
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/versioning.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/versioning.adoc
deleted file mode 100644
index 826959b..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/dto/versioning.adoc
+++ /dev/null
@@ -1,105 +0,0 @@
-= Versioning
-
-: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 ag [...]
-:page-partial:
-
-
-The whole point of using DTOs (in Apache Isis, at least) is to define a formal contact between two inter-operating but independent applications.
-Since the only thing we can predicate about the future with any certainty is that it one or both of these applications will change, we should version DTOs from the get-go.
-This allows us to make changes going forward without unnecessarily breaking existing consumers of the data.
-
-[NOTE]
-====
-There are several ways that versioning might be accomplished; we base our guidelines on this link:http://www.xfront.com/Versioning.pdf[article] taken from Roger Costello's blog, well worth a read.
-====
-
-We can distinguish two types of changes:
-
-* backwardly compatible changes
-* breaking changes.
-
-We can immediately say that the XSD namespace should change only when there is a major/breaking change.
-If following link:http://semver.org[semantic versioning] that means when we bump the major version number v1, v2, etc.
-
-XML namespaces correspond (when using JAXB) to Java packages.
-We should therefore place our DTOs in a package that contains only the major number; this package will eventually contain a range of DTOs that are intended to be backwardly compatible with one another.
-The package should also have a `package-info.java`; it is this that declares the XSD namespace:
-
-[source,java]
-----
-@javax.xml.bind.annotation.XmlSchema(
-        namespace = "http://viewmodels.app.todoapp/todoitem/v1/Dto.xsd",        // <1>
-        xmlns = {
-                @javax.xml.bind.annotation.XmlNs(
-                        namespaceURI = "http://isis.apache.org/schema/common",
-                        prefix = "com"
-                )
-        },
-        elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED
-)
-package todoapp.app.viewmodels.todoitem.v1;                                     // <2>
-----
-<1> the namespace URI, used by the DTO residing in this package.
-<2> the package in which the DTO resides.  Note that this contains only the major version.
-
-Although there is no requirement for the namespace URI to correspond to a physical URL, it should be unique.
-This usually means including a company domain name within the string.
-
-As noted above, this package will contain multiple DTO classes all with the same namespace; these represent a set of minor versions of the DTO, each subsequent one intended to be backwardly compatible with the previous.
-Since these DTO classes will all be in the same package (as per the advice above), the class should therefore include the minor version name:
-
-[source,java]
-----
-package todoapp.app.viewmodels.todoitem.v1;     // <1>
-...
-public class ToDoItemV1_1 implements Dto {      // <2>
-    ...
-}
-----
-<1> package contains the major version only
-<2> DTO class contains the (major and) minor version
-
-
-We also recommend that each DTO instance should also specify the version of the XSD schema that it is logically compatible with.
-Probably most consumers will not persist the DTOs; they will be processed and then discarded.
-However, it would be wrong to assume that is the case in all cases; some consumers might choose to persist the DTO (eg for replay at some later state).
-
-Thus:
-
-[source,java]
-----
-public class ToDoItemV1_1 implements Dto {
-    @XmlElement(required = true, defaultValue = "1")
-    public final String getMajorVersion() { return "1"; }   // <1>
-    @XmlElement(required = true, defaultValue = "1")
-    public String getMinorVersion() { return "1"; }         // <2>
-    ...
-}
-----
-<1> returns the major version (in sync with the package)
-<2> returns the minor version (in sync with the class name)
-
-These methods always return a hard-coded literal.
-Any instances serialized from these classes will implicitly "declare" the (major and) minor version of the schema with which they are compatible.
-If a consumer has a minimum version that it requires, it can therefore inspect the XML instance itself to determine if it is able to consume said XML.
-
-If a new (minor) version of a DTO is required, then we recommend copying-and-pasting the previous version, eg:
-
-[source,java]
-----
-public class ToDoItemV1_2 implements Dto {
-    @XmlElement(required = true, defaultValue = "1")
-    public final String getMajorVersion() { return "1"; }
-    @XmlElement(required = true, defaultValue = "2")
-    public String getMinorVersion() { return "2"; }
-    ...
-}
-----
-
-Obviously, only changes made must be backward compatible, eg new members must be optional.
-
-Alternatively, you might also consider simply editing the source file, ie renaming the class and bumping up the value returned by `getMinorVersion()`.
-
-We also _don't_ recommend using inheritance (ie `ToDoItemV1_2` should not inherit from `ToDoItemV1_1`; this creates unnecessary complexity downstream if generating XSDs and DTOs for the downstream consumer.
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb.adoc
deleted file mode 100644
index 2739114..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb.adoc
+++ /dev/null
@@ -1,68 +0,0 @@
-[[jaxb]]
-= JAXB View Models
-
-: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 ag [...]
-:page-partial:
-
-
-Here's a typical example of a JAXB view model, to allow (certain properties of) two ``Customer``s to be compared:
-
-[source,java]
-----
-@XmlRootElement(name = "compareCustomers")          // <1>
-@XmlType(
-        propOrder = {                               // <2>
-            "customer1",
-            "customer2"
-        }
-)
-@XmlAccessorType(XmlAccessType.FIELD)               // <3>
-public class CompareCustomers {
-
-    @XmlElement(required = true)                    // <4>
-    @Getter @Setter
-    Customer customer1;
-
-    @XmlElement(required = true)                    // <4>
-    @Getter @Setter
-    Customer customer2;
-
-    @XmlTransient                                   // <5>
-    public String getCustomer1Name() {
-        return getCustomer1().getName();
-    }
-
-    @XmlTransient                                   // <5>
-    public String getCustomer2Name() {
-        return getCustomer2().getName();
-    }
-
-    ...
-}
-----
-<1> The JAXB `@XmlRootElement` annotation indicates this is a view model to Apache Isis, which then uses JAXB to serialize the state of the view model between interactions
-
-<2> Optionally, the properties of the view model can be listed using the `XmlType#propOrder` attribute.
-+
-This is an all-or-nothing affair: either all properties must be listed, or else the annotation omitted.
-
-<3> Specifying field accessor type allows the Lombok `@Getter` and `@Setter` annotations to be used.
-<4> The `@XmlElement` indicates the property is part of the view model's state.
-For collections, the `@XmlElementWrapper` would also typically be used.
-<5> The `@XmlTransient` indicates that the property is derived and should be ignored by JAXB.
-+
-The derived properties could also have been implemented using xref:userguide:fun:building-blocks.adoc#mixins[mixins].
-
-
-[IMPORTANT]
-====
-Be aware that all the state will become the DTO's memento, ultimately converted into a URL-safe form, by way of the xref:refguide:applib-svc:UrlEncodingService.adoc[`UrlEncodingService`].
-
-There are limits to the lengths of URLs, however.
-If the URL does exceed limits or contains invalid characters, then provide a custom implementation of xref:refguide:applib-svc:UrlEncodingService.adoc[`UrlEncodingService`] to handle the memento string in some other fashion (eg substituting it with a GUID, with the memento cached somehow on the server).
-a URL.
-====
-
-
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb/joda-datatypes.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb/joda-datatypes.adoc
deleted file mode 100644
index a81132d..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb/joda-datatypes.adoc
+++ /dev/null
@@ -1,73 +0,0 @@
-[[joda-datatypes]]
-= JODA Time Datatypes
-
-: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 ag [...]
-:page-partial:
-
-
-If your JAXB view model contains fields using the JODA datatypes (`LocalDate` and so on), then `@XmlJavaTypeAdapter` additional annotations in order to "teach" JAXB how to serialize out the state.
-
-The Apache Isis applib provides a number of adapters to use out-of-the-box.
-For example:
-
-
-[source,java]
-----
-@XmlRootElement(name = "categorizeIncomingInvoice")
-@XmlType(
-        propOrder = {
-                ...
-                "dateReceived",
-                ...
-        }
-)
-@XmlAccessorType(XmlAccessType.FIELD)
-public class IncomingInvoiceViewModel extends IncomingOrderAndInvoiceViewModel {
-
-    @XmlJavaTypeAdapter(JodaLocalDateStringAdapter.ForJaxb.class)
-    private LocalDate dateReceived;
-
-    ...
-}
-----
-
-The full list of adapter classes are:
-
-
-
-.JAXB adapters
-[cols="1a,2a", options="header"]
-|===
-
-| JODA datatype
-| Adapter
-
-.2+| `org.joda.time.DateTime`
-| `JodaDateTimeStringAdapter.ForJaxb`
-| `JodaDateTimeXMLGregorianCalendarAdapter.ForJaxb`
-
-.2+| `org.joda.time.LocalDate`
-| `JodaLocalDateStringAdapter.ForJaxb`
-| `JodaLocalDateXMLGregorianCalendarAdapter.ForJaxb`
-
-.2+| `org.joda.time.LocalDateTime`
-| `JodaLocalDateTimeStringAdapter.ForJaxb`
-| `JodaLocalDateTimeXMLGregorianCalendarAdapter.ForJaxb`
-
-
-.2+| `org.joda.time.LocalTime`
-| `JodaLocalTimeStringAdapter.ForJaxb`
-| `JodaLocalTimeXMLGregorianCalendarAdapter.ForJaxb`
-
-| `java.sql.Timestamp`
-| `JavaSqlTimestampXmlGregorianCalendarAdapter.ForJaxb`
-
-
-|===
-
-
-[TIP]
-====
-If you want to roll-your-own, take a look at link:http://blog.bdoughan.com/2011/05/jaxb-and-joda-time-dates-and-times.html[this blog post].
-====
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb/referencing-domain-entities.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb/referencing-domain-entities.adoc
deleted file mode 100644
index e8c83ac..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/jaxb/referencing-domain-entities.adoc
+++ /dev/null
@@ -1,63 +0,0 @@
-= Referencing Domain Entities
-
-: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 ag [...]
-:page-partial:
-
-
-It's quite common for view models to be "backed by" (be projections of) some underlying domain entity.
-For example, the `CompareCustomers` view model described xref:userguide:fun:programming-model.adoc#jaxb[above] actually references two underlying ``Customer`` entities.
-
-It wouldn't make sense to serialize out the state of a persistent entity.
-However, the identity of the underlying entity is well defined; Apache Isis defines the xref:refguide:schema:common.adoc[common schema] which defines the `<oid-dto>` element (and corresponding `OidDto` class): the object's type and its identifier.
-This is basically a formal XML equivalent to the `Bookmark` object obtained from the xref:refguide:applib-svc:BookmarkService.adoc[`BookmarkService`].
-
-There is only one requirement to make this work: every referenced domain entity must be annotated with xref:refguide:applib-ant:XmlJavaTypeAdapter.adoc[`@XmlJavaTypeAdapter`], specifying the framework-provided `PersistentEntityAdapter`.
-And this class is similar to the xref:refguide:applib-svc:BookmarkService.adoc[`BookmarkService`]: it knows how to create an `OidDto` from an object reference.
-
-Thus, in our view model we can legitimately write:
-
-[source,java]
-----
-public class CompareCustomers {
-
-    @XmlElement(required = true)
-    @Getter @Setter
-    Customer customer1;
-    ...
-}
-----
-
-All we need to do is remember to add that `@XmlJavaTypeAdapter` annotation to the referenced entity:
-
-[source,java]
-----
-@XmlJavaTypeAdapter(PersistentEntityAdapter.class)
-public class Customer ...  {
-    ...
-}
-----
-
-
-It's also possible for a DTO view models to hold collections of objects.
-These can be of any type, either simple properties, or references to other objects.
-The only bit of boilerplate that is required is the `@XmlElementWrapper` annotation.
-This instructs JAXB to create an XML element (based on the field name) to contain each of the elements.
-(If this is omitted then the contents of the collection are at the same level as the properties; almost certainly not what is required).
-
-For example, we could perhaps generalize the view model to hold a set of ``Customer``s to be compared:
-
-[source,java]
-----
-public class CompareCustomers {
-    ...
-    @XmlElementWrapper
-    @XmlElement(name = "customers")
-    @Getter @Setter
-    protected List<Customer> customersToCompare = Lists.newArrayList();
-}
-----
-
-This capability is particularly useful when the JAXB view model is being used as a xref:userguide:fun:programming-model.adoc#dto[DTO].
-
-
-
diff --git a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/non-jaxb.adoc b/api/adoc/userguide/modules/fun/pages/programming-model/view-models/non-jaxb.adoc
deleted file mode 100644
index 4133484..0000000
--- a/api/adoc/userguide/modules/fun/pages/programming-model/view-models/non-jaxb.adoc
+++ /dev/null
@@ -1,80 +0,0 @@
-[[non-jaxb]]
-= Non-JAXB View Models
-
-: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 ag [...]
-:page-partial:
-
-
-Instead of using JAXB to specify a view model, it is also possible to use Apache Isis-specific annotations.
-
-As was explained xref:userguide:fun:programming-model.adoc#view-models[earlier], the approach is described here is neither as flexible nor as powerful as using the JAXB-style of view models.
-It is however likely to be faster.
-
-WARNING: TODO: v2: I think we should only support programmatic API (ViewModel), and JAXB.
-//  So let's get rid of all these other natures that, under the covers, are all our original poor-man's JAXB (ie, EXTERNAL_ENTITY, INMEMORY_ENTITY, VIEW_MODEL, and @ViewModel itself).
-
-
-While the underlying technique is the same irrespective of use case, the programming model provides various ways of defining a view model so that the original intent is not lost.
-They are:
-
-.View model programming model
-[cols="1a,4a,2a", options="header"]
-|===
-
-| Use case
-| Code
-| Description
-
-
-| External entity
-|[source,java]
-----
-@DomainObject(nature=Nature.EXTERNAL_ENTITY)
-public class CustomerRecordOnSAP { /* ... */ }
-----
-|Annotated with xref:refguide:applib-ant:DomainObject.adoc#nature[`@DomainObject#nature`] and a nature of `EXTERNAL_ENTITY`, with memento derived automatically from the properties of the domain object.  Collections are ignored, as are any properties annotated as xref:refguide:applib-ant:Property.adoc#mementoSerialization[memento serialization].
-
-| In-memory entity
-|[source,java]
-----
-@DomainObject(nature=Nature.INMEMORY_ENTITY)
-public class Log4JAppender { /* ... */ }
-----
-|As preceding, but using a nature of `INMEMORY_ENTITY`.
-
-|Application view model
-|[source,java]
-----
-@DomainObject(nature=Nature.VIEW_MODEL)
-public class Dashboard { /* ... */ }
-----
-|As preceding, but using a nature of `VIEW_MODEL`.
-
-|Application view model
-|
-[source,java]
-----
-@ViewModel
-public class Dashboard { /* ... */ }
-----
-
-|Annotated with xref:refguide:applib-ant:ViewModel.adoc[`@ViewModel`] annotation (effectively just an alias)' memento is as preceding: from "persisted" properties, collections ignored
-
-|Application view model
-|
-[source,java]
-----
-public class ExcelUploadManager implements ViewModel {
-  public String viewModelMemento() { /* ... */ }
-  public void viewModelInit(String memento) { /* ... */ }
-}
-----
-|Implement xref:refguide:applib-cm:classes/super.adoc#ViewModel[`ViewModel`] interface.  The memento is as defined by the
-interface's methods: the programmer has full control (but also full responsibility) for the string memento.
-
-|===
-
-
-
-
-