Repository: isis
Updated Branches:
  refs/heads/master 8c0aff2f7 -> fcfe52218


ISIS-1228: splitting out a TitleService


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

Branch: refs/heads/master
Commit: fcfe52218c003a32023d84577f948af958ffdf34
Parents: 8c0aff2
Author: Dan Haywood <d...@haywood-associates.co.uk>
Authored: Thu Mar 17 18:26:04 2016 +0000
Committer: Dan Haywood <d...@haywood-associates.co.uk>
Committed: Thu Mar 17 18:26:04 2016 +0000

----------------------------------------------------------------------
 .../_rgsvc_api_DomainObjectContainer.adoc       | 35 +++++---
 ...nObjectContainer_generic-repository-api.adoc |  5 --
 ..._api_DomainObjectContainer_messages-api.adoc |  5 --
 ...mainObjectContainer_object-creation-api.adoc |  5 --
 ...nObjectContainer_object-persistence-api.adoc |  6 --
 ..._DomainObjectContainer_presentation-api.adoc |  1 -
 ...pi_DomainObjectContainer_properties-api.adoc |  6 --
 ..._api_DomainObjectContainer_security-api.adoc |  5 --
 ..._api_DomainObjectContainer_services-api.adoc |  5 --
 ...pi_DomainObjectContainer_validation-api.adoc | 13 ++-
 .../guides/_rgsvc_api_FactoryService.adoc       |  2 +-
 .../guides/_rgsvc_api_TitleService.adoc         | 74 ++++++++++++++++
 .../guides/_rgsvc_application-layer-api.adoc    | 12 +++
 .../isis/applib/DomainObjectContainer.java      |  8 +-
 .../applib/services/title/TitleService.java     | 41 +++++++++
 .../container/DomainObjectContainerDefault.java | 29 ++-----
 .../services/title/TitleServiceDefault.java     | 91 ++++++++++++++++++++
 17 files changed, 267 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer.adoc
index 26ef7d3..8be3cb7 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer.adoc
@@ -7,29 +7,38 @@
 
 The `DomainObjectContainer` service provides a set of general purpose 
functionality for domain objects to call.  Principal amongst these are a 
generic APIs for querying objects and creating and persisting objects.  In 
addition, the service provides access to security context (the "current user"), 
allows information and warning messages to be raised, and various other 
miscellaneous functions.
 
+
 [NOTE]
 ====
-Compared to other services provided by Apache Isis, the 
`DomainObjectContainer` provides by far the most number of methods, addressing 
several quite distinct responsibilities.  This is a historical accident: in 
early versions of Apache Isis the `DomainObjectContainer` was the one and only 
domain service provided by the framework.
-
-In the future we may deprecate this service and break out its responsibilities 
into a number of small services.  However, given how important this service was 
in days past, we are unlikely to delete it as a service even once it has been 
deprecated.
+(As of `1.12.0-SNAPSHOT`), the methods in this service have been moved out 
into a number of more fine-grained services: 
xref:rgsvc.adoc#_rgsvc_api_RepositoryService[`RepositoryService`], 
xref:rgsvc.adoc#_rgsvc_api_MessageService[`MessageService`], 
xref:rgsvc.adoc#_rgsvc_api_FactoryService[`FactoryService`], 
xref:rgsvc.adoc#_rgsvc_api_TitleService[`TitleService`], 
xref:rgsvc.adoc#_rgsvc_api_ConfigurationService[`ConfigurationService`], 
xref:rgsvc.adoc#_rgsvc_api_UserService[`UserService`] and 
xref:rgsvc.adoc#_rgsvc_api_ServiceRegistry[`ServiceRegistry`].
 ====
 
+
+
+
+== APIs
+
 The sections below discuss the functions provided by the service, broken out 
