| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width,initial-scale=1"> |
| <title>@Property :: Apache Isis</title> |
| <link rel="canonical" href="https://isis.apache.org/refguide/2.0.0-M3/applib-ant/Property.html"> |
| <meta name="generator" content="Antora 2.2.0"> |
| <link rel="stylesheet" href="../../../_/css/site.css"> |
| <link rel="stylesheet" href="../../../_/css/site-custom.css"> |
| <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Raleway:300,400,500,700,800|Montserrat:300,400,700" rel="stylesheet"> |
| <link rel="home" href="https://isis.apache.org" title="Apache Isis"> |
| <link rel="next" href="PropertyLayout.html" title="PropertyLayout"> |
| <link rel="prev" href="Programmatic.html" title="Programmatic"> |
| </head> |
| <body class="article"> |
| <header class="header"> |
| <nav class="navbar"> |
| <div class="navbar-brand"> |
| <a class="navbar-item" href="https://isis.apache.org"> |
| <span class="icon"> |
| <img src="../../../_/img/isis-logo-48x48.png"></img> |
| </span> |
| <span>Apache Isis</span> |
| </a> |
| <button class="navbar-burger" data-target="topbar-nav"> |
| <span></span> |
| <span></span> |
| <span></span> |
| </button> |
| </div> |
| <div id="topbar-nav" class="navbar-menu"> |
| <a class="navbar-end"> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Quick Start</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Starter Apps</span> |
| <a class="navbar-item" href="../../../docs/latest/starters/helloworld.html">Hello World</a> |
| <a class="navbar-item" href="../../../docs/latest/starters/simpleapp.html">Simple App</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Demos & Tutorials</span> |
| <a class="navbar-item" href="../../../docs/latest/demo/about.html">Demo App</a> |
| <a class="navbar-item" href="https://danhaywood.gitlab.io/isis-petclinic-tutorial-docs/petclinic/1.16.2/intro.html">Petclinic (tutorial)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Resources</span> |
| <a class="navbar-item" href="../../../docs/latest/resources/cheatsheet.html">Cheatsheet</a> |
| <a class="navbar-item" href="../../../docs/latest/resources/icons.html">Icons</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Guides</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Development</span> |
| <a class="navbar-item" href="../../../setupguide/latest/about.html">Setup Guide</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Core</span> |
| <a class="navbar-item" href="../../../userguide/latest/about.html">User Guide</a> |
| <a class="navbar-item" href="../../../refguide/latest/about.html">Reference Guide</a> |
| <a class="navbar-item" href="../../../testing/latest/about.html">Testing Guide</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Libraries</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">For Use in Apps</span> |
| <a class="navbar-item" href="../../../subdomains/latest/about.html">Subdomain Libraries</a> |
| <a class="navbar-item" href="../../../valuetypes/latest/about.html">Value Types</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Integrate between Apps</span> |
| <a class="navbar-item" href="../../../mappings/latest/about.html">Bounded Context Mapping Libraries</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Other</span> |
| <a class="navbar-item" href="../../../incubator/latest/about.html">Incubator</a> |
| <a class="navbar-item" href="../../../legacy/latest/about.html">Legacy</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Components</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Viewers</span> |
| <a class="navbar-item" href="../../../vw/latest/about.html">Wicket UI</a> |
| <a class="navbar-item" href="../../../vro/latest/about.html">Restful Objects (REST)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Security</span> |
| <a class="navbar-item" href="../../../security/latest/about.html">Security Guide</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Persistence</span> |
| <a class="navbar-item" href="../../../pjdo/latest/about.html">DataNucleus (JDO)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Extensions</span> |
| <a class="navbar-item" href="../../../extensions/latest/about.html">Extensions Catalog</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Support</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Contact</span> |
| <a class="navbar-item" href="../../../docs/latest/support/slack-channel.html">Slack</a> |
| <a class="navbar-item" href="../../../docs/latest/support/mailing-list.html">Mailing Lists</a> |
| <a class="navbar-item" href="https://issues.apache.org/jira/browse/ISIS">JIRA</a> |
| <a class="navbar-item" href="https://stackoverflow.com/questions/tagged/isis">Stack Overflow</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Releases</span> |
| <a class="navbar-item" href="../../../docs/latest/downloads/how-to.html">Downloads</a> |
| <a class="navbar-item" href="../../../relnotes/latest/about.html">Release Notes</a> |
| <a class="navbar-item" href="../../../docs/latest/archive/1-x.html">Archive (1.x)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Framework</span> |
| <a class="navbar-item" href="../../../conguide/latest/about.html">Contributors' Guide</a> |
| <a class="navbar-item" href="../../../comguide/latest/about.html">Committers' Guide</a> |
| <a class="navbar-item" href="../../../core/latest/about.html">Core Design</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">ASF</a> |
| <div class="navbar-dropdown"> |
| <a class="navbar-item" href="http://www.apache.org/">Apache Homepage</a> |
| <a class="navbar-item" href="https://www.apache.org/events/current-event">Events</a> |
| <a class="navbar-item" href="https://www.apache.org/licenses/">Licenses</a> |
| <a class="navbar-item" href="https://www.apache.org/security/">Security</a> |
| <a class="navbar-item" href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a> |
| <a class="navbar-item" href="https://www.apache.org/foundation/thanks.html">Thanks</a> |
| <hr class="navbar-divider"/> |
| <a class="navbar-item" href="https://whimsy.apache.org/board/minutes/Isis.html">PMC board minutes</a> |
| </div> |
| </div> |
| <a class="navbar-item" href="../../../docs/latest/about.html"> |
| <span class="icon"> |
| <img src="../../../_/img/home.png"></img> |
| </span> |
| </a> |
| </div> |
| </div> |
| </nav> |
| </header> |
| <div class="body "> |
| <div class="nav-container" data-component="refguide" data-version="2.0.0-M3"> |
| <aside class="nav"> |
| <div class="panels"> |
| <div class="nav-panel-pagination"> |
| <a class="page-previous" rel="prev" href="Programmatic.html" title="Programmatic"><span></span></a> |
| <a class="page-next" rel="next" |
| href="PropertyLayout.html" title="PropertyLayout"><span></span></a> |
| <!-- |
| page.parent doesn't seem to be set... |
| <a class="page-parent" rel="prev" href="about.html" title="Programmatic"><span></span></a> |
| --> |
| </div> |
| <div class="nav-panel-menu is-active" data-panel="menu"> |
| <nav class="nav-menu"> |
| <h3 class="title"><a href="../about.html">Reference Guide</a></h3> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="0"> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <a class="nav-link" href="about.html">Annotations</a> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Action.html">Action</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="ActionLayout.html">ActionLayout</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Collection.html">Collection</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="CollectionLayout.html">CollectionLayout</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Column.html">Column</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Digits.html">Digits</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Discriminator.html">Discriminator</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="DomainObject.html">DomainObject</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="DomainObjectLayout.html">DomainObjectLayout</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="DomainService.html">DomainService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="DomainServiceLayout.html">DomainServiceLayout</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Facets.html">Facets</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="HomePage.html">HomePage</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="MemberOrder.html">MemberOrder</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Mixin.html">Mixin</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="NotPersistent.html">NotPersistent.</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Nullable.html">Nullable</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="MinLength.html">MinLength</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Parameter.html">Parameter</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="ParameterLayout.html">ParameterLayout</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Pattern.html">Pattern</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="PersistenceCapable.html">PersistenceCapable</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="PrimaryKey.html">PrimaryKey</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Programmatic.html">Programmatic</a> |
| </li> |
| <li class="nav-item is-current-page" data-depth="2"> |
| <a class="nav-link" href="Property.html">Property</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="PropertyLayout.html">PropertyLayout</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="IsisSessionScope.html">RequestScoped</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="Title.html">Title</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="ViewModel.html">ViewModel</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="XmlRootElement.html">XmlRootElement</a> |
| </li> |
| </ul> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <a class="nav-link" href="../applib-methods/about.html">Methods</a> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-methods/prefixes.html">Supporting Method Prefixes</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-methods/reserved.html">Reserved Methods</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-methods/lifecycle.html">Lifecycle Methods</a> |
| </li> |
| </ul> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <a class="nav-link" href="../applib-classes/about.html">Classes</a> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-classes/events.html">Events</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-classes/ViewModel.html"><code>ViewModel</code></a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-classes/value-types.html">Value Types</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-classes/spec.html">Specification pattern</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-classes/i18n.html">i18n support</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-classes/roles-mixins-contributees.html">Roles, Mixins and Contributees</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-classes/utility.html">Utility Classes</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-classes/layout.html">Layout</a> |
| </li> |
| </ul> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <a class="nav-link" href="../applib-svc/about.html">Domain Services</a> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/AcceptHeaderService.html">AcceptHeaderService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ApplicationFeatureRepository.html">ApplicationFeatureRepository</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/AuditerService.html">AuditerService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/BookmarkService.html">BookmarkService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/BookmarkUiService.html">BookmarkUiService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ClockService.html">ClockService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/CommandContext.html">CommandContext</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/CommandDtoProcessorService.html">CommandDtoProcessorService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/CommandExecutorService.html">CommandExecutorService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/CommandService.html">CommandService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ConfigurationMenu.html">ConfigurationMenu</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ConfigurationViewService.html">ConfigurationViewService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ContentMappingService.html">ContentMappingService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/DeepLinkService.html">DeepLinkService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/EmailNotificationService.html">EmailNotificationService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/EmailService.html">EmailService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ErrorReportingService.html">ErrorReportingService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/EventBusService.html">EventBusService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ExceptionRecognizerService.html">ExceptionRecognizerService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/FactoryService.html">FactoryService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/GridLoaderService.html">GridLoaderService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/GridService.html">GridService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/GridSystemService.html">GridSystemService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/HealthCheckService.html">HealthCheckService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/HintStore.html">HintStore</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/HomePageResolverService.html">HomePageResolverService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/InteractionContext.html">InteractionContext</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/JaxbService.html">JaxbService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/LayoutService.html">LayoutService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/LayoutServiceMenu.html">LayoutServiceMenu</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/LocaleProvider.html">LocaleProvider</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/MenuBarsLoaderService.html">MenuBarsLoaderService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/MenuBarsService.html">MenuBarsService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/MessageService.html">MessageService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/MetaModelService.html">MetamodelService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/MetaModelServiceMenu.html">MetamodelServiceMenu</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/MetricsService.html">MetricsService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/PublisherService.html">PublisherService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/QueryResultsCache.html">QueryResultsCache</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/RepositoryService.html">RepositoryService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/RoutingService.html">RoutingService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/Scratchpad.html">Scratchpad</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ServiceInjector.html">ServiceInjector</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/ServiceRegistry.html">ServiceRegistry</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/SessionLoggingService.html">SessionLoggingService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/SudoService.html">SudoService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/SwaggerService.html">SwaggerService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/TableColumnOrderService.html">TableColumnOrderService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/TitleService.html">TitleService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/TranslationService.html">TranslationService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/TranslationsResolver.html">TranslationsResolver</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/TransactionService.html">TransactionService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/UrlEncodingService.html">UrlEncodingService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/UserProfileService.html">UserProfileService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/UserRegistrationService.html">UserRegistrationService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/UserService.html">UserService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/WrapperFactory.html">WrapperFactory</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/XmlService.html">XmlService</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../applib-svc/XmlSnapshotService.html">XmlSnapshotService</a> |
| </li> |
| </ul> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <a class="nav-link" href="../config/about.html">Configuration</a> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.applib.html">Applib</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.core.meta-model.html">Core MetaModel</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.core.meta-model.introspector.html">Core MetaModel Introspection</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.core.meta-model.validator.html">MetaModel Validator</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.core.runtime.html">Core Runtime Services configurations</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.core.runtime-services.html">Core Runtime Services configurations</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.security.shiro.html">Shiro Security Implementation</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.persistence.jdo-datanucleus.html">JDO DataNucleus</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.persistence.jdo-datanucleus.impl.html">DataNucleus Configuration</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.viewer.restfulobjects.html">Restful Objects Viewer</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.viewer.wicket.html">Wicket Viewer</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.extensions.html">Extensions</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.value-types.html">Value types</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.testing.html">Testing</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/isis.legacy.html">Legacy</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/resteasy.html">RestEasy Configuration</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../config/sections/Other.html">Other</a> |
| </li> |
| </ul> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <a class="nav-link" href="../schema/about.html">Schema</a> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../schema/mml.html">MetaModel</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../schema/cmd.html">Command</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../schema/ixn.html">Interaction</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../schema/chg.html">Changes</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../schema/common.html">Common</a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </nav> |
| </div> |
| <div class="nav-panel-explore" data-panel="explore"> |
| <div class="context"> |
| <span class="title">Reference Guide</span> |
| <span class="version">2.0.0-M3</span> |
| </div> |
| <ul class="components"> |
| <li class="component"> |
| <span class="title"> </span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../docs/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">BC Mappings Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../mappings/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Committers' Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../comguide/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Contributors' Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../conguide/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Design Docs</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../core/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Extensions Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../extensions/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Incubator Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../incubator/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">JDO/DataNucleus</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../pjdo/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Legacy Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../legacy/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component is-current"> |
| <span class="title">Reference Guide</span> |
| <ul class="versions"> |
| <li class="version is-current is-latest"> |
| <a href="../about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Release Notes</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../relnotes/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Restful Objects Viewer</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../vro/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Security Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../security/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Setup Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../setupguide/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Subdomains Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../subdomains/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Testing Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../testing/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">User Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../userguide/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Value Types Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../valuetypes/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Wicket Viewer</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../vw/2.0.0-M3/about.html">2.0.0-M3</a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </aside> |
| </div> |
| <main role="main"> |
| <div class="toolbar" role="navigation"> |
| <button class="nav-toggle"></button> |
| <a href="../../../docs/2.0.0-M3/about.html" class="home-link"></a> |
| <nav class="breadcrumbs" aria-label="breadcrumbs"> |
| <ul> |
| <li><a href="../about.html">Reference Guide</a></li> |
| <li><a href="about.html">Annotations</a></li> |
| <li><a href="Property.html">Property</a></li> |
| </ul> |
| </nav> |
| <div class="edit-this-page"><a href="https://github.com/apache/isis/edit/2.0.0-M3/api/applib/src/main/adoc/modules/applib-ant/pages/Property.adoc">Edit</a></div> |
| </div> |
| <article class="doc"> |
| <a name="section-top"></a> |
| <h1 class="page"><code>@Property</code></h1> |
| <div id="preamble"> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <code>@Property</code> annotation applies to properties collecting together all domain semantics within a single annotation.</p> |
| </div> |
| <div class="paragraph"> |
| <p>It is also possible to apply the annotation to actions of domain services that are acting as contributed properties.</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@Inherited |
| @Target({ |
| ElementType.METHOD, |
| ElementType.FIELD, |
| ElementType.TYPE, |
| ElementType.ANNOTATION_TYPE |
| }) |
| @Retention(RetentionPolicy.RUNTIME) |
| @Mixin(method = "prop") |
| public @interface Property { |
| |
| CommandReification command() <i class="conum" data-value="1"></i><b>(1)</b> |
| default CommandReification.NOT_SPECIFIED; |
| |
| CommandPersistence commandPersistence() <i class="conum" data-value="2"></i><b>(2)</b> |
| default CommandPersistence.PERSISTED; |
| |
| CommandExecuteIn commandExecuteIn() <i class="conum" data-value="3"></i><b>(3)</b> |
| default CommandExecuteIn.FOREGROUND; |
| |
| Class<? extends CommandDtoProcessor> commandDtoProcessor() <i class="conum" data-value="4"></i><b>(4)</b> |
| default CommandDtoProcessor.class; |
| |
| Class<? extends PropertyDomainEvent<?,?>> domainEvent() <i class="conum" data-value="5"></i><b>(5)</b> |
| default PropertyDomainEvent.Default.class; |
| |
| Editing editing() <i class="conum" data-value="6"></i><b>(6)</b> |
| default Editing.NOT_SPECIFIED; |
| |
| String editingDisabledReason() <i class="conum" data-value="7"></i><b>(7)</b> |
| default ""; |
| |
| String fileAccept() <i class="conum" data-value="8"></i><b>(8)</b> |
| default ""; |
| |
| Where hidden() <i class="conum" data-value="9"></i><b>(9)</b> |
| default Where.NOT_SPECIFIED; |
| |
| int maxLength() <i class="conum" data-value="10"></i><b>(10)</b> |
| default -1; |
| |
| MementoSerialization mementoSerialization() <i class="conum" data-value="11"></i><b>(11)</b> |
| default MementoSerialization.NOT_SPECIFIED; |
| |
| Class<? extends Specification>[] mustSatisfy() <i class="conum" data-value="12"></i><b>(12)</b> |
| default {}; |
| |
| Optionality optionality() <i class="conum" data-value="13"></i><b>(13)</b> |
| default Optionality.NOT_SPECIFIED; |
| |
| Projecting projecting() <i class="conum" data-value="14"></i><b>(14)</b> |
| default Projecting.NOT_SPECIFIED; |
| |
| Publishing publishing() <i class="conum" data-value="15"></i><b>(15)</b> |
| default Publishing.NOT_SPECIFIED; |
| |
| String regexPattern() <i class="conum" data-value="16"></i><b>(16)</b> |
| default ""; |
| |
| int regexPatternFlags() <i class="conum" data-value="17"></i><b>(17)</b> |
| default 0; |
| |
| String regexPatternReplacement() <i class="conum" data-value="18"></i><b>(18)</b> |
| default "Doesn't match pattern"; |
| |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td><a href="#command"><code>command()</code></a> |
| <div class="paragraph"> |
| <p>Whether the property edit should be reified into a <code>o.a.i.applib.</code><br> |
| <code>services.command.Command</code> object through the <a href="../applib-svc/CommandContext.html" class="page"><code>CommandContext</code></a> service.</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td><code>commandPersistence()</code> |
| <div class="paragraph"> |
| <p>Whether the reified <code>Command</code> (as provided by the <code>CommandContext</code> domain service) should actually be persisted (assuming an appropriate implementation of <a href="../applib-svc/CommandService.html" class="page"><code>CommandService</code></a> has been configured).</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="3"></i><b>3</b></td> |
| <td><code>commandExecuteIn()</code> |
| <div class="paragraph"> |
| <p>Whether to execute the command immediately, or to persist it (assuming that an appropriate implementation of <a href="../applib-svc/CommandService.html" class="page"><code>CommandService</code></a> has been configured) such that a background scheduler can execute the command asynchronously</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="4"></i><b>4</b></td> |
| <td><code>commandDtoProcessor()</code> |
| <div class="paragraph"> |
| <p>If the <code>Command</code> also implements <code>CommandWithDto</code> (meaning that it can return a <code>CommandDto</code>, in other words be converted into an XML memento), then optionally specifies the implementation of a <code>CommandDtoProcessor</code> that can refine this XML.</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="5"></i><b>5</b></td> |
| <td><a href="#domainEvent"><code>domainEvent()</code></a> |
| <div class="paragraph"> |
| <p>The event type to be posted to the <a href="../applib-svc/EventBusService.html" class="page"><code>EventBusService</code></a> to broadcast the property’s business rule checking (hide, disable, validate) and its modification (before and after).</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="6"></i><b>6</b></td> |
| <td><a href="#editing"><code>editing()</code></a> |
| <div class="paragraph"> |
| <p>Whether a property can be modified or cleared from within the UI</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="7"></i><b>7</b></td> |
| <td><code>editingDisabledReason()</code> |
| <div class="paragraph"> |
| <p>The reason that this property cannot be modified.</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="8"></i><b>8</b></td> |
| <td><a href="#fileAccept"><code>fileAccept()</code></a> |
| <div class="paragraph"> |
| <p>Hints the file type (media type or file extension) to be uploaded to a <a href="#applib-classes:classes/value-types.adoc#Blob" class="page unresolved"><code>Blob</code></a> |
| or <a href="#applib-classes:classes/value-types.adoc#Clob" class="page unresolved"><code>Clob</code></a>.<br></p> |
| </div> |
| <div class="paragraph"> |
| <p>Note that this does not prevent the user from uploading some other file type; rather it merely defaults the file type in the file open dialog.</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="9"></i><b>9</b></td> |
| <td><a href="#hidden"><code>hidden()</code></a> |
| <div class="paragraph"> |
| <p>Indicates where (in the UI) the property should be hidden from the user.</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="10"></i><b>10</b></td> |
| <td><a href="#maxLength"><code>maxLength()</code></a> |
| <div class="paragraph"> |
| <p>Maximum number of characters for string parameters; ignored otherwise<br></p> |
| </div> |
| <div class="admonitionblock tip"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <i class="fa icon-tip" title="Tip"></i> |
| </td> |
| <td class="content"> |
| In many/most cases you should however use <a href="Column.html" class="page"><code>@Column#length()</code></a> |
| </td> |
| </tr> |
| </table> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="11"></i><b>11</b></td> |
| <td><a href="#mementoSerialization"><code>mementoSerialization()</code></a> |
| <div class="paragraph"> |
| <p>Whether to exclude from snapshots.<br></p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="12"></i><b>12</b></td> |
| <td><a href="#mustSatisfy"><code>mustSatisfy()</code></a> |
| <div class="paragraph"> |
| <p>Implementation of <code>o.a.i.applib.spec.Specification</code> that allows arbitrary validation to be applied.</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="13"></i><b>13</b></td> |
| <td><a href="#optionality"><code>optionality()</code></a> |
| <div class="paragraph"> |
| <p>Specifies a property is optional rather than mandatory</p> |
| </div> |
| <div class="admonitionblock tip"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <i class="fa icon-tip" title="Tip"></i> |
| </td> |
| <td class="content"> |
| In many/most cases you should however use <a href="Column.html" class="page"><code>@Column#allowsNull()</code></a> |
| </td> |
| </tr> |
| </table> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="14"></i><b>14</b></td> |
| <td><a href="#projecting"><code>projecting()</code></a> |
| <div class="paragraph"> |
| <p>Indicates that owning object is a view model that is acting as a projection of the underlying entity referenced by this property.</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="15"></i><b>15</b></td> |
| <td><a href="#publishing"><code>publishing()</code></a> |
| <div class="paragraph"> |
| <p>Determines whether the editing of a property should be published.</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="16"></i><b>16</b></td> |
| <td><a href="#regexPattern"><code>regexPattern()</code></a> |
| <div class="paragraph"> |
| <p>Validates the contents of a string parameter against the regular expression pattern</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="17"></i><b>17</b></td> |
| <td><code>regexPatternFlags()</code> |
| <div class="paragraph"> |
| <p>Value of flags as normally passed to <code>java.util.regex.</code><br> |
| <code>Pattern#compile(…​)</code>, modifying the compilation of the regular expression</p> |
| </div></td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="18"></i><b>18</b></td> |
| <td><code>regexPatternReplacement()</code> |
| <div class="paragraph"> |
| <p>Unused.</p> |
| </div></td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@DomainObject |
| public class Customer { |
| public static class EmailSpecification extends AbstractSpecification<String> { |
| public String satisfiesSafely(String proposed) { |
| return EmailUtil.ensureValidEmail(proposed); <i class="conum" data-value="1"></i><b>(1)</b> |
| } |
| } |
| @javax.jdo.annotations.Column(allowsNull="true") <i class="conum" data-value="2"></i><b>(2)</b> |
| @Property( |
| maxLength=30, |
| mustSatisfy=EmailSpecification.class, |
| regexPattern = "(\\w+\\.)*\\w+@(\\w+\\.)+[A-Za-z]+", |
| regexPatternFlags=Pattern.CASE_INSENSITIVE |
| ) |
| public String getEmailAddress() { /* ... */ } |
| public void setEmailAddress(String emailAddress) { /* ... */ } |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>the (fictitious) <code>EmailUtil.ensureValid(…​)</code> (omitted for brevity) returns a string explaining if an email is invalid</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td>generally use instead of the <code>@Property#optionality</code> attribute</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>The annotation is one of a handful (others including <a href="Collection.html" class="page"><code>@Collection</code></a>, <a href="CollectionLayout.html" class="page"><code>@CollectionLayout</code></a> and <a href="PropertyLayout.html" class="page"><code>@PropertyLayout</code></a>) that can also be applied to the field, rather than the getter method. This is specifically |
| so that boilerplate-busting tools such as <a href="https://projectlombok.org/">Project Lombok</a> can be used.</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="command"><a class="anchor" href="#command"></a>Command Persistence and Processing</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>Every property edit (and action invocation for that matter) is automatically reified into a concrete <code>Command</code> object. |
| The <code>@Property(command=…​, commandXxx=…​)</code> attributes provide hints for the persistence of that <code>Command</code> object, and the subsequent processing of that persisted command. |
| The primary use cases for this are to support the deferring the execution of the action such that it can be invoked in the background, and to replay commands in a master/slave configuration.</p> |
| </div> |
| <div class="sect2"> |
| <h3 id="design"><a class="anchor" href="#design"></a>Design</h3> |
| <div class="paragraph"> |
| <p>The annotation works with (and is influenced by the behaviour of) a number of domain services:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><a href="../applib-svc/CommandContext.html" class="page"><code>CommandContext</code></a></p> |
| </li> |
| <li> |
| <p><a href="../applib-svc/CommandService.html" class="page"><code>CommandService</code></a></p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>Each property edit is automatically reified by the <a href="../applib-svc/CommandContext.html" class="page"><code>CommandContext</code></a> service into a <code>Command</code> object, capturing details of the target object, the property, the proposed new value for the property, the user, a timestamp and so on.</p> |
| </div> |
| <div class="paragraph"> |
| <p>If an appropriate <code>CommandService</code> is configured (for example using <a href="../../../extensions/2.0.0-M3/command-log/about.html" class="page">Command Log</a> extension module), then the <code>Command</code> itself is persisted.</p> |
| </div> |
| <div class="paragraph"> |
| <p>By default, actions are invoked in directly in the thread of the invocation.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="command-and-commandpersistence"><a class="anchor" href="#command-and-commandpersistence"></a><code>command()</code> and <code>commandPersistence()</code></h3> |
| <div class="paragraph"> |
| <p>The <code>command()</code> and `commandPersistence() attributes work together to determine whether a command will actually be persisted. |
| There inter-relationship is somewhat complex, so is probably best explained by way of examples:</p> |
| </div> |
| <table class="tableblock frame-all grid-all stretch"> |
| <colgroup> |
| <col style="width: 16.6666%;"> |
| <col style="width: 16.6666%;"> |
| <col style="width: 16.6666%;"> |
| <col style="width: 16.6666%;"> |
| <col style="width: 33.3336%;"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th class="tableblock halign-left valign-top"><code>command()</code></th> |
| <th class="tableblock halign-left valign-top"><code>isis.services. |
| command.properties</code> config property</th> |
| <th class="tableblock halign-left valign-top"><code>command |
| Persistence()</code></th> |
| <th class="tableblock halign-left valign-top">action dirties objects?</th> |
| <th class="tableblock halign-left valign-top">is command persisted?</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>ENABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(either)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>ENABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>IF_HINTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>ENABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>IF_HINTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>ENABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>NOT_PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>all</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>all</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>IF_HINTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>all</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>IF_HINTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>all</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>NOT_PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>none</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no (!)</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>none</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>none</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>IF_HINTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>none</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>IF_HINTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>none</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>NOT_PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>AS_CONFIGURED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>none</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>NOT_PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes (!)</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>DISABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no (!)</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>DISABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>DISABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>IF_HINTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>DISABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>IF_HINTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>DISABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>NOT_PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>no</p> |
| </div></div></td> |
| </tr> |
| <tr> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>DISABLED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>(any)</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p><code>NOT_PERSISTED</code></p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes</p> |
| </div></div></td> |
| <td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph"> |
| <p>yes (!)</p> |
| </div></div></td> |
| </tr> |
| </tbody> |
| </table> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public class Order { |
| @Property( |
| command=CommandReification.ENABLED, |
| commandPersistence=CommandPersistence.PERSISTED |
| ) |
| public Product getProduct() { /* ... */ } |
| public void setProduct(Product p) { /* ... */ } |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>As can be seen, whether a command is actually persisted does not always follow the value of the <code>commandPersistence</code> attribute. |
| This is because the <code>command</code> attribute actually determines whether any command metadata for the action is captured within the framework’s internal metamodel. |
| If <code>command</code> is <code>DISABLED</code> or does not otherwise apply due to the action’s declared semantics, then the framework decides to persist a command based solely on whether the action dirtied any objects (as if <code>commandPersistence()</code> was set to <code>IF_HINTED</code>).</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="commandexecutein"><a class="anchor" href="#commandexecutein"></a><code>commandExecuteIn()</code></h3> |
| <div class="paragraph"> |
| <p>For persisted commands, the <code>commandExecuteIn</code> attribute determines whether the <code>Command</code> should be executed in the foreground (the default) or executed in the background.</p> |
| </div> |
| <div class="admonitionblock warning"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <i class="fa icon-warning" title="Warning"></i> |
| </td> |
| <td class="content"> |
| TODO: v2 - background execution has temporarily been removed, will be reinstated for v2.0. |
| </td> |
| </tr> |
| </table> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="commanddtoprocessor"><a class="anchor" href="#commanddtoprocessor"></a><code>commandDtoProcessor()</code></h3> |
| <div class="paragraph"> |
| <p>The <code>commandDtoProcessor</code> attribute allows an implementation of <code>CommandDtoProcessor</code> to be specified. |
| This interface has the following API:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public interface CommandDtoProcessor { |
| CommandDto process( <i class="conum" data-value="1"></i><b>(1)</b> |
| Command command, <i class="conum" data-value="2"></i><b>(2)</b> |
| CommandDto dto); <i class="conum" data-value="3"></i><b>(3)</b> |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>The returned <code>CommandDto</code>. |
| This will typically be the <code>CommandDto</code> passed in, but supplemented in some way.</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td>The <code>Command</code> being processed</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="3"></i><b>3</b></td> |
| <td>The <code>CommandDto</code> (XML) obtained already from the <code>Command</code> (by virtue of it also implementing <code>CommandWithDto</code>, see discussion below).</td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>This interface is used by the framework-provided implementations of <code>ContentMappingService</code> for the REST API, allowing <code>Command</code>s implementations that also implement <code>CommandWithDto</code> to be further customised as they are serialized out. |
| The primary use case for this capability is in support of master/slave replication.</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>on the master, <code>Command</code>s are serialized to XML. |
| This includes the identity of the target object and the intended new value of the property.</p> |
| <div class="admonitionblock important"> |
| <table> |
| <tr> |
| <td class="icon"> |
| <i class="fa icon-important" title="Important"></i> |
| </td> |
| <td class="content"> |
| <div class="paragraph"> |
| <p>However, any <code>Blob</code>s and <code>Clob</code>s are deliberately excluded from this XML (they are instead stored as references). |
| This is to prevent the storage requirements for <code>Command</code> from becoming excessive. |
| A <code>CommandDtoProcessor</code> can be provided to re-attach blob information if required.</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| </li> |
| <li> |
| <p>replaying <code>Command</code>s requires this missing parameter information to be reinstated. |
| The <code>CommandDtoProcessor</code> therefore offers a hook to dynamically re-attach the missing <code>Blob</code> or <code>Clob</code> argument.</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>As a special case, returning <code>null</code> means that the command’s DTO is effectively excluded when retrieving the list of commands. |
| If replicating from master to slave, this effectively allows certain commands to be ignored. |
| The <code>CommandDtoProcessor.Null</code> class provides a convenience implementation for this requirement.</p> |
| </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 <code>commandDtoProcessor()</code> is specified, then <code>command()</code> is assumed to be ENABLED.</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>For an example application, see <a href="Action.html#command" class="page"><code>Action#command()</code></a>.</p> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="domainEvent"><a class="anchor" href="#domainEvent"></a><code>domainEvent()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>Whenever a domain object (or list of domain objects) is to be rendered, the framework fires off multiple domain events for every property, collection and action of the domain object. |
| In the cases of the domain object’s properties, the events that are fired are:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>hide phase: to check that the property is visible (has not been hidden)</p> |
| </li> |
| <li> |
| <p>disable phase: to check that the property is usable (has not been disabled)</p> |
| </li> |
| <li> |
| <p>validate phase: to check that the property’s arguments are valid (to modify/clear its value)</p> |
| </li> |
| <li> |
| <p>pre-execute phase: before the modification of the property</p> |
| </li> |
| <li> |
| <p>post-execute: after the modification of the property</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>Subscribers (which must be domain services) subscribe to events posted through the <a href="../applib-svc/EventBusService.html" class="page"><code>EventBusService</code></a>, and can influence each of these phases.</p> |
| </div> |
| <div class="paragraph"> |
| <p>By default the event raised is <code>PropertyDomainEvent.Default</code>. |
| For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class ToDoItem { |
| |
| @Property |
| @Getter @Setter |
| private LocalDate dueBy; |
| |
| // ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>The <code>domainEvent</code> attribute allows a custom subclass to be emitted allowing more precise subscriptions (to those subclasses) to be defined instead.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class ToDoItem { |
| |
| public static class DueByChangedEvent |
| extends PropertyDomainEvent<ToDoItem, LocalDate> { } <i class="conum" data-value="1"></i><b>(1)</b> |
| |
| @Property(domainEvent=ToDoItem.DueByChangedEvent) |
| @Getter @Setter |
| private LocalDate dueBy; |
| |
| // ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>inherit from <code>PropertyDomainEvent<T,P></code> where <code>T</code> is the type of the domain object being interacted with, and <code>P</code> is the type of the property (<code>LocalDate</code> in this example)</td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>The benefit is that subscribers can be more targetted as to the events that they subscribe to.</p> |
| </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>The framework provides a no-arg constructor and will initialize the domain event using (non-API) setters rather than through the constructor. |
| This substantially reduces the boilerplate in the subclasses because no explicit constructor is required..</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="sect2"> |
| <h3 id="subscribers"><a class="anchor" href="#subscribers"></a>Subscribers</h3> |
| <div class="paragraph"> |
| <p>Subscribers (which must be domain services) subscribe to events posted through the <a href="../applib-svc/EventBusService.html" class="page"><code>EventBusService</code></a>.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Subscribers can be either coarse-grained (if they subscribe to the top-level event type):</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import org.springframework.context.event.EventListener; |
| import org.springframework.stereotype.Service; |
| |
| @Service |
| public class SomeSubscriber { |
| |
| @EventListener(PropertyDomainEvent.class) |
| public void on(PropertyDomainEvent ev) { |
| // ... |
| } |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>or can be fine-grained (by subscribing to specific event subtypes):</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import org.springframework.context.event.EventListener; |
| import org.springframework.stereotype.Service; |
| |
| @Service |
| public class SomeSubscriber { |
| |
| @EventListener(ToDoItem.DueByChangedEvent.class) |
| public void on(ToDoItem.DueByChangedEvent ev) { |
| // ... |
| } |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>The subscriber’s method is called (up to) 5 times:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>whether to veto visibility (hide)</p> |
| </li> |
| <li> |
| <p>whether to veto usability (disable)</p> |
| </li> |
| <li> |
| <p>whether to veto execution (validate)</p> |
| </li> |
| <li> |
| <p>steps to perform prior to the property being modified</p> |
| </li> |
| <li> |
| <p>steps to perform after the property has been modified.</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>The subscriber can distinguish these by calling <code>ev.getEventPhase()</code>. |
| Thus the general form is:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import org.springframework.context.event.EventListener; |
| import org.springframework.stereotype.Service; |
| |
| @Service |
| public class SomeSubscriber { |
| |
| public void on(PropertyDomainEvent ev) { |
| switch(ev.getEventPhase()) { |
| |
| case HIDE: <i class="conum" data-value="1"></i><b>(1)</b> |
| break; |
| case DISABLE: <i class="conum" data-value="2"></i><b>(2)</b> |
| break; |
| case VALIDATE: <i class="conum" data-value="3"></i><b>(3)</b> |
| break; |
| |
| case EXECUTING: |
| break; |
| case EXECUTED: |
| break; |
| } |
| } |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>call <code>ev.hide()</code> or <code>ev.veto("")</code> to hide the property</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td>call <code>ev.disable("…​")</code> or <code>ev.veto("…​")</code> to disable the property</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="3"></i><b>3</b></td> |
| <td>call ev.invalidate("…​") or ev.veto("…​") if proposed new value for property is invalid</td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>It is also possible to abort the transaction during the executing or executed phases by throwing an exception. |
| If the exception is a subtype of <code>RecoverableException</code> then the exception will be rendered as a user-friendly warning (eg Growl/toast) rather than an error.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="default-doop-and-noop-events"><a class="anchor" href="#default-doop-and-noop-events"></a>Default, Doop and Noop events</h3> |
| <div class="paragraph"> |
| <p>If the <code>domainEvent</code> attribute is not explicitly specified (is left as its default value, <code>PropertyDomainEvent.Default</code>), then the framework will, by default, post an event.</p> |
| </div> |
| <div class="paragraph"> |
| <p>If this is not required, then the <code>isis.reflector.facet.propertyAnnotation.domainEvent.postForDefault</code> configuration property can be set to "false"; this will disable posting.</p> |
| </div> |
| <div class="paragraph"> |
| <p>On the other hand, if the <code>domainEvent</code> has been explicitly specified to some subclass, then an event will be posted. |
| The framework provides <code>PropertyDomainEvent.Doop</code> as such a subclass, so setting the <code>domainEvent</code> attribute to this class will ensure that the event to be posted, irrespective of the configuration property setting.</p> |
| </div> |
| <div class="paragraph"> |
| <p>And, conversely, the framework also provides <code>PropertyDomainEvent.Noop</code>; if <code>domainEvent</code> attribute is set to this class, then no event will be posted.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="raising-events-programmatically"><a class="anchor" href="#raising-events-programmatically"></a>Raising events programmatically</h3> |
| <div class="paragraph"> |
| <p>Normally events are only raised for interactions through the UI. |
| However, events can be raised programmatically by wrapping the target object using the <a href="../applib-svc/WrapperFactory.html" class="page"><code>WrapperFactory</code></a> service.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="see-also"><a class="anchor" href="#see-also"></a>See also</h3> |
| <div class="paragraph"> |
| <p>This attribute is also supported for:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><a href="Action.html#domainEvent" class="page">actions</a> and</p> |
| </li> |
| <li> |
| <p><a href="#domainEvent">properties</a>.</p> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="editing"><a class="anchor" href="#editing"></a><code>editing()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <code>editing</code> attribute can be used to prevent a property from being modified or cleared, ie to make it read-only.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The related <code>editingDisabledReason</code> attribute specifies the a hard-coded reason why the property cannot be modified directly.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Whether a property is enabled or disabled depends upon these factors:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>whether the domain object has been configured as immutable through the <a href="DomainObject.html#editing" class="page"><code>@DomainObject#editing()</code></a> attribute</p> |
| </li> |
| <li> |
| <p>else (that is, if the domain object’s editability is specified as being <code>AS_CONFIGURED</code>), then the value of the <a href="../config/sections/isis.applib.html#isis.applib.annotation.domain-object.editing" class="page">'isis.applib.annotation.domain-object.editing'</a> configuration property. |
| If set to <code>false</code>, then the object’s properties (and collections) are <em>not</em> editable</p> |
| </li> |
| <li> |
| <p>else, then the value of the <code>@Property(editing=…​)</code> attribute itself</p> |
| </li> |
| <li> |
| <p>else, the result of invoking any supporting <a href="../applib-methods/prefixes.html#disable" class="page"><code>disable…​()</code></a> supporting methods</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>Thus, to make a property read-only even if the object would otherwise be editable, use:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class Customer { |
| @Property( |
| editing=Editing.DISABLED, |
| editingDisabledReason = |
| "The credit rating is derived from multiple factors" |
| ) |
| @Getter @Setter |
| private int initialCreditRating; |
| }</code></pre> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="see-also-2"><a class="anchor" href="#see-also-2"></a>See also</h3> |
| <div class="paragraph"> |
| <p>This attribute can also be specified for:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><a href="Collection.html#editing" class="page">collections</a></p> |
| </li> |
| <li> |
| <p><a href="DomainObject.html#editing" class="page">domain object</a>.</p> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="fileAccept"><a class="anchor" href="#fileAccept"></a><code>fileAccept()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <code>fileAccept</code> attribute applies only to <a href="#applib-classes:classes/value-types.adoc#Blob" class="page unresolved"><code>Blob</code></a> or <a href="#applib-classes:classes/value-types.adoc#Clob" class="page unresolved"><code>Clob</code></a> parameters, indicating the type of file to accept when uploading a new value. |
| The attribute is also supported on <a href="Parameter.html#fileAccept" class="page">parameters</a>.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class ScannedDocument { |
| |
| @Property(fileAccept="image/*") <i class="conum" data-value="1"></i><b>(1)</b> |
| @Getter @Setter |
| private Blob scannedImage; |
| |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>as per <a href="http://www.w3schools.com/tags/att_input_accept.asp">reference docs</a>, either a media type (such as <code>image/*</code>) or a file type extension (such as <code>.png</code>).</td> |
| </tr> |
| </table> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="hidden"><a class="anchor" href="#hidden"></a><code>hidden()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>Properties can be hidden at the domain-level, indicating that they are not visible to the end-user.</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="#hidden"><code>@Property#hidden()</code></a> to hide an action at the domain layer.</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class Customer { |
| |
| @Property(hidden=Where.EVERYWHERE) |
| @Getter @Setter |
| private int internalId; |
| |
| // ... |
| }</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></p> |
| <div class="paragraph"> |
| <p>The property should be hidden everywhere.</p> |
| </div> |
| </li> |
| <li> |
| <p><code>Where.ANYWHERE</code></p> |
| <div class="paragraph"> |
| <p>Synonym for everywhere.</p> |
| </div> |
| </li> |
| <li> |
| <p><code>Where.OBJECT_FORMS</code></p> |
| <div class="paragraph"> |
| <p>The property should be hidden when displayed within an object form.</p> |
| </div> |
| </li> |
| <li> |
| <p><code>Where.PARENTED_TABLES</code></p> |
| <div class="paragraph"> |
| <p>The property should be hidden when displayed as a column of a table within a parent object’s collection.</p> |
| </div> |
| </li> |
| <li> |
| <p><code>Where.STANDALONE_TABLES</code></p> |
| <div class="paragraph"> |
| <p>The property should be hidden when displayed as a column of a table showing a standalone list of objects, for example as returned by a repository query.</p> |
| </div> |
| </li> |
| <li> |
| <p><code>Where.ALL_TABLES</code></p> |
| <div class="paragraph"> |
| <p>The property should be hidden when displayed as a column of a table, either an object’s * collection or a standalone list. |
| This combines <code>PARENTED_TABLES</code> and <code>STANDALONE_TABLES</code>.</p> |
| </div> |
| </li> |
| <li> |
| <p><code>Where.NOWHERE</code><br> |
| + The property should not be hidden, overriding any other metadata/conventions that would normally cause the property to be hidden.<br></p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>For example, if a property is annotated with <a href="Title.html" class="page"><code>@Title</code></a>, then normally this should be hidden from all tables. |
| Annotating with <code>@Property(where=Where.NOWHERE)</code> overrides this.</p> |
| </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>The <a href="../../../vro/2.0.0-M3/about.html" class="page">RestfulObjects viewer</a> has only partial support for these <code>Where</code> enums.</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="sect2"> |
| <h3 id="see-also-3"><a class="anchor" href="#see-also-3"></a>See also</h3> |
| <div class="paragraph"> |
| <p>This attribute can also be applied to:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><a href="ActionLayout.html#hidden" class="page">actions</a></p> |
| </li> |
| <li> |
| <p><a href="CollectionLayout.html#hidden" class="page">collections</a>.</p> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="maxLength"><a class="anchor" href="#maxLength"></a><code>maxLength()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <code>maxLength</code> attribute applies only to <code>String</code> properties, indicating the maximum number of characters that the user may enter (for example in a text field in the UI). |
| The attribute It is ignored if applied to properties of any other type.</p> |
| </div> |
| <div class="paragraph"> |
| <p>That said, properties are most commonly defined on persistent domain objects (entities), in which case the JDO <a href="Column.html" class="page"><code>@Column</code></a> will in any case need to be specified. |
| Apache Isis can infer the <code>maxLength</code> semantic directly from the equivalent <code>@Column#length()</code> annotation/attribute.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class Customer { |
| |
| @javax.jdo.annotations.Column(length=30) |
| @Getter @Setter |
| private String firstName; |
| |
| // ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>In this case there is therefore no need for the <code>@Property#maxLength</code> attribute.</p> |
| </div> |
| <div class="sect2"> |
| <h3 id="non-persistent-properties"><a class="anchor" href="#non-persistent-properties"></a>Non-persistent properties</h3> |
| <div class="paragraph"> |
| <p>Of course, not every property is persistent (it could instead be derived), and neither is every domain object an entity (it could be a view model). |
| For these non persistable properties the <code>maxLength</code> attribute is still required.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public class Customer { |
| |
| @javax.jdo.annotation.NotPersistent <i class="conum" data-value="1"></i><b>(1)</b> |
| @Property(maxLength=100) |
| public String getFullName() { /* ... */ } <i class="conum" data-value="2"></i><b>(2)</b> |
| public void setFullName(String fullName) { /* ... */ } <i class="conum" data-value="3"></i><b>(3)</b> |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>a non persisted (derived) property</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td>implementation would most likely derive full name from constituent parts (eg first name, middle initial, last name)</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="3"></i><b>3</b></td> |
| <td>implementation would most likely parse the input and update the constituent parts</td> |
| </tr> |
| </table> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="see-also-4"><a class="anchor" href="#see-also-4"></a>See also</h3> |
| <div class="paragraph"> |
| <p>This attribute can also be applied to <a href="Parameter.html#maxLength" class="page">parameters</a>.</p> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="mustSatisfy"><a class="anchor" href="#mustSatisfy"></a><code>mustSatisfy()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <code>mustSatisfy</code> attribute allows arbitrary validation to be applied to properties using an (implementation of a) <code>org.apache.isis.applib.spec.Specification</code> object. |
| The attribute is also supported on <a href="Parameter.html#mustSatisfy" class="page">parameters</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>The specification implementations can (of course) be reused between properties and <a href="Parameter.html#mustSatisfy" class="page">parameters</a>.</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>The <code>Specification</code> is consulted during validation, being passed the proposed value. |
| If the proposed value fails, then the value returned is the used as the invalidity reason.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public class StartWithCapitalLetterSpecification |
| extends AbstractSpecification<String> { <i class="conum" data-value="1"></i><b>(1)</b> |
| public String satisfiesSafely(String proposed) { |
| return "".equals(proposed) |
| ? "Empty string" |
| : !Character.isUpperCase(proposed.charAt(0)) |
| ? "Does not start with a capital letter" |
| : null; |
| } |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>the <code>AbstractSpecification</code> class conveniently handles type-safety and dealing with null values.</td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>where:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class Customer { |
| |
| @Property(mustSatisfy=StartWithCapitalLetterSpecification.class) |
| @Getter @Setter |
| private String firstName; |
| |
| // ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>It is also possible to provide translatable reasons. |
| Rather than implement <code>Specification</code>, instead implement <code>Specification2</code> which defines the API:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public interface Specification2 extends Specification { |
| public TranslatableString satisfiesTranslatable(Object obj); <i class="conum" data-value="1"></i><b>(1)</b> |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>Return <code>null</code> if specification satisfied, otherwise the reason as a translatable string</td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>With <code>Specification2</code> there is no need to implement the inherited <code>satifies(Object)</code>; that method will never be called.</p> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="mementoSerialization"><a class="anchor" href="#mementoSerialization"></a><code>mementoSerialization()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <code>mementoSerialization</code> attribute indicates whether the property should be included/excluded from any snapshots generated by the <a href="../applib-svc/XmlSnapshotService.html" class="page"><code>XmlSnapshotService</code></a>.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class Order { |
| |
| @Property(mementoSerialization=EXCLUDED) |
| @Getter @Setter |
| private Order previousOrder; |
| |
| // ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>Alternatively, if the property is derived, then providing only a "getter" will also work:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public class Order { |
| public Order getPreviousOrder() {...} |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="see-also-5"><a class="anchor" href="#see-also-5"></a>See also</h3> |
| <div class="paragraph"> |
| <p>This attribute is also supported for <a href="Collection.html#mementoSerialization" class="page">collections</a>.</p> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="optionality"><a class="anchor" href="#optionality"></a><code>optionality()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>By default, Apache Isis assumes that all properties of an domain object or view model are required (mandatory). |
| The <code>optionality</code> attribute allows this to be relaxed. |
| The attribute is also supported for <a href="Parameter.html#optionality" class="page">parameters</a>.</p> |
| </div> |
| <div class="paragraph"> |
| <p>That said, properties are most commonly defined on persistent domain objects (entities), in which case the JDO <a href="Column.html" class="page"><code>@Column</code></a> should be specified. |
| Apache Isis can infer the maxLength directly from the equivalent @Column#length() annotation.</p> |
| </div> |
| <div class="paragraph"> |
| <p>That said, properties are most commonly defined on persistent domain objects (entities), in which case the JDO <a href="Column.html" class="page"><code>@Column</code></a> will in any case need to be specified. |
| Apache Isis can infer the <code>optionality</code> semantic directly from the equivalent <code>@Column#allowsNull()</code> annotation/attribute.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class Customer { |
| |
| @javax.jdo.annotations.Column(allowsNull="true") |
| @Getter @Setter |
| private String middleInitial; |
| |
| // ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>In this case there is no need for the <code>@Property#optionality</code> attribute.</p> |
| </div> |
| <div class="sect2"> |
| <h3 id="mismatched-defaults"><a class="anchor" href="#mismatched-defaults"></a>Mismatched defaults</h3> |
| <div class="paragraph"> |
| <p>If the <code>@Column#allowsNull</code> attribute is omitted and the `@Property#optionality() attribute is also omitted, then note that Isis' defaults and JDO’s defaults differ. |
| Specifically, Isis always assumes properties are mandatory, whereas JDO specifies that primitives are mandatory, but all reference types are optional.</p> |
| </div> |
| <div class="paragraph"> |
| <p>When Apache Isis initializes it checks for these mismatches during its metamodel validation phase, and will fail to boot ("fail-fast") if there is a mismatch. |
| The fix is usually to add the <code>@Column#allowsNull()</code> annotation/attribute.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="superclass-inheritance-type"><a class="anchor" href="#superclass-inheritance-type"></a>Superclass inheritance type</h3> |
| <div class="paragraph"> |
| <p>There is one case (at least) it may be necessary to annotate the property with both <code>@Column#allowsNull</code> and also <code>@Property#optionality()</code>. |
| If the property is logically mandatory and is in a subclass, but the mapping of the class hierarchy is to store both the superclass and subclass(es) into a single table (ie a "roll-up" mapping using <code>javax.jdo.annotations.InheritanceStrategy#SUPERCLASS_TABLE</code>), then JDO requires that the property is annotated as <code>@Column#allowsNull="true"</code>: its value will be not defined for other subclasses.</p> |
| </div> |
| <div class="paragraph"> |
| <p>In this case we therefore require both annotations.</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@javax.jdo.annotations.PersistenceCapable |
| @javax.jdo.annotations.Inheritance(strategy = InheritanceStrategy.NEW_TABLE) |
| public abstract class PaymentMethod { |
| ... |
| } |
| @javax.jdo.annotations.PersistenceCapable |
| @javax.jdo.annotations.Inheritance(strategy = InheritanceStrategy.SUPERCLASS_TABLE) |
| public class CreditCardPaymentMethod extends PaymentMethod { |
| |
| private String cardNumber; |
| @javax.jdo.annotations.Column(allowsNull="true") |
| @Property(optionality=Optionality.MANDATORY) |
| public String getCardNumber() { return this.cardNumber; } |
| public void setCardNumber(String cardNumber) { this.cardNumber = cardNumber; } |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>Alternatively, you could rely on the fact that Apache Isis never looks at fields (whereas JDO does) and move the JDO annotation to the field:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@javax.jdo.annotations.PersistenceCapable |
| @javax.jdo.annotations.Inheritance(strategy = InheritanceStrategy.SUPERCLASS_TABLE) |
| public class CreditCardPaymentMethod extends PaymentMethod { |
| |
| @javax.jdo.annotations.Column(allowsNull="true") |
| private String cardNumber; |
| |
| public String getCardNumber() { return this.cardNumber; } |
| public void setCardNumber(String cardNumber) { this.cardNumber = cardNumber; } |
| |
| // ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>However this at first glance this might be read as meaning that the property is optional whereas Apache Isis' default (required) applies.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="non-persistent-properties-2"><a class="anchor" href="#non-persistent-properties-2"></a>Non-persistent properties</h3> |
| <div class="paragraph"> |
| <p>Of course, not every property is persistent (it could instead be derived), and neither is every domain object an entity (it could be a view model). |
| For these non persistable properties the <code>optionality</code> attribute is still required.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public class Customer { |
| |
| @javax.jdo.annotation.NotPersistent <i class="conum" data-value="1"></i><b>(1)</b> |
| @Property(optionality=Optionality.OPTIONAL) |
| public String getFullName() { <i class="conum" data-value="2"></i><b>(2)</b> |
| // ... |
| } |
| public void setFullName(String fullName) { <i class="conum" data-value="3"></i><b>(3)</b> |
| // ... |
| } |
| |
| // ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>a non persisted (derived) property</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td>implementation would most likely derive full name from constituent parts (eg first name, middle initial, last name)</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="3"></i><b>3</b></td> |
| <td>implementation would most likely parse the input and update the constituent parts</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>The attribute has no meaning for a primitive type such as <code>int</code>: primitives will always have a default value (e.g. zero). |
| If optionality is required, then use the corresponding wrapper class (e.g. <code>java.lang.Integer</code>) and annotate with <code>Parameter#optionality()</code> as required.</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>The values for the attribute are simply <code>OPTIONAL</code> or <code>MANDATORY</code>.</p> |
| </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>It is also possible to specify optionality using <a href="Nullable.html" class="page"><code>@Nullable</code></a> annotation.</p> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="projecting"><a class="anchor" href="#projecting"></a><code>projecting()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>A common use case for view models is to act as a projection of some underlying entity, to decorate that entity with additional behaviour (or remove existing behaviour) for some particular business context.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Very often the object that is of interest to the end-user is the underlying entity, not the view model per se. |
| If the view model is displayed within a table (on a home page, say), then when the user clicks the entity/icon link for the view model, they will in fact want to drill-down to the underlying entity and skip the view model completely.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The <code>projecting</code> attribute allows the view model to indicate which of its properties holds a reference to the underlying entity of which it is a projection.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@ViewModel |
| public InvoiceSummary { |
| |
| @Property( |
| projecting = Projecting.PROJECTED <i class="conum" data-value="1"></i><b>(1)</b> |
| hidden = Where.EVERYWHERE <i class="conum" data-value="2"></i><b>(2)</b> |
| } |
| @Getter @Setter |
| private Invoice invoice; |
| |
| public LocalDate getDueDate() { <i class="conum" data-value="3"></i><b>(3)</b> |
| return invoice.getDueDate(); |
| } |
| |
| ... |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>indicates that this property holds a reference to the underlying entity</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td>the underlying entity is typically (though not necessarily) hidden</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="3"></i><b>3</b></td> |
| <td>typical implementation of the properties of the underlying entity that are being projected in the view model.</td> |
| </tr> |
| </table> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="publishing"><a class="anchor" href="#publishing"></a><code>publishing()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The <code>publishing</code> attribute determines whether and how a property edit is published via the registered implementation of <a href="../applib-svc/PublisherService.html" class="page"><code>PublisherService</code></a>.</p> |
| </div> |
| <div class="paragraph"> |
| <p>A common use case is to notify external "downstream" systems of changes in the state of the Apache Isis application. |
| The default value for the attribute is <code>AS_CONFIGURED</code>, meaning that the <a href="../config/sections/isis.applib.html#isis.applib.annotation.property.publishing" class="page"><code>isis.applib.annotation.property.publishing</code></a> configuration property is used to determine the whether the property edits are published:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><code>all</code></p> |
| <div class="paragraph"> |
| <p>all property edits are published</p> |
| </div> |
| </li> |
| <li> |
| <p><code>none</code></p> |
| <div class="paragraph"> |
| <p>no property edits are published</p> |
| </div> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>If there is no configuration property in <code>application.properties</code> then publishing is automatically enabled.</p> |
| </div> |
| <div class="paragraph"> |
| <p>This default can be overridden on an property-by-property basis; if <code>publishing()</code> is set to <code>ENABLED</code> then the property edit is published irrespective of the configured value; if set to <code>DISABLED</code> then the property edit is <em>not</em> published, again irrespective of the configured value.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class Order { |
| |
| @Property(publishing=Publishing.ENABLED) <i class="conum" data-value="1"></i><b>(1)</b> |
| @Getter @Setter |
| private int quantity; |
| |
| // ... |
| }</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 published irrespective of the configured value.</td> |
| </tr> |
| </table> |
| </div> |
| <div class="sect2"> |
| <h3 id="see-also-6"><a class="anchor" href="#see-also-6"></a>See also</h3> |
| <div class="paragraph"> |
| <p>This attribute can also be specified for:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><a href="DomainObject.html#publishing" class="page">domain objects</a></p> |
| <div class="paragraph"> |
| <p>where it controls whether changed objects are published as events, and for</p> |
| </div> |
| </li> |
| <li> |
| <p><a href="Action.html#publishing" class="page">actions</a></p> |
| <div class="paragraph"> |
| <p>where it controls whether action invocations are published as events.</p> |
| </div> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="regexPattern"><a class="anchor" href="#regexPattern"></a><code>regexPattern()</code></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>There are three attributes related to enforcing regular expressions:</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>The <code>regexPattern</code> attribute validates the contents of any string property with respect to a regular expression pattern. |
| It is ignored if applied to properties of any other type.</p> |
| </li> |
| <li> |
| <p>The <code>regexPatternFlags</code> attribute specifies flags that modify the handling of the pattern. |
| The values are those that would normally be passed to <code>java.util.regex.Pattern#compile(String,int)</code>.</p> |
| </li> |
| <li> |
| <p>The related <code>regexPatternReplacement</code> attribute specifies the error message to show if the provided argument does not match the regex pattern.</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>For example:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import lombok.Getter; |
| import lombok.Setter; |
| |
| public class Customer { |
| |
| @Property( |
| regexPattern = "(\\w+\\.)*\\w+@(\\w+\\.)+[A-Za-z]+", |
| regexPatternFlags=Pattern.CASE_INSENSITIVE, |
| regexPatternReplacement = |
| "Must be valid email address (containing a '@') symbol" <i class="conum" data-value="1"></i><b>(1)</b> |
| ) |
| @Getter @Setter |
| private String email; |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>Note that there is currently no i18n support for this phrase.</td> |
| </tr> |
| </table> |
| </div> |
| <div class="sect2"> |
| <h3 id="see-also-7"><a class="anchor" href="#see-also-7"></a>See also</h3> |
| <div class="paragraph"> |
| <p>This attribute can also be specified for <a href="Parameter.html#regexPattern" class="page">parameters</a>.</p> |
| </div> |
| </div> |
| </div> |
| </div> |
| </article> |
| <aside class="article-aside toc" role="navigation"> |
| <p class="toc-title">On this page</p> |
| <div id="article-toc"></div> |
| </aside> |
| </main> |
| </div> |
| <footer class="footer"> |
| <div class="content"> |
| <div class="copyright"> |
| <p> |
| Copyright © 2010~2020 The Apache Software Foundation, licensed under the Apache License, v2.0. |
| <br/> |
| Apache, the Apache feather logo, Apache Isis, and the Apache Isis project logo are all trademarks of The Apache Software Foundation. |
| </p> |
| </div> |
| <div class="revision"> |
| <p>Revision: SNAPSHOT</p> |
| </div> |
| </div> |
| </footer> |
| <script src="../../../_/js/site.js"></script> |
| <script async src="../../../_/js/vendor/highlight.js"></script> |
| <script src="../../../_/js/vendor/jquery-3.4.1.min.js"></script> |
| <script src="../../../_/js/vendor/jquery-ui-1.12.1.custom.widget-only.min.js"></script> |
| <script src="../../../_/js/vendor/jquery.tocify.min.js"></script> |
| |
| <script> |
| $(function() { |
| $("#article-toc").tocify( { |
| showEffect: "slideDown", |
| hashGenerator: "pretty", |
| hideEffect: "slideUp", |
| selectors: "h2, h3", |
| scrollTo: 120, |
| smoothScroll: true, |
| theme: "jqueryui", |
| highlightOnScroll: true |
| } ); |
| }); |
| </script> |
| </body> |
| </html> |