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 2017/01/21 17:15:58 UTC

isis git commit: ISIS-785: updates to the "fundamentals" guide, as prereq to being able to document new functionality.

Repository: isis
Updated Branches:
  refs/heads/master bf9b97a46 -> 390348905


ISIS-785: updates to the "fundamentals" guide, as prereq to being able to document new functionality.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/39034890
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/39034890
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/39034890

Branch: refs/heads/master
Commit: 39034890510aea83428567f1a99bc8e5addcaea6
Parents: bf9b97a
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sat Jan 21 17:14:17 2017 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Sat Jan 21 17:14:17 2017 +0000

----------------------------------------------------------------------
 .../main/asciidoc/guides/_ugbtb_decoupling.adoc |  10 +-
 .../guides/_ugbtb_view-models_jaxb.adoc         | 121 +++++-----
 ...fun_getting-started_simpleapp-archetype.adoc |   6 +-
 .../guides/_ugfun_how-tos_class-structure.adoc  |  14 +-
 ...ow-tos_class-structure_class-definition.adoc | 192 +++++++++++++++-
 ...fun_how-tos_class-structure_collections.adoc |  85 ++++++-
 ...ow-tos_class-structure_ignoring-methods.adoc |  16 --
 ...gfun_how-tos_class-structure_properties.adoc | 226 ++++++++++++-------
 .../simple/dom/impl/SimpleObjectMenu.java       |   3 +-
 9 files changed, 473 insertions(+), 200 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/adocs/documentation/src/main/asciidoc/guides/_ugbtb_decoupling.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugbtb_decoupling.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugbtb_decoupling.adoc
index 3cfb2b1..099a913 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugbtb_decoupling.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugbtb_decoupling.adoc
@@ -5,16 +5,18 @@
 :_imagesdir: images/
 
 
-We use Java packages as a way to group related domain objects together; the package name forms a namespace. We can then
-reason about all the classes in that package/namespace as a single unit, or module.
+We use Maven modules as a way to group related domain objects together; we can then reason about all the classes in that module as a single unit.
+By convention there will be a single top-level package corresponding to the module.
 
-This section describes how to use Apache Isis' features to ensure that your domain application remains decoupled.  The techniques described here are also the ones that have been adopted by the various http://github.com/isisaddons[Isis Addons] modules (not ASF) for security, commands, auditing etc.
+
+This section describes how to use Apache Isis' features to ensure that your domain application remains decoupled.
+The techniques described here are also the ones that have been adopted by the various http://github.com/isisaddons[Isis Addons] modules (not ASF) for security, commands, auditing etc.
 
 The following sections describe how to re-assemble an application, in particular where some modules are in-house but others are potentially third-party (eg the Isis Addons modules).
 
 [NOTE]
 ====
-There is some overlap with OSGi and Java 9's Jigsaw concepts of "module"; in the future we expect to refactor Apache Isis to leverage these module systems.
+There is some overlap with Java 9's Jigsaw concepts of "module"; in the future we expect to refactor Apache Isis to build on top of this module system.
 ====
 
 include::_ugbtb_decoupling_db-schemas.adoc[leveloffset=+1]

http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/adocs/documentation/src/main/asciidoc/guides/_ugbtb_view-models_jaxb.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugbtb_view-models_jaxb.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugbtb_view-models_jaxb.adoc
index 23889c9..5527e4f 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugbtb_view-models_jaxb.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugbtb_view-models_jaxb.adoc
@@ -6,24 +6,22 @@
 
 
 
-As noted in the xref:ugbtb.adoc#_ugbtb_view-models_use-cases[introduction], view models can also be defined using
-JAXB annotations.  The serialized form of these view models is therefore XML, which also enables these view models
+As noted in the xref:ugbtb.adoc#_ugbtb_view-models_use-cases[introduction], view models can also be defined using JAXB annotations.
+The serialized form of these view models is therefore XML, which also enables these view models
 to act as DTOs.
 
-In case it's not obvious, these DTOs are still usable as "regular" view models; they will render in the
-xref:ugvw.adoc#[Wicket viewer] just like any other.  In fact, these JAXB-annotated view models are in many regards the
-most powerful of all the various ways of writing view models:
+In case it's not obvious, these DTOs are still usable as "regular" view models; they will render in the xref:ugvw.adoc#[Wicket viewer] just like any other.
+In fact, these JAXB-annotated view models are in many regards the most powerful of all the various ways of writing view models:
 
 * their entire state (collections as well as properties) is automatically managed from interaction to interaction. +
 +
-In contrast, using xref:rgant.adoc#_rgant-ViewModel[`@ViewModel`] (or its
-xref:rgant.adoc#_rgant-DomainObject_nature[`@DomainObject#nature()`] equivalent) will only manage the state of
-properties, but not collections.  And if using the xref:rgcms.adoc#_rgcms_classes_super_ViewModel[`ViewModel`]
-interface, then the programmer must write all the state management (lots of boilerplate).
+In contrast, using xref:rgant.adoc#_rgant-ViewModel[`@ViewModel`] (or its xref:rgant.adoc#_rgant-DomainObject_nature[`@DomainObject#nature()`] equivalent) will only manage the state of properties, but not collections.
+And if using the xref:rgcms.adoc#_rgcms_classes_super_ViewModel[`ViewModel`] interface, then the programmer must write all the state management (lots of boilerplate).
 
 * JAXB-annotated view models are editable.
 
-The examples in this section uses the DTO for `ToDoItem`, taken from the (non-ASF) http://github.com/isisaddons/isis-app-todoapp[Isis addons' todoapp].  This DTO is defined as follows:
+The examples in this section uses the DTO for `ToDoItem`, taken from the (non-ASF) http://github.com/isisaddons/isis-app-todoapp[Isis addons' todoapp].
+This DTO is defined as follows:
 
 [source,java]
 ----