into categories.
 
 
-include::_rgsvc_api_DomainObjectContainer_object-creation-api.adoc[leveloffset=+1]
-include::_rgsvc_api_DomainObjectContainer_generic-repository-api.adoc[leveloffset=+1]
-include::_rgsvc_api_DomainObjectContainer_object-persistence-api.adoc[leveloffset=+1]
-include::_rgsvc_api_DomainObjectContainer_messages-api.adoc[leveloffset=+1]
-include::_rgsvc_api_DomainObjectContainer_security-api.adoc[leveloffset=+1]
-include::_rgsvc_api_DomainObjectContainer_presentation-api.adoc[leveloffset=+1]
-include::_rgsvc_api_DomainObjectContainer_validation-api.adoc[leveloffset=+1]
-include::_rgsvc_api_DomainObjectContainer_properties-api.adoc[leveloffset=+1]
-include::_rgsvc_api_DomainObjectContainer_services-api.adoc[leveloffset=+1]
+include::_rgsvc_api_DomainObjectContainer_object-creation-api.adoc[leveloffset=+2]
+include::_rgsvc_api_DomainObjectContainer_generic-repository-api.adoc[leveloffset=+2]
+include::_rgsvc_api_DomainObjectContainer_object-persistence-api.adoc[leveloffset=+2]
+include::_rgsvc_api_DomainObjectContainer_messages-api.adoc[leveloffset=+2]
+include::_rgsvc_api_DomainObjectContainer_security-api.adoc[leveloffset=+2]
+include::_rgsvc_api_DomainObjectContainer_presentation-api.adoc[leveloffset=+2]
+include::_rgsvc_api_DomainObjectContainer_properties-api.adoc[leveloffset=+2]
+include::_rgsvc_api_DomainObjectContainer_services-api.adoc[leveloffset=+2]
+include::_rgsvc_api_DomainObjectContainer_validation-api.adoc[leveloffset=+2]
 
 
 
 
+== Implementation
+
+The core framework provides a default implementation of this service 
(`o.a.i.core.metamodel.services.container.DomainObjectContainerDefault`).
+
+
 
 == Registering the Service
 
@@ -38,3 +47,5 @@ Assuming that the `configuration-and-annotation` services 
installer is configure
 implementation of `DomainObjectContainer` service is automatically registered 
and injected (it is annotated with
 `@DomainService`) so no further configuration is required.
 
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_generic-repository-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_generic-repository-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_generic-repository-api.adoc
index 728063e..3184e90 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_generic-repository-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_generic-repository-api.adoc
@@ -8,11 +8,6 @@
 
 The repository API acts as an abstraction over the JDO/DataNucleus 
objectstore.  You can use it during prototyping to write naive queries (find 
all rows, then filter using the Guava `Predicate` API, or you can use it to 
call JDO 
link:http://www.datanucleus.org/products/accessplatform_4_0/jdo/query.html#named[named
 queries] using JDOQL.
 
-[NOTE]
-====
-(As of `1.12.0-SNAPSHOT`), the majority of these methods have been moved to 
the xref:rgsvc.adoc#_rgsvc_api_RepositoryService[`RepositoryService`] or 
xref:rgsvc.adoc#_rgsvc_api_TransactionService[`TransactionService`]; the 
corresponding methods in `DomainObjectContainer` are therefore deprecated.
-====
-
 As an alternative, you could also use 
link:http://www.datanucleus.org/products/accessplatform_4_0/jdo/jdoql_typesafe.html[JDO
 typesafe queries] through the 
xref:rgsvc.adoc#_rgsvc_api_IsisJdoSupport[`IsisJdoSupport`] service.
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_messages-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_messages-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_messages-api.adoc
index 6976d09..e80ab3c 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_messages-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_messages-api.adoc
@@ -8,11 +8,6 @@
 
 The `DomainObjectContainer` allows domain objects to raise information, 
warning or error messages.  These messages can either be simple strings, or can 
be translated.
 
