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 2018/01/17 12:46:27 UTC

[isis] branch ISIS-1569-replay-commands created (now 1e7ae6d)

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

danhaywood pushed a change to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git.


      at 1e7ae6d  ISIS-1569: by way of tidy-up, just removes unused injected ClockService from CommandServiceDefault

This branch includes the following new commits:

     new b20b23e  ISIS-1825: uses thread local to pass rendering context up to the scalar panel so that it, in turn, can correctly report on where it is being rendered.
     new 1b43c93  ISIS-1569: adds CommandService2 as an extension
     new 1e7ae6d  ISIS-1569: by way of tidy-up, just removes unused injected ClockService from CommandServiceDefault

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@isis.apache.org" <co...@isis.apache.org>'].

[isis] 03/03: ISIS-1569: by way of tidy-up, just removes unused injected ClockService from CommandServiceDefault

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 1e7ae6de3009de323a3b076527fb53146735ea36
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 17 12:46:05 2018 +0000

    ISIS-1569: by way of tidy-up, just removes unused injected ClockService from CommandServiceDefault
---
 .../isis/core/runtime/services/command/CommandServiceDefault.java      | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandServiceDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandServiceDefault.java
index 7d2986a..ce6ec12 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandServiceDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandServiceDefault.java
@@ -58,7 +58,4 @@ public class CommandServiceDefault implements CommandService {
         return false;
     }
 
-    @javax.inject.Inject
-    ClockService clockService;
-
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.

[isis] 01/03: ISIS-1825: uses thread local to pass rendering context up to the scalar panel so that it, in turn, can correctly report on where it is being rendered.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit b20b23e0eca9a105537b18f654ae1d6be12d2628
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 17 12:42:39 2018 +0000

    ISIS-1825: uses thread local to pass rendering context up to the scalar panel so that it, in turn, can correctly report on where it is being rendered.
---
 .../ajaxtable/IsisAjaxFallbackDataTable.java       | 15 +++++++++++++-
 .../components/scalars/ScalarPanelAbstract2.java   | 24 ++++++++++++++++------
 2 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/IsisAjaxFallbackDataTable.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/IsisAjaxFallbackDataTable.java
index 39de90f..9838d8b 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/IsisAjaxFallbackDataTable.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/IsisAjaxFallbackDataTable.java
@@ -39,6 +39,7 @@ import org.apache.wicket.util.lang.Generics;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
@@ -86,6 +87,13 @@ public class IsisAjaxFallbackDataTable<T, S> extends DataTable<T, S> {
         addBottomToolbar(new NoRecordsToolbar(this));
     }
 
+    private final static ThreadLocal<EntityCollectionModel> entityCollectionModel = new ThreadLocal<>();
+
+    public static Boolean isParented() {
+        EntityCollectionModel entityCollectionModel = IsisAjaxFallbackDataTable.entityCollectionModel.get();
+        return entityCollectionModel != null ? entityCollectionModel.isParented() : null;
+    }
+
     @Override
     protected void onConfigure() {
         super.onConfigure();
@@ -93,7 +101,12 @@ public class IsisAjaxFallbackDataTable<T, S> extends DataTable<T, S> {
 
     @Override
     protected void onBeforeRender() {
-        super.onBeforeRender();
+        try {
+            entityCollectionModel.set(dataProvider.getEntityCollectionModel());
+            super.onBeforeRender();
+        } finally {
+            entityCollectionModel.set(null);
+        }
     }
 
     @Override
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract2.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract2.java
index 3f16905..695f971 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract2.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract2.java
@@ -59,6 +59,7 @@ import org.apache.isis.viewer.wicket.model.models.ScalarModel;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.LinkAndLabelUtil;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.IsisAjaxFallbackDataTable;
 import org.apache.isis.viewer.wicket.ui.components.property.PropertyEditFormPanel;
 import org.apache.isis.viewer.wicket.ui.components.property.PropertyEditPanel;
 import org.apache.isis.viewer.wicket.ui.components.propertyheader.PropertyEditPromptHeaderPanel;
@@ -536,17 +537,28 @@ public abstract class ScalarPanelAbstract2 extends PanelAbstract<ScalarModel> im
 		case STANDALONE_TITLE_COLUMN:
 			return Where.STANDALONE_TABLES;
 		case PROPERTY_COLUMN:
-			final ObjectAdapter parentAdapter =
-			 	scalarModel.getParentEntityModel().load(AdapterManager.ConcurrencyChecking.NO_CHECK);
-			final boolean parented = parentAdapter.isParentedCollection();
-			return parented ? Where.PARENTED_TABLES : Where.STANDALONE_TABLES;
-		case REGULAR:
+            // this is pretty hacky, but can't (for the moment) think of another way to
+            // pass through the context other than a thread-local
+            Boolean parented = IsisAjaxFallbackDataTable.isParented();
+            if(parented == null) {
+                // this code is wrong (but kept in because it's what we had before) ...
+                // the parentEntityModel *isn't* the "parented" collection (eg Parent#child, a java.util.List),
+                // rather it is the parent of this field (the Child object itself).
+                EntityModel parentEntityModel = scalarModel.getParentEntityModel();
+                final ObjectAdapter parentAdapter =
+                     parentEntityModel.load(AdapterManager.ConcurrencyChecking.NO_CHECK);
+                parented = parentAdapter.isParentedCollection();
+            }
+            // this bit is correct, I think; earlier in the stack trace is the IsisAjaxFallbackDataTable which
+            // tells us whether it's being used to render a parented collection or a standalone collection.
+            return parented ? Where.PARENTED_TABLES : Where.STANDALONE_TABLES;
+
+        case REGULAR:
 			return Where.OBJECT_FORMS;
 		default:
 			throw new RuntimeException("unmatched case "+scalarModel.getRenderingHint());
 		}
     }
-    
 
     // ///////////////////////////////////////////////////////////////////
 

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.

[isis] 02/03: ISIS-1569: adds CommandService2 as an extension

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 1b43c93fb03159eafe1100b5dc40c50d69699d4a
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 17 12:45:34 2018 +0000

    ISIS-1569: adds CommandService2 as an extension
---
 .../services/command/spi/CommandService2.java      | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/spi/CommandService2.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/spi/CommandService2.java
new file mode 100644
index 0000000..c745bdd
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/spi/CommandService2.java
@@ -0,0 +1,55 @@
+/**
+ *  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.command.spi;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.command.Command;
+
+public interface CommandService2 extends CommandService {
+
+    public static class NotFoundException extends RuntimeException {
+
+        private static final long serialVersionUID = 1L;
+
+        private final String transactionId;
+
+        public NotFoundException(final String transactionId) {
+            this.transactionId = transactionId;
+        }
+
+        public String getTransactionId() {
+            return transactionId;
+        }
+    }
+
+    /**
+     * Finds all {@link Command}s created since the specified command (identified by its transaction Id).
+     *
+     * @param transactionId
+     * @param maxNumber
+     * @return
+     */
+    @Programmatic
+    List<Command> findSince(
+            final UUID transactionId,
+            int maxNumber)
+            throws NotFoundException;
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.