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 2015/08/25 01:01:12 UTC
[15/37] isis-site git commit: ISIS-1044: configuration properties to
disable visibility filtering
http://git-wip-us.apache.org/repos/asf/isis-site/blob/bea6c37a/content/guides/rg.html
----------------------------------------------------------------------
diff --git a/content/guides/rg.html b/content/guides/rg.html
index cd26195..d79773a 100644
--- a/content/guides/rg.html
+++ b/content/guides/rg.html
@@ -3969,319 +3969,422 @@ wrapping the target object using the <a href="#_rg_services-api_manpage-WrapperF
</tr>
</table>
</div>
-<div class="paragraph">
-<p>Unresolved directive in _rg_annotations.adoc - include::_rg_annotations_manpage-Collectionlayout.adoc[leveloffset=+1]
-:leveloffset: +1</p>
-</div>
-</div>
-</div>
</div>
</div>
-<div class="sect1">
-<h2 id="_rg_annotations_manpage-Column">3. <code>@Column</code> (<code>javax.jdo</code>)</h2>
-<div class="sectionbody">
+<div class="sect2">
+<h3 id="_rg_annotations_manpage-CollectionLayout">2.5. <code>@CollectionLayout</code></h3>
<div class="paragraph">
-<p>The JDO <code>@javax.jdo.annotation.Column</code> provides metadata describing how JDO/DataNucleus should persist the property to a database RDBMS table column (or equivalent concept for other persistence stores).</p>
+<p>The <code>@CollectionLayout</code> annotation applies to collections, collecting together all UI hints within a single
+annotation. It is also possible to apply the annotation to actions of domain services that are acting as contributed collections.</p>
</div>
<div class="paragraph">
-<p>Apache Isis also parses and interprets this annotation in order to build up aspects of its metamodel.</p>
+<p>The table below summarizes the annotation’s attributes.</p>
</div>
-<div class="admonitionblock note">
-<table>
+<table class="tableblock frame-all grid-all spread">
+<caption class="title">Table 11. <code>@CollectionLayout</code> attributes</caption>
+<colgroup>
+<col style="width: 25%;">
+<col style="width: 25%;">
+<col style="width: 50%;">
+</colgroup>
+<thead>
<tr>
-<td class="icon">
-<i class="fa icon-note" title="Note"></i>
-</td>
-<td class="content">
-<div class="paragraph">
-<p>Isis parses the <code>@Column</code> annotation from the Java source code; it does not query the JDO metamodel. This means that it the <code>@Column</code> annotation must be used rather than the equivalent <code><column></code> <a href="http://www.datanucleus.org/products/accessplatform_4_0/jdo/orm/schema_mapping.html">XML metadata</a>.</p>
+<th class="tableblock halign-left valign-top">Attribute</th>
+<th class="tableblock halign-left valign-top">Values (default)</th>
+<th class="tableblock halign-left valign-top">Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-CollectionLayout_cssClass"><code>cssClass()</code></a></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">Any string valid as a CSS class</p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>the css class that a collection should have, to allow more targetted styling in <a href="#_rg_runtime_application-specific_application-css"><code>application.css</code></a></p>
+</div></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-CollectionLayout_describedAs"><code>describedAs()</code></a></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">String.</p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>description of this collection, eg to be rendered in a tooltip.</p>
+</div></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-CollectionLayout_hidden"><code>hidden()</code></a></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EVERYWHERE</code>, <code>OBJECT_FORMS</code>, <code>NOWHERE</code><br>
+(<code>NOWHERE</code>)</p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>indicates where (in the UI) the collection should be hidden from the user.</p>
+</div></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-CollectionLayout_named">named()</a></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">String.</p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>to override the name inferred from the collection’s name in code.<br></p>
</div>
<div class="paragraph">
-<p>Moreover, while JDO/DataNucleus will recognize annotations on either the field or the getter method, Apache Isis (currently) only inspects the getter method. Therefore ensure that the annotation is placed there.</p>
-</div>
-</td>
+<p>A typical use case is if the desired name is a reserved Java keyword, such as <code>default</code> or <code>package</code>.</p>
+</div></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">namedEscaped()</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><code>true</code>,<code>false</code> (<code>true</code>)</p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>whether to HTML escape the name of this property.</p>
+</div></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-CollectionLayout_paged"><code>paged()</code></a></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">Positive integer</p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>the page size for instances of this class when rendered within a table.</p>
+</div></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-CollectionLayout_render"><code>render()</code></a></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EAGERLY</code>, <code>LAZILY</code><br>
+(<code>LAZILY</code>)</p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>whether the collection should be (eagerly) rendered open or (lazily) rendered closed</p>
+</div></div></td>
</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-CollectionLayout_sortedBy"><code>sortedBy()</code></a></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">Subclass of <code>java.util.Comparator</code> for element type</p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>indicates that the elements in the <code>java.util.SortedSet</code> collection should be sorted according to a specified <code>Comparator</code> rather than their natural sort order.</p>
+</div></div></td>
+</tr>
+</tbody>
</table>
-</div>
<div class="paragraph">
-<p>This section identifies which attributes of <code>@Column</code> are recognized and used by Apache Isis.</p>
+<p>For example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">ToDoItem</span> {
+ <span class="annotation">@CollectionLayout</span>(
+ cssClass=<span class="string"><span class="delimiter">"</span><span class="content">x-key</span><span class="delimiter">"</span></span>,
+ named=<span class="string"><span class="delimiter">"</span><span class="content">Todo items that are <i>dependencies</i> of this item.</span><span class="delimiter">"</span></span>,
+ namedEscaped=<span class="predefined-constant">false</span>,
+ describedAs=<span class="string"><span class="delimiter">"</span><span class="content">Other todo items that must be completed before this one</span><span class="delimiter">"</span></span>,
+ labelPosition=LabelPosition.LEFT,
+ render=EAGERLY)
+ <span class="directive">public</span> <span class="predefined-type">SortedSet</span><ToDoItem> getDependencies() { ... }
+ ...
+}</code></pre>
</div>
-<div class="sect2">
-<h3 id="_nullability">3.1. Nullability</h3>
-<div class="paragraph">
-<p>The <code>allowsNull()</code> attribute is used to specify if a property is mandatory or is optional.</p>
</div>
<div class="paragraph">
-<p>For example:</p>
+<p>As an alternative to using the <code>@CollectionLayout</code> annotation, a dynamic layout using <a href="#_rg_object-layout_dynamic"><code>.layout.json</code></a> file can be specified; for example:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
- <span class="annotation">@javax</span>.jdo.annotations.Column(allowNulls=<span class="string"><span class="delimiter">"</span><span class="content">true</span><span class="delimiter">"</span></span>)
- <span class="directive">public</span> <span class="predefined-type">String</span> getMiddleInitial() { ... }
- <span class="directive">public</span> <span class="type">void</span> setMiddleInitial(<span class="predefined-type">String</span> middleInitial) { ... }</code></pre>
+<pre class="CodeRay highlight"><code data-lang="javascript"><span class="string"><span class="delimiter">"</span><span class="content">dependencies</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">collectionLayout</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">cssClass</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">x-key</span><span class="delimiter">"</span></span>,
+ <span class="key"><span class="delimiter">"</span><span class="content">named</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Todo items that are <i>dependencies</i> of this item.</span><span class="delimiter">"</span></span>,
+ <span class="key"><span class="delimiter">"</span><span class="content">namedEscaped</span><span class="delimiter">"</span></span>: <span class="predefined-constant">false</span>,
+ <span class="key"><span class="delimiter">"</span><span class="content">describedAs</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Other todo items that must be completed before this one</span><span class="delimiter">"</span></span>,
+ <span class="key"><span class="delimiter">"</span><span class="content">labelPosition</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">LEFT</span><span class="delimiter">"</span></span>,
+ <span class="key"><span class="delimiter">"</span><span class="content">render</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">EAGERLY</span><span class="delimiter">"</span></span>
+ }
+}</code></pre>
</div>
</div>
+<div class="sect3">
+<h4 id="_rg_annotations_manpage-CollectionLayout_cssClass">2.5.1. <code>cssClass()</code></h4>
<div class="paragraph">
-<p>Isis also provides <a href="#_rg_annotations_manpage-Property_optionality"><code>@Property#optionality()</code></a> attribute. If both are specified, Apache Isis will check when it initializes for any contradictions, and will fail-fast with an appropriate error message in the log if there are.</p>
+<p>The <code>cssClass()</code> attribute can be used to render additional CSS classes in the HTML (a wrapping <code><div></code>) that represents the collection. <a href="#_rg_runtime_application-specific_application-css">Application-specific CSS</a> can then be used to target and adjust the UI representation of that particular element.</p>
</div>
<div class="paragraph">
-<p>You should also be aware that in the lack of either the <code>@Column#allowsNull()</code> or the <code>@Property#optionality()</code> attributes, that the JDO and Apache Isis defaults differ. Apache Isis rule is straight-forward: properties are assumed to be required. JDO on the other hand specifies that only primitive types are mandatory; everything else is assumed to be optional. Therefore a lack of either annotation can also trigger the fail-fast validation check.</p>
+<p>This attribute can also be applied to <a href="#_rg_annotations_manpage-DomainObjectLayout_cssClass">domain objects</a>, <a href="#_rg_annotations_manpage-ViewModelLayout_cssClass">view models</a>, <a href="#_rg_annotations_manpage-ActionLayout_cssClass">actions</a>, <a href="#_rg_annotations_manpage-PropertyLayout_cssClass">properties</a> and <a href="#_rg_annotations_manpage-ParameterLayout_cssClass">parameters</a>.</p>
</div>
<div class="paragraph">
-<p>In the vast majority of cases you should be fine just to add the <code>@Column#allowsNull()</code> attribute to the getter. But see the documentation for <a href="#_rg_annotations_manpage-Property_optionality"><code>@Property#optionality()</code></a> attribute for discussion on one or two minor edge cases.</p>
+<p>For example:</p>
</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">ToDoItem</span> {
+ <span class="annotation">@CollectionLayout</span>(
+ cssClass=<span class="string"><span class="delimiter">"</span><span class="content">x-important</span><span class="delimiter">"</span></span>
+ )
+ <span class="directive">public</span> <span class="predefined-type">SortedSet</span><ToDoItem> getDependencies() { ... }
+ ...
+}</code></pre>
</div>
-<div class="sect2">
-<h3 id="_length_for_code_string_code_s">3.2. Length for <code>String</code>s</h3>
-<div class="paragraph">
-<p>The <code>length()</code> attribute is used to specify the length of <code>java.lang.String</code> property types as they map to <code>varchar(n)</code> columns.</p>
</div>
<div class="paragraph">
-<p>For example:</p>
+<p>As an alternative to using the annotation, the dynamic <a href="#_rg_object-layout_dynamic"><code>.layout.json</code></a>
+can be used instead, eg:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
- <span class="annotation">@javax</span>.jdo.annotations.Column(length=<span class="integer">20</span>)
- <span class="directive">public</span> <span class="predefined-type">String</span> getFirstName() { ... }
- <span class="directive">public</span> <span class="type">void</span> setFirstName(<span class="predefined-type">String</span> firstName) { ... }
- <span class="annotation">@javax</span>.jdo.annotations.Column(allowNulls=<span class="string"><span class="delimiter">"</span><span class="content">true</span><span class="delimiter">"</span></span>, length=<span class="integer">1</span>)
- <span class="directive">public</span> <span class="predefined-type">String</span> getMiddleInitial() { ... }
- <span class="directive">public</span> <span class="type">void</span> setMiddleInitial(<span class="predefined-type">String</span> middleInitial) { ... }
- <span class="annotation">@javax</span>.jdo.annotations.Column(length=<span class="integer">30</span>)
- <span class="directive">public</span> <span class="predefined-type">String</span> getLastName() { ... }
- <span class="directive">public</span> <span class="type">void</span> setLastName(<span class="predefined-type">String</span> lastName) { ... }</code></pre>
+<pre class="CodeRay highlight"><code data-lang="javascript"><span class="string"><span class="delimiter">"</span><span class="content">dependencies</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">collectionLayout</span><span class="delimiter">"</span></span>: { <span class="key"><span class="delimiter">"</span><span class="content">cssClass</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">x-important</span><span class="delimiter">"</span></span> }
+}</code></pre>
</div>
</div>
-<div class="paragraph">
-<p>Isis also provides <a href="#_rg_annotations_manpage-Property_maxLength"><code>@Property#maxLength()</code></a> attribute. If both are specified, Apache Isis will check when it initializes for any contradictions, and will fail-fast with an appropriate error message in the log if there are.</p>
</div>
+<div class="sect3">
+<h4 id="_rg_annotations_manpage-CollectionLayout_describedAs">2.5.2. <code>describedAs()</code></h4>
+<div class="paragraph">
+<p>The <code>describedAs()</code> attribute is used to provide a short description of the collection to the user. In the <a href="ug.html#_ug_wicket-viewer">Wicket viewer</a> it is displayed as a 'tool tip'.</p>
</div>
-<div class="sect2">
-<h3 id="_length_scale_for_code_bigdecimal_code_s">3.3. Length/scale for <code>BigDecimal</code>s</h3>
<div class="paragraph">
-<p>The <code>length()</code> and <code>scale()</code> attributes are used to infer the precision/scale of <code>java.math.BigDecimal</code> property types as they map to <code>decimal(n,p)</code> columns.</p>
+<p>The <code>describedAs()</code> attribute can also be specified for <a href="#_rg_annotations_manpage-PropertyLayout_describedAs">properties</a>, <a href="#_rg_annotations_manpage-ActionLayout_describedAs">actions</a>, <a href="#_rg_annotations_manpage-ParameterLayout_describedAs">parameters</a>, <a href="#_rg_annotations_manpage-DomainObjectLayout_describedAs">domain objects</a> and <a href="#_rg_annotations_manpage-ViewModelLayout_describedAs">view models</a>.</p>
</div>
<div class="paragraph">
<p>For example:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
- <span class="annotation">@javax</span>.jdo.annotations.Column(length=<span class="integer">10</span>, scale=<span class="integer">2</span>)
- <span class="directive">public</span> <span class="predefined-type">BigDecimal</span> getTotalOrdersToDate() { ... }
- <span class="directive">public</span> <span class="type">void</span> setTotalOrdersToDate(<span class="predefined-type">BigDecimal</span> totalOrdersToDate) { ... }</code></pre>
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">ToDoItem</span> {
+ <span class="annotation">@CollectionLayout</span>(
+ describedAs=<span class="string"><span class="delimiter">"</span><span class="content">Other todo items that must be completed before this one</span><span class="delimiter">"</span></span>)
+ <span class="directive">public</span> <span class="predefined-type">SortedSet</span><ToDoItem getDependencies() { ... }
+ ...
+}</code></pre>
</div>
</div>
<div class="paragraph">
-<p>For <code>BigDecimal</code>s it is also possible to specify the <a href="#<em>rg_annotations_manpage-Digits"><code>@Digits</code></a> annotation, whose form is <code>@Digits(integer, fraction)</code>. There is a subtle difference here: while <code>@Column#scale()</code> corresponds to <code>@Digits#fraction()</code>, the value of <code>@Column#length()</code> (ie the precision) is actually the _sum</em> of the <code>@Digits’ `integer()</code> and <code>fraction()</code> parts.</p>
+<p>As an alternative to using the annotation, the dynamic <a href="#_rg_object-layout_dynamic"><code>.layout.json</code></a>
+can be used instead, eg:</p>
</div>
-<div class="paragraph">
-<p>If both are specified, Apache Isis will check when it initializes for any contradictions, and will fail-fast with an appropriate error message in the log if there are.</p>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="javascript"><span class="string"><span class="delimiter">"</span><span class="content">dependencies</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">collectionLayout</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">describedAs</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Other todo items that must be completed before this one</span><span class="delimiter">"</span></span>
+ }
+}</code></pre>
</div>
</div>
-<div class="sect2">
-<h3 id="_hints_and_tips">3.4. Hints and Tips</h3>
-<div class="paragraph">
-<p>This seems to be a good place to describe some additional common mappings that use <code>@Column</code>. Unlike the sections above, the attributes specified in these hints and tips aren’t actually part of Apache Isis metamodel.</p>
</div>
<div class="sect3">
-<h4 id="_mapping_foreign_keys">3.4.1. Mapping foreign keys</h4>
+<h4 id="_rg_annotations_manpage-CollectionLayout_hidden">2.5.3. <code>hidden()</code></h4>
<div class="paragraph">
-<p>The <code>name()</code> attribute can be used to override the name of the column. References to other objects are generally mapped as foreign key columns. If there are multiple references to a given type, then you will want to override the name that JDO/DataNucleus would otherwise default.</p>
+<p>The <code>hidden()</code> attribute indicates where (in the UI) the collection should be hidden from the user. This attribute can also be applied to <a href="#_rg_annotations_manpage-ActionLayout_hidden">actions</a> and <a href="#_rg_annotations_manpage-PropertyLayout_hidden">properties</a>.</p>
+</div>
+<div class="admonitionblock tip">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-tip" title="Tip"></i>
+</td>
+<td class="content">
+<div class="paragraph">
+<p>It is also possible to use <a href="#_rg_annotations_manpage-Collection_hidden"><code>@Collection#hidden()</code></a> to hide an action at the domain layer. Both options are provided with a view that in the future the view-layer semantics may be under the control of (expert) users, whereas domain-layer semantics should never be overridden or modified by the user.</p>
+</div>
+</td>
+</tr>
+</table>
</div>
<div class="paragraph">
-<p>For example (taken from <a href="http://github.com/estatio/estatio">estatio</a> app):</p>
+<p>For example:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">PartyRelationship</span> {
- <span class="annotation">@Column</span>(name = <span class="string"><span class="delimiter">"</span><span class="content">fromPartyId</span><span class="delimiter">"</span></span>, allowsNull = <span class="string"><span class="delimiter">"</span><span class="content">false</span><span class="delimiter">"</span></span>)
- <span class="directive">public</span> Party getFrom() { ... }
- <span class="directive">public</span> <span class="type">void</span> setFrom(Party from) { ... }
- <span class="annotation">@Column</span>(name = <span class="string"><span class="delimiter">"</span><span class="content">toPartyId</span><span class="delimiter">"</span></span>, allowsNull = <span class="string"><span class="delimiter">"</span><span class="content">false</span><span class="delimiter">"</span></span>)
- <span class="directive">public</span> Party getTo() { ... }
- <span class="directive">public</span> <span class="type">void</span> setTo(Party to) { ... }
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">ToDoItem</span> {
+ <span class="annotation">@CollectionLayout</span>(
+ hidden=Where.EVERYWHERE
+ <span class="directive">public</span> <span class="predefined-type">SortedSet</span><ToDoItem> getDependencies() { ... }
...
}</code></pre>
</div>
</div>
+<div class="paragraph">
+<p>The acceptable values for the <code>where</code> parameter are:</p>
</div>
+<div class="ulist">
+<ul>
+<li>
+<p><code>Where.EVERYWHERE</code> or <code>Where.ANYWHERE</code><br></p>
+<div class="paragraph">
+<p>The collection should be hidden everywhere.</p>
</div>
-<div class="sect2">
-<h3 id="_mapping_code_blob_code_s_and_code_clob_code_s">3.5. Mapping <code>Blob</code>s and <code>Clob</code>s</h3>
+</li>
+<li>
+<p><code>Where.ANYWHERE</code><br></p>
<div class="paragraph">
-<p>Isis provides custom value types for <a href="#_rg_classes_value-types_manpage-Blob"><code>Blob</code></a>s and <a href="#_rg_classes_value-types_manpage-Clob"><code>Clob</code></a>s. These value types have multiple internal fields, meaning that they corresponding to multiple columns in the database. Mapping this correctly requires using <code>@Column</code> within JDO’s <code>@Persistent</code> annotation.</p>
+<p>Synonym for everywhere.</p>
</div>
+</li>
+<li>
+<p><code>Where.OBJECT_FORMS</code><br></p>
<div class="paragraph">
-<p>For example, here’s how to map a <code>Blob</code> (taken from (non-ASF) <a href="http://github.com/isisaddons/isis-app-todoapp">Isis addons' todoapp</a>):</p>
+<p>The collection should be hidden when displayed within an object form.</p>
</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">private</span> <span class="predefined-type">Blob</span> attachment;
-<span class="annotation">@javax</span>.jdo.annotations.Persistent(defaultFetchGroup=<span class="string"><span class="delimiter">"</span><span class="content">false</span><span class="delimiter">"</span></span>, columns = {
- <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">attachment_name</span><span class="delimiter">"</span></span>),
- <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">attachment_mimetype</span><span class="delimiter">"</span></span>),
- <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">attachment_bytes</span><span class="delimiter">"</span></span>, jdbcType = <span class="string"><span class="delimiter">"</span><span class="content">BLOB</span><span class="delimiter">"</span></span>, sqlType = <span class="string"><span class="delimiter">"</span><span class="content">LONGVARBINARY</span><span class="delimiter">"</span></span>)
-})
-<span class="annotation">@Property</span>(
- domainEvent = AttachmentDomainEvent.class,
- optionality = Optionality.OPTIONAL
-)
-<span class="directive">public</span> <span class="predefined-type">Blob</span> getAttachment() { ... }
-<span class="directive">public</span> <span class="type">void</span> setAttachment(<span class="predefined-type">Blob</span> attachment) { ... }</code></pre>
+</li>
+<li>
+<p><code>Where.NOWHERE</code><br></p>
+<div class="paragraph">
+<p>The collection should not be hidden.</p>
</div>
+</li>
+</ul>
</div>
<div class="paragraph">
-<p>And here’s how to map a <code>Clob</code> (also taken from the todoapp):</p>
+<p>The other values of the <code>Where</code> enum have no meaning for a collection.</p>
+</div>
+<div class="paragraph">
+<p>As an alternative to using the annotation, the dynamic <a href="#_rg_object-layout_dynamic"><code>.layout.json</code></a>
+can be used instead, eg:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">private</span> <span class="predefined-type">Clob</span> doc;
-<span class="annotation">@javax</span>.jdo.annotations.Persistent(defaultFetchGroup=<span class="string"><span class="delimiter">"</span><span class="content">false</span><span class="delimiter">"</span></span>, columns = {
- <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">doc_name</span><span class="delimiter">"</span></span>),
- <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">doc_mimetype</span><span class="delimiter">"</span></span>),
- <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">doc_chars</span><span class="delimiter">"</span></span>, jdbcType = <span class="string"><span class="delimiter">"</span><span class="content">CLOB</span><span class="delimiter">"</span></span>, sqlType = <span class="string"><span class="delimiter">"</span><span class="content">LONGVARCHAR</span><span class="delimiter">"</span></span>)
-})
-<span class="annotation">@Property</span>(
- optionality = Optionality.OPTIONAL
-)
-<span class="directive">public</span> <span class="predefined-type">Clob</span> getDoc() { ... }
-<span class="directive">public</span> <span class="type">void</span> setDoc(<span class="directive">final</span> <span class="predefined-type">Clob</span> doc) { ... }</code></pre>
+<pre class="CodeRay highlight"><code data-lang="javascript"><span class="string"><span class="delimiter">"</span><span class="content">dependencies</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">collectionLayout</span><span class="delimiter">"</span></span>: { <span class="key"><span class="delimiter">"</span><span class="content">hidden</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">EVERYWHERE</span><span class="delimiter">"</span></span> }
+}</code></pre>
</div>
</div>
</div>
-<div class="sect2">
-<h3 id="_rg_annotations_manpage-Digits">3.6. <code>@Digits</code> (<code>javax</code>)</h3>
+<div class="sect3">
+<h4 id="_rg_annotations_manpage-CollectionLayout_named">2.5.4. <code>named()</code></h4>
<div class="paragraph">
-<p>The <code>@javax.validation.constraints.Digits</code> annotation is recognized by Apache Isis as a means to specify the precision for properties and action parameters of type <code>java.math.BigDecimal</code>.</p>
+<p>The <code>named()</code> attribute explicitly specifies the collection’s name, overriding the name that would normally be inferred from the Java source code. This attribute can also be specified for <a href="#_rg_annotations_manpage-ActionLayout_named">actions</a>, <a href="#_rg_annotations_manpage-PropertyLayout_named">properties</a>, <a href="#_rg_annotations_manpage-ParameterLayout_named">parameters</a>, <a href="#_rg_annotations_manpage-DomainObjectLayout_named">domain objects</a>, <a href="#_rg_annotations_manpage-ViewModelLayout_named">view models</a> and <a href="#_rg_annotations_manpage-DomainServiceLayout_named">domain services</a>.</p>
</div>
+<div class="admonitionblock tip">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-tip" title="Tip"></i>
+</td>
+<td class="content">
<div class="paragraph">
-<p>For example (taken from the (non-ASF) <a href="http://github.com/isisaddons/isis-app-todoapp">Isis addons' todoapp</a>):</p>
+<p>Following the <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself">don’t repeat yourself</a> principle, we recommend that you only use this attribute when the desired name cannot be used in Java source code. Examples of that include a name that would be a reserved Java keyword (eg "package"), or a name that has punctuation, eg apostrophes.</p>
</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@javax</span>.jdo.annotations.Column(
- scale=<span class="integer">2</span> <i class="conum" data-value="1"></i><b>(1)</b>
-)
-<span class="annotation">@javax</span>.validation.constraints.Digits(
- integer=<span class="integer">10</span>,
- fraction=<span class="integer">2</span> <i class="conum" data-value="2"></i><b>(2)</b>
-)
-<span class="directive">public</span> <span class="predefined-type">BigDecimal</span> getCost() {
- <span class="keyword">return</span> cost;
-}
-<span class="directive">public</span> <span class="type">void</span> setCost(<span class="directive">final</span> <span class="predefined-type">BigDecimal</span> cost) {
- <span class="local-variable">this</span>.cost = cost!=<span class="predefined-constant">null</span>
- ? cost.setScale(<span class="integer">2</span>, <span class="predefined-type">BigDecimal</span>.ROUND_HALF_EVEN) <i class="conum" data-value="3"></i><b>(3)</b>
- :<span class="predefined-constant">null</span>;
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
+<p>By default the name is HTML escaped. To allow HTML markup, set the related <code>namedEscaped()</code> attribute to <code>false</code>.</p>
+</div>
+<div class="paragraph">
+<p>For example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">ToDoItem</span> {
+ <span class="annotation">@CollectionLayout</span>(
+ named=<span class="string"><span class="delimiter">"</span><span class="content">Todo items that are <i>dependencies</i> of this item</span><span class="delimiter">"</span></span>,
+ namedEscaped=<span class="predefined-constant">false</span>
+ )
+ <span class="directive">public</span> <span class="predefined-type">SortedSet</span><ToDoItem getDependencies() { ... }
+ ...
}</code></pre>
</div>
</div>
-<div class="colist arabic">
+<div class="paragraph">
+<p>As an alternative to using the annotation, the dynamic <a href="#_rg_object-layout_dynamic"><code>.layout.json</code></a>
+can be used instead, eg:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="javascript"><span class="string"><span class="delimiter">"</span><span class="content">dependencies</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">collectionLayout</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">named</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Todo items that are <i>dependencies</i> of this item</span><span class="delimiter">"</span></span>,
+ <span class="key"><span class="delimiter">"</span><span class="content">namedEscaped</span><span class="delimiter">"</span></span>: <span class="predefined-constant">false</span>,
+ }
+}</code></pre>
+</div>
+</div>
+<div class="admonitionblock tip">
<table>
<tr>
-<td><i class="conum" data-value="1"></i><b>1</b></td>
-<td>the <a href="#_rg_annotations_manpage-Column"><code>@Column#scale()</code></a> attribute must be …​</td>
-</tr>
-<tr>
-<td><i class="conum" data-value="2"></i><b>2</b></td>
-<td>…​ consistent with <code>@Digits#fraction()</code></td>
-</tr>
-<tr>
-<td><i class="conum" data-value="3"></i><b>3</b></td>
-<td>the correct idiom when setting a new value is to normalized to the correct scale</td>
+<td class="icon">
+<i class="fa icon-tip" title="Tip"></i>
+</td>
+<td class="content">
+<div class="paragraph">
+<p>The framework also provides a separate, powerful mechanism for <a href="ug.html#_ug_more-advanced_i18n">internationalization</a>.</p>
+</div>
+</td>
</tr>
</table>
</div>
</div>
-<div class="sect2">
-<h3 id="_rg_annotations_manpage-Discriminator">3.7. <code>@Discriminator</code> (<code>javax.jdo</code>)</h3>
-<div class="paragraph">
-<p>The <code>@javax.jdo.annotation.Discriminator</code> is used by JDO/DataNucleus to specify how to discriminate between subclasses of an inheritance hierarchy.</p>
-</div>
+<div class="sect3">
+<h4 id="_rg_annotations_manpage-CollectionLayout_paged">2.5.5. <code>paged()</code></h4>
<div class="paragraph">
-<p>It is valid to add a <code>@Discriminator</code> for any class, even those not part of an explicitly mapped inheritance hierarchy. Apache Isis also checks for this annotation, and if present will use the <code>@Discriminator#value()</code> as the object type, a unique alias for the object’s class name.</p>
+<p>The <code>paged()</code> attribute specifies the number of rows to display in a (parented) collection. This attribute can also be applied to <a href="#_rg_annotations_manpage-DomainObjectLayout_paged">domain objects</a> and <a href="#_rg_annotations_manpage-ViewModelLayout_paged">view models</a>.</p>
</div>
-<div class="admonitionblock note">
+<div class="admonitionblock warning">
<table>
<tr>
<td class="icon">
-<i class="fa icon-note" title="Note"></i>
+<i class="fa icon-warning" title="Warning"></i>
</td>
<td class="content">
<div class="paragraph">
-<p>Isis parses the <code>@Discriminator</code> annotation from the Java source code; it does not query the JDO metamodel. This means that it the <code>@Discriminator</code> annotation must be used rather than the equivalent <code><discriminator></code> <a href="http://www.datanucleus.org/products/accessplatform_4_0/jdo/orm/inheritance.html">XML metadata</a>.</p>
+<p>The <a href="ug.html#<em>ug_restfulobjects-viewer">RestfulObjects viewer</a> currently does not support paging. The <a href="ug.html#_ug_wicket-viewer">Wicket viewer</a> _does</em> support paging, but note that the paging is performed client-side rather than server-side.</p>
</div>
<div class="paragraph">
-<p>Moreover, while JDO/DataNucleus will recognize annotations on either the field or the getter method, Apache Isis (currently) only inspects the getter method. Therefore ensure that the annotation is placed there.</p>
+<p>We therefore recommend that large collections should instead be modelled as actions (to allow filtering to be applied to limit the number of rows).</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
-<p>The object type is used internally by Apache Isis to generate a string representation of an objects identity (the <code>Oid</code>). This can appear in several contexts, including:</p>
-</div>
-<div class="ulist">
-<ul>
-<li>
-<p>as the value of <code>o.a.i.applib.services.bookmark.Bookmark#getObjectType()</code></p>
-</li>
-<li>
-<p>in the <code>toString()</code> value of <code>Bookmark</code></p>
-</li>
-<li>
-<p>in the URLs of the <a href="ug.html#_ug_restfulobjects-viewer">RestfulObjects viewer</a></p>
-</li>
-<li>
-<p>in the URLs of the <a href="ug.html#_ug_wicket-viewer">Wicket viewer</a> (in general and in particular if <a href="ug.html#_ug_wicket-viewer_features_hints-and-copy-url">copying URLs</a>)</p>
-</li>
-<li>
-<p>in XML snapshots generated by the <a href="#_rg_services-api_manpage-XmlSnapshotService"><code>XmlSnapshotService</code></a></p>
-</li>
-</ul>
-</div>
-<div class="paragraph">
<p>For example:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@javax</span>.jdo.annotations.Discriminator(value=<span class="string"><span class="delimiter">"</span><span class="content">custmgmt.Customer</span><span class="delimiter">"</span></span>)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
- ...
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">Order</span> {
+ <span class="annotation">@CollectionLayout</span>(paged=<span class="integer">15</span>)
+ <span class="directive">public</span> <span class="predefined-type">SortedSet</span><OrderLine> getDetails() {...}
}</code></pre>
</div>
</div>
<div class="paragraph">
-<p>has an object type of <code>custmgmt.Customer</code>.</p>
+<p>It is also possible to specify a global default for the page size of standalone collections, using the <a href="#_rg_runtime_configuring-core">configuration property</a> <code>isis.viewer.paged.parented</code>.</p>
</div>
<div class="paragraph">
-<p>If the object type has not been specified, then Apache Isis will use the fully qualified class name of the entity.</p>
+<p>As an alternative to using the annotation, the dynamic <a href="#_rg_object-layout_dynamic"><code>.layout.json</code></a>
+can be used instead, eg:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="javascript"><span class="string"><span class="delimiter">"</span><span class="content">details</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">collectionLayout</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">paged</span><span class="delimiter">"</span></span>: <span class="integer">15</span>
+ }
+}</code></pre>
+</div>
</div>
-<div class="admonitionblock tip">
-<table>
-<tr>
-<td class="icon">
-<i class="fa icon-tip" title="Tip"></i>
-</td>
-<td class="content">
-<div class="paragraph">
-<p>This might be obvious, but to make explicit: we recommend that you use namespaces of some form or other.</p>
</div>
+<div class="sect3">
+<h4 id="_rg_annotations_manpage-CollectionLayout_render">2.5.6. <code>render()</code></h4>
<div class="paragraph">
-<p>If the object type has not been specified (by either this annotation, or by <a href="#_rg_annotations_manpage-PersistenceCapable"><code>@PersistenceCapable</code></a>, or by Apache Isis' own <a href="#_rg_annotations_manpage-DomainObject_objectType"><code>@DomainObject#objectType()</code></a> annotation/attribute), then (as noted above) Apache Isis will use the fully qualified class name of the entity.</p>
+<p>The <code>render()</code> attribute specifies that the collection be rendered either "eagerly" (shown open, displaying its contents) or "lazily" (shown closed, hiding its contents). The terminology here is based on the similar concept of lazy loading of collections in the domain/persistence layer boundary (except that the rendering relates to the presentation/domain layer boundary).</p>
</div>
<div class="paragraph">
-<p>However, chances are that the fully qualified class name is liable to change over time, for example if the code is refactored or (more fundamentally) if your company/organization reorganizes/renames itself/is acquired.</p>
+<p>For example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">Order</span> {
+ <span class="annotation">@CollectionLayout</span>(render=RenderType.EAGERLY)
+ <span class="directive">public</span> <span class="predefined-type">SortedSet</span><LineItem> getDetails() { ... }
+ ...
+}</code></pre>
+</div>
</div>
<div class="paragraph">
-<p>We therefore strongly recommend that you specify an object type for all entities, one way or another. Specifying <code>@Discriminator</code> will override <code>@PersistenceCapable</code>, which overrides <code>@DomainObject#objectType()</code>. Using <code>@PersistenceCapable#schema()</code> is probably the best choice in most cases.</p>
+<p>As an alternative to using the annotation, the dynamic <a href="#_rg_object-layout_dynamic"><code>.layout.json</code></a>
+can be used instead, eg:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="javascript"><span class="string"><span class="delimiter">"</span><span class="content">details</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">collectionLayout</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">render</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">EAGERLY</span><span class="delimiter">"</span></span>
+ }
+}</code></pre>
</div>
-</td>
-</tr>
-</table>
</div>
<div class="admonitionblock note">
<table>
@@ -4291,119 +4394,35 @@ wrapping the target object using the <a href="#_rg_services-api_manpage-WrapperF
</td>
<td class="content">
<div class="paragraph">
-<p>If the object type is not unique across all domain classes then the framework will fail-fast and fail to boot. An error message will be printed in the log to help you determine which classes have duplicate object tyoes.</p>
+<p>Note that <a href="ug.html#_ug_how-tos_contributed-members">contributed collections</a> (which, under the covers are just action invocations against a domain service) are always rendered eagerly.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
-<div class="sect2">
-<h3 id="_rg_annotations_manpage-DomainObject">3.8. <code>@DomainObject</code></h3>
-<div class="paragraph">
-<p>The <code>@DomainObject</code> annotation applies to domain objects, collecting together all domain semantics within a single annotation.</p>
-</div>
+<div class="sect3">
+<h4 id="_rg_annotations_manpage-CollectionLayout_sortedBy">2.5.7. <code>sortedBy()</code></h4>
<div class="paragraph">
-<p>The table below summarizes the annotation’s attributes.</p>
+<p>The <code>sortedBy()</code> attribute specifies that the collection be ordered using the specified comparator, rather than the natural ordering of the entity (as would usually be the case).</p>
</div>
-<table class="tableblock frame-all grid-all spread">
-<caption class="title">Table 11. <code>@DomainObject</code> attributes</caption>
-<colgroup>
-<col style="width: 25%;">
-<col style="width: 25%;">
-<col style="width: 50%;">
-</colgroup>
-<thead>
-<tr>
-<th class="tableblock halign-left valign-top">Attribute</th>
-<th class="tableblock halign-left valign-top">Values (default)</th>
-<th class="tableblock halign-left valign-top">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-DomainObject_auditing"><code>auditing()</code></a></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AS_CONFIGURED</code>, <code>ENABLED</code>, <code>DISABLED</code><br>
-(<code>AS_CONFIGURED</code>)</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>indicates whether each of the changed properties of an object should be submitted to the registered <a href="#_rg_services-spi_manpage-AuditingService"><code>AuditingService</code></a>.</p>
-</div></div></td>
-</tr>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-DomainObject_autoCompleteRepository"><code>autoCompleteRepository()</code></a></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock">Domain service class</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>nominate a method on a domain service to be used for looking up instances of the domain object</p>
-</div></div></td>
-</tr>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><code>autoCompleteAction()</code></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock">Method name<br>
-(<code>autoComplete()</code>)</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>override the method name to use on the auto-complete repository</p>
-</div></div></td>
-</tr>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-DomainObject_bounded"><code>bounded()</code></a></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><code>true</code>, <code>false</code><br>
-(<code>false</code>)</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>Whether the number of instances of this domain class is relatively small (a "bounded" set), such that instances could be selected from a drop-down list box or similar.</p>
-</div></div></td>
-</tr>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-DomainObject_editing"><code>editing()</code></a></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AS_CONFIGURED</code>, <code>ENABLED</code>, <code>DISABLED</code><br>
-(<code>AS_CONFIGURED</code>)</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>whether the object’s properties and collections can be edited or not (ie whether the instance should be considered to be immutable)</p>
-</div></div></td>
-</tr>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-DomainObject_nature"><code>nature()</code></a></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><code>NOT_SPECIFIED</code>, <code>JDO_ENTITY</code>, <code>EXTERNAL_ENTITY</code>, <code>INMEMORY_ENTITY</code>, <code>VIEW_MODEL</code> (<code>NOT_SPECIFIED</code>)</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>whether the domain object logically is an entity (part of the domain layer) or is a view model (part of the application layer); and if an entity, how is its persistence managed</p>
-</div></div></td>
-</tr>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-DomainObject_objectType"><code>objectType()</code></a></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock">(none, which implies fully qualified class name)</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>specify an alias for the domain class used to uniquely identify the object both within the Apache Isis runtime and externally</p>
-</div></div></td>
-</tr>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rg_annotations_manpage-DomainObject_publishing"><code>publishing()</code></a></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AS_CONFIGURED</code>, <code>ENABLED</code>, <code>DISABLED</code><br>
-(<code>AS_CONFIGURED</code>)</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>whether changes to the object should be published to the registered <a href="#_rg_services-spi_manpage-PublishingService"><code>PublishingService</code></a>.</p>
-</div></div></td>
-</tr>
-<tr>
-<td class="tableblock halign-left valign-top"><p class="tableblock"><code>publishing-</code><br>
-<code>PayloadFactory()</code></p></td>
-<td class="tableblock halign-left valign-top"><p class="tableblock">subtype of <code>PublishingPayloadFactory-</code> <code>ForObject</code> (none)</p></td>
-<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>specifies that a custom implementation of <code>PublishingPayloadFactoryForObject</code> be used to create the (payload of the) published event representing the change to the object</p>
-</div></div></td>
-</tr>
-</tbody>
-</table>
<div class="paragraph">
<p>For example:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@DomainObject</span>(
- auditing=Auditing.ENABLED,
- autoCompleteRepository=CustomerRepository.class
- editing=Editing.ENABLED, <i class="conum" data-value="1"></i><b>(1)</b>
- publishing=Publishing.ENABLED
-)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">ToDoItem</span> <span class="directive">implements</span> <span class="predefined-type">Comparable</span><ToDoItem> { <i class="conum" data-value="1"></i><b>(1)</b>
+ <span class="directive">public</span> <span class="directive">static</span> <span class="type">class</span> <span class="class">DependenciesComparator</span> <i class="conum" data-value="2"></i><b>(2)</b>
+ <span class="directive">implements</span> <span class="predefined-type">Comparator</span><ToDoItem> {
+ <span class="annotation">@Override</span>
+ <span class="directive">public</span> <span class="type">int</span> compare(ToDoItem p, ToDoItem q) {
+ <span class="keyword">return</span> ORDERING_BY_DESCRIPTION <i class="conum" data-value="3"></i><b>(3)</b>
+ .compound(Ordering.<ToDoItem>natural())
+ .compare(p, q);
+ }
+ }
+ <span class="annotation">@CollectionLayout</span>(sortedBy=DependenciesComparator.class) <i class="conum" data-value="4"></i><b>(4)</b>
+ <span class="directive">public</span> <span class="predefined-type">SortedSet</span><ToDoItem> getDependencies() { ... }
...
}</code></pre>
</div>
@@ -4412,347 +4431,288 @@ wrapping the target object using the <a href="#_rg_services-api_manpage-WrapperF
<table>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
-<td>default value, so could be omitted</td>
+<td>the class has a natural ordering (implementation not shown)</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="2"></i><b>2</b></td>
+<td>declaration of the comparator class</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="3"></i><b>3</b></td>
+<td>ordering defined as being by the object’s <code>description</code> property (not shown), and then by the natural ordering of the class</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="4"></i><b>4</b></td>
+<td>specify the comparator to use</td>
</tr>
</table>
</div>
-<div class="sect3">
-<h4 id="_rg_annotations_manpage-DomainObject_auditing">3.8.1. <code>auditing()</code></h4>
-<div class="paragraph">
-<p>The <code>auditing()</code> attribute indicates that if the object is modified, then each of its changed properties should be submitted to the <a href="#_rg_services-spi_manpage-AuditingService"><code>AuditingService</code></a>, if one has been configured.</p>
-</div>
<div class="paragraph">
-<p>The default value for the attribute is <code>AS_CONFIGURED</code>, meaning that the <a href="#_rg_runtime_configuring-core">configuration property</a> <code>isis.services.audit.objects</code> is used to determine the whether the action is published:</p>
+<p>When the <code>dependencies</code> collection is rendered, the elements are sorted by the <code>description</code> property first:</p>
</div>
-<div class="ulist">
-<ul>
-<li>
-<p><code>all</code><br></p>
-<div class="paragraph">
-<p>all changed objects are published</p>
-</div>
-</li>
-<li>
-<p><code>none</code><br></p>
-<div class="paragraph">
-<p>no changed objects are published</p>
+<div class="imageblock">
+<div class="content">
+<a class="image" href="images/reference-annotations/CollectionLayout/sortedby-dependencies.png"><img src="images/reference-annotations/CollectionLayout/sortedby-dependencies.png" alt="sortedby dependencies" width="720px"></a>
</div>
-</li>
-</ul>
</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
<div class="paragraph">
-<p>If there is no configuration property in <code>isis.properties</code> then auditing is automatically enabled for domain objects.</p>
+<p>Note that this screenshot shows an earlier version of the <a href="ug.html#_ug_wicket-viewer">Wicket viewer</a> UI (specifically, pre 1.8.0).</p>
+</div>
+</td>
+</tr>
+</table>
</div>
<div class="paragraph">
-<p>This default can be overridden on an object-by-object basis; if <code>auditing()</code> is set to <code>ENABLED</code> then changed properties of instances of the domain class are audited irrespective of the configured value; if set to <code>DISABLED</code> then the changed properties of instances are <em>not</em> audited, again irrespective of the configured value.</p>
+<p>Without this annotation, the order would have been inverted (because the natural ordering places items not completed before those items that have been completed.</p>
</div>
<div class="paragraph">
-<p>For example:</p>
+<p>As an alternative to using the annotation, the dynamic <a href="#_rg_object-layout_dynamic"><code>.layout.json</code></a>
+can be used instead, eg:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@DomainObject</span>(
- auditing=Auditing.ENABLED <i class="conum" data-value="1"></i><b>(1)</b>
-)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
- ...
+<pre class="CodeRay highlight"><code data-lang="javascript"><span class="string"><span class="delimiter">"</span><span class="content">dependencies</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">collectionLayout</span><span class="delimiter">"</span></span>: {
+ <span class="key"><span class="delimiter">"</span><span class="content">sortedBy</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">com.mycompany.myapp.dom.ToDoItem.DependenciesComparator</span><span class="delimiter">"</span></span>
+ }
}</code></pre>
</div>
</div>
-<div class="colist arabic">
-<table>
-<tr>
-<td><i class="conum" data-value="1"></i><b>1</b></td>
-<td>because set to enabled, will be audited irrespective of the configured value.</td>
-</tr>
-</table>
</div>
</div>
-<div class="sect3">
-<h4 id="_rg_annotations_manpage-DomainObject_autoCompleteRepository">3.8.2. <code>autoCompleteRepository()</code></h4>
+<div class="sect2">
+<h3 id="_rg_annotations_manpage-Column">2.6. <code>@Column</code> (<code>javax.jdo</code>)</h3>
<div class="paragraph">
-<p>The <code>autoCompleteRepository()</code> attribute nominates a single method on a domain service as the fallback means for lookuping up instances of the domain object using a simple string.</p>
+<p>The JDO <code>@javax.jdo.annotation.Column</code> provides metadata describing how JDO/DataNucleus should persist the property to a database RDBMS table column (or equivalent concept for other persistence stores).</p>
</div>
<div class="paragraph">
-<p>For example, this might search for a customer by their name or number. Or it could search for a country based on its ISO-3 code or user-friendly name.</p>
+<p>Apache Isis also parses and interprets this annotation in order to build up aspects of its metamodel.</p>
</div>
-<div class="admonitionblock tip">
+<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
-<i class="fa icon-tip" title="Tip"></i>
+<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
-<p>If you require additional control - for example restricting the returned results based on the object being interacted with - then use the <a href="#_rg_methods_prefixes_manpage-autoComplete"><code>autoComplete…​()</code></a> supporting method instead.</p>
+<p>Isis parses the <code>@Column</code> annotation from the Java source code; it does not query the JDO metamodel. This means that it the <code>@Column</code> annotation must be used rather than the equivalent <code><column></code> <a href="http://www.datanucleus.org/products/accessplatform_4_0/jdo/orm/schema_mapping.html">XML metadata</a>.</p>
+</div>
+<div class="paragraph">
+<p>Moreover, while JDO/DataNucleus will recognize annotations on either the field or the getter method, Apache Isis (currently) only inspects the getter method. Therefore ensure that the annotation is placed there.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
+<p>This section identifies which attributes of <code>@Column</code> are recognized and used by Apache Isis.</p>
+</div>
+<div class="sect3">
+<h4 id="_nullability">2.6.1. Nullability</h4>
+<div class="paragraph">
+<p>The <code>allowsNull()</code> attribute is used to specify if a property is mandatory or is optional.</p>
+</div>
+<div class="paragraph">
<p>For example:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@AutoComplete</span>(
- autoCompleteRepository=Customers.class
-)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> <span class="directive">extends</span> AbstractDomainObject {
- ....
-}</code></pre>
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
+ <span class="annotation">@javax</span>.jdo.annotations.Column(allowNulls=<span class="string"><span class="delimiter">"</span><span class="content">true</span><span class="delimiter">"</span></span>)
+ <span class="directive">public</span> <span class="predefined-type">String</span> getMiddleInitial() { ... }
+ <span class="directive">public</span> <span class="type">void</span> setMiddleInitial(<span class="predefined-type">String</span> middleInitial) { ... }</code></pre>
</div>
</div>
<div class="paragraph">
-<p>where:</p>
+<p>Isis also provides <a href="#_rg_annotations_manpage-Property_optionality"><code>@Property#optionality()</code></a> attribute. If both are specified, Apache Isis will check when it initializes for any contradictions, and will fail-fast with an appropriate error message in the log if there are.</p>
</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">interface</span> <span class="class">Customers</span> {
- <span class="annotation">@Programmatic</span> <i class="conum" data-value="1"></i><b>(1)</b>
- <span class="predefined-type">List</span><Customer> autoComplete(<span class="predefined-type">String</span> search); <i class="conum" data-value="2"></i><b>(2)</b>
- ...
-}</code></pre>
+<div class="paragraph">
+<p>You should also be aware that in the lack of either the <code>@Column#allowsNull()</code> or the <code>@Property#optionality()</code> attributes, that the JDO and Apache Isis defaults differ. Apache Isis rule is straight-forward: properties are assumed to be required. JDO on the other hand specifies that only primitive types are mandatory; everything else is assumed to be optional. Therefore a lack of either annotation can also trigger the fail-fast validation check.</p>
</div>
+<div class="paragraph">
+<p>In the vast majority of cases you should be fine just to add the <code>@Column#allowsNull()</code> attribute to the getter. But see the documentation for <a href="#_rg_annotations_manpage-Property_optionality"><code>@Property#optionality()</code></a> attribute for discussion on one or two minor edge cases.</p>
</div>
-<div class="colist arabic">
-<table>
-<tr>
-<td><i class="conum" data-value="1"></i><b>1</b></td>
-<td>do not expose in the UI</td>
-</tr>
-<tr>
-<td><i class="conum" data-value="2"></i><b>2</b></td>
-<td>is assumed to be called "autoComplete", and accepts a single string</td>
-</tr>
-</table>
</div>
-<div class="sect4">
-<h5 id="__code_autocompleteaction_code"><code>autoCompleteAction()</code></h5>
+<div class="sect3">
+<h4 id="_length_for_code_string_code_s">2.6.2. Length for <code>String</code>s</h4>
<div class="paragraph">
-<p>As noted above, by default the method invoked on the repository is assumed to be called "autoComplete". The optional <code>autoCompleteAction()</code> attribute allows the method on the repository to be overridden.</p>
+<p>The <code>length()</code> attribute is used to specify the length of <code>java.lang.String</code> property types as they map to <code>varchar(n)</code> columns.</p>
</div>
<div class="paragraph">
<p>For example:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@AutoComplete</span>(
- autoCompleteRepository=Customers.class,
- autoCompleteAction=<span class="string"><span class="delimiter">"</span><span class="content">findByCustomerName</span><span class="delimiter">"</span></span>
-)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> <span class="directive">extends</span> AbstractDomainObject {
- ....
-}</code></pre>
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
+ <span class="annotation">@javax</span>.jdo.annotations.Column(length=<span class="integer">20</span>)
+ <span class="directive">public</span> <span class="predefined-type">String</span> getFirstName() { ... }
+ <span class="directive">public</span> <span class="type">void</span> setFirstName(<span class="predefined-type">String</span> firstName) { ... }
+ <span class="annotation">@javax</span>.jdo.annotations.Column(allowNulls=<span class="string"><span class="delimiter">"</span><span class="content">true</span><span class="delimiter">"</span></span>, length=<span class="integer">1</span>)
+ <span class="directive">public</span> <span class="predefined-type">String</span> getMiddleInitial() { ... }
+ <span class="directive">public</span> <span class="type">void</span> setMiddleInitial(<span class="predefined-type">String</span> middleInitial) { ... }
+ <span class="annotation">@javax</span>.jdo.annotations.Column(length=<span class="integer">30</span>)
+ <span class="directive">public</span> <span class="predefined-type">String</span> getLastName() { ... }
+ <span class="directive">public</span> <span class="type">void</span> setLastName(<span class="predefined-type">String</span> lastName) { ... }</code></pre>
</div>
</div>
<div class="paragraph">
-<p>where in this case <code>findByCustomerName</code> might be an existing method already defined:</p>
+<p>Isis also provides <a href="#_rg_annotations_manpage-Property_maxLength"><code>@Property#maxLength()</code></a> attribute. If both are specified, Apache Isis will check when it initializes for any contradictions, and will fail-fast with an appropriate error message in the log if there are.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_length_scale_for_code_bigdecimal_code_s">2.6.3. Length/scale for <code>BigDecimal</code>s</h4>
+<div class="paragraph">
+<p>The <code>length()</code> and <code>scale()</code> attributes are used to infer the precision/scale of <code>java.math.BigDecimal</code> property types as they map to <code>decimal(n,p)</code> columns.</p>
+</div>
+<div class="paragraph">
+<p>For example:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">interface</span> <span class="class">Customers</span> {
- <span class="annotation">@Action</span>(semantics=SemanticsOf.SAFE)
- <span class="predefined-type">List</span><Customer> findByCustomerName(<span class="annotation">@ParameterLayout</span>(named=<span class="string"><span class="delimiter">"</span><span class="content">name</span><span class="delimiter">"</span></span>) <span class="predefined-type">String</span> name);
- ...
-}</code></pre>
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">Customer</span> {
+ <span class="annotation">@javax</span>.jdo.annotations.Column(length=<span class="integer">10</span>, scale=<span class="integer">2</span>)
+ <span class="directive">public</span> <span class="predefined-type">BigDecimal</span> getTotalOrdersToDate() { ... }
+ <span class="directive">public</span> <span class="type">void</span> setTotalOrdersToDate(<span class="predefined-type">BigDecimal</span> totalOrdersToDate) { ... }</code></pre>
+</div>
</div>
+<div class="paragraph">
+<p>For <code>BigDecimal</code>s it is also possible to specify the <a href="#<em>rg_annotations_manpage-Digits"><code>@Digits</code></a> annotation, whose form is <code>@Digits(integer, fraction)</code>. There is a subtle difference here: while <code>@Column#scale()</code> corresponds to <code>@Digits#fraction()</code>, the value of <code>@Column#length()</code> (ie the precision) is actually the _sum</em> of the <code>@Digits’ `integer()</code> and <code>fraction()</code> parts.</p>
</div>
+<div class="paragraph">
+<p>If both are specified, Apache Isis will check when it initializes for any contradictions, and will fail-fast with an appropriate error message in the log if there are.</p>
</div>
</div>
<div class="sect3">
-<h4 id="_rg_annotations_manpage-DomainObject_bounded">3.8.3. <code>bounded()</code></h4>
+<h4 id="_hints_and_tips">2.6.4. Hints and Tips</h4>
<div class="paragraph">
-<p>Some domain classes are immutable to the user, and moreover have only a fixed number of instances. Often these are "reference" ("standing") data, or lookup data/pick lists. Typical examples could include categories, countries, states, and tax or interest rate tables.</p>
+<p>This seems to be a good place to describe some additional common mappings that use <code>@Column</code>. Unlike the sections above, the attributes specified in these hints and tips aren’t actually part of Apache Isis metamodel.</p>
</div>
+<div class="sect4">
+<h5 id="_mapping_foreign_keys">Mapping foreign keys</h5>
<div class="paragraph">
-<p>Where the number of instances is relatively small, ie bounded, then the <code>bounded()</code> attribute can be used as a hint. For such domain objects the framework will automatically allow instances to be selected; <a href="ug.html#_ug_wicket-viewer">Wicket viewer</a> displays these as a drop-down list.</p>
+<p>The <code>name()</code> attribute can be used to override the name of the column. References to other objects are generally mapped as foreign key columns. If there are multiple references to a given type, then you will want to override the name that JDO/DataNucleus would otherwise default.</p>
</div>
<div class="paragraph">
-<p>For example:</p>
+<p>For example (taken from <a href="http://github.com/estatio/estatio">estatio</a> app):</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@DomainObject</span>(
- bounded=<span class="predefined-constant">true</span>,
- editing=Editing.DISABLED <i class="conum" data-value="1"></i><b>(1)</b>
-)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">Currency</span> {
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">PartyRelationship</span> {
+ <span class="annotation">@Column</span>(name = <span class="string"><span class="delimiter">"</span><span class="content">fromPartyId</span><span class="delimiter">"</span></span>, allowsNull = <span class="string"><span class="delimiter">"</span><span class="content">false</span><span class="delimiter">"</span></span>)
+ <span class="directive">public</span> Party getFrom() { ... }
+ <span class="directive">public</span> <span class="type">void</span> setFrom(Party from) { ... }
+ <span class="annotation">@Column</span>(name = <span class="string"><span class="delimiter">"</span><span class="content">toPartyId</span><span class="delimiter">"</span></span>, allowsNull = <span class="string"><span class="delimiter">"</span><span class="content">false</span><span class="delimiter">"</span></span>)
+ <span class="directive">public</span> Party getTo() { ... }
+ <span class="directive">public</span> <span class="type">void</span> setTo(Party to) { ... }
...
}</code></pre>
</div>
</div>
-<div class="colist arabic">
-<table>
-<tr>
-<td><i class="conum" data-value="1"></i><b>1</b></td>
-<td>This attribute is commonly combined with <code>editing=DISABLED</code> to enforce the fact that reference data is immutable</td>
-</tr>
-</table>
-</div>
-<div class="admonitionblock tip">
-<table>
-<tr>
-<td class="icon">
-<i class="fa icon-tip" title="Tip"></i>
-</td>
-<td class="content">
-<div class="paragraph">
-<p>There is nothing to prevent you from using this attribute for regular mutable entities, and indeed this is sometimes worth doing during early prototyping. However, if there is no realistic upper bound to the number of instances of an entity that might be created, generally you should use <a href="#_rg_methods_prefixes_manpage-autoComplete"><code>autoComplete…​()</code></a> supporting method or the <a href="#_rg_annotations_manpage-DomainObject_autoCompleteRepository"><code>@DomainObject#autoCompleteRepository()</code></a> attribute instead.</p>
-</div>
-</td>
-</tr>
-</table>
</div>
</div>
<div class="sect3">
-<h4 id="_rg_annotations_manpage-DomainObject_editing">3.8.4. <code>editing()</code></h4>
-<div class="paragraph">
-<p>The <code>editing()</code> attribute determines whether a domain object’s properties and collections are not editable (are read-only).</p>
-</div>
-<div class="paragraph">
-<p>The default is <code>AS_CONFIGURED</code>, meaning that the <a href="#_rg_runtime_configuring-core">configuration property</a> <code>isis.objects.editing</code> is used to determine the whether the object is modifiable:</p>
-</div>
-<div class="ulist">
-<ul>
-<li>
-<p><code>true</code><br></p>
+<h4 id="_mapping_code_blob_code_s_and_code_clob_code_s">2.6.5. Mapping <code>Blob</code>s and <code>Clob</code>s</h4>
<div class="paragraph">
-<p>the object’s properties and collections are modifiable.</p>
+<p>Isis provides custom value types for <a href="#_rg_classes_value-types_manpage-Blob"><code>Blob</code></a>s and <a href="#_rg_classes_value-types_manpage-Clob"><code>Clob</code></a>s. These value types have multiple internal fields, meaning that they corresponding to multiple columns in the database. Mapping this correctly requires using <code>@Column</code> within JDO’s <code>@Persistent</code> annotation.</p>
</div>
-</li>
-<li>
-<p><code>false</code><br></p>
<div class="paragraph">
-<p>the object’s properties and collections are read-only, ie <em>not</em> modifiable.</p>
+<p>For example, here’s how to map a <code>Blob</code> (taken from (non-ASF) <a href="http://github.com/isisaddons/isis-app-todoapp">Isis addons' todoapp</a>):</p>
</div>
-</li>
-</ul>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">private</span> <span class="predefined-type">Blob</span> attachment;
+<span class="annotation">@javax</span>.jdo.annotations.Persistent(defaultFetchGroup=<span class="string"><span class="delimiter">"</span><span class="content">false</span><span class="delimiter">"</span></span>, columns = {
+ <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">attachment_name</span><span class="delimiter">"</span></span>),
+ <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">attachment_mimetype</span><span class="delimiter">"</span></span>),
+ <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">attachment_bytes</span><span class="delimiter">"</span></span>, jdbcType = <span class="string"><span class="delimiter">"</span><span class="content">BLOB</span><span class="delimiter">"</span></span>, sqlType = <span class="string"><span class="delimiter">"</span><span class="content">LONGVARBINARY</span><span class="delimiter">"</span></span>)
+})
+<span class="annotation">@Property</span>(
+ domainEvent = AttachmentDomainEvent.class,
+ optionality = Optionality.OPTIONAL
+)
+<span class="directive">public</span> <span class="predefined-type">Blob</span> getAttachment() { ... }
+<span class="directive">public</span> <span class="type">void</span> setAttachment(<span class="predefined-type">Blob</span> attachment) { ... }</code></pre>
</div>
-<div class="paragraph">
-<p>If there is no configuration property in <code>isis.properties</code> then object are assumed to be modifiable.</p>
</div>
-<div class="admonitionblock tip">
-<table>
-<tr>
-<td class="icon">
-<i class="fa icon-tip" title="Tip"></i>
-</td>
-<td class="content">
<div class="paragraph">
-<p>In other words, editing can be disabled globally for an application by setting:</p>
+<p>And here’s how to map a <code>Clob</code> (also taken from the todoapp):</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="ini">isis.objects.editing=false</code></pre>
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">private</span> <span class="predefined-type">Clob</span> doc;
+<span class="annotation">@javax</span>.jdo.annotations.Persistent(defaultFetchGroup=<span class="string"><span class="delimiter">"</span><span class="content">false</span><span class="delimiter">"</span></span>, columns = {
+ <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">doc_name</span><span class="delimiter">"</span></span>),
+ <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">doc_mimetype</span><span class="delimiter">"</span></span>),
+ <span class="annotation">@javax</span>.jdo.annotations.Column(name = <span class="string"><span class="delimiter">"</span><span class="content">doc_chars</span><span class="delimiter">"</span></span>, jdbcType = <span class="string"><span class="delimiter">"</span><span class="content">CLOB</span><span class="delimiter">"</span></span>, sqlType = <span class="string"><span class="delimiter">"</span><span class="content">LONGVARCHAR</span><span class="delimiter">"</span></span>)
+})
+<span class="annotation">@Property</span>(
+ optionality = Optionality.OPTIONAL
+)
+<span class="directive">public</span> <span class="predefined-type">Clob</span> getDoc() { ... }
+<span class="directive">public</span> <span class="type">void</span> setDoc(<span class="directive">final</span> <span class="predefined-type">Clob</span> doc) { ... }</code></pre>
</div>
</div>
-<div class="paragraph">
-<p>We recommend enabling this feature; it will help drive out the underlying business operations (processes and procedures) that require objects to change; these can then be captured as business actions.</p>
</div>
-</td>
-</tr>
-</table>
</div>
+<div class="sect2">
+<h3 id="_rg_annotations_manpage-Digits">2.7. <code>@Digits</code> (<code>javax</code>)</h3>
<div class="paragraph">
-<p>The related <code>editingDisabledReason()</code> attribute specifies the a hard-coded reason why the object’s properties and collections cannot be modified directly.</p>
+<p>The <code>@javax.validation.constraints.Digits</code> annotation is recognized by Apache Isis as a means to specify the precision for properties and action parameters of type <code>java.math.BigDecimal</code>.</p>
</div>
<div class="paragraph">
-<p>This default can be overridden on an object-by-object basis; if <code>editing()</code> is set to <code>ENABLED</code> then the object’s properties and collections are editable irrespective of the configured value; if set to <code>DISABLED</code> then the object’s properties and collections are not editable irrespective of the configured value.</p>
-</div>
-<div class="paragraph">
-<p>For example:</p>
+<p>For example (taken from the (non-ASF) <a href="http://github.com/isisaddons/isis-app-todoapp">Isis addons' todoapp</a>):</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@DomainObject</span>(
- editing=Editing.DISABLED,
- editingDisabledReason=<span class="string"><span class="delimiter">"</span><span class="content">Reference data, so cannot be modified</span><span class="delimiter">"</span></span>
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@javax</span>.jdo.annotations.Column(
+ scale=<span class="integer">2</span> <i class="conum" data-value="1"></i><b>(1)</b>
)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">Country</span> {
- ...
+<span class="annotation">@javax</span>.validation.constraints.Digits(
+ integer=<span class="integer">10</span>,
+ fraction=<span class="integer">2</span> <i class="conum" data-value="2"></i><b>(2)</b>
+)
+<span class="directive">public</span> <span class="predefined-type">BigDecimal</span> getCost() {
+ <span class="keyword">return</span> cost;
+}
+<span class="directive">public</span> <span class="type">void</span> setCost(<span class="directive">final</span> <span class="predefined-type">BigDecimal</span> cost) {
+ <span class="local-variable">this</span>.cost = cost!=<span class="predefined-constant">null</span>
+ ? cost.setScale(<span class="integer">2</span>, <span class="predefined-type">BigDecimal</span>.ROUND_HALF_EVEN) <i class="conum" data-value="3"></i><b>(3)</b>
+ :<span class="predefined-constant">null</span>;
}</code></pre>
</div>
</div>
-<div class="admonitionblock tip">
+<div class="colist arabic">
<table>
<tr>
-<td class="icon">
-<i class="fa icon-tip" title="Tip"></i>
-</td>
-<td class="content">
-<div class="paragraph">
-<p>Another interesting example of immutable reference data is to define an entity to represent individual dates; after all, for a system with an expected lifetime of 20 years that equates to only 7,300 days, a comparatively tiny number of rows to hold in a database.</p>
-</div>
-</td>
+<td><i class="conum" data-value="1"></i><b>1</b></td>
+<td>the <a href="#_rg_annotations_manpage-Column"><code>@Column#scale()</code></a> attribute must be …​</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="2"></i><b>2</b></td>
+<td>…​ consistent with <code>@Digits#fraction()</code></td>
+</tr>
+<tr>
+<td><i class="conum" data-value="3"></i><b>3</b></td>
+<td>the correct idiom when setting a new value is to normalized to the correct scale</td>
</tr>
</table>
</div>
</div>
-<div class="sect3">
-<h4 id="_rg_annotations_manpage-DomainObject_nature">3.8.5. <code>nature()</code></h4>
-<div class="paragraph">
-<p>The <code>nature()</code> attribute is used to characterize the domain object as either an entity (part of the domain layer) or as a view model (part of the application layer). If the domain object should be thought of as an entity, it also captures how the persistence of that entity is managed.</p>
-</div>
-<div class="paragraph">
-<p>For example:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@DomainObject</span>(nature=Nature.VIEW_MODEL)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">PieChartAnalysis</span> {
- ...
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>Specifically, the nature must be one of:</p>
-</div>
-<div class="ulist">
-<ul>
-<li>
-<p><code>NOT_SPECIFIED,</code><br></p>
-<div class="paragraph">
-<p>(the default); specifies no paricular semantics for the domain class.</p>
-</div>
-</li>
-<li>
-<p><code>JDO_ENTITY</code><br></p>
-<div class="paragraph">
-<p>indicates that the domain object is an entity whose persistence is managed internally by Apache Isis, using the JDO/DataNucleus objectstore.</p>
-</div>
-</li>
-<li>
-<p><code>EXTERNAL_ENTITY</code><br></p>
-<div class="paragraph">
-<p>indicates that the domain objecct is a wrapper/proxy/stub (choose your term) to an entity that is managed by some related external system. For example, the domain object may hold just the URI to a RESTful resource of some third party REST service, or the id of some system accessible over SOAP.<br></p>
-</div>
-<div class="paragraph">
-<p>The identity of an external entity is determined solely by the state of entity’s properties. The framework will automatically recreate the domain object each time it is interacted with.</p>
-</div>
-</li>
-<li>
-<p><code>INMEMORY_ENTITY</code><br></p>
-<div class="paragraph">
-<p>indicates that the domain object is a wrapper/proxy/stub to a "synthetic" entity, for example one that is constructed from some sort of internal memory data structure.<br></p>
-</div>
-<div class="paragraph">
-<p>The identity of an inmemory entity is determined solely by the state of entity’s properties. The framework will automatically recreate the domain object each time it is interacted with.</p>
-</div>
-</li>
-<li>
-<p><code>VIEW_MODEL</code><br></p>
-<div class="paragraph">
-<p>indicates that the domain object is conceptually part of the application layer, and exists to surfaces behaviour and/or state that is aggregate of one or more domain entities.</p>
-</div>
-</li>
-</ul>
-</div>
+<div class="sect2">
+<h3 id="_rg_annotations_manpage-Discriminator">2.8. <code>@Discriminator</code> (<code>javax.jdo</code>)</h3>
<div class="paragraph">
-<p>The identity of an inmemory entity is determined solely by the state of entity’s properties. The framework will automatically recreate the domain object each time it is interacted with.</p>
+<p>The <code>@javax.jdo.annotation.Discriminator</code> is used by JDO/DataNucleus to specify how to discriminate between subclasses of an inheritance hierarchy.</p>
</div>
<div class="paragraph">
-<p>Those natures that indicate the domain object is an entity (of some sort or another) mean then that the domain object is considered to be part of the domain model layer. As such the domain object’s class cannot be annotated with <a href="#_rg_annotations_manpage-ViewModel"><code>@ViewModel</code></a> or implement the <a href="#_rg_classes_super_manpage-ViewModel"><code>ViewModel</code></a> interface.</p>
+<p>It is valid to add a <code>@Discriminator</code> for any class, even those not part of an explicitly mapped inheritance hierarchy. Apache Isis also checks for this annotation, and if present will use the <code>@Discriminator#value()</code> as the object type, a unique alias for the object’s class name.</p>
</div>
<div class="adm
<TRUNCATED>