-[NOTE]
-====
-(As of `1.12.0-SNAPSHOT`), these methods have been moved to the 
xref:rgsvc.adoc#_rgsvc_api_MessageService[`MessageService`]; the corresponding 
methods in `DomainObjectContainer` are deprecated.
-====
-
 [source,java]
 ----
 public interface DomainObjectContainer {

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-creation-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-creation-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-creation-api.adoc
index c717383..c48aa82 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-creation-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-creation-api.adoc
@@ -8,11 +8,6 @@
 
 The object creation APIs are used to instantiate new domain objects or view 
models.
 
-[NOTE]
-====
-(As of `1.12.0-SNAPSHOT`), some of these methods have been moved to the 
xref:rgsvc.adoc#_rgsvc_api_FactoryService[`FactoryService`]; the corresponding 
methods in `DomainObjectContainer` are deprecated.
-====
-
 [source,java]
 ----
 public interface DomainObjectContainer {

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-persistence-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-persistence-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-persistence-api.adoc
index 4c67741..d520916 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-persistence-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_object-persistence-api.adoc
@@ -9,12 +9,6 @@
 
 The persistence API is used to persist newly created objects (as per 
xref:rgsvc.adoc#_rgsvc_api_DomainObjectContainer_object-creation-api[`#newTransientInstance(...)`],
 above and to delete (remove) objects that are persistent.
 
-[NOTE]
-====
-(As of `1.12.0-SNAPSHOT`), the majority of these methods have been moved to 
the xref:rgsvc.adoc#_rgsvc_api_RepositoryService[`RepositoryService`] or 
xref:rgsvc.adoc#_rgsvc_api_TransactionService[`TransactionService`]; the 
corresponding methods in `DomainObjectContainer` are therefore deprecated.
-====
-
-
 Note that there is no API for updating existing objects; the framework (or 
rather, JDO/DataNucleus) performs object dirty tracking and so any objects that 
are modified in the course of a request will be automatically updated).
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_presentation-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_presentation-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_presentation-api.adoc
index 5d5ea2d..75040d5 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_presentation-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_presentation-api.adoc
@@ -18,7 +18,6 @@ The API defined by `DomainObjectContainer` is simply:
 [source,java]
 ----
 public interface DomainObjectContainer {
-    @Programmatic
     String titleOf(Object domainObject);                // <1>
     String iconNameOf(Object domainObject);             // <2>
     ...

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_properties-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_properties-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_properties-api.adoc
index f4b9a6f..aecc5b8 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_properties-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_properties-api.adoc
@@ -6,16 +6,10 @@
 
 
 
-
 = Properties API
 
 The properties API allows domain objects to read the configuration properties 
aggregated from the various 
xref:rgcfg.adoc#_rgcfg_configuration-files[configuration files].
 
-[NOTE]
-====
-(As of `1.12.0-SNAPSHOT`), these methods have been moved to the 
xref:rgsvc.adoc#_rgsvc_api_ConfigurationService[`ConfigurationService`]; the 
corresponding methods in `DomainObjectContainer` are deprecated.
-====
-
 [source,java]
 ----
 public interface DomainObjectContainer {

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_security-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_security-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_security-api.adoc
index 2daef94..8126a11 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_security-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_security-api.adoc
@@ -8,11 +8,6 @@
 
 The security API allows the domain object to obtain the identity of the user 
interacting with said object.
 
-[NOTE]
-====
-(As of `1.12.0-SNAPSHOT`), these methods have been moved to the 
xref:rgsvc.adoc#_rgsvc_api_UserService[`UserService`]; the corresponding 
methods in `DomainObjectContainer` are deprecated.
-====
-
 [source,java]
 ----
 public interface DomainObjectContainer {

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_services-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_services-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_services-api.adoc
index 475b729..8a2f82a 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_services-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_services-api.adoc
@@ -7,11 +7,6 @@
 
 The services API allows your domain objects to programmatically inject 
services into arbitrary objects, as well as to look up services by type.
 
-[NOTE]
-====
-(As of `1.12.0-SNAPSHOT`), some of these methods have been moved to the 
xref:rgsvc.adoc#_rgsvc_api_ServiceRegistry[`ServiceRegistry`]; the 
corresponding methods in `DomainObjectContainer` are deprecated.
-====
-
 The methods are:
 
 [source,java]

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_validation-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_validation-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_validation-api.adoc
index af66b2b..8a03c81 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_validation-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_DomainObjectContainer_validation-api.adoc
@@ -5,8 +5,16 @@
 :_imagesdir: images/
 
 
+The intent of this API is to provide a mechanism where an object can 
programmatically check the state any class
+invariants.  Specifically, this means the validating the current state of all 
properties, as well as any object-level
+validation defined by 
xref:rgcms.adoc#_rgcms_methods_reserved_validate[`validate()`].
+
+[WARNING]
+====
+As of `1.12.0-SNAPSHOT` these methods have been deprecated; this feature 
should be considered experimental and
+your mileage may vary.
+====
 
-The validation API allows a domain object to programmatically validate itself 
or any other domain object.  Specifically, this means the validating the 
current state of all properties, as well as any object-level validation defined 
by xref:rgcms.adoc#_rgcms_methods_reserved_validate[`validate()`].
 
 The API provided is:
 
@@ -19,6 +27,3 @@ public interface DomainObjectContainer {
 }
 ----
 
-If an object is changed by editing its properties, then (using the 
xref:ugvw.adoc#[Wicket viewer] at least) Apache Isis will check that the state 
of the object is valid.  There is currently however no equivalent guarantee for 
actions.
-
-The intent of this API was (originally at least) to provide a fallback whereby 
actions could at least be able to perform this validation programmatically (eg 
in their own xref:rgcms.adoc#_rgcms_methods_prefixes_validate[`validate...()`] 
or xref:rgcms.adoc#_rgcms_methods_prefixes_disable[`disable...()`] methods.  
However, this feature should be considered experimental; your mileage may vary.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_FactoryService.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_FactoryService.adoc 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_FactoryService.adoc
index 0547777..16023a2 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_FactoryService.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_FactoryService.adoc
@@ -53,7 +53,7 @@ repositoryService.persist(cust);
 
 == Implementation
 
-The core framework provides a default implementation of this service 
(`o.a.i.core.runtime.services.factory.FactoryServiceDefault`).
+The core framework provides a default implementation of this service 
(`o.a.i.core.metamodel.services.factory.FactoryServiceDefault`).
 
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TitleService.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TitleService.adoc 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TitleService.adoc
new file mode 100644
index 0000000..e5e2ce8
--- /dev/null
+++ b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TitleService.adoc
@@ -0,0 +1,74 @@
+[[_rgsvc_api_TitleService]]
+= `TitleService` (`1.12.0-SNAPSHOT`)
+:Notice: Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with this work 
for additional information regarding copyright ownership. The ASF licenses this 
file to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy of 
the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by 
applicable law or agreed to in writing, software distributed under the License 
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY 
KIND, either express or implied. See the License for the specific language 
governing permissions and limitations under the License.
+:_basedir: ../
+:_imagesdir: images/
+
+
+The `TitleService` provides methods to programmatically obtain the title and 
icon of a domain object.
+
+[NOTE]
+====
+The methods in this service replace similar methods (now deprecated) in 
xref:rgsvc.adoc#_rgsvc_api_DomainObjectContainer[`DomainObjectContainer`].
+====
+
+
+
+== API
+
+The API of `TitleService` is:
+
+[source,java]
+----
+public interface PresentationService {
+    String titleOf(Object domainObject);                // <1>
+    String iconNameOf(Object domainObject);             // <2>
+}
+----
+<1> return the title of the object, as rendered in the UI by the Apache Isis 
viewers.
+<2> return the icon name of the object, as rendered in the UI by the Apache 
Isis viewers.
+
+
+
+== Usage
+
+By way of example, here's some code based on a system for managing government 
benefits:
+
+[source,java]
+----
+public class QualifiedAdult {
+
+    private Customer qualifying;
+
+    public String title() {
+        return "QA for " + titleService.titleOf(qualifying);
+    }
+
+    ...
+    @Inject
+    TitleService titleService;
+}
+----
+
+In this example, whatever the title of a `Customer`, it is reused within the 
title of that customer's ``QualifiedAdult`` object.
+
+
+
+== Implementation
+
+The core framework provides a default implementation of this service 
(`o.a.i.core.metamodel.services.title.TitleServiceDefault`).
+
+
+
+== Registering the Service
+
+Assuming that the `configuration-and-annotation` services installer is 
configured (implicit if using the
+`AppManifest` to 
xref:rgcms.adoc#_rgcms_classes_AppManifest-bootstrapping[bootstrap the app]) 
then Apache Isis' core
+implementation of `TitleService` service is automatically registered and 
injected (it is annotated with
+`@DomainService`) so no further configuration is required.
+
+To use an alternative implementation, use
+xref:rgant.adoc#_rgant-DomainServiceLayout_menuOrder[`@DomainServiceLayout#menuOrder()`]
 (as explained
+in the xref:rgsvc.adoc#_rgsvc_intro_overriding-the-services[introduction] to 
this guide).
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/adocs/documentation/src/main/asciidoc/guides/_rgsvc_application-layer-api.adoc
----------------------------------------------------------------------
diff --git 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_application-layer-api.adoc
 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_application-layer-api.adoc
index 432ed67..140703a 100644
--- 
a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_application-layer-api.adoc
+++ 
b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_application-layer-api.adoc
@@ -88,6 +88,17 @@ xref:rgsvc.adoc#_rgsvc_spi_CommandService[`CommandService`] 
for persistent `Comm
 |
 
 
+|xref:rgsvc.adoc#_rgsvc_api_TitleService[`o.a.i.applib.` +
+`services.title` +
+`TitleService`]
+|(`1.12.0-SNAPSHOT`) Methods to programmatically obtain the title or icon of a 
domain object.
+|`TitleService-` +
+``Default`` +
+``o.a.i.core`` +
+``isis-core-metamodel``
+|Supercedes methods in 
xref:rgsvc.adoc#_rgsvc_api_DomainObjectContainer[`DomainObjectContainer`].
+
+
 
 |xref:rgsvc.adoc#_rgsvc_api_TransactionService[`o.a.i.applib.` +
 `services.xactn` +
@@ -128,5 +139,6 @@ include::_rgsvc_api_BackgroundService.adoc[leveloffset=+1]
 include::_rgsvc_api_CommandContext.adoc[leveloffset=+1]
 include::_rgsvc_api_MessageService.adoc[leveloffset=+1]
 include::_rgsvc_api_SessionManagementService.adoc[leveloffset=+1]
+include::_rgsvc_api_TitleService.adoc[leveloffset=+1]
 include::_rgsvc_api_TransactionService.adoc[leveloffset=+1]
 include::_rgsvc_api_WrapperFactory.adoc[leveloffset=+1]

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
----------------------------------------------------------------------
diff --git 
a/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java 
b/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
index bbed50e..3b09970 100644
--- 
a/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
+++ 
b/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
@@ -28,8 +28,8 @@ import org.apache.isis.applib.annotation.Programmatic;
 import org.apache.isis.applib.filter.Filter;
 import org.apache.isis.applib.query.Query;
 import org.apache.isis.applib.security.UserMemento;
-import org.apache.isis.applib.services.config.ConfigurationService;
 import org.apache.isis.applib.services.i18n.TranslatableString;
+import org.apache.isis.applib.services.title.TitleService;
 import org.apache.isis.applib.services.user.UserService;
 
 /**
@@ -44,7 +44,10 @@ public interface DomainObjectContainer {
     /**
      * Return the title of the object, as rendered in the UI by the 
      * Isis viewers.
+     *
+     * @deprecated - use {@link TitleService#titleOf(Object)} instead.
      */
+    @Deprecated
     @Programmatic
     String titleOf(Object domainObject);
 
@@ -55,7 +58,10 @@ public interface DomainObjectContainer {
     /**
      * Return the icon name of the object, as rendered in the UI by the
      * Isis viewers.
+     *
+     * @deprecated - use {@link TitleService#iconNameOf(Object)} instead.
      */
+    @Deprecated
     @Programmatic
     String iconNameOf(Object domainObject);
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/core/applib/src/main/java/org/apache/isis/applib/services/title/TitleService.java
----------------------------------------------------------------------
diff --git 
a/core/applib/src/main/java/org/apache/isis/applib/services/title/TitleService.java
 
b/core/applib/src/main/java/org/apache/isis/applib/services/title/TitleService.java
new file mode 100644
index 0000000..c918feb
--- /dev/null
+++ 
b/core/applib/src/main/java/org/apache/isis/applib/services/title/TitleService.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.applib.services.title;
+
+import org.apache.isis.applib.annotation.Programmatic;
+
+public interface TitleService {
+
+    /**
+     * Return the title of the object, as rendered in the UI by the
+     * Isis viewers.
+     */
+    @Programmatic
+    String titleOf(Object domainObject);
+
+    /**
+     * Return the icon name of the object, as rendered in the UI by the
+     * Isis viewers.
+     */
+    @Programmatic
+    String iconNameOf(Object domainObject);
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
----------------------------------------------------------------------
diff --git 
a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
 
b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
index b07c7e1..34c0a83 100644
--- 
a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
+++ 
b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
@@ -44,6 +44,7 @@ import 
org.apache.isis.applib.services.exceprecog.ExceptionRecognizerForType;
 import org.apache.isis.applib.services.factory.FactoryService;
 import org.apache.isis.applib.services.i18n.TranslatableString;
 import org.apache.isis.applib.services.message.MessageService;
+import org.apache.isis.applib.services.title.TitleService;
 import org.apache.isis.applib.services.registry.ServiceRegistry;
 import org.apache.isis.applib.services.repository.RepositoryService;
 import org.apache.isis.applib.services.user.UserService;
@@ -60,8 +61,6 @@ import 
org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
 import org.apache.isis.core.metamodel.consent.InteractionResult;
 import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
-import org.apache.isis.core.metamodel.runtimecontext.LocalizationProvider;
-import org.apache.isis.core.metamodel.runtimecontext.LocalizationProviderAware;
 import org.apache.isis.core.metamodel.runtimecontext.PersistenceSessionService;
 import 
org.apache.isis.core.metamodel.runtimecontext.PersistenceSessionServiceAware;
 import 
org.apache.isis.core.metamodel.services.container.query.QueryFindByPattern;
@@ -73,22 +72,17 @@ import 
org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
 @DomainService(nature = NatureOfService.DOMAIN)
 public class DomainObjectContainerDefault
         implements DomainObjectContainer,
-        PersistenceSessionServiceAware, SpecificationLoaderAware, 
AuthenticationSessionProviderAware, AdapterManagerAware,
-        LocalizationProviderAware, ExceptionRecognizer {
+        PersistenceSessionServiceAware, SpecificationLoaderAware,
+        AuthenticationSessionProviderAware, AdapterManagerAware, 
ExceptionRecognizer {
 
 
     //region > titleOf
 
+    @Deprecated
     @Programmatic
     @Override
     public String titleOf(final Object domainObject) {
-        final ObjectAdapter objectAdapter = 
adapterManager.adapterFor(unwrapped(domainObject));
-        final boolean destroyed = objectAdapter.isDestroyed();
-        if(!destroyed) {
-            return objectAdapter.getSpecification().getTitle(objectAdapter, 
localizationProvider.getLocalization());
-        } else {
-            return "[DELETED]";
-        }
+        return titleService.titleOf(domainObject);
     }
 
     //endregion
@@ -98,8 +92,7 @@ public class DomainObjectContainerDefault
     @Programmatic
     @Override
     public String iconNameOf(final Object domainObject) {
-        final ObjectAdapter objectAdapter = 
adapterManager.adapterFor(unwrapped(domainObject));
-        return objectAdapter.getSpecification().getIconName(objectAdapter);
+        return titleService.iconNameOf(domainObject);
     }
 
     //endregion
@@ -674,8 +667,6 @@ public class DomainObjectContainerDefault
     private SpecificationLoader specificationLoader;
     private AuthenticationSessionProvider authenticationSessionProvider;
     private AdapterManager adapterManager;
-    private LocalizationProvider localizationProvider;
-
 
 
     protected SpecificationLoader getSpecificationLoader() {
@@ -718,11 +709,6 @@ public class DomainObjectContainerDefault
         this.persistenceSessionService = persistenceSessionService;
     }
 
-    @Override
-    public void setLocalizationProvider(final LocalizationProvider 
localizationProvider) {
-        this.localizationProvider = localizationProvider;
-    }
-
 
 
     //endregion
@@ -748,6 +734,9 @@ public class DomainObjectContainerDefault
     TransactionService transactionService;
 
     @javax.inject.Inject
+    TitleService titleService;
+
+    @javax.inject.Inject
     UserService userService;
 
     @javax.inject.Inject

http://git-wip-us.apache.org/repos/asf/isis/blob/fcfe5221/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/title/TitleServiceDefault.java
----------------------------------------------------------------------
diff --git 
a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/title/TitleServiceDefault.java
 
b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/title/TitleServiceDefault.java
new file mode 100644
index 0000000..ce456d8
--- /dev/null
+++ 
b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/title/TitleServiceDefault.java
@@ -0,0 +1,91 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.services.title;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.title.TitleService;
+import org.apache.isis.applib.services.wrapper.WrapperFactory;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
+import org.apache.isis.core.metamodel.runtimecontext.LocalizationProvider;
+import org.apache.isis.core.metamodel.runtimecontext.LocalizationProviderAware;
+
+@DomainService(
+        nature = NatureOfService.DOMAIN
+)
+public class TitleServiceDefault
+        implements TitleService, AdapterManagerAware, 
LocalizationProviderAware {
+
+    @Programmatic
+    @Override
+    public String titleOf(final Object domainObject) {
+        final ObjectAdapter objectAdapter = 
adapterManager.adapterFor(unwrapped(domainObject));
+        final boolean destroyed = objectAdapter.isDestroyed();
+        if(!destroyed) {
+            return objectAdapter.getSpecification().getTitle(objectAdapter, 
localizationProvider.getLocalization());
+        } else {
+            return "[DELETED]";
+        }
+    }
+
+    @Programmatic
+    @Override
+    public String iconNameOf(final Object domainObject) {
+        final ObjectAdapter objectAdapter = 
adapterManager.adapterFor(unwrapped(domainObject));
+        return objectAdapter.getSpecification().getIconName(objectAdapter);
+    }
+
+
+
+
+    // //////////////////////////////////////
+
+    private Object unwrapped(Object domainObject) {
+        return wrapperFactory != null ? wrapperFactory.unwrap(domainObject) : 
domainObject;
+    }
+
+    // //////////////////////////////////////
+
+    private AdapterManager adapterManager;
+
+    protected AdapterManager getAdapterManager() {
+        return adapterManager;
+    }
+
+    @Programmatic
+    @Override
+    public void setAdapterManager(final AdapterManager adapterManager) {
+        this.adapterManager = adapterManager;
+    }
+
+    private LocalizationProvider localizationProvider;
+    @Override
+    public void setLocalizationProvider(final LocalizationProvider 
localizationProvider) {
+        this.localizationProvider = localizationProvider;
+    }
+
+
+    @javax.inject.Inject
+    WrapperFactory wrapperFactory;
+
+}

Reply via email to