@@ -77,20 +75,15 @@ public class ToDoItemV1_1 implements Dto {                          // <5>
 [[_ugbtb_view-models_jaxb_referencing-domain-entities]]
 == Referencing Domain Entities
 
-It's quite common for view models to be "backed by" (be projections of) some underlying domain entity.  The
-`ToDoItemDto` we've been using as the example in this section is an example: there is an underlying `ToDoItem` entity.
+It's quite common for view models to be "backed by" (be projections of) some underlying domain entity.
+The `ToDoItemDto` we've been using as the example in this section is an example: there is an underlying `ToDoItem` entity.
 
-It wouldn't make sense to serialize out the state of a persistent entity: the point of a DTO is to act as a facade
-on top of the entity so that the implementation details (of the entity's structure) don't leak out to the consumer.
-However, the identity of the underlying entity can be well defined; Apache Isis defines the
-xref:rgcms.adoc#_rgcms_schema-common[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:rgsvc.adoc#_rgsvc_api_BookmarkService[`BookmarkService`].
+It wouldn't make sense to serialize out the state of a persistent entity: the point of a DTO is to act as a facade on top of the entity so that the implementation details (of the entity's structure) don't leak out to the consumer.
+However, the identity of the underlying entity can be well defined; Apache Isis defines the xref:rgcms.adoc#_rgcms_schema-common[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:rgsvc.adoc#_rgsvc_api_BookmarkService[`BookmarkService`].
 
-There is only one requirement to make this work: every referenced domain entity must be annotated with
-xref:rgant.adoc#_rgant-XmlJavaTypeAdapter[`@XmlJavaTypeAdapter`], specifying the framework-provided
-`PersistentEntityAdapter.class`.  This class is similar to the `BookmarkService`: it knows how to create an `OidDto`
-from an object reference.
+There is only one requirement to make this work: every referenced domain entity must be annotated with xref:rgant.adoc#_rgant-XmlJavaTypeAdapter[`@XmlJavaTypeAdapter`], specifying the framework-provided `PersistentEntityAdapter.class`.
+This class is similar to the `BookmarkService`: it knows how to create an `OidDto` from an object reference.
 
 Thus, in our view model we can legitimately write:
 
@@ -116,8 +109,11 @@ public class ToDoItem ...  {
 ----
 
 
-It's also possible for a DTO 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).
+It's also possible for a DTO 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, the DTO also contains:
 
@@ -135,13 +131,12 @@ public class ToDoItemV1_1 implements Dto {
 ----
 
 
-There's nothing to prevent a JAXB DTO from containing rich graphs of data, parent containing children containing
-children.  Be aware though that all of this state will become the DTO's memento, ultimately converted into a URL-safe
-form, by way of the xref:rgsvc.adoc#_rgsvc_spi_UrlEncodingService[`UrlEncodingService`].
+There's nothing to prevent a JAXB DTO from containing rich graphs of data, parent containing children containing children.
+Be aware though that all of this state will become the DTO's memento, ultimately converted into a URL-safe form, by way of the xref:rgsvc.adoc#_rgsvc_spi_UrlEncodingService[`UrlEncodingService`].
 
-There are limits to the lengths of URLs, however.  Therefore the DTO should not include state that can easily be
-derived from other information.  If the URL does exceed limits, then provide a custom implementation of xref:rgsvc.adoc#_rgsvc_spi_UrlEncodingService[`UrlEncodingService`] to handle the memento string in some other fashion (eg substituting it with a GUID, with the memento cached somehow
-on the server).
+There are limits to the lengths of URLs, however.
+Therefore the DTO should not include state that can easily be derived from other information.
+If the URL does exceed limits, then provide a custom implementation of xref:rgsvc.adoc#_rgsvc_spi_UrlEncodingService[`UrlEncodingService`] to handle the memento string in some other fashion (eg substituting it with a GUID, with the memento cached somehow on the server).
 
 
 
@@ -150,9 +145,9 @@ on the server).
 [[_ugbtb_view-models_jaxb_versioning]]
 == 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.
+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]
 ====
@@ -166,9 +161,9 @@ We can distinguish two types of 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:
+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]
 ----
@@ -187,13 +182,11 @@ package todoapp.app.viewmodels.todoitem.v1;
 <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 xref:ugbtb.adoc#_ugbtb_view-models_jaxb_using-packages-to-version[advice above]), the class should therefore include the minor version name:
+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 xref:ugbtb.adoc#_ugbtb_view-models_jaxb_using-packages-to-version[advice above]), the class should therefore include the minor version name:
 
 [source,java]
 ----
@@ -207,10 +200,9 @@ public class ToDoItemV1_1 implements Dto {      // <2>
 <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).
+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:
 
