You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/02/14 12:40:55 UTC

[isis] 02/02: ISIS-2444: fixes compile issue

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 9c84de6cf1e5c93ab60df44d18699e2251ad24e4
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Feb 14 12:40:24 2021 +0000

    ISIS-2444: fixes compile issue
---
 .../modules/applib-svc/pages/RoutingService.adoc   | 76 +---------------------
 .../RoutingService/hooks/examples_and_usage.adoc   | 15 +++++
 .../pages/RoutingService/hooks/implementation.adoc |  4 ++
 .../adoc/modules/applib-svc/pages/Scratchpad.adoc  |  2 +-
 .../applib/services/routing/RoutingService.java    | 57 +++++++++++++++-
 .../isis/legacy/applib/DomainObjectContainer.java  | 60 ++++++++---------
 6 files changed, 108 insertions(+), 106 deletions(-)

diff --git a/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService.adoc b/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService.adoc
index 6af74d7..ec94659 100644
--- a/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService.adoc
+++ b/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService.adoc
@@ -1,10 +1,9 @@
-[#RoutingService`
-= `RoutingService`
+[#RoutingService]
+= RoutingService
 
 :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 ag [...]
 
 
-WARNING: TODO: this content has not yet been reviewed/updated for v2.0
 
 include::system:generated:page$index/applib/services/routing/RoutingService.adoc[RoutingService]
 
@@ -13,74 +12,3 @@ include::RoutingService/hooks/implementation.adoc[]
 include::RoutingService/hooks/examples_and_usage.adoc[]
 
 
-
-The `RoutingService` provides the ability to return (and therefore render) an alternative object from an action invocation.
-
-There are two primary use cases:
-
-* if an action returns an aggregate leaf (that is, a child object which has an owning parent), then the parent object can be
-returned instead. +
-+
-For example, an action returning `OrderItem` might instead render the owning `Order` object.  It is the responsibility
-of the implementation to figure out what the "owning" object might be.
-
-* if an action returns `null` or is `void`, then return some other "useful" object. +
-+
-For example, return the home page (eg as defined by the xref:refguide:applib-ant:HomePage.adoc[`@HomePage`] annotation).
-
-Currently the routing service is used only by the xref:vw:ROOT:about.adoc[Wicket viewer]; it is ignored by the xref:vro:ROOT:about.adoc[Restful Objects] viewer.
-
-
-[NOTE]
-====
-Unlike most other domain services, the framework will check _all_ available implementations of `RoutingService` to return a route, rather than the first implementation found; in other words it uses the chain-of-responsibility pattern.
-Services are called in the order defined by the Spring link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/annotation/Order.html[`@Order`] annotation (or equivalent).
-The route used will be the result of the first implementation checked that declares that it can provide a route.
-====
-
-
-== API
-
-include::system:generated:page$index/applib/services/routing/RoutingService.adoc[leveloffset=+2]
-
-TODO example migration
-
-.Deprecated Docs
-[WARNING]
-================================
-
-== SPI
-
-The SPI defined by this service is:
-
-[source,java]
-----
-include::refguide:applib-svc:example$services/routing/RoutingService.java[tags="refguide"]
-----
-<.> whether this implementation recognizes and can "route" the object.
-The `route(...)` method is only called if this method returns `true`.
-<.> the object to use; this may be the same as the original object, some other object, or (indeed) `null`.
-
-
-
-
-
-================================
-
-== Implementation
-
-The framework provides a default implementation - `o.a.i.runtimeservices.routing.RoutingServiceDefault` - which will always return the original object provided, or the home page if a `null` or `void` was provided.
-Under the covers it uses the xref:refguide:applib-svc:HomePageResolverService.adoc[`HomePageResolverService`].
-
-There can be multiple implementations of `RoutingService` registered.
-These are checked in turn (chain of responsibility pattern), ordered according to the Spring link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/annotation/Order.html[`@Order`] annotation or equivalent (as explained in the xref:refguide:applib-svc:about.adoc#overriding-the-services[introduction] to this guide).
-The route from the first service that returns `true` from its `canRoute(...)` method will be used.
-
-
-
-
-
-== Related Services
-
-The default implementation of this service uses the
-xref:refguide:applib-svc:HomePageResolverService.adoc[`HomePageResolverService`].
diff --git a/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService/hooks/examples_and_usage.adoc b/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService/hooks/examples_and_usage.adoc
index 21f4ba4..2049759 100644
--- a/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService/hooks/examples_and_usage.adoc
+++ b/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService/hooks/examples_and_usage.adoc
@@ -2,3 +2,18 @@
 :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 ag [...]
 
 
+
+== Usage
+
+Unlike most other domain services, the framework will check _all_ available implementations of `RoutingService` to return a route, rather than the first implementation found; in other words it uses the chain-of-responsibility pattern.
+
+Services are called in the order defined by the Spring link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/annotation/Order.html[`@Order`] annotation (or equivalent).
+The route used will be the result of the first implementation checked that declares that it can provide a route.
+
+
+== Related Services
+
+* xref:refguide:applib-svc:HomePageResolverService.adoc[`HomePageResolverService`]
++
+Used by the default implementation of this service uses the
+ to determine where to route actions that return `null` or are declared as `void`.
diff --git a/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService/hooks/implementation.adoc b/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService/hooks/implementation.adoc
index 697f559..72bfc2e 100644
--- a/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService/hooks/implementation.adoc
+++ b/api/applib/src/main/adoc/modules/applib-svc/pages/RoutingService/hooks/implementation.adoc
@@ -4,3 +4,7 @@
 
 
 == Implementation
+
+
+The framework provides a default implementation - `o.a.i.runtimeservices.routing.RoutingServiceDefault` - which will always return the original object provided, or the home page if a `null` or `void` was provided.
+Under the covers this implementation uses the xref:refguide:applib-svc:HomePageResolverService.adoc[`HomePageResolverService`].
diff --git a/api/applib/src/main/adoc/modules/applib-svc/pages/Scratchpad.adoc b/api/applib/src/main/adoc/modules/applib-svc/pages/Scratchpad.adoc
index 180b5dc..840fdce 100644
--- a/api/applib/src/main/adoc/modules/applib-svc/pages/Scratchpad.adoc
+++ b/api/applib/src/main/adoc/modules/applib-svc/pages/Scratchpad.adoc
@@ -1,4 +1,4 @@
-= `Scratchpad`
+[#Scratchpad]
 = `Scratchpad`
 
 :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 ag [...]
diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/routing/RoutingService.java b/api/applib/src/main/java/org/apache/isis/applib/services/routing/RoutingService.java
index c77a148..6316ee7 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/routing/RoutingService.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/services/routing/RoutingService.java
@@ -19,13 +19,68 @@
 package org.apache.isis.applib.services.routing;
 
 /**
- * Provides the ability to return (and therefore have rendered) an alternative object from an action invocation.
+ * Provides the ability to return (and therefore have rendered) an alternative
+ * object from an action invocation.
+ *
+ * <p>
+ * There are two primary use cases:
+ * </p>
+ *
+ * <ul>
+ *     <li>
+ *          <p>
+ *              if an action returns an aggregate leaf (that is, a child
+ *              object which has an owning parent), then the parent object can
+ *              be * returned instead.
+ *          </p>
+ *          <p>
+ *              For example, an action returning `OrderItem` might instead
+ *              render the owning `Order` object.  It is the responsibility
+ *              of the implementation to figure out what the "owning" object
+ *              might be.
+ *          </p>
+ *     </li>
+ *     <li>
+ *          <p>
+ *              if an action returns `null` or is `void`, then return some
+ *              other "useful" object.
+ *          </p>
+ *          <p>
+ *              For example, return the home page (eg as defined by the
+ *              {@link org.apache.isis.applib.annotation.HomePage} annotation).
+ *          </p>
+ *     </li>
+ * </ul>
+ *
+ * <p>
+ * Currently this service is used only by the Wicket viewer; it is ignored by
+ * the Restful Objects viewer.
+ * </p>
+ *
  * @since 1.x {@index}
  */
 public interface RoutingService {
 
+    /**
+     * whether this implementation recognizes and can "route" the object.
+     *
+     * <p>
+     *     The {@link #route(Object)} method is only called if this method
+     *     returns <code>true</code>.
+     * </p>
+     *
+     * @param original
+     * @return
+     */
     boolean canRoute(Object original);
 
+    /**
+     * The object to route to instead; this may be the same as the original
+     * object, some other object, or (indeed) `null`.
+     *
+     * @param original
+     * @return
+     */
     Object route(Object original);
 
 }
diff --git a/legacy/extensions/core/applib/src/main/java/org/apache/isis/legacy/applib/DomainObjectContainer.java b/legacy/extensions/core/applib/src/main/java/org/apache/isis/legacy/applib/DomainObjectContainer.java
index 7084cea..a579faf 100644
--- a/legacy/extensions/core/applib/src/main/java/org/apache/isis/legacy/applib/DomainObjectContainer.java
+++ b/legacy/extensions/core/applib/src/main/java/org/apache/isis/legacy/applib/DomainObjectContainer.java
@@ -52,7 +52,7 @@ import org.apache.isis.applib.services.xactn.TransactionService;
 import org.apache.isis.commons.internal.exceptions._Exceptions;
 import org.apache.isis.core.config.IsisConfiguration;
 import org.apache.isis.legacy.applib.filter.Filter;
-import org.apache.isis.persistence.jdo.applib.integration.JdoSupportService;
+import org.apache.isis.persistence.jdo.applib.services.JdoSupportService;
 
 import lombok.NonNull;
 import lombok.SneakyThrows;
@@ -67,7 +67,7 @@ import lombok.SneakyThrows;
 @Qualifier("Default")
 @Deprecated
 public class DomainObjectContainer {
-	
+
 	@Inject private RepositoryService repositoryService;
 	@Inject private MetaModelService metaModelService;
 	@Inject private JdoSupportService jdoSupport;
@@ -78,9 +78,9 @@ public class DomainObjectContainer {
 	@Inject private ServiceRegistry serviceRegistry;
 	@Inject private MessageService messageService;
 	@Inject private UserService userService;
-	
+
     /**
-     * Return the title of the object, as rendered in the UI by the 
+     * Return the title of the object, as rendered in the UI by the
      * Isis viewers.
      *
      * @deprecated - use {@link TitleService#titleOf(Object)} instead.
@@ -102,7 +102,7 @@ public class DomainObjectContainer {
     public String iconNameOf(Object domainObject) {
     	return titleService.iconNameOf(domainObject);
     }
-    
+
     /**
      * Re-initialises the fields of an object, using the
      * JDO {@link javax.jdo.PersistenceManager#refresh(Object) refresh} API.
@@ -152,15 +152,15 @@ public class DomainObjectContainer {
     public void objectChanged(Object domainObject) {
     	// do nothing
     }
-    
+
 
     /**
      * Flush all changes to the object store.
-     * 
+     *
      * <p>
      * Occasionally useful to ensure that newly persisted domain objects
-     * are flushed to the database prior to a subsequent repository query. 
-     * 
+     * are flushed to the database prior to a subsequent repository query.
+     *
      * @return  - is never used, always returns <tt>false</tt>.
      *
      * @deprecated - use {@link TransactionService#flushTransaction()}.
@@ -174,12 +174,12 @@ public class DomainObjectContainer {
 
     /**
      * Commit all changes to the object store.
-     * 
+     *
      * <p>
      * This has been deprecated because the demarcation of transaction
      * boundaries is a framework responsibility rather than being a
      * responsibility of the domain object model.
-     * 
+     *
      * @deprecated
      */
     @Programmatic
@@ -245,12 +245,12 @@ public class DomainObjectContainer {
     /**
      * Returns a new instance of the specified class that has the same persisted
      * state (either transient or persisted) as the provided object.
-     * 
+     *
      * <p>
      * This method has been deprecated because it is a rare use case, causing
      * unnecessary interface bloat for very little gain.
      * <p></p>
-     * 
+     *
      * @deprecated
      */
     @Programmatic
@@ -293,13 +293,13 @@ public class DomainObjectContainer {
     @Deprecated
     @Programmatic
     public <T> Iterable<T> lookupServices(Class<T> service){
-    	return serviceRegistry.select(service);	
+    	return serviceRegistry.select(service);
     }
 
     /**
      * Whether the object is in a valid state, that is that none of the
      * validation of properties, collections and object-level is vetoing.
-     * 
+     *
      * @see #validate(Object)
      */
     @Programmatic
@@ -309,7 +309,7 @@ public class DomainObjectContainer {
 
     /**
      * The reason, if any why the object is in a invalid state
-     * 
+     *
      * <p>
      * Checks the validation of all of the properties, collections and
      * object-level.
@@ -348,7 +348,7 @@ public class DomainObjectContainer {
     public void persist(Object domainObject) {
     	repositoryService.persist(domainObject);
     }
-    
+
     /**
      * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#persist(Object)} instead.
      */
@@ -493,7 +493,7 @@ public class DomainObjectContainer {
                 ? repositoryService.allMatches(ofType, predicate::apply, range[0], range[1])
                 : repositoryService.allMatches(ofType, predicate::apply);
     }
-    
+
     /**
      * @deprecated - use {@link #allMatches(Class, Predicate, long...)} or (better) {@link #allMatches(Query)} instead
      */
@@ -509,9 +509,9 @@ public class DomainObjectContainer {
     /**
      * Returns all the instances of the specified type (including subtypes) that
      * have the given title.
-     * If the optional range parameters are used, the dataset returned starts 
-     * from (0 based) index, and consists of only up to count items.  
-     * 
+     * If the optional range parameters are used, the dataset returned starts
+     * from (0 based) index, and consists of only up to count items.
+     *
      * <p>
      * If there are no instances the list will be empty. This method creates a
      * new {@link List} object each time it is called so the caller is free to
@@ -543,9 +543,9 @@ public class DomainObjectContainer {
      * Returns all the instances of the specified type (including subtypes) that
      * match the given object: where any property that is set will be tested and
      * properties that are not set will be ignored.
-     * If the optional range parameters are used, the dataset returned starts 
-     * from (0 based) index, and consists of only up to count items.  
-     * 
+     * If the optional range parameters are used, the dataset returned starts
+     * from (0 based) index, and consists of only up to count items.
+     *
      * <p>
      * If there are no instances the list will be empty. This method creates a
      * new {@link List} object each time it is called so the caller is free to
@@ -588,7 +588,7 @@ public class DomainObjectContainer {
     public <T> T firstMatch(final Class<T> ofType, final Predicate<T> predicate) {
     	return repositoryService.firstMatch(ofType, predicate::apply).orElse(null);
     }
-    
+
     /**
      * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#firstMatch(Class, java.util.function.Predicate)}  instead.
      */
@@ -663,15 +663,15 @@ public class DomainObjectContainer {
     public <T> T uniqueMatch(final Class<T> ofType, final Filter<T> filter) {
     	return repositoryService.uniqueMatch(ofType, filter::accept).orElse(null);
     }
-    
+
     /**
      * Find the only instance of the specified type (including subtypes) that
      * has the specified title.
-     * 
+     *
      * <p>
      * If no instance is found then <tt>null</tt> will be returned, while if
      * there is more that one instances a run-time exception will be thrown.
-     * 
+     *
      * <p>
      * This method is useful during prototyping, but - because the filtering is performed client-side -
      * this method is only really suitable for initial development/prototyping, or for classes with very few
@@ -691,7 +691,7 @@ public class DomainObjectContainer {
      * that matches the set fields in the pattern object: where any property
      * that is set will be tested and properties that are not set will be
      * ignored.
-     * 
+     *
      * <p>
      * If no instance is found then null will be return, while if there is more
      * that one instances a run-time exception will be thrown.
@@ -720,5 +720,5 @@ public class DomainObjectContainer {
     	return repositoryService.uniqueMatch(query).orElse(null);
     }
 
-	
+
 }