http://git-wip-us.apache.org/repos/asf/isis-site/blob/2f475bbf/content/versions/2.0.0-M1/guides/rgcms/rgcms.html ---------------------------------------------------------------------- diff --git a/content/versions/2.0.0-M1/guides/rgcms/rgcms.html b/content/versions/2.0.0-M1/guides/rgcms/rgcms.html new file mode 100644 index 0000000..296e499 --- /dev/null +++ b/content/versions/2.0.0-M1/guides/rgcms/rgcms.html @@ -0,0 +1,7633 @@ +<!doctype html> +<html> + <head> + <!-- + 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. + --> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <!-- No caching headers --> + <meta http-equiv="cache-control" content="no-cache"> + <meta http-equiv="pragma" content="no-cache"> + <meta http-equiv="expires" content="-1"> + <title>Classes, Methods and Schema</title> + <link rel="icon" type="image/png" href="../../images/isis-favicon.png"> + <!-- + Based on DataNucleus' template, + that was in turn based on an earlier version of Apache Isis' template, + that was in turn based on Apache Deltaspike's template. + + This template uses + * Bootstrap v3.3.7 (https://getbootstrap.com/) for navbar. + * Bootstrap TOC plugin v0.4.1 (https://afeld.github.io/bootstrap-toc/) + for the table of contents. + * jQuery (necessary for Bootstrap's JavaScript plugins) + * Font-Awesome for some icons used by Asciidoctor + + Also: + * Bootswatch "flatly" theme for Bootstrap (https://bootswatch.com/flatly). + * slick.js (carousel) + * add a link to all headers (home-grown, adapted from blog posts) + * integration of elasticlunr.js (home-grown, adapted from blog posts) + --> + <link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/flatly/bootstrap.min.css" rel="stylesheet"> + <link href="../../css/bootstrap-toc/0.4.1/bootstrap-toc.min.css" rel="stylesheet"> + <link href="../../css/asciidoctor/foundation.css" rel="stylesheet"> + <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"> + <link href="../../css/slick/1.5.0/slick.css" rel="stylesheet"> + <link href="../../css/slick/1.5.0/slick-theme.css" rel="stylesheet"> + <link href="../../css/search-panel/search-panel.css" rel="stylesheet"> + <link href="../../css/header-links/header-links.css" rel="stylesheet"> + <link href="../../css/sticky-header/sticky-header.css" rel="stylesheet"> + <link href="../../css/customisations.css" rel="stylesheet"> + <!-- Coderay syntax formatter --> + <style type="text/css"> + /* Stylesheet for CodeRay to match GitHub theme | MIT License | http://foundation.zurb.com */ +/*pre.CodeRay {background-color:#f7f7f8;}*/ +.CodeRay .line-numbers{border-right:1px solid #d8d8d8;padding:0 0.5em 0 .25em} +.CodeRay span.line-numbers{display:inline-block;margin-right:.5em;color:rgba(0,0,0,.3)} +.CodeRay .line-numbers strong{color:rgba(0,0,0,.4)} +table.CodeRay{border-collapse:separate;border-spacing:0;margin-bottom:0;border:0;background:none} +table.CodeRay td{vertical-align: top;line-height:1.45} +table.CodeRay td.line-numbers{text-align:right} +table.CodeRay td.line-numbers>pre{padding:0;color:rgba(0,0,0,.3)} +table.CodeRay td.code{padding:0 0 0 .5em} +table.CodeRay td.code>pre{padding:0} +.CodeRay .debug{color:#fff !important;background:#000080 !important} +.CodeRay .annotation{color:#007} +.CodeRay .attribute-name{color:#000080} +.CodeRay .attribute-value{color:#700} +.CodeRay .binary{color:#509} +.CodeRay .comment{color:#998;font-style:italic} +.CodeRay .char{color:#04d} +.CodeRay .char .content{color:#04d} +.CodeRay .char .delimiter{color:#039} +.CodeRay .class{color:#458;font-weight:bold} +.CodeRay .complex{color:#a08} +.CodeRay .constant,.CodeRay .predefined-constant{color:#008080} +.CodeRay .color{color:#099} +.CodeRay .class-variable{color:#369} +.CodeRay .decorator{color:#b0b} +.CodeRay .definition{color:#099} +.CodeRay .delimiter{color:#000} +.CodeRay .doc{color:#970} +.CodeRay .doctype{color:#34b} +.CodeRay .doc-string{color:#d42} +.CodeRay .escape{color:#666} +.CodeRay .entity{color:#800} +.CodeRay .error{color:#808} +.CodeRay .exception{color:inherit} +.CodeRay .filename{color:#099} +.CodeRay .function{color:#900;font-weight:bold} +.CodeRay .global-variable{color:#008080} +.CodeRay .hex{color:#058} +.CodeRay .integer,.CodeRay .float{color:#099} +.CodeRay .include{color:#555} +.CodeRay .inline{color:#000} +.CodeRay .inline .inline{background:#ccc} +.CodeRay .inline .inline .inline{background:#bbb} +.CodeRay .inline .inline-delimiter{color:#d14} +.CodeRay .inline-delimiter{color:#d14} +.CodeRay .important{color:#555;font-weight:bold} +.CodeRay .interpreted{color:#b2b} +.CodeRay .instance-variable{color:#008080} +.CodeRay .label{color:#970} +.CodeRay .local-variable{color:#963} +.CodeRay .octal{color:#40e} +.CodeRay .predefined{color:#369} +.CodeRay .preprocessor{color:#579} +.CodeRay .pseudo-class{color:#555} +.CodeRay .directive{font-weight:bold} +.CodeRay .type{font-weight:bold} +.CodeRay .predefined-type{color:inherit} +.CodeRay .reserved,.CodeRay .keyword {color:#000;font-weight:bold} +.CodeRay .key{color:#808} +.CodeRay .key .delimiter{color:#606} +.CodeRay .key .char{color:#80f} +.CodeRay .value{color:#088} +.CodeRay .regexp .delimiter{color:#808} +.CodeRay .regexp .content{color:#808} +.CodeRay .regexp .modifier{color:#808} +.CodeRay .regexp .char{color:#d14} +.CodeRay .regexp .function{color:#404;font-weight:bold} +.CodeRay .string{color:#d20} +.CodeRay .string .string .string{background:#ffd0d0} +.CodeRay .string .content{color:#d14} +.CodeRay .string .char{color:#d14} +.CodeRay .string .delimiter{color:#d14} +.CodeRay .shell{color:#d14} +.CodeRay .shell .delimiter{color:#d14} +.CodeRay .symbol{color:#990073} +.CodeRay .symbol .content{color:#a60} +.CodeRay .symbol .delimiter{color:#630} +.CodeRay .tag{color:#008080} +.CodeRay .tag-special{color:#d70} +.CodeRay .variable{color:#036} +.CodeRay .insert{background:#afa} +.CodeRay .delete{background:#faa} +.CodeRay .change{color:#aaf;background:#007} +.CodeRay .head{color:#f8f;background:#505} +.CodeRay .insert .insert{color:#080} +.CodeRay .delete .delete{color:#800} +.CodeRay .change .change{color:#66f} +.CodeRay .head .head{color:#f4f} + </style> + </head> + <body data-spy="scroll" data-target="#toc"> + <div id="basedir" style="display:none;"> + ../../ + </div> + <div id="docname" style="display:none;"> + rgcms + </div> + <div id="filetype" style="display:none;"> + html + </div> + <!-- Navbar --> + <nav class="navbar navbar-default navbar-static-top header"> + <div class="container"> + <div class="navbar-header"> + <!-- Three line menu button for use on mobile screens --> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> + <a class="navbar-brand" href="../../index.html"> <img alt="Brand" src="../../images/isis-logo-48x48.png"> </a> + <a class="navbar-brand" href="../../index.html">Apache Isis</a> + </div> + <!-- Navbar that will collapse on mobile screens --> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Documentation<span class="caret"></span></a> + <ul class="dropdown-menu"> + <li><a href="../../documentation.html">Table of Contents</a></li> + <li role="separator" class="divider"></li> + <li class="dropdown-header">User Guides</li> + <li><a href="../../guides/ugfun/ugfun.html">Fundamentals</a></li> + <li><a href="../../guides/ugvw/ugvw.html">Wicket Viewer</a></li> + <li><a href="../../guides/ugvro/ugvro.html">Restful Objects Viewer</a></li> + <li><a href="../../guides/ugodn/ugodn.html">DataNucleus Object Store</a></li> + <li><a href="../../guides/ugsec/ugsec.html">Security</a></li> + <li><a href="../../guides/ugtst/ugtst.html">Testing</a></li> + <li><a href="../../guides/ugbtb/ugbtb.html">Beyond the Basics</a></li> + <li role="separator" class="divider"></li> + <li class="dropdown-header">Reference Guides</li> + <li><a href="../../guides/rgant/rgant.html">Annotations</a></li> + <li><a href="../../guides/rgsvc/rgsvc.html">Domain Services</a></li> + <li><a href="../../guides/rgcfg/rgcfg.html">Core Config' Properties</a></li> + <li><a href="../../guides/rgcms/rgcms.html">Classes, Methods and Schema</a></li> + <li><a href="../../guides/rgmvn/rgmvn.html">Maven plugin</a></li> + <li><a href="../../guides/rgfis/rgfis.html">Framework Internal Services</a></li> + <li role="separator" class="divider"></li> + <li class="dropdown-header">Javadoc</li> + <li><a href="http://javadoc.io/doc/org.apache.isis.core/isis-core-applib">Applib</a></li> + </ul> </li> + <li class="dropdown hidden-sm hidden-md"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Downloads<span class="caret"></span></a> + <ul class="dropdown-menu"> + <li class="dropdown-header">Maven archetypes</li> + <li><a href="../../guides/ugfun/ugfun.html#_ugfun_getting-started_helloworld-archetype">helloworld</a></li> + <li><a href="../../guides/ugfun/ugfun.html#_ugfun_getting-started_simpleapp-archetype">simpleapp</a></li> + <li role="separator" class="divider"></li> + <li><a href="../../downloads.html">Downloads</a></li> + <li><a href="../../release-notes/release-notes.html">Release Notes</a></li> + <li><a href="../../migration-notes/migration-notes.html">Migration Notes</a></li> + <li role="separator" class="divider"></li> + <li><a href="https://github.com/apache/isis">Github mirror</a></li> + </ul> </li> + <li class="dropdown hidden-sm"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Support<span class="caret"></span></a> + <ul class="dropdown-menu"> + <li class="dropdown-header">Guides</li> + <li><a href="../../guides/dg/dg.html">Developers' Guide</a></li> + <li><a href="../../guides/cgcom/cgcom.html">Committers' Guide</a></li> + <li><a href="../../guides/htg.html">Hints-n-Tips Guide</a></li> + <li role="separator" class="divider"></li> + <li class="dropdown-header">Mailing Lists</li> + <li><a href="../../support.html">How to subscribe</a></li> + <li><a href="https://lists.apache.org/list.html?us...@isis.apache.org">Archives (ASF Pony mail)</a></li> + <li><a href="http://isis.markmail.org/search/?q=">Archives (Markmail)</a></li> + <li role="separator" class="divider"></li> + <li class="dropdown-header">Other Resources</li> + <li><a href="https://issues.apache.org/jira/browse/ISIS">ASF JIRA</a></li> + <li><a href="https://stackoverflow.com/questions/tagged/isis">Stack Overflow</a></li> + <li><a href="../../help.html">Wiki, Fisheye etc.</a></li> + </ul> </li> + <li class="dropdown hidden-sm hidden-md"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">@ASF<span class="caret"></span></a> + <ul class="dropdown-menu"> + <li><a href="https://www.apache.org/">Apache Homepage</a></li> + <li><a href="https://www.apache.org/events/current-event">Events</a></li> + <li><a href="https://www.apache.org/licenses/">Licenses</a></li> + <li><a href="https://www.apache.org/security/">Security</a></li> + <li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> + <li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li> + <li role="separator" class="divider"></li> + <li><a href="https://whimsy.apache.org/board/minutes/Isis.html">PMC board minutes</a></li> + </ul> </li> + </ul> + <div class="nav navbar-nav navbar-right"> + <!-- 'style' added to fix height of input box. FIX THIS --> + <form class="navbar-form" role="search" id="search-form" style="padding: 1px 15px;"> + <div class="form-group"> + <input class="form-control" id="search-field" type="text" size="30" placeholder="Search"> + </div> + </form> + </div> + <p class="nav navbar-text navbar-right small">v2.0.0-M1</p> + </div> + </div> + </nav> + <div class="container"> + <div class="row-fluid"> + <div class="col-xs-12 col-sm-12 col-md-12 col-lg-9"> + <div id="search-panel"> + <div id="search-results"></div> + <div> + <br> + <a href="#" id="search-results-clear">clear</a> + </div> + </div> + <span class="pdf-link"><a href="rgcms.pdf"><img src="../../images/PDF-50.png"></a></span> + <div class="page-title"> + <h1>Classes, Methods and Schema</h1> + </div> + <div id="doc-content"> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/rgcms.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/rgcms.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/rgcms.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/rgcms.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/rgcms.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="sect1"> + <h2 id="__rgcms">1. Classes, Methods and Schema</h2> + <div class="sectionbody"> + <div class="paragraph"> + <p>This reference guide lists and describes various elements of the the Apache Isis Programming Model, specifically reserved and prefix <a href="../rgcms/rgcms.html#_rgcms_methods">methods</a> (such as <code>title()</code> and <code>validateâ¦â()</code>) and various utility and supporting <a href="../rgcms/rgcms.html#_rgcms_classes">classes</a>.</p> + </div> + <div class="paragraph"> + <p>It also describes the <a href="../rgcms/rgcms.html#_rgcms_schema">XSD schema</a> defined by Apache Isis. One use case is for the JAXB serialization of view models.</p> + </div> + <div class="sect2"> + <h3 id="_other_guides">1.1. Other Guides</h3> + <div class="paragraph"> + <p>Apache Isis documentation is broken out into a number of user, reference and "supporting procedures" guides.</p> + </div> + <div class="paragraph"> + <p>The user guides available are:</p> + </div> + <div class="ulist"> + <ul> + <li> <p><a href="../ugfun/ugfun.html">Fundamentals</a></p> </li> + <li> <p><a href="../ugvw/ugvw.html">Wicket viewer</a></p> </li> + <li> <p><a href="../ugvro/ugvro.html">Restful Objects viewer</a></p> </li> + <li> <p><a href="../ugodn/ugodn.html">DataNucleus object store</a></p> </li> + <li> <p><a href="../ugsec/ugsec.html">Security</a></p> </li> + <li> <p><a href="../ugtst/ugtst.html">Testing</a></p> </li> + <li> <p><a href="../ugbtb/ugbtb.html">Beyond the Basics</a></p> </li> + </ul> + </div> + <div class="paragraph"> + <p>The reference guides are:</p> + </div> + <div class="ulist"> + <ul> + <li> <p><a href="../rgant/rgant.html">Annotations</a></p> </li> + <li> <p><a href="../rgsvc/rgsvc.html">Domain Services</a></p> </li> + <li> <p><a href="../rgcfg/rgcfg.html">Configuration Properties</a></p> </li> + <li> <p><a href="../rgcms/rgcms.html">Classes, Methods and Schema</a> (this guide)</p> </li> + <li> <p><a href="../rgmvn/rgmvn.html">Apache Isis Maven plugin</a></p> </li> + <li> <p><a href="../rgfis/rgfis.html">Framework Internal Services</a></p> </li> + </ul> + </div> + <div class="paragraph"> + <p>The remaining guides are:</p> + </div> + <div class="ulist"> + <ul> + <li> <p><a href="../dg/dg.html">Developers' Guide</a> (how to set up a development environment for Apache Isis and contribute back to the project)</p> </li> + <li> <p><a href="../cgcom/cgcom.html">Committers' Guide</a> (release procedures and related practices)</p> </li> + </ul> + </div> + </div> + </div> + </div> + <div class="sect1"> + <h2 id="_rgcms_methods">2. Methods</h2> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; margin-top: -55px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="sectionbody"> + <div class="paragraph"> + <p>The Apache Isis metamodel is built up from declaratively (ie, <a href="../rgant/rgant.html#_rgant">annotations</a>) and imperatively, from "supporting" methods and other reserved methods.</p> + </div> + <div class="paragraph"> + <p>This chapter documents the supporting methods and the reserved methods. It also documents (separately) the reserved methods that act as callback hooks into the persistence lifecycle of domain entities.</p> + </div> + <div class="sect2"> + <h3 id="_rgcms_methods_prefixes">2.1. Supporting Method Prefixes</h3> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; margin-top: -55px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="paragraph"> + <p>Supporting methods are those that are associated with properties, collections and actions, providing additional imperative business rule checking and behaviour to be performed when the user interacts with those object members.</p> + </div> + <div class="paragraph"> + <p>This association is performed by name matching. Thus, a property called "firstName", derived from a method <code>getFirstName()</code> may have supporting methods <code>hideFirstName()</code>, <code>disableFirstName()</code> and <code>validateFirstName()</code>. Supporting methods are, therefore, each characterized by their own particular prefix.</p> + </div> + <div class="admonitionblock note"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>Using name matching to associate supporting methods generally works very well, but of course if an object memberâs method is renamed, thereâs always the risk that the developer forgets to rename the supporting method; the supporting methods become "orphaned".</p> + </div> + <div class="paragraph"> + <p>Apache Isis checks for this automatically, and will fail-fast (fail to boot) if any orphaned methods are located. A suitable error message is logged so that the issue can be easily diagnosed.</p> + </div> </td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>The table below lists the method prefixes that are recognized as part of Apache Isis' default programming model.</p> + </div> + <table class="tableblock frame-all grid-all spread"> + <caption class="title"> + Table 1. Recognized Method Prefixes + </caption> + <colgroup> + <col style="width: 18.1818%;"> + <col style="width: 9.0909%;"> + <col style="width: 9.0909%;"> + <col style="width: 9.0909%;"> + <col style="width: 9.0909%;"> + <col style="width: 9.0909%;"> + <col style="width: 36.3637%;"> + </colgroup> + <thead> + <tr> + <th class="tableblock halign-left valign-top">Prefix</th> + <th class="tableblock halign-left valign-top">Object</th> + <th class="tableblock halign-left valign-top">Property</th> + <th class="tableblock halign-left valign-top">Collection</th> + <th class="tableblock halign-left valign-top">Action</th> + <th class="tableblock halign-left valign-top">Action<br> Param</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="../rgcms/rgcms.html#_rgcms_methods_prefixes_addTo"><code>addToâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>add object to a collection <br></p> + </div> + <div class="admonitionblock note"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>Directly mutable collections are not currently supported by the <a href="../ugvw/ugvw.html">Wicket viewer</a>.</p> + </div> </td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_removeFrom"><code>removeFromâ¦â()</code></a>`</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_autoComplete"><code>autoCompleteâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Return a list of matching elements for a property or an action parameter.<br></p> + </div> + <div class="paragraph"> + <p>Alternatively, can specify for a class using <a href="../rgant/rgant.html#_rgant-DomainObject_autoCompleteRepository"><code>@DomainObject</code><br> <code>#autoCompleteRepository</code></a><br></p> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_choices"><code>choicesâ¦â()</code></a></p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_choices"><code>choicesâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Provide list of choices for a property or action parameter.<br></p> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_autoComplete"><code>autoCompleteâ¦â()</code></a>.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_clear"><code>clearâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Clear a property (set it to null).<br></p> + </div> + <div class="paragraph"> + <p>Allows business logic to be placed apart from the setter.<br></p> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_modify"><code>modifyâ¦â()</code></a></p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_default"><code>defaultâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Default value for a property or an action parameter.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_disable"><code>disableâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Disables (makes read-only) a property, a collection or an action.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_get"><code>getâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Access the value of a property or collection.<br></p> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_set"><code>setâ¦â()</code></a>.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_hide"><code>hideâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Hides a property, a collection or an action.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_modify"><code>modifyâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Modify a property (set it to a non-null) value.<br></p> + </div> + <div class="paragraph"> + <p>Allows business logic to be placed apart from the setter.<br></p> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_clear"><code>clearâ¦â()</code></a>`.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_removeFrom"><code>removeFromâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>remove object from a collection.<br></p> + </div> + <div class="admonitionblock note"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>Directly mutable collections are not currently supported by the <a href="../ugvw/ugvw.html">Wicket viewer</a>.</p> + </div> </td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_addTo"><code>addToâ¦â()</code></a>`</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_set"><code>setâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Sets the value of a property or a collection.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validate"><code>validateâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Check that a proposed value of a property or a set of action parameters or a single action parameter is valid.<br></p> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validateAddTo"><code>validateAddToâ¦â()</code></a> and <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validateRemoveFrom"><code>validateRemoveFromâ¦â()</code></a> to validate modifications to collections.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validateAddTo"><code>validate<br> AddToâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Check that a proposed object to add to a collection is valid.<br></p> + </div> + <div class="admonitionblock note"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>Directly mutable collections are not currently supported by the <a href="../ugvw/ugvw.html">Wicket viewer</a>.</p> + </div> </td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validateRemoveFrom"><code>validateRemoveFromâ¦â()</code></a>, and <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validate"><code>validateâ¦â()</code></a> for properties and actions.</p> + </div> + </div></td> + </tr> + <tr> + <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validateRemoveFrom"><code>validate<br> RemoveFromâ¦â()</code></a></p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"><p class="tableblock">Y</p></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"></td> + <td class="tableblock halign-left valign-top"> + <div> + <div class="paragraph"> + <p>Check that a proposed object to remove from a collection is valid.<br></p> + </div> + <div class="admonitionblock note"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>Directly mutable collections are not currently supported by the <a href="../ugvw/ugvw.html">Wicket viewer</a>.</p> + </div> </td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validateAddTo"><code>validateAddToâ¦â()</code></a>, and <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_validate"><code>validateâ¦â()</code></a> for properties and actions.</p> + </div> + </div></td> + </tr> + </tbody> + </table> + <div class="sect3"> + <h4 id="_rgcms_methods_prefixes_addTo">2.1.1. <code>addToâ¦â()</code> (deprecated)</h4> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; margin-top: -55px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_addTo.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_addTo.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_addTo.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_addTo.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_addTo.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="paragraph"> + <p>The <code>addToâ¦â()</code> supporting method is called whenever an object is added to a collection. Its purpose is to allow additional business logic to be performed.</p> + </div> + <div class="admonitionblock note"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>Directly mutable collections are not currently supported by the <a href="../ugvw/ugvw.html">Wicket viewer</a>. The suggested workaround is to simply define an action.</p> + </div> </td> + </tr> + </tbody> + </table> + </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">LibraryMember</span> { + <span class="directive">public</span> <span class="predefined-type">SortedSet</span><<span class="predefined-type">Book</span>> getBorrowed() { ... } + <span class="directive">public</span> <span class="type">void</span> setBorrowed(<span class="predefined-type">SortedSet</span><<span class="predefined-type">Book</span>> borrowed) { ... } + <span class="directive">public</span> <span class="type">void</span> addToBorrowed(<span class="predefined-type">Book</span> book) { + getBorrowed().add(book); <i class="conum" data-value="1"></i><b>(1)</b> + reminderService.addReminder(<span class="local-variable">this</span>, book, clock.today().plusDays(<span class="integer">21</span>)); <i class="conum" data-value="2"></i><b>(2)</b> + } + <span class="directive">public</span> <span class="type">void</span> removeFromBorrowed(<span class="predefined-type">Book</span> book) { ... } + ... +}</code></pre> + </div> + </div> + <div class="colist arabic"> + <table> + <tbody> + <tr> + <td><i class="conum" data-value="1"></i><b>1</b></td> + <td>update the collection</td> + </tr> + <tr> + <td><i class="conum" data-value="2"></i><b>2</b></td> + <td>perform some additional business logic</td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_removeFrom"><code>removeFromâ¦â()</code></a>`</p> + </div> + </div> + <div class="sect3"> + <h4 id="_rgcms_methods_prefixes_autoComplete">2.1.2. <code>autoCompleteâ¦â()</code></h4> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; margin-top: -55px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_autoComplete.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_autoComplete.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_autoComplete.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_autoComplete.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_autoComplete.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="paragraph"> + <p>The <code>autoCompleteâ¦â()</code> supporting method is called for action parameters and for properties to find objects from a drop-down list box. The use case is when the number of candidate objects is expected to be large, so the user is required to enter some characters to narrow the search down.</p> + </div> + <div class="admonitionblock tip"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-tip" title="Tip"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>If the number of candidate objects is comparatively small, then use <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_choices"><code>choicesâ¦â()</code></a> supporting method instead.</p> + </div> </td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>The signature of the supporting method depends on whether it is for a parameter or a property.</p> + </div> + <div class="sect4"> + <h5 id="_parameters">Parameters</h5> + <div class="paragraph"> + <p>For an action parameter in (0-based) position <em>N</em>, and of type <code>T</code>, the signature is:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="predefined-type">List</span><T> autoCompleteNXxx(<span class="predefined-type">String</span> search) { ... }</code></pre> + </div> + </div> + <div class="paragraph"> + <p>It is also valid to return <code>T[]</code>, a <code>Set<T></code> or a <code>Collection<T></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">ShoppingCartItem</span> { + <span class="annotation">@Property</span>(editing=Editing.DISABLED) + <span class="directive">public</span> Product getProduct() { ... } + <span class="directive">public</span> <span class="type">void</span> setProduct(Product product) { ... } + + <span class="annotation">@Property</span>(editing=Editing.DISABLED) + <span class="directive">public</span> <span class="type">int</span> getQuantity() { ... } + <span class="directive">public</span> <span class="type">void</span> setQuantity(<span class="type">int</span> quantity) { ... } + + <span class="annotation">@Action</span>(semantics=SemanticsOf.IDEMPOTENT) + <span class="directive">public</span> ShoppingCartItem updateProduct( + Product product, + <span class="annotation">@ParameterLayout</span>(named=<span class="string"><span class="delimiter">"</span><span class="content">Quantity</span><span class="delimiter">"</span></span>) + <span class="directive">final</span> <span class="type">int</span> quantity) { + setProduct(product); + setQuantity(quantity); + } + <span class="directive">public</span> <span class="predefined-type">Collection</span><Product> autoComplete0UpdateProduct( <i class="conum" data-value="1"></i><b>(1)</b> + <span class="annotation">@MinLength</span>(<span class="integer">3</span>) <span class="predefined-type">String</span> search <i class="conum" data-value="2"></i><b>(2)</b> + ) { + ... + } + ... +}</code></pre> + </div> + </div> + <div class="colist arabic"> + <table> + <tbody> + <tr> + <td><i class="conum" data-value="1"></i><b>1</b></td> + <td><code>product</code> is the 0th argument of the action.</td> + </tr> + <tr> + <td><i class="conum" data-value="2"></i><b>2</b></td> + <td>the <a href="../rgant/rgant.html#_rgant-MinLength"><code>@MinLength</code></a> annotation specifies the minimum number of characters that must be entered before a search is performed for matching objects</td> + </tr> + </tbody> + </table> + </div> + </div> + <div class="sect4"> + <h5 id="_properties">Properties</h5> + <div class="paragraph"> + <p>For a property of type <code>T</code>, the signature is:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="predefined-type">List</span><T> autoCompleteXxx(<span class="predefined-type">String</span> search) { ... }</code></pre> + </div> + </div> + <div class="paragraph"> + <p>(As for action parameters) it is also valid to return <code>T[]</code>, a <code>Set<T></code> or a <code>Collection<T></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">ShoppingCartItem</span> { + <span class="directive">public</span> Product getProduct() { ... } + <span class="directive">public</span> <span class="type">void</span> setProduct(Product product) { ... } + + <span class="directive">public</span> <span class="predefined-type">Collection</span><Product> autoCompleteProduct( + <span class="annotation">@MinLength</span>(<span class="integer">3</span>) <span class="predefined-type">String</span> search <i class="conum" data-value="1"></i><b>(1)</b> + ) { + ... + } + ... +}</code></pre> + </div> + </div> + <div class="colist arabic"> + <table> + <tbody> + <tr> + <td><i class="conum" data-value="1"></i><b>1</b></td> + <td>the <a href="../rgant/rgant.html#_rgant-MinLength"><code>@MinLength</code></a> annotation specifies the minimum number of characters that must be entered before a search is performed for matching objects</td> + </tr> + </tbody> + </table> + </div> + </div> + </div> + <div class="sect3"> + <h4 id="_rgcms_methods_prefixes_choices">2.1.3. <code>choicesâ¦â()</code></h4> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; margin-top: -55px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_choices.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_choices.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_choices.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_choices.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_choices.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="paragraph"> + <p>The <code>choicesâ¦â()</code> supporting method is called for both action parameters and for properties, to find objects from a drop-down list box. Unlike <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_autoComplete"><code>autoCompleteâ¦â()</code></a>, the use case is when the number of objects is comparatively small and can be selected from a drop-down without any additional filtering.</p> + </div> + <div class="paragraph"> + <p>The signature of the supporting method depends on whether it is for an action parameter or a property.</p> + </div> + <div class="sect4"> + <h5 id="_parameters_2">Parameters</h5> + <div class="paragraph"> + <p>For an action parameter in (0-based) position <em>N</em>, and of type <code>T</code>, the signature is:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="predefined-type">Collection</span><T> choicesNXxx() { ... }</code></pre> + </div> + </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">ShoppingCartItem</span> { + <span class="annotation">@Property</span>(editing=Editing.DISABLED) + <span class="directive">public</span> Product getProduct() { ... } + <span class="directive">public</span> <span class="type">void</span> setProduct(Product product) { ... } + + <span class="annotation">@Property</span>(editing=Editing.DISABLED) + <span class="directive">public</span> <span class="type">int</span> getQuantity() { ... } + <span class="directive">public</span> <span class="type">void</span> setQuantity(<span class="type">int</span> quantity) { ... } + + <span class="annotation">@Action</span>(semantics=SemanticsOf.IDEMPOTENT) + <span class="directive">public</span> ShoppingCartItem updateProduct( + Product product, + <span class="annotation">@ParameterLayout</span>(named=<span class="string"><span class="delimiter">"</span><span class="content">Quantity</span><span class="delimiter">"</span></span>) + <span class="directive">final</span> <span class="predefined-type">Integer</span> quantity) { + setProduct(product); + setQuantity(quantity); + } + <span class="directive">public</span> <span class="predefined-type">Collection</span><<span class="predefined-type">Integer</span>> choices1UpdateProduct() { + <span class="keyword">return</span> <span class="predefined-type">Arrays</span>.asList(<span class="integer">1</span>,<span class="integer">2</span>,<span class="integer">3</span>,<span class="integer">5</span>,<span class="integer">10</span>,<span class="integer">25</span>,<span class="integer">50</span>,<span class="integer">100</span>); + } + ... +}</code></pre> + </div> + </div> + <div class="sect5"> + <h6 id="_dependent_choices">Dependent Choices</h6> + <div class="paragraph"> + <p>Action parameters also support the notion of dependent choices, whereby the list of choices is dependent upon the value of some other argument.</p> + </div> + <div class="paragraph"> + <p>An example can be found in the (non-ASF) <a href="http://github.com/isisaddons/isis-app-todoapp">Isis addons' todoapp</a>, whereby `ToDoItem`s are categorized and then can also be subcategorized:</p> + </div> + <div class="imageblock"> + <div class="content"> + <a class="image" href="images/reference-methods/prefixes/choices/dependent.png"><img src="images/reference-methods/prefixes/choices/dependent.png" alt="dependent" width="800px"></a> + </div> + </div> + <div class="paragraph"> + <p>This functionality is actually implemented as a <a href="../ugfun/ugfun.html#_ugfun_how-tos_contributed-members">contributed action</a>, so the code for this is:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@DomainService</span>(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY) +<span class="directive">public</span> <span class="type">class</span> <span class="class">UpdateCategoryContributions</span> ... { + <span class="annotation">@ActionLayout</span>( + describedAs = <span class="string"><span class="delimiter">"</span><span class="content">Update category and subcategory</span><span class="delimiter">"</span></span> + ) + <span class="annotation">@Action</span>(semantics = SemanticsOf.IDEMPOTENT) + <span class="directive">public</span> Categorized updateCategory( + <span class="directive">final</span> Categorized item, <i class="conum" data-value="1"></i><b>(1)</b> + <span class="directive">final</span> Category category, + <span class="annotation">@Parameter</span>(optionality = Optionality.OPTIONAL) + <span class="directive">final</span> Subcategory subcategory) { + item.setCategory(category); + item.setSubcategory(subcategory); + <span class="keyword">return</span> item; + } + <span class="directive">public</span> <span class="predefined-type">List</span><Subcategory> choices2UpdateCategory( <i class="conum" data-value="2"></i><b>(2)</b> + <span class="directive">final</span> Categorized item, <i class="conum" data-value="3"></i><b>(3)</b> + <span class="directive">final</span> Category category) { <i class="conum" data-value="4"></i><b>(4)</b> + <span class="keyword">return</span> Subcategory.listFor(category); + } + ... +}</code></pre> + </div> + </div> + <div class="colist arabic"> + <table> + <tbody> + <tr> + <td><i class="conum" data-value="1"></i><b>1</b></td> + <td><code>ToDoItem</code> implements <code>Categorized</code></td> + </tr> + <tr> + <td><i class="conum" data-value="2"></i><b>2</b></td> + <td>subcategory is the 2-th argument (0-based)</td> + </tr> + <tr> + <td><i class="conum" data-value="3"></i><b>3</b></td> + <td>the item contributed to</td> + </tr> + <tr> + <td><i class="conum" data-value="4"></i><b>4</b></td> + <td>the category selected</td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>Dependent choices are not restricted to enums, however. Going back to the shopping cart example shown above, the choices for the <code>quantity</code> parameter could be dependent upon the selected <code>Product</code>:</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">ShoppingCartItem</span> { + ... + <span class="annotation">@Action</span>(semantics=SemanticsOf.IDEMPOTENT) + <span class="directive">public</span> ShoppingCartItem updateProduct( + Product product, + <span class="annotation">@ParameterLayout</span>(named=<span class="string"><span class="delimiter">"</span><span class="content">Quantity</span><span class="delimiter">"</span></span>) + <span class="directive">final</span> <span class="predefined-type">Integer</span> quantity) { + setProduct(product); + setQuantity(quantity); + } + <span class="directive">public</span> <span class="predefined-type">Collection</span><<span class="predefined-type">Integer</span>> choices1UpdateProduct(Product product) { + <span class="keyword">return</span> productService.quantityChoicesFor(product); <i class="conum" data-value="1"></i><b>(1)</b> + } + ... +}</code></pre> + </div> + </div> + <div class="colist arabic"> + <table> + <tbody> + <tr> + <td><i class="conum" data-value="1"></i><b>1</b></td> + <td><code>productService</code> is a (fictitous) injected service that knows what the quantity choices should be for any given product</td> + </tr> + </tbody> + </table> + </div> + </div> + </div> + <div class="sect4"> + <h5 id="_properties_2">Properties</h5> + <div class="paragraph"> + <p>For a property of type <code>T</code>, the signature is:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="predefined-type">Collection</span><T> choicesXxx() { ... }</code></pre> + </div> + </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">ShoppingCartItem</span> { + <span class="directive">public</span> Product getProduct() { ... } + <span class="directive">public</span> <span class="type">void</span> setProduct(Product product) { ... } + + <span class="directive">public</span> <span class="predefined-type">Collection</span><Product> choicesProduct() { + ... + }</code></pre> + </div> + </div> + </div> + </div> + <div class="sect3"> + <h4 id="_rgcms_methods_prefixes_clear">2.1.4. <code>clearâ¦â()</code> (deprecated)</h4> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; margin-top: -55px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_clear.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_clear.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_clear.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_clear.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_clear.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="paragraph"> + <p>The <code>clearâ¦â()</code> supporting method is calledâââinstead of the setterâââwhenever an (optional) property is to be set to <code>null</code>. Its purpose is to allow additional business logic to be performed.</p> + </div> + <div class="admonitionblock note"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>DataNucleus' smart handling of setters means that this supporting methods are in essence redundant, and so should be considered deprecated.</p> + </div> </td> + </tr> + </tbody> + </table> + </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">LibraryMember</span> { + <span class="directive">public</span> Title getFavoriteTitle() { ... } + <span class="directive">public</span> <span class="type">void</span> setFavoriteTitle(Title title) { ... } + <span class="directive">public</span> <span class="type">void</span> modifyFavoriteTitle(Title title) { ... } + <span class="directive">public</span> <span class="type">void</span> clearFavoriteTitle() { + <span class="keyword">if</span>(getTitle() == <span class="predefined-constant">null</span>) { <span class="keyword">return</span>; } + setFavoriteTitle(<span class="predefined-constant">null</span>); <i class="conum" data-value="1"></i><b>(1)</b> + titleFavoritesService.decrement(title); <i class="conum" data-value="2"></i><b>(2)</b> + } + ... +}</code></pre> + </div> + </div> + <div class="colist arabic"> + <table> + <tbody> + <tr> + <td><i class="conum" data-value="1"></i><b>1</b></td> + <td>update the property</td> + </tr> + <tr> + <td><i class="conum" data-value="2"></i><b>2</b></td> + <td>perform some additional business logic</td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>See also <a href="../rgcms/rgcms.html#_rgcms_methods_prefixes_modify"><code>modifyâ¦â()</code></a>`</p> + </div> + </div> + <div class="sect3"> + <h4 id="_rgcms_methods_prefixes_default">2.1.5. <code>defaultâ¦â()</code></h4> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; margin-top: -55px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_default.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_default.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_default.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_default.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_default.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="paragraph"> + <p>The <code>defaultâ¦â()</code> supporting method is called for action parameters to return the initial argument value. This may be some sensible default (eg todayâs date, or 0 or 1), orâââfor an action that is modifying the state of an objectâââmight default to the current value of a corresponding property.</p> + </div> + <div class="paragraph"> + <p>The method is <em>also</em> called for properties in the case when an object is newly instantiated using <a href="../rgsvc/rgsvc.html#_rgsvc_core-domain-api_DomainObjectContainer"><code>DomainObjectContainer#newTransientInstance(â¦â)</code></a>. This is a much less common use case. If a default is not specified then properties are initialized to a default based on their type (eg 0 or <code>false</code>).</p> + </div> + <div class="paragraph"> + <p>The signature of the supporting method depends on whether it is for an action parameter or a property.</p> + </div> + <div class="sect4"> + <h5 id="_parameters_3">Parameters</h5> + <div class="paragraph"> + <p>For an action parameter in (0-based position n), and of type <code>T</code>, the signature is:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> T defaultNXxx() { ... }</code></pre> + </div> + </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">ShoppingCartItem</span> { + <span class="annotation">@Property</span>(editing=Editing.DISABLED) + <span class="directive">public</span> Product getProduct() { ... } + <span class="directive">public</span> <span class="type">void</span> setProduct(Product product) { ... } + + <span class="annotation">@Property</span>(editing=Editing.DISABLED) + <span class="directive">public</span> <span class="type">int</span> getQuantity() { ... } + <span class="directive">public</span> <span class="type">void</span> setQuantity(<span class="type">int</span> quantity) { ... } + + <span class="annotation">@Action</span>(semantics=SemanticsOf.IDEMPOTENT) + <span class="directive">public</span> ShoppingCartItem updateProduct( + Product product, + <span class="annotation">@ParameterLayout</span>(named=<span class="string"><span class="delimiter">"</span><span class="content">Quantity</span><span class="delimiter">"</span></span>) + <span class="directive">final</span> <span class="predefined-type">Integer</span> quantity) { + setProduct(product); + setQuantity(quantity); + } + <span class="directive">public</span> Product default0UpdateProduct() { <i class="conum" data-value="1"></i><b>(1)</b> + <span class="keyword">return</span> getProduct(); + } + <span class="directive">public</span> <span class="type">int</span> default1UpdateProduct() { <i class="conum" data-value="2"></i><b>(2)</b> + <span class="keyword">return</span> getQuantity(); + } + ... +}</code></pre> + </div> + </div> + <div class="colist arabic"> + <table> + <tbody> + <tr> + <td><i class="conum" data-value="1"></i><b>1</b></td> + <td>default the 0-th parameter using the current value of the <code>product</code> property</td> + </tr> + <tr> + <td><i class="conum" data-value="2"></i><b>2</b></td> + <td>default the 1-th parameter using the current value of the <code>quantity</code> property</td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>Defaults are also supported (of course) for <a href="../ugfun/ugfun.html#_ugfun_how-tos_contributed-members">contributed actions</a>. For example, here is a contributed action for updating category/subcategory of 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">@DomainService</span>(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY) +<span class="directive">public</span> <span class="type">class</span> <span class="class">UpdateCategoryContributions</span> ... { + <span class="annotation">@ActionLayout</span>( + describedAs = <span class="string"><span class="delimiter">"</span><span class="content">Update category and subcategory</span><span class="delimiter">"</span></span> + ) + <span class="annotation">@Action</span>(semantics = SemanticsOf.IDEMPOTENT) + <span class="directive">public</span> Categorized updateCategory( + <span class="directive">final</span> Categorized item, <i class="conum" data-value="1"></i><b>(1)</b> + <span class="directive">final</span> Category category, + <span class="annotation">@Parameter</span>(optionality = Optionality.OPTIONAL) + <span class="directive">final</span> Subcategory subcategory) { + item.setCategory(category); + item.setSubcategory(subcategory); + <span class="keyword">return</span> item; + } + <span class="directive">public</span> Category default1UpdateCategory( <i class="conum" data-value="2"></i><b>(2)</b> + <span class="directive">final</span> Categorized item) { + <span class="keyword">return</span> item != <span class="predefined-constant">null</span>? item.getCategory(): <span class="predefined-constant">null</span>; + } + <span class="directive">public</span> Subcategory default2UpdateCategory( <i class="conum" data-value="3"></i><b>(3)</b> + <span class="directive">final</span> Categorized item) { + <span class="keyword">return</span> item != <span class="predefined-constant">null</span>? item.getSubcategory(): <span class="predefined-constant">null</span>; + } +}</code></pre> + </div> + </div> + <div class="colist arabic"> + <table> + <tbody> + <tr> + <td><i class="conum" data-value="1"></i><b>1</b></td> + <td><code>ToDoItem</code> implements <code>Categorized</code></td> + </tr> + <tr> + <td><i class="conum" data-value="2"></i><b>2</b></td> + <td>defaults the 1-th parameter using the itemâs <code>category</code> property</td> + </tr> + <tr> + <td><i class="conum" data-value="3"></i><b>3</b></td> + <td>defaults the 2-th parameter using the itemâs <code>subcategory</code> property</td> + </tr> + </tbody> + </table> + </div> + </div> + <div class="sect4"> + <h5 id="_properties_3">Properties</h5> + <div class="paragraph"> + <p>For a property of type <code>T</code>, the signature is:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> T defaultXxx() { ... }</code></pre> + </div> + </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">ShoppingCartItem</span> { + <span class="directive">public</span> <span class="type">int</span> getQuantity() { ... } + <span class="directive">public</span> <span class="type">void</span> setQuantity(<span class="type">int</span> quantity) { ... } + + <span class="directive">public</span> <span class="type">int</span> defaultProduct() { + <span class="keyword">return</span> <span class="integer">1</span>; + }</code></pre> + </div> + </div> + <div class="sect5"> + <h6 id="_alternatives">Alternatives</h6> + <div class="paragraph"> + <p>There are, in fact, two other ways to set properties of a newly instantiated object to default values.</p> + </div> + <div class="paragraph"> + <p>The first is to use the <a href="../rgcms/rgcms.html#_rgcms_methods_lifecycle_created"><code>created()</code></a> callback, called by the framework when <a href="../rgsvc/rgsvc.html#_rgsvc_core-domain-api_DomainObjectContainer"><code>DomainObjectContainer#newTransientInstance(â¦â)</code></a> is called. This method is called after any dependencies have been injected into the service.</p> + </div> + <div class="paragraph"> + <p>The second is more straightforward: simply initialize properties in the constructor. However, this cannot use any injected services as they will not have been initialized.</p> + </div> + </div> + </div> + </div> + <div class="sect3"> + <h4 id="_rgcms_methods_prefixes_disable">2.1.6. <code>disableâ¦â()</code></h4> + <div class="btn-group" style="float: right; font-size: small; padding: 6px; margin-top: -55px; "> + <button type="button" class="btn btn-xs btn-default" onclick="window.location.href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_disable.adoc""><i class="fa fa-pencil-square-o"></i> Edit</button> + <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button> + <ul class="dropdown-menu"> + <li><a href="https://github.com/apache/isis/edit/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_disable.adoc" target="_blank"><i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> Edit</a></li> + <li><a href="https://github.com/apache/isis/commits/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_disable.adoc" target="_blank"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> History</a></li> + <li><a href="https://github.com/apache/isis/raw/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_disable.adoc" target="_blank"><i class="fa fa-file-text-o fa-fw" aria-hidden="true"></i> Raw</a></li> + <li><a href="https://github.com/apache/isis/blame/master/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_methods_prefixes_disable.adoc" target="_blank"><i class="fa fa-hand-o-right fa-fw" aria-hidden="true"></i> Blame</a></li> + </ul> + </div> + <div class="paragraph"> + <p>The <code>disableâ¦â()</code> supporting method is called for properties, collections and actions. It allows the modification of the property/collection to be vetoed (ie made read-only) and to prevent the invocation of the action ("grey it out").</p> + </div> + <div class="admonitionblock note"> + <table> + <tbody> + <tr> + <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> + <td class="content"> + <div class="paragraph"> + <p>Directly mutable collections are not currently supported by the <a href="../ugvw/ugvw.html">Wicket viewer</a>; they are always implicitly disabled.</p> + </div> </td> + </tr> + </tbody> + </table> + </div> + <div class="paragraph"> + <p>Typically modification/invocation is vetoed based on the state of the domain object being interacted with, though it could be any reason at all (eg the current date/time of the interaction, or the state of some other related data such as stock levels, or the identity of the calling user).</p> + </div> + <div class="paragraph"> + <p>The reason for vetoing a modification/invocation is normally returned as a string. However, Apache Isis' <a href="../ugbtb/ugbtb.html#_ugbtb_i18n">i18n support</a> extends this so that reasons can be internationalized.</p> + </div> + <div class="paragraph"> + <p>The signature of the supporting method is simply:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="predefined-type">String</span> disableXxx() { ... }</code></pre> + </div> + </div> + <div class="paragraph"> + <p>where the returned string is the reason the property cannot be edited, or the action invoked.</p> + </div> + <div class="paragraph"> + <p>For i18n, the supporting method returns a <code>TranslatableString</code>:</p> + </div> + <div class="listingblock"> + <div class="content"> + <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public<
<TRUNCATED>