@@ -227,9 +219,9 @@ public class ToDoItemV1_1 implements Dto {
 <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 that they are compatible with.   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.
+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:
 
@@ -246,8 +238,7 @@ public class ToDoItemV1_2 implements Dto {
 
 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()`.
+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.
 
@@ -255,27 +246,22 @@ We also _don't_ recommend using inheritance (ie `ToDoItemV1_2` should not inheri
 [[_ugbtb_view-models_jaxb_generating-xsds-and-dtos]]
 == Generating XSDs and DTOs
 
-In the section xref:ugbtb.adoc#_ugbtb_view-models_jaxb_referencing-domain-entities[above] it was explained how a
-view model DTO can transparent reference any "backing" entities; these references are converted to internal object
-identifiers.
+In the section xref:ugbtb.adoc#_ugbtb_view-models_jaxb_referencing-domain-entities[above] it was explained how a view model DTO can transparent 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.  After a little thought though you'll realize
- that (duh!) of course you cannot; the consumer runs in a different process space, and will not have references to
- those containing entities.
+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.
+After a little thought though you'll realize that (duh!) of course you cannot; the consumer runs in a different process space, and will not have references to those containing entities.
 
 There are therefore two options:
 
-* either choose not to have the view model DTO reference any persistent entities, and simply limit the DTO to simple
-scalars. +
+* either choose not to have the view model DTO reference any persistent entities, and simply limit the DTO to simple scalars. +
 +
-Such a DTO will then be usable in both the Apache Isis app (to generate the original XML) and in the consumer.  The
-xref:rgsvc.adoc#_rgsvc_api_BookmarkService[`BookmarkService`] can be used to obtain the object identifiers
+Such a DTO will then be usable in both the Apache Isis app (to generate the original XML) and in the consumer.
+The xref:rgsvc.adoc#_rgsvc_api_BookmarkService[`BookmarkService`] can be used to obtain the object identifiers
 
 * alternatively, generate a different DTO for the consumer from the XSD of the view model DTO.
 
-The (non-ASF) http://github.com/isisaddons/isis-app-todoapp[Isis addons' todoapp] uses the second approach; generating
-the XSD and consumer's DTO is mostly just boilerplate `pom.xml` file.  In the todoapp this can be found in the `todoapp-xsd` Maven module, whose `pom.xml` is structured as two profiles:
+The (non-ASF) http://github.com/isisaddons/isis-app-todoapp[Isis addons' todoapp] uses the second approach; generating the XSD and consumer's DTO is mostly just boilerplate `pom.xml` file.
+In the todoapp this can be found in the `todoapp-xsd` Maven module, whose `pom.xml` is structured as two profiles:
 
 [source,xml]
 ----
@@ -369,11 +355,9 @@ The `isis-xsd` profile generates the XSD using the xref:rgmvn.adoc#_rgmvn_xsd[`x
 </build>
 ----
 
-The `todoapp.dom.ToDoAppDomManifest` is a cut-down version of the app manifest that identifies only the `dom` domain
-services.
+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:
+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]
 ----
@@ -429,4 +413,3 @@ DTO from the XSD generated by the preceding profile:
     </plugins>
 </build>
 ----
-

http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/adocs/documentation/src/main/asciidoc/guides/_ugfun_getting-started_simpleapp-archetype.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugfun_getting-started_simpleapp-archetype.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugfun_getting-started_simpleapp-archetype.adoc
index acf796c..df5237c 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugfun_getting-started_simpleapp-archetype.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugfun_getting-started_simpleapp-archetype.adoc
@@ -100,8 +100,7 @@ First, you could run the WAR in a Maven-hosted Jetty instance, though you need t
 
 [source,bash]
 ----
-cd webapp
-mvn jetty:run
+mvn -pl webapp jetty:run
 ----
 
 
@@ -109,8 +108,7 @@ You can also provide a system property to change the port:
 
 [source,bash]
 ----
-cd webapp
-mvn jetty:run -D jetty.port=9090
+mvn -pl webapp jetty:run -D jetty.port=9090
 ----
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure.adoc
index df242af..377f5f5 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure.adoc
@@ -5,11 +5,15 @@
 :_imagesdir: images/
 
 
-Apache Isis works by building a metamodel of the domain objects: entities, xref:ugbtb.adoc#_ugbtb_view-models[view model]s and services.  The class members of both entities and view models represent both state -- (single-valued) properties and (multi-valued) collections -- and behaviour -- actions.  The class members of domain services is simpler: just behaviour, ie actions.
+Apache Isis works by building a metamodel of the domain objects: entities, xref:ugbtb.adoc#_ugbtb_view-models[view model]s and services.
+The class methods of both entities and view models represent both state -- (single-valued) properties and (multi-valued) collections -- and behaviour -- actions.  The class members of domain services is simpler: just behaviour, ie actions.
 
-In the automatically generated UI a property is rendered as a field.  This can be either of a value type (a string, number, date, boolean etc) or can be a reference to another entity.  A collection is generally rendered as a table.
+In the automatically generated UI a property is rendered as a field.
+This can be either of a value type (a string, number, date, boolean etc) or can be a reference to another entity.
+A collection is generally rendered as a table.
 
-In order for Apache Isis to build its metamodel the domain objects must follow some conventions: what we call the _Apache Isis Programming Model_.  This is just an extension of the pojo / JavaBean standard of yesteryear: properties and collections are getters/setters, while actions are simply any remaining `public` methods.
+In order for Apache Isis to build its metamodel the domain objects must follow some conventions: what we call the _Apache Isis Programming Model_.
+This is just an extension of the pojo / JavaBean standard of yesteryear: properties and collections are getters/setters, while actions are simply any remaining `public` methods.
 
 Additional metamodel semantics are inferred both imperatively from _supporting methods_ and declaratively from annotations.
 
@@ -17,7 +21,8 @@ In this section we discuss the mechanics of writing domain objects that comply w
 
 [TIP]
 ====
-In fact, the Apache Isis programming model is extensible; you can teach Apache Isis new programming conventions and you can remove existing ones; ultimately they amount to syntax.   The only real fundamental that can't be changed is the notion that objects consist of properties, collections and actions.
+In fact, the Apache Isis programming model is extensible; you can teach Apache Isis new programming conventions and you can remove existing ones; ultimately they amount to syntax.
+The only real fundamental that can't be changed is the notion that objects consist of properties, collections and actions.
 
 You can learn more about extending Apache Isis programming model xref:ugbtb.adoc#_ugbtb_programming-model[here].
 ====
@@ -32,7 +37,6 @@ include::_ugfun_how-tos_class-structure_inject-services.adoc[leveloffset=+1]
 
 include::_ugfun_how-tos_class-structure_properties-vs-parameters.adoc[leveloffset=+1]
 
-include::_ugfun_how-tos_class-structure_ignoring-methods.adoc[leveloffset=+1]
 
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_class-definition.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_class-definition.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_class-definition.adoc
index 678508d..9f21131 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_class-definition.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_class-definition.adoc
@@ -6,19 +6,195 @@
 
 
 
-NOTE: TODO
+Apache Isis supports recognises three main types of domain classes:
 
+* domain entities - domain objects persisted to the database using JDO/DataNucleus; for example `Customer`
 
-Classes are defined both to Isis and (if an entity) also to JDO/DataNucleus.
+* domain services - generally singletons, automatically injected, and providing various functionality; for example `CustomerRepository`
 
+* view models - domain objects that are a projection of some state held by the database, in support a particular use case; for example `CustomerDashboard` (to pull together commonly accessed information about a customer).
 
-We use Java packages as a way to group related domain objects together; the package name forms a namespace. We can then reason about all the classes in that package/namespace as a single unit.
+Domain classes are generally recognized using annotations.
+Apache Isis defines its own set of annotations, while entities are annotated using JDO/DataNucleus (though XML can also be used if required).
+JAXB can also be used for view models.
+Apache Isis recognizes some of the JDO and JAXB annotations and infers domain semantics from these annotations.
 
-In the same way that Java packages act as a namespace for domain objects, it's good practice to map domain entities to their own (database) schemas.
+You can generally recognize an Apache Isis domain class because it will be probably be annotated using `@DomainObject` and `@DomainService`.
+The framework also defines supplementary annotations, `@DomainObjectLayout` and `@DomainServiceLayout`.
+These provide hints relating to the layout of the domain object in the user interface.
+(Alternatively, these UI hints can be defined in a supplementary xref:ugfun.adoc#_ugfun_object-layout[`.layout.xml`] file.
 
-[TIP]
-====
-For more on this topic, see the topic discussing modules and xref:ugbtb.adoc#_ugbtb_decoupling[decoupling].
-====
+We use Maven modules as a way to group related domain objects together; we can then reason about all the classes in that module as a single unit.
+By convention there will be a single top-level package corresponding to the module.
 
+For example, the (non-ASF) link:https://github.com/incodehq/incode-module-document[Document module] (part of the link:http://catalog.incode.org[Incode Catalog]) has a top-level package of `org.incode.module.document`.
+Within the module there may be various subpackages, but its the module defines the namespace.
 
+In the same way that the Java module act as a namespace for domain objects, it's good practice to map domain entities to their own (database) schemas.
+
+
+[[_ugfun_how-tos_class-structure_class-definition_entities]]
+== Entities
+
+Entities are persistent domain objects.
+Their persistence is handled by JDO/DataNucleus, which means that it will generally be decorated with both DataNucleus and Apache Isis annotations.
+The following is typical:
+
+[source,java]
+----
+@javax.jdo.annotations.PersistenceCapable(                                      // <1>
+        identityType=IdentityType.DATASTORE,                                    // <2>
+        schema = "simple",                                                      // <3>
+        table = "SimpleObject"
+)
+@javax.jdo.annotations.DatastoreIdentity(                                       // <4>
+        strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY,
+        column="id"
+)
+@javax.jdo.annotations.Version(                                                 // <5>
+        strategy= VersionStrategy.DATE_TIME,
+        column="version"
+)
+@javax.jdo.annotations.Queries({
+        @javax.jdo.annotations.Query(                                           // <6>
+                name = "findByName",
+                value = "SELECT "
+                        + "FROM domainapp.modules.simple.dom.impl.SimpleObject "
+                        + "WHERE name.indexOf(:name) >= 0 ")
+})
+@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ", members = {"name"}) // <7>
+@DomainObject(                                                                  // <8>
+        objectType = "simple.SimpleObject"
+)
+public class SimpleObject
+             implements Comparable<SimpleObject> {                              // <9>
+
+    public SimpleObject(final String name) {                                    // <10>
+        setName(name);
+    }
+
+    ...
+
+    @Override
+    public String toString() {
+        return ObjectContracts.toString(this, "name");                          // <11>
+    }
+    @Override
+    public int compareTo(final SimpleObject other) {
+        return ObjectContracts.compare(this, other, "name");                    // <9>
+    }
+}
+----
+<1> The `@PersistenceCapable` annotation indicates that this is an entity to DataNucleus.
+The DataNucleus enhancer acts on the bytecode of compiled entities, injecting lazy loading and dirty object tracking functionality.
+Enhanced entities end up also implementing the `javax.jdo.spi.PersistenceCapable` interface.
+<2> Indicates how identifiers for the entity are handled.
+Using `DATASTORE` means that a DataNucleus is responsible for assigning the value (rather than the application).
+<3> Specifies the RDBMS database schema and table name for this entity will reside.
+The schema should correspond with the module in which the entity resides.
+The table will default to the entity name if omitted.
+<4> For entities that are using `DATASTORE` identity, indicates how the id will be assigned.
+A common strategy is to allow the database to assign the id, for example using an identity column or a sequence.
+<5> The `@Version` annotation is useful for optimistic locking; the strategy indicates what to store in the `version` column.
+<6> The `@Query` annotation (usually several of them, nested within a `@Queries` annotation) defines queries using JDOQL.
+DataNucleus provides several APIs for defining queries, including entirely programmatic and type-safe APIs; but JDOQL is very similar to SQL and so easily learnt.
+<7> DataNucleus will automatically add a unique index to the primary surrogate id (discussed above), but additional alternative keys can be defined using the `@Unique` annotation.
+In the example above, the "name" property is assumed to be unique.
+<8> The `@DomainObject` annotation identifies the domain object to Apache Isis (not DataNucleus).
+It isn't necessary to include this annotation -- at least, not for entities -- but it is nevertheless recommended.
+In particular, its strongly recommended that the `objectType` (which acts like an alias to the concrete domain class) is specified; note that it corresponds to the schema/table for DataNucleus' `@PersistenceCapable` annotation.
+<9> Although not required, we strongly recommend that all entities are naturally `Comparable`.
+This then allows parent/child relationships to be defined using ``SortedSet``s; RDBMS after all are set-oriented.
+The `ObjectContracts` utility class provided by Apache Isis makes it easy to implement the `compareTo()` method, but you can also just use an IDE to generate an implementation or roll your own.
+<10> Chances are that some of the properties of the entity will be mandatory, for example any properties that represent an alternate unique key to the entity.
+In regular Java programming we would represent this using a constructor that defines these mandatory properties, and in Apache Isis/DataNucleus we can likewise define such a constructor.
+When DataNucleus rehydrates domain entities from the database at runtime, it actually requires a no-arg constructor (it then sets all state reflectively).
+However, there is no need to provide such a no-arg constructor; it is added by the enhancer process.
+<11> The `ObjectContracts` utility class also provides assistance for `toString()`, useful when debugging in an IDE.
+
+
+[[_ugfun_how-tos_class-structure_class-definition_domain-services]]
+== Domain Services
+
+Domain services are generally singletons that are automatically injected into other domain services.
+A very common usage is as a repository (to find/locate existing entities) or as a factory (to create new instances of entities).
+But services can also be exposed in the UI as top-level menus; and services are also used as a bridge to access technical resources (eg rendering a document object as a PDF).
+
+The Apache Isis framework itself also provides a large number of number of domain services, catalogued in the xref:rgsvc.adoc#[Domain Services Reference Guide].
+Some of these are APIs (intended to be called by your application's own domain objects) and some are SPIs (implemented by your application and called by the framework, customising the way it works).
+
+The following is a typical menu service:
+
+[source,java]
+----
+@DomainService(                                                 // <1>
+        nature = NatureOfService.VIEW_MENU_ONLY
+)
+@DomainServiceLayout(                                           // <2>
+        named = "Simple Objects",
+        menuOrder = "10"
+)
+public class SimpleObjectMenu {
+
+    ...
+
+    @Action(semantics = SemanticsOf.SAFE)
+    @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
+    @MemberOrder(sequence = "2")
+    public List<SimpleObject> findByName(                       // <3>
+            @ParameterLayout(named="Name")
+            final String name
+    ) {
+        return simpleObjectRepository.findByName(name);
+    }
+
+    @javax.inject.Inject
+    SimpleObjectRepository simpleObjectRepository;              // <4>
+}
+----
+<1> The (Apache Isis) `@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_MENU_ONLY` nature indicates that this service's actions should be exposed as menu items.
+<2> The (Apache Isis) `@DomainServiceLayout` annotation provides UI hints.
+In the example above the menu is named "Simple Objects" (otherwise it would have defaulted to "Simple Object Menu", based on the class name, while the `menuOrder` attribute determines the order of the menu with respect to other menu services.
+<3> The `findByName` method is annotated with various Apache Isis annotations (`@Action`, `@ActionLayout` and `@MemberOrder`) and is itself rendered in the UI as a "Find By Name" menu item underneath the "Simple Objects" menu.
+The implementation delegates to an `SimpleObjectRepository` service, which is injected.
+<4> The `javax.inject.Inject` annotation instructs Apache Isis framework to inject the `SimpleObjectRepository` service into this domain object.
+The framework can inject into not just other domain services but will also automatically into domain entities and view models.
+
+
+[[_ugfun_how-tos_class-structure_class-definition_view-models]]
+== View Models
+
+xref:ugbtb.adoc#_ugbtb_view-models[View model]s are similar to entities in that (unlike domain services) there can be many instances of any given type; but they differ from entities in that they are not persisted into a database.
+Instead they are recreated dynamically by serializing their state, ultimately into the URL itself.
+
+A common use case for view models is to support a business process.
+For example, in an invoicing application there could be an `InvoiceRun` view model, which lists all the invoices due to be paid (each month, say) and provides actions to allow those invoices to be processed.
+
+Another use case is for a view model to act as a proxy for an entity that is managed in an external system.
+For example, a `Content` view model could represent a PDF that has been scanned and is held within a separate Content Management system.
+
+A third use case is to define DTOs that act as a stable projection of one or more underlying entities.
+Apache Isis' xref:ugvro.adoc[Restful Objects] viewer provides a REST API that then allows REST clients to query the application using these DTOs; useful for integration scenarios.
+
+Apache Isis offers several ways to implement view models, but the most flexible/powerful is to annotate the class using JAXB annotations.
+For example:
+
+[source,java]
+----
+@XmlRootElement(name = "invoiceRun")    // <1>
+@XmlType(
+        propOrder = {                   // <2>
+            ...
+        }
+)
+public class InvoiceRun {
+    ...
+}
+----
+<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> All properties of the view model must be listed using the `XmlType#propOrder` attribute.
+
+Use JAXB elements such as `@XmlElement` for properties and the combination of `@XmlElementWrapper` and `@XmlElement` for collections.
+Properties can be ignored (for serialization) using `@XmlTransient`.

http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_collections.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_collections.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_collections.adoc
index 23f87bd..3a628ea 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_collections.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_collections.adoc
@@ -5,22 +5,91 @@
 :_imagesdir: images/
 
 
-NOTE: TODO
+A collection is an instance variable of a domain object, of a collection type that holds references to other domain objects.
+For example, a `Customer` may have a collection of ``Order``s).
 
+It's ok for a xref:ugfun.adoc#_ugfun_how-tos_class-structure_class-definition_entities[domain entity] to reference another domain entity, and for a xref:ugfun.adoc#_ugfun_how-tos_class-structure_class-definition_view-models[view model] to reference both view model and domain entities.
+However, it isn't valid for a domain entity to hold a persisted reference to view model (DataNucleus will not know how to persist that view model).
 
-[NOTE]
-====
-While Apache Isis support collections of references, the framework (currently) does not support collections of values. That is, it isn't possible to define a collection of type `Set<String>`.
+Formally speaking, a collection is simply a regular JavaBean getter, returning a collection type (subtype of `java.util.Collection`).
+Most collections (those that are modifiable) will also have a setter and (if persisted) a backing instance field.
+And collections properties will also have a number of annotations:
 
-Or, actually, you can, because that is a valid mapping supported by JDO/DataNucleus .  However, Apache Isis has no default visualization.
+* Apache Isis defines its own set own `@Collection` annotation for capturing domain semantics.
+It also provides a `@CollectionLayout` for UI hints (though the information in this annotation may instead be provided by a supplementary xref:ugfun.adoc#_ugfun_object-layout[`.layout.xml`] file
 
-One workaround is to mark the collection as xref:rgant.adoc#_rgant-Programmatic[`@Programmatic`].  This ensures that the collection is ignored by Apache Isis.
+* the collections of domain entities are often annotated with various JDO/DataNucleus annotations, most notable `javax.jdo.annotations.Persistent`.
+This and other annotations can be used to specify if the association is bidirectional, and whether to define a link table or not to hold foreign key columns.
 
-Another workaround is to wrap each value in a view model, as explained in this xref:ugfun.adoc#_ugfun_how-tos_simulating-collections-of-values[tip].
-====
+* for the collections of view models, then JAXB annotations such as `@javax.xml.bind.annotation.XmlElementWrapper` and `@javax.xml.bind.annotation.XmlElement` will be present
+
+Apache Isis recognises some of these annotations for JDO/DataNucleus and JAXB and infers some domain semantics from them (for example, the maximum allowable length of a string property).
+
+Unlike xref:ugfun.adoc#_ugfun_how-tos_class-structure_properties[properties], the framework (at least, the xref:ugvw.adoc[Wicket viewer]) does not allow collections to be "edited".
+Instead, xref:ugfun.adoc#_ugfun_how-tos_class-structure_actions[action]s can be written that will modify the contents of the collection as a side-effect.
+For example, a `placeOrder(...)` action will likely add to an `Order` to the `Customer#orders` collection.
+
+Since writing getter and setter methods adds quite a bit of boilerplate, it's common to use link:https://projectlombok.org/[Project Lombok] to code generate these methods at compile time (using Java's annotation processor) simply by adding the `@lombok.Getter` and `@lombok.Setter` annotations to the field.
+
+
+== Value vs Reference Types
+
+Apache Isis can (currently) only provide a UI for collections of references.
+While you can use DataNucleus to persist collections/arrays of value types, such properties must be annotated as `@Programmatic` so that they are ignored by Apache Isis.
+
+If you want to visualize an array of value types in Apache Isis, then one option is to wrap value in a view model, as explained xref:ugfun.adoc#_ugfun_how-tos_simulating-collections-of-values[elsewhere].
 
 
+== One-to-many collections
 
+Bidirectional one-to-many collections are one of the most common collection types.
+In the parent object, the collection can be defined as:
 
+[source,java]
+----
+public class ParentObject
+        implements Comparable<ParentObject>{
 
+    @javax.jdo.annotations.Persistent(
+        mappedBy = "parent",                                                // <1>
+        dependentElement = "false"                                          // <2>
+    )
+    @Collection                                                             // <3>
+    @lombok.Getter @lombok.Setter
+    private SortedSet<ChildObject> children = new TreeSet<ChildObject>();   // <4>
+
+}
+----
+<1> indicates a bidirectional association; the foreign key pointing back to the `Parent` will be in the table for `ChildObject`
+<2> disable cascade delete
+<3> (not actually required in this case, because no attributes are set, but acts as a useful reminder that this collection will be rendered in the UI by Apache Isis)
+<3> uses a `SortedSet` (as opposed to some other collection type; discussion below)
+
+while in the child object you will have:
+
+[source,java]
+----
+public class ChildObject
+        implements Comparable<ChildObject> {    // <1>
+
+    @javax.jdo.annotations.Column(
+        allowsNull = "false"                    // <2>
+    )
+    @Property(editing = Editing.DISABLED)       // <3>
+    @lombok.Getter @lombok.Setter
+    private ParentObject parent;
+}
+----
+<1> implements `Comparable` because is mapped using a `SortedSet`
+<2> mandatory; every child must reference its parent
+<3> cannot be edited directly
+
+Generally speaking you should use `SortedSet` for collection types (as opposed to `Set`, `List` or `Collection`).
+JDO/Datanucleus does support the mapping of these other types, but RDBMS are set-oriented, so using this type introduces the least friction.
+
+[NOTE]
+====
+JDO/DataNucleus does also support `java.util.Map` as a collection type, but this is not supported by Apache Isis.
+If you do use this collection type, then annotate the getter with `@Programmatic` so that it is ignored by the Apache Isis framework.
+====
 

http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_ignoring-methods.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_ignoring-methods.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_ignoring-methods.adoc
deleted file mode 100644
index cbaf310..0000000
--- a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_ignoring-methods.adoc
+++ /dev/null
@@ -1,16 +0,0 @@
-[[_ugfun_how-tos_class-structure_ignoring-methods]]
-= Ignoring Methods
-:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-:_basedir: ../
-:_imagesdir: images/
-
-
-
-NOTE: TODO
-
-
-Sometimes you want to define a `public` method on a domain object that is not intended to be rendered in Apache Isis' UI.
-
-To exclude such methods, use the xref:rgant.adoc#_rgant-Programmatic[`@Programmatic`] annotation.
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_properties.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_properties.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_properties.adoc
index a530db6..b6ccc6c 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_properties.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugfun_how-tos_class-structure_properties.adoc
@@ -5,57 +5,135 @@
 :_imagesdir: images/
 
 
-NOTE: TODO
+A property is an instance variable of a domain object, of a scalar type, that holds some state about either a xref:ugfun.adoc#_ugfun_how-tos_class-structure_class-definition_entities[domain entity] or a xref:ugfun.adoc#_ugfun_how-tos_class-structure_class-definition_view-models[view model].
 
+For example, a ``Customer``'s `firstName` would be a property, as would their `accountCreationDate` that they created their account.
+All properties have at least a "getter" method, and most properties have also a "setter" method (meaning that they are immutable).
+Properties that do _not_ have a setter method are derived properties, and so are not persisted.
 
+Formally speaking, a property is simply a regular JavaBean getter, returning a scalar value recognized by the framework.
+Most properties (those that are editable/modifiable) will also have a setter and (if persisted) a backing instance field.
+And most properties will also have a number of annotations:
 
+* Apache Isis defines its own set own `@Property` annotation for capturing domain semantics.
+It also provides a `@PropertyLayout` for UI hints (though the information in this annotation may instead be provided by a supplementary xref:ugfun.adoc#_ugfun_object-layout[`.layout.xml`] file
+
+* the properties of domain entities are often annotated with the JDO/DataNucleus `@javax.jdo.annotations.Column` annotation.
+For property references, there may be other annotations to indicate whether the reference is bidirectional.
+It's also possible (using annotations) to define a link table to hold foreign key columns.
+
+* for the properties of view models, then JAXB annotations such as `@javax.xml.bind.annotation.XmlElement` will be present
+
+Apache Isis recognises some of these annotations for JDO/DataNucleus and JAXB and infers some domain semantics from them (for example, the maximum allowable length of a string property).
+
+Since writing getter and setter methods adds quite a bit of boilerplate, it's common to use link:https://projectlombok.org/[Project Lombok] to code generate these methods at compile time (using Java's annotation processor) simply by adding the `@lombok.Getter` and `@lombok.Setter` annotations to the field.
+The xref:guides/ugfun.adoc#_ugfun_getting-started_simpleapp-archetype[SimpleApp archetype] uses this approach.
 
 
 == Value vs Reference Types
 
-NOTE: TODO
+Properties can be either a value types (strings, int, date and so on) or be a reference to another object (for example, an `Order` referencing the `Customer` that placed it).
 
-The annotations for mapping value types tend to be different for properties vs action parameters, because JDO annotations are only valid on properties.  The table in the xref:ugfun.adoc#_ugfun_how-tos_class-structure_properties-vs-parameters[Properties vs Parameters] section provides a handy reference of each.
+It's ok for a xref:ugfun.adoc#_ugfun_how-tos_class-structure_class-definition_entities[domain entity] to reference another domain entity, and for a xref:ugfun.adoc#_ugfun_how-tos_class-structure_class-definition_view-models[view model] to reference both view model and domain entities.
+However, it isn't valid for a domain entity to hold a persisted reference to view model (DataNucleus will not know how to persist that view model).
 
+For domain entities, the annotations for mapping value types tend to be different for properties vs action parameters, because JDO annotations are only valid on properties.
+The table in the xref:ugfun.adoc#_ugfun_how-tos_class-structure_properties-vs-parameters[Properties vs Parameters] section provides a handy reference of each.
 
 
 == Optional Properties
 
-JDO/DataNucleus' default is that a property is assumed to be mandatory if it is a primitive type (eg `int`, `boolean`), but optional if a reference type (eg `String`, `BigDecimal` etc).  To override optionality in JDO/DataNucleus the `@Column(allowsNull="...")` annotations is used.
+(For domain entities) JDO/DataNucleus' default is that a property is assumed to be mandatory if it is a primitive type (eg `int`, `boolean`), but optional if a reference type (eg `String`, `BigDecimal` etc).
+To override optionality in JDO/DataNucleus the `@Column(allowsNull="...")` annotations is used.
 
-Apache Isis on the other hand assumes that all properties (and action parameters, for that matter) are mandatory, not optional.  These defaults can also be overridden using Apache Isis' own annotations, specifically `@Property(optionality=...)`.
+Apache Isis on the other hand assumes that all properties (and action parameters, for that matter) are mandatory, not optional.
+These defaults can also be overridden using Apache Isis' own annotations, specifically `@Property(optionality=...)`, or (because it's much less verbose) using `@javax.annotation.Nullable`.
 
-These different defaults can lead to incompatibilities between the two frameworks.  To counteract that, Apache Isis also recognizes and honours JDO's `@Column(allowsNull=...)`.
+These different defaults can lead to incompatibilities between the two frameworks.
+To counteract that, Apache Isis also recognizes and honours JDO's `@Column(allowsNull=...)`.
 
 For example, rather than:
 
 [source,java]
 ----
 @javax.jdo.annotations.Column(allowsNull="true")
-private LocalDate date;
 @Property(optionality=Optionality.OPTIONAL)
-public LocalDate getDate() { ... }
-public void setDate(LocalDate d) { ... }
+@lombok.Getter @lombok.Setter
+private LocalDate date;
 ----
 
 you should instead simply write:
 
 [source,java]
 ----
-private LocalDate date;
 @javax.jdo.annotations.Column(allowsNull="true")
-public LocalDate getDate() { ... }
-public void setDate(LocalDate d) { ... }
+@lombok.Getter @lombok.Setter
+private LocalDate date;
 ----
 
-[WARNING]
-====
-With JDO/DataNucleus it's valid for the `@Column` annotation to be placed on either the field or the getter.  Apache Isis (currently) only looks for annotations on the getter.  We therefore recommend that you always place `@Column` on the gettter.
-====
-
 In all cases the framework will search for any incompatibilities in optionality (whether specified explicitly or defaulted implicitly) between Isis' defaults and DataNucleus, and refuse to boot if any are found (fail fast).
 
 
+== Editable Properties
+
+Apache Isis provides the capability to allow individual properties to be modified.
+This is specified using the `@Property(editing=...)` attribute.
+
+For example:
+
+[source,java]
+----
+@Property(editing = Editing.ENABLED)
+@Getter @Setter
+private String notes;
+----
+
+If this is omitted then whether editing is enabled or disabled is defined globally, in the `isis.properties` configuration file; see xref:rgcfg.adoc#_rgcfg_configuring-core_isis-objects-editing[reference configuration guide] for further details.
+
+
+== Ignoring Properties
+
+By default Apache Isis will automatically render all properties in the xref:ugvw.adoc[UI] or in the xref:ugvro.adoc[REST API].
+To get Apache Isis to ignore a property (exclude it from its metamodel), annotate the getter using `@Programmatic`.
+
+Similarly, you can tell JDO/DataNucleus to ignore a property using the `@javax.jdo.annotations.NotPersistent` annotation.
+This is independent of Apache Isis; in other words that property will still be rendered in the UI (unless also annotated with `@Programmatic`).
+
+For view models, you can tell JAXB to ignore a property using the `@javax.xml.bind.annotation.XmlTransient` annotation.
+Again, this is independent of Apache Isis.
+
+
+== Derived Properties
+
+Derived properties are those with a getter but no setter.
+Provided that the property has not been annotated with `@Programmatic`, these will still be rendered in the UI, but they will be read-only (not editable) and their state will not be persisted.
+
+Subtly different, it is also possible to have non-persisted but still editable properties.
+In this case you will need a getter and a setter, but with the getter annotated using `@NotPersistent`.
+The implementation of these getters and setters will most likely persist state using other properties (which might be hidden from view using `@Programmatic`).
+
+For example:
+
+[source,java]
+----
+@javax.jdo.annotations.NotPersistent
+@Property(editing=Editing.ENABLED)
+public String getAddress() { return addressService.toAddress( getLatLong() ); }             // <1>
+public void setAddress(String address) { setLatLong(addressService.toLatLong(address)); }
+
+@javax.jdo.annotations.Column
+private String latLong;
+@Programmatic
+public String getLatLong() { return latLong; }                                              // <2>
+public void setLatLong(String latLong) { this.latLong = latLong; }
+
+@javax.inject.Inject
+AddressService addressService;                                                              // <3>
+----
+<1> the representation of the address, in human readable form, eg "10 Downing Street, London, UK"
+<2> the lat/long representation of the address, eg "51.503363;-0.127625"
+<3> an injected service that can convert to/from address and latLong.
+
 
 === Handling Mandatory Properties in Subtypes
 
@@ -83,61 +161,61 @@ For example:
 ----
 @javax.jdo.annotations.Inheritance(strategy = InheritanceStrategy.SUPER_TABLE)
 public class SomeSubtype extends SomeSuperType {
-    private LocalDate date;
     @javax.jdo.annotations.Column(allowsNull="true")
     @Property(optionality=Optionality.MANDATORY)
-    public LocalDate getDate() { ... }
-    public void setDate(LocalDate d) { ... }
+    @lombok.Getter @lombok.Setter
+    private LocalDate date;
 }
 ----
 
 [TIP]
 ====
-The `@Property(optionality=...)` annotation is equivalent to the older but still supported `@Optional` annotation and `@Mandatory` annotations. Its benefit is that it lumps together all Apache Isis' property metadata in a single annotation.  Its downside is that it is rather verbose if the only semantic that needs to be specified -- as is often the case -- is optionality.
+The `@Property(optionality=...)` annotation is equivalent to the older but still supported `@Optional` annotation and `@Mandatory` annotations.
 ====
 
-An alternative way to achieve this is to leave the JDO annotation on the field (where it is invisible to Apache Isis), and rely on Isis' default, eg:
-
-[source,java]
-----
-@javax.jdo.annotations.Inheritance(strategy = InheritanceStrategy.SUPER_TABLE)
-public class SomeSubtype extends SomeSuperType {
-    @javax.jdo.annotations.Column(allowsNull="true")
-    private LocalDate date;
-    // mandatory in Apache Isis by default
-    public LocalDate getDate() { }
-    public void setDate(LocalDate d) { }
-}
-----
-
-We recommend the former mapping, though, using `@Property(optionality=Optionality.MANDATORY)`.
-
 
+== Mapping ``String``s (Length)
 
+By default JDO/DataNucleus will map string properties to a `VARCHAR(255)`.
+To limit the length, use the `@Column(length=...)` annotation.
 
+For example:
 
-== ``String``s (Length)
-
-NOTE: TODO
-
+[source,java]
+----
+@javax.jdo.annotations.Column(length=50)
+@lombok.Getter @lombok.Setter
+private String firstName
+----
 
+This is a good example of a case where Apache Isis infers domain semantics from the JDO annotation.
 
 
 
 [[_ugfun_how-tos_class-structure_properties_mapping-joda-dates]]
-== Mapping JODA Dates
+== Mapping JODA Date
 
 Isis' JDO objectstore bundles DataNucleus' http://www.datanucleus.org/documentation/products/plugins.html[built-in support] for Joda `LocalDate` and `LocalDateTime` datatypes, meaning that entity properties of these types will be persisted as appropriate data types in the database tables.
 
-It is, however, necessary to annotate your properties with `@javax.jdo.annotations.Persistent`, otherwise the data won't actually be persisted. See the http://db.apache.org/jdo/field_types.html[JDO docs] for more details on this.
+It is, however, necessary to annotate your properties with `@javax.jdo.annotations.Persistent`, otherwise the data won't actually be persisted.
+See the link:http://db.apache.org/jdo/field_types.html[JDO docs] for more details on this.
 
-Moreover, these datatypes are _not_ in the default fetch group, meaning that JDO/DataNucleus will perform an additional `SELECT` query for each attribute. To avoid this extra query, the annotation should indicate that the property is in the default fetch group.
+Moreover, these datatypes are _not_ in the default fetch group, meaning that JDO/DataNucleus will perform an additional `SELECT` query for each attribute.
+To avoid this extra query, the annotation should indicate that the property is in the default fetch group.
 
 For example, the `ToDoItem` (in the https://github.com/isisaddons/isis-app-todoapp[todoapp example app] (not ASF)) defines the `dueBy` property as follows:
 
+[source,java]
+----
+@javax.jdo.annotations.Persistent(defaultFetchGroup="true")
+@javax.jdo.annotations.Column(allowsNull="true")
+@Getter @Setter
+private LocalDate dueBy;
+----
+
 
 
-== ``BigDecimal``s (Precision)
+== Mapping ``BigDecimal``s (Precision)
 
 Working with `java.math.BigDecimal` properties takes a little care due to scale/precision issues.
 
@@ -145,13 +223,8 @@ For example, suppose we have:
 
 [source,java]
 ----
+@lombok.Getter @lombok.Setter
 private BigDecimal impact;
-public BigDecimal getImpact() {
-    return impact;
-}
-public void setImpact(final BigDecimal impact) {
-    this.impact = impact;
-}
 ----
 
 JDO/DataNucleus creates, at least with HSQL, the table with the field type as NUMERIC(19). No decimal digits are admitted. (Further details http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types[here]).
@@ -170,13 +243,8 @@ The solution is to explicitly add the scale to the field like this:
 [source,java]
 ----
 @javax.jdo.annotations.Column(scale=2)
+@lombok.Getter @lombok.Setter
 private BigDecimal impact;
-public BigDecimal getImpact() {
-    return impact;
-}
-public void setImpact(final BigDecimal impact) {
-    this.impact = impact;
-}
 ----
 
 In addition, you should also set the scale of the `BigDecimal`, using `setScale(scale, roundingMode)`.
@@ -185,16 +253,16 @@ More information can be found http://www.opentaps.org/docs/index.php/How_to_Use_
 
 
 
-
-== Mapping Blobs and Clobs
+== Mapping ``Blob``s and ``Clob``s
 
 Apache Isis configures JDO/DataNucleus so that the properties of type `org.apache.isis.applib.value.Blob` and `org.apache.isis.applib.value.Clob` can also be persisted.
 
-As for xref:ugfun.adoc#_ugfun_how-tos_class-structure_properties_mapping-joda-dates[Joda dates], this requires the `@javax.jdo.annotations.Persistent` annotation. However, whereas for dates one would always expect this value to be retrieved eagerly, for blobs and clobs it is not so clear cut.
+As for xref:ugfun.adoc#_ugfun_how-tos_class-structure_properties_mapping-joda-dates[Joda dates], this requires the `@javax.jdo.annotations.Persistent` annotation.
+However, whereas for dates one would always expect this value to be retrieved eagerly, for blobs and clobs it is not so clear cut.
 
-=== Mapping Blobs
+=== Mapping ``Blob``s
 
-For example, in the `ToDoItem` class (of the https://github.com/isisaddons/isis-app-todoapp/blob/61b8114a8e01dbb3c380b31cf09eaed456407570/dom/src/main/java/todoapp/dom/module/todoitem/ToDoItem.java#L475[todoapp example app] (non-ASF) the `attachment` property is as follows:
+For example, in the `ToDoItem` class (of the https://github.com/isisaddons/isis-app-todoapp/blob/0333852ddd18ad67e3356fccf805aa442246790d/dom/src/main/java/todoapp/dom/todoitem/ToDoItem.java#L442[todoapp example app] (non-ASF) the `attachment` property is as follows:
 
 [source,java]
 ----
@@ -203,19 +271,15 @@ For example, in the `ToDoItem` class (of the https://github.com/isisaddons/isis-
     @javax.jdo.annotations.Column(name = "attachment_mimetype"),
     @javax.jdo.annotations.Column(name = "attachment_bytes", jdbcType="BLOB", sqlType = "LONGVARBINARY")
 })
-private Blob attachment;
 @Property(
         optionality = Optionality.OPTIONAL
 )
-public Blob getAttachment() {
-    return attachment;
-}
-public void setAttachment(final Blob attachment) {
-    this.attachment = attachment;
-}
+@lombok.Getter @lombok.Setter
+private Blob attachment;
 ----
 
-The three `@javax.jdo.annotations.Column` annotations are required because the mapping classes that Apache Isis provides (https://github.com/apache/isis/blob/isis-1.4.0/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisBlobMapping.java#L59[IsisBlobMapping] and https://github.com/apache/isis/blob/isis-1.4.0/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisClobMapping.java#L59[IsisClobMapping]) map to 3 columns. (It is not an error to omit these `@Column` annotations, but without them the names of the table columns are simply suffixed `_0`, `_1`, `_2` etc.
+The three `@javax.jdo.annotations.Column` annotations are required because the mapping classes that Apache Isis provides (https://github.com/apache/isis/blob/isis-1.4.0/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisBlobMapping.java#L59[IsisBlobMapping] and https://github.com/apache/isis/blob/isis-1.4.0/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisClobMapping.java#L59[IsisClobMapping]) map to 3 columns.
+(It is not an error to omit these `@Column` annotations, but without them the names of the table columns are simply suffixed `_0`, `_1`, `_2` etc.
 
 If the `Blob` is mandatory, then use:
 
@@ -228,25 +292,21 @@ If the `Blob` is mandatory, then use:
                                   jdbcType="BLOB", sqlType = "LONGVARBINARY",
                                   allowsNull="false")
 })
-private Blob attachment;
 @Property(
     optionality = Optionality.MANDATORY
 )
-public Blob getAttachment() {
-return attachment;
-}
-public void setAttachment(final Blob attachment) {
-this.attachment = attachment;
-}
+@lombok.Getter @lombok.Setter
+private Blob attachment;
 ----
 
 [NOTE]
 ====
-If specifying a `sqlType` of "LONGVARBINARY" does not work, try instead "BLOB".  There can be differences in behaviour between JDBC drivers.
+If specifying a `sqlType` of "LONGVARBINARY" does not work, try instead "BLOB".
+There can be differences in behaviour between JDBC drivers.
 ====
 
 
-=== Mapping Clobs
+=== Mapping ``Clob``s
 
 Mapping `Clob`s works in a very similar way, but the `jdbcType` and `sqlType` attributes will, respectively, be `CLOB` and `LONGVARCHAR`:
 
@@ -277,23 +337,21 @@ If specifying a `sqlType` of "LONGVARCHAR" does not work, try instead "CLOB".  T
 
 === Mapping to VARBINARY or VARCHAR
 
-Instead of mapping to a sqlType of `LONGVARBINARY` (or perhaps `BLOB`), you might instead decide to map to a `VARBINARY`.  The difference is whether the binary data is held "on-row" or as a pointer "off-row"; with a `VARBINARY` the data is held on-row and so you will need to specify a length.
+Instead of mapping to a sqlType of `LONGVARBINARY` (or perhaps `BLOB`), you might instead decide to map to a `VARBINARY`.
+The difference is whether the binary data is held "on-row" or as a pointer "off-row"; with a `VARBINARY` the data is held on-row and so you will need to specify a length.
 
 For example:
 
-
 [source,java]
 ----
 @javax.jdo.annotations.Column(name = "attachment_bytes", jdbcTypr="BLOB", sqlType = "VARBINARY", length=2048)
 ----
 
-
 The same argument applies to `LONGVARCHAR` (or `CLOB`); you could instead map to a regular `VARCHAR`:
 
-
 [source,java]
 ----
 @javax.jdo.annotations.Column(name = "attachment_chars", sqlType = "VARCHAR", length=2048)
 ----
+Support and maximum allowed length will vary by database vendor.
 
-Support and maximum allowed length will vary by database vendor.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/39034890/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java
index b3e7ea4..01235a9 100644
--- a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java
+++ b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java
@@ -32,8 +32,7 @@ import org.apache.isis.applib.annotation.SemanticsOf;
 import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
 
 @DomainService(
-        nature = NatureOfService.VIEW_MENU_ONLY,
-        repositoryFor = SimpleObject.class
+        nature = NatureOfService.VIEW_MENU_ONLY
 )
 @DomainServiceLayout(
         named = "Simple Objects",