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/03/03 09:07:19 UTC

[isis] branch ISIS-2444 updated (bbd83ab -> 81b06c3)

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

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


 discard bbd83ab  ISIS-439: removes disabled interaction advisor reponsibility from CollectionDomainEventFacet (dead code)
 discard 5dead77  ISIS-2444: more on domain event docs
 discard ede3153  ISIS-439: further work removing dead code re: mutable collections
 discard 39ebfac  ISIS-439: further work removing dead code re: mutable collections
 discard 6a723db  ISIS-439: further work removing dead code re: mutable collections
 discard 0817c6a  ISIS-2444: cleaning up domain event docs
     add 5554634  ISIS-2534: AuthorizorShiro: regression ... remove assertion
     add 6b0b500  ISIS-2559: ApplicationUser_delete: add are_u_sure semantics
     add f7c1a25  ISIS-2559: ApplicationUser_delete: add are_u_sure semantics (2)
     new 4796927  ISIS-2444: cleaning up domain event docs
     new 7c2eb7a  ISIS-439: further work removing dead code re: mutable collections
     new 50d7ae3  ISIS-439: further work removing dead code re: mutable collections
     new cc5cda0  ISIS-439: further work removing dead code re: mutable collections
     new 8973bc2  ISIS-2444: more on domain event docs
     new 81b06c3  ISIS-439: removes disabled interaction advisor reponsibility from CollectionDomainEventFacet (dead code)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (bbd83ab)
            \
             N -- N -- N   refs/heads/ISIS-2444 (81b06c3)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 6 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.


Summary of changes:
 .../isis/extensions/secman/model/dom/role/ApplicationRole_delete.java | 4 +++-
 .../isis/extensions/secman/model/dom/user/ApplicationUser_delete.java | 4 +++-
 .../org/apache/isis/security/shiro/authorization/AuthorizorShiro.java | 3 +--
 3 files changed, 7 insertions(+), 4 deletions(-)


[isis] 04/06: ISIS-439: further work removing dead code re: mutable collections

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

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

commit cc5cda03fea39f2cbd1e4929c42d682052588dec
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Mar 3 07:09:21 2021 +0000

    ISIS-439: further work removing dead code re: mutable collections
---
 .../events/domain/CollectionDomainEvent.java       | 31 -------------------
 .../core/metamodel/facets/DomainEventHelper.java   | 36 ++++++++--------------
 .../modify/CollectionDomainEventFacetAbstract.java | 12 ++++----
 ...HelperTest_newCollectionDomainEvent_forAdd.java |  6 ++--
 ...perTest_newCollectionDomainEvent_forRemove.java |  6 ++--
 5 files changed, 25 insertions(+), 66 deletions(-)

diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
index 7b1c489..a126c76 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
@@ -27,17 +27,6 @@ import lombok.Getter;
  * Subclass of {@link AbstractDomainEvent} for collections.
  *
  * <p>
- * The class has a couple of responsibilities (in addition to those it
- * inherits):
- * </p>
- *
- * <ul>
- *     <li>
- *      capture the target object being interacted with
- *     </li>
- * </ul>
- *
- * <p>
  * The class itself is instantiated automatically by the framework whenever
  * interacting with a rendered object's collection.
  * </p>
@@ -83,31 +72,11 @@ public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S>
 
 
 
-    /**
-     * The proposed reference to either add or remove (per {@link #getOf()}), populated at
-     * {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE}
-     * and subsequent phases (is null for
-     * {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden}
-     * and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable} phases).
-     */
-    @Getter
-    private T value;
-
-
-    /**
-     * Not API, set by the framework.
-     */
-    public void setValue(T value) {
-        this.value = value;
-    }
-
-
     private static final ToString<CollectionDomainEvent<?,?>> toString =
             ObjectContracts.<CollectionDomainEvent<?,?>>
     toString("source", CollectionDomainEvent::getSource)
     .thenToString("identifier", CollectionDomainEvent::getIdentifier)
     .thenToString("eventPhase", CollectionDomainEvent::getEventPhase)
-    .thenToString("value", CollectionDomainEvent::getValue)
     ;
 
     @Override
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
index 56cb6d6..2eb6e2c 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
@@ -306,31 +306,24 @@ public class DomainEventHelper {
     // -- postEventForCollection, newCollectionDomainEvent
 
     public <S, T> CollectionDomainEvent<S, T> postEventForCollection(
-            AbstractDomainEvent.Phase phase,
+            final AbstractDomainEvent.Phase phase,
             final Class<? extends CollectionDomainEvent<S, T>> eventType,
-            final CollectionDomainEvent<S, T> existingEvent,
             final IdentifiedHolder identified,
-            final InteractionHead head,
-            final T reference) {
+            final InteractionHead head) {
 
         _Assert.assertTypeIsInstanceOf(eventType, CollectionDomainEvent.class);
 
         try {
             final CollectionDomainEvent<S, T> event;
-            if (existingEvent != null && phase.isExecuted()) {
-                // reuse existing event from the executing phase
-                event = existingEvent;
-            } else {
-                // all other phases, create a new event
-                final S source = uncheckedCast(UnwrapUtil.single(head.getTarget()));
-                final Identifier identifier = identified.getIdentifier();
-                event = newCollectionDomainEvent(eventType, phase, identifier, source, reference);
 
-                // copy over if have
-                head.getMixedIn()
-                .ifPresent(mixedInAdapter->
-                    event.setMixedIn(mixedInAdapter.getPojo()));
-            }
+            final S source = uncheckedCast(UnwrapUtil.single(head.getTarget()));
+            final Identifier identifier = identified.getIdentifier();
+            event = newCollectionDomainEvent(eventType, phase, identifier, source);
+
+            // copy over if have
+            head.getMixedIn()
+            .ifPresent(mixedInAdapter->
+                event.setMixedIn(mixedInAdapter.getPojo()));
 
             event.setEventPhase(phase);
 
@@ -345,8 +338,7 @@ public class DomainEventHelper {
             final Class<? extends CollectionDomainEvent<S, T>> type,
             final AbstractDomainEvent.Phase phase,
             final Identifier identifier,
-            final S source,
-            final T value)
+            final S source)
             throws NoSuchMethodException, SecurityException,
             IllegalArgumentException {
 
@@ -360,21 +352,19 @@ public class DomainEventHelper {
 
             cde.initSource(source);
             cde.setIdentifier(identifier);
-            cde.setValue(value);
             return cde;
         }
 
         // else
-        // search for constructor accepting source, identifier, type, value
+        // search for constructor accepting source, identifier
         val updateEventConstructors = constructors
                 .filter(paramCount(4)
                         .and(paramAssignableFrom(0, source.getClass()))
                         .and(paramAssignableFrom(1, Identifier.class))
-                        .and(paramAssignableFromValue(2, value))
                         );
 
         for (val constructor : updateEventConstructors) {
-            val event = invokeConstructor(constructor, source, identifier, value);
+            val event = invokeConstructor(constructor, source, identifier);
             return uncheckedCast(event);
         }
 
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
index e400f70..7046627 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
@@ -74,9 +74,9 @@ public abstract class CollectionDomainEventFacetAbstract
         final CollectionDomainEvent<?, ?> event =
                 domainEventHelper.postEventForCollection(
                         AbstractDomainEvent.Phase.HIDE,
-                        getEventType(), null,
-                        getIdentified(), ic.getHead(),
-                        null);
+                        getEventType(),
+                        getIdentified(), ic.getHead()
+                );
         if (event != null && event.isHidden()) {
             return "Hidden by subscriber";
         }
@@ -89,9 +89,9 @@ public abstract class CollectionDomainEventFacetAbstract
         final CollectionDomainEvent<?, ?> event =
                 domainEventHelper.postEventForCollection(
                         AbstractDomainEvent.Phase.DISABLE,
-                        getEventType(), null,
-                        getIdentified(), ic.getHead(),
-                        null);
+                        getEventType(),
+                        getIdentified(), ic.getHead()
+                );
         if (event != null && event.isDisabled()) {
             final TranslatableString reasonTranslatable = event.getDisabledReasonTranslatable();
             if(reasonTranslatable != null) {
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
index 5ae89a1..5abc008 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
@@ -48,7 +48,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<Object, Object> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                CollectionDomainEvent.Default.class, null, identifier, sdo, other);
+                CollectionDomainEvent.Default.class, null, identifier, sdo);
         assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
@@ -63,7 +63,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<Object, Object> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
+                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo);
         assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
@@ -78,7 +78,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                SomeDomainObjectCollectionDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
+                SomeDomainObjectCollectionDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo);
         assertThat(ev.getSource(), is(sdo));
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
index dc2c6d0..b4e2a52 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
@@ -48,7 +48,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<Object, Object> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
+                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo);
         assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
@@ -63,7 +63,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<Object, Object> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
+                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo);
         assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
@@ -78,7 +78,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                SomeDomainObjectCollectionRemovedFromDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
+                SomeDomainObjectCollectionRemovedFromDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo);
         assertThat(ev.getSource(), is(sdo));
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));


[isis] 02/06: ISIS-439: further work removing dead code re: mutable collections

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

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

commit 7c2eb7a357da11741bb0dafc108947bb54a57d89
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Mar 3 06:56:44 2021 +0000

    ISIS-439: further work removing dead code re: mutable collections
---
 .../modify/CollectionDomainEventFacet.java         |  2 +-
 .../modify/CollectionDomainEventFacetAbstract.java | 41 +----------
 .../validate/CollectionValidateAddToFacet.java     | 40 -----------
 .../CollectionValidateAddToFacetAbstract.java      | 47 ------------
 .../CollectionValidateAddToFacetViaMethod.java     | 83 ---------------------
 .../CollectionValidateRemoveFromFacet.java         | 39 ----------
 .../CollectionValidateRemoveFromFacetAbstract.java | 46 ------------
 ...CollectionValidateRemoveFromFacetViaMethod.java | 84 ----------------------
 .../interactions/CollectionAddToContext.java       | 62 ----------------
 .../interactions/CollectionRemoveFromContext.java  | 62 ----------------
 .../services/metamodel/DomainMemberDefault.java    | 17 ++---
 .../rendering/domainobjects/MemberType.java        |  2 -
 12 files changed, 10 insertions(+), 515 deletions(-)

diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacet.java
index da2afed..6ebc17a 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacet.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacet.java
@@ -28,7 +28,7 @@ import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
  * Corresponds to <tt>@Collection(domainEvent=...)</tt> annotation in the Isis programming model.
  */
 public interface CollectionDomainEventFacet
-extends SingleClassValueFacet, HidingInteractionAdvisor, DisablingInteractionAdvisor, ValidatingInteractionAdvisor {
+extends SingleClassValueFacet, HidingInteractionAdvisor, DisablingInteractionAdvisor {
 
 }
 
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
index 23cb8b9..d63ec04 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
@@ -28,13 +28,12 @@ import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
 import org.apache.isis.core.metamodel.facets.DomainEventHelper;
 import org.apache.isis.core.metamodel.facets.SingleClassValueFacetAbstract;
-import org.apache.isis.core.metamodel.interactions.CollectionAddToContext;
-import org.apache.isis.core.metamodel.interactions.ProposedHolder;
 import org.apache.isis.core.metamodel.interactions.UsabilityContext;
-import org.apache.isis.core.metamodel.interactions.ValidityContext;
 import org.apache.isis.core.metamodel.interactions.VisibilityContext;
 
-public abstract class CollectionDomainEventFacetAbstract extends SingleClassValueFacetAbstract implements CollectionDomainEventFacet {
+public abstract class CollectionDomainEventFacetAbstract
+        extends SingleClassValueFacetAbstract
+        implements CollectionDomainEventFacet {
 
     private final DomainEventHelper domainEventHelper;
     private final TranslationService translationService;
@@ -105,38 +104,4 @@ public abstract class CollectionDomainEventFacetAbstract extends SingleClassValu
         return null;
     }
 
-    @Override
-    public String invalidates(final ValidityContext ic) {
-
-        // if this is a mixin, then this ain't true.
-        if(!(ic instanceof ProposedHolder)) {
-            return null;
-        }
-        final ProposedHolder catc = (ProposedHolder) ic;
-        final Object proposed = catc.getProposed().getPojo();
-
-        final CollectionDomainEvent.Of of =
-                ic instanceof CollectionAddToContext
-                ? CollectionDomainEvent.Of.ADD_TO
-                        : CollectionDomainEvent.Of.REMOVE_FROM;
-
-        final CollectionDomainEvent<?, ?> event =
-                domainEventHelper.postEventForCollection(
-                        AbstractDomainEvent.Phase.VALIDATE,
-                        getEventType(), null,
-                        getIdentified(), ic.getHead(),
-                        of,
-                        proposed);
-        if (event != null && event.isInvalid()) {
-            final TranslatableString reasonTranslatable = event.getInvalidityReasonTranslatable();
-            if(reasonTranslatable != null) {
-                return reasonTranslatable.translate(translationService, translationContext);
-            }
-            return event.getInvalidityReason();
-        }
-
-        return null;
-    }
-
-
 }
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacet.java
deleted file mode 100644
index b6a97f0..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacet.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  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.facets.collections.validate;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-
-/**
- * Validate that an object can be added to a collection.
- *
- * <p>
- * In the standard Apache Isis Programming Model, corresponds to invoking the
- * <tt>validateAddToXxx</tt> support method for a collection.
- *
- */
-public interface CollectionValidateAddToFacet extends Facet, ValidatingInteractionAdvisor {
-
-    /**
-     * Reason the object cannot be added, or <tt>null</tt> if okay.
-     */
-    public String invalidReason(ManagedObject target, ManagedObject proposedArgument);
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacetAbstract.java
deleted file mode 100644
index 0cdeb01..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacetAbstract.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  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.facets.collections.validate;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.interactions.CollectionAddToContext;
-import org.apache.isis.core.metamodel.interactions.ValidityContext;
-
-public abstract class CollectionValidateAddToFacetAbstract extends FacetAbstract implements CollectionValidateAddToFacet {
-
-    public static Class<? extends Facet> type() {
-        return CollectionValidateAddToFacet.class;
-    }
-
-    public CollectionValidateAddToFacetAbstract(final FacetHolder holder) {
-        super(type(), holder, Derivation.NOT_DERIVED);
-    }
-
-    @Override
-    public String invalidates(final ValidityContext context) {
-        if (!(context instanceof CollectionAddToContext)) {
-            return null;
-        }
-        final CollectionAddToContext collectionAddToContext = (CollectionAddToContext) context;
-        return invalidReason(context.getTarget(), collectionAddToContext.getProposed());
-    }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacetViaMethod.java
deleted file mode 100644
index 7d1427b..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateAddToFacetViaMethod.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *  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.facets.collections.validate;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.isis.applib.services.i18n.TranslatableString;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.ImperativeFacet;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-import org.apache.isis.core.metamodel.spec.ManagedObjects;
-
-public class CollectionValidateAddToFacetViaMethod extends CollectionValidateAddToFacetAbstract implements ImperativeFacet {
-
-    private final Method method;
-    private final TranslationService translationService;
-    private final String translationContext;
-
-    public CollectionValidateAddToFacetViaMethod(final Method method, final TranslationService translationService, final String translationContext, final FacetHolder holder) {
-        super(holder);
-        this.method = method;
-        this.translationService = translationService;
-        this.translationContext = translationContext;
-    }
-
-    /**
-     * Returns a singleton list of the {@link Method} provided in the
-     * constructor.
-     */
-    @Override
-    public List<Method> getMethods() {
-        return Collections.singletonList(method);
-    }
-
-    @Override
-    public Intent getIntent(final Method method) {
-        return Intent.CHECK_IF_VALID;
-    }
-
-    @Override
-    public String invalidReason(final ManagedObject owningAdapter, final ManagedObject proposedAdapter) {
-        final Object returnValue = ManagedObjects.InvokeUtil.invoke(method, owningAdapter, proposedAdapter);
-        if(returnValue instanceof String) {
-            return (String) returnValue;
-        }
-        if(returnValue instanceof TranslatableString) {
-            final TranslatableString ts = (TranslatableString) returnValue;
-            return ts.translate(translationService, translationContext);
-        }
-        return null;
-    }
-
-    @Override
-    protected String toStringValues() {
-        return "method=" + method;
-    }
-
-    @Override public void appendAttributesTo(final Map<String, Object> attributeMap) {
-        super.appendAttributesTo(attributeMap);
-        ImperativeFacet.Util.appendAttributesTo(this, attributeMap);
-    }
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacet.java
deleted file mode 100644
index e097440..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacet.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  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.facets.collections.validate;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-
-/**
- * Validate that an object can be removed to a collection.
- *
- * <p>
- * In the standard Apache Isis Programming Model, corresponds to invoking the
- * <tt>validateRemoveFromXxx</tt> support method for a collection.
- */
-public interface CollectionValidateRemoveFromFacet extends Facet, ValidatingInteractionAdvisor {
-
-    /**
-     * Reason the object cannot be removed, or <tt>null</tt> if okay.
-     */
-    public String invalidReason(ManagedObject inObject, ManagedObject value);
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacetAbstract.java
deleted file mode 100644
index 97a779b..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacetAbstract.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  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.facets.collections.validate;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.interactions.CollectionRemoveFromContext;
-import org.apache.isis.core.metamodel.interactions.ValidityContext;
-
-public abstract class CollectionValidateRemoveFromFacetAbstract extends FacetAbstract implements CollectionValidateRemoveFromFacet {
-
-    public static Class<? extends Facet> type() {
-        return CollectionValidateRemoveFromFacet.class;
-    }
-
-    public CollectionValidateRemoveFromFacetAbstract(final FacetHolder holder) {
-        super(type(), holder, Derivation.NOT_DERIVED);
-    }
-
-    @Override
-    public String invalidates(final ValidityContext context) {
-        if (!(context instanceof CollectionRemoveFromContext)) {
-            return null;
-        }
-        final CollectionRemoveFromContext collectionRemoveFromContext = (CollectionRemoveFromContext) context;
-        return invalidReason(context.getTarget(), collectionRemoveFromContext.getProposed());
-    }
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacetViaMethod.java
deleted file mode 100644
index 978287b..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/validate/CollectionValidateRemoveFromFacetViaMethod.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  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.facets.collections.validate;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.isis.applib.services.i18n.TranslatableString;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.ImperativeFacet;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-import org.apache.isis.core.metamodel.spec.ManagedObjects;
-
-public class CollectionValidateRemoveFromFacetViaMethod extends CollectionValidateRemoveFromFacetAbstract implements ImperativeFacet {
-
-    private final Method method;
-    private final TranslationService translationService;
-    private final String translationContext;
-
-    public CollectionValidateRemoveFromFacetViaMethod(final Method method, final TranslationService translationService, final String translationContext, final FacetHolder holder) {
-        super(holder);
-        this.method = method;
-        this.translationService = translationService;
-        this.translationContext = translationContext;
-    }
-
-    /**
-     * Returns a singleton list of the {@link Method} provided in the
-     * constructor.
-     */
-    @Override
-    public List<Method> getMethods() {
-        return Collections.singletonList(method);
-    }
-
-    @Override
-    public Intent getIntent(final Method method) {
-        return Intent.CHECK_IF_VALID;
-    }
-
-    @Override
-    public String invalidReason(final ManagedObject owningAdapter, final ManagedObject proposedAdapter) {
-        final Object returnValue = ManagedObjects.InvokeUtil.invoke(method, owningAdapter, proposedAdapter);
-        if(returnValue instanceof String) {
-            return (String) returnValue;
-        }
-        if(returnValue instanceof TranslatableString) {
-            final TranslatableString ts = (TranslatableString) returnValue;
-            return ts.translate(translationService, translationContext);
-        }
-        return null;
-    }
-
-    @Override
-    protected String toStringValues() {
-        return "method=" + method;
-    }
-
-    @Override public void appendAttributesTo(final Map<String, Object> attributeMap) {
-        super.appendAttributesTo(attributeMap);
-        ImperativeFacet.Util.appendAttributesTo(this, attributeMap);
-    }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/interactions/CollectionAddToContext.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/interactions/CollectionAddToContext.java
deleted file mode 100644
index 9ac9bfc..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/interactions/CollectionAddToContext.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  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.interactions;
-
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.services.wrapper.events.CollectionAddToEvent;
-import org.apache.isis.core.metamodel.consent.InteractionContextType;
-import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-import org.apache.isis.core.metamodel.spec.ManagedObjects.UnwrapUtil;
-
-/**
- * See {@link InteractionContext} for overview; analogous to
- * {@link CollectionAddToEvent}.
- */
-public class CollectionAddToContext 
-extends ValidityContext 
-implements ProposedHolder {
-
-    private final ManagedObject proposed;
-
-    public CollectionAddToContext(
-            final InteractionHead head,
-            final Identifier id,
-            final ManagedObject proposed,
-            final InteractionInitiatedBy interactionInitiatedBy) {
-        super(InteractionContextType.COLLECTION_ADD_TO, head, id, interactionInitiatedBy);
-
-        this.proposed = proposed;
-    }
-
-    @Override
-    public ManagedObject getProposed() {
-        return proposed;
-    }
-
-    @Override
-    public CollectionAddToEvent createInteractionEvent() {
-        return new CollectionAddToEvent(
-                UnwrapUtil.single(getTarget()), 
-                getIdentifier(), 
-                UnwrapUtil.single(getProposed()));
-    }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/interactions/CollectionRemoveFromContext.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/interactions/CollectionRemoveFromContext.java
deleted file mode 100644
index 088cf24..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/interactions/CollectionRemoveFromContext.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  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.interactions;
-
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.services.wrapper.events.CollectionRemoveFromEvent;
-import org.apache.isis.core.metamodel.consent.InteractionContextType;
-import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
-import org.apache.isis.core.metamodel.spec.ManagedObject;
-import org.apache.isis.core.metamodel.spec.ManagedObjects.UnwrapUtil;
-
-/**
- * See {@link InteractionContext} for overview; analogous to
- * {@link CollectionRemoveFromEvent}.
- */
-public class CollectionRemoveFromContext 
-extends ValidityContext 
-implements ProposedHolder{
-
-    private final ManagedObject proposed;
-
-    public CollectionRemoveFromContext(
-            final InteractionHead head,
-            final Identifier identifier,
-            final ManagedObject proposed,
-            final InteractionInitiatedBy interactionInitiatedBy) {
-        super(InteractionContextType.COLLECTION_REMOVE_FROM, head, identifier, interactionInitiatedBy);
-
-        this.proposed = proposed;
-    }
-
-    @Override
-    public ManagedObject getProposed() {
-        return proposed;
-    }
-
-    @Override
-    public CollectionRemoveFromEvent createInteractionEvent() {
-        return new CollectionRemoveFromEvent(
-                UnwrapUtil.single(getTarget()), 
-                getIdentifier(), 
-                UnwrapUtil.single(getProposed()));
-    }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/DomainMemberDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/DomainMemberDefault.java
index 253704c..c5287a9 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/DomainMemberDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/DomainMemberDefault.java
@@ -37,8 +37,6 @@ import org.apache.isis.core.metamodel.facets.ImperativeFacet;
 import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet;
 import org.apache.isis.core.metamodel.facets.actions.validate.ActionValidationFacet;
 import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
-import org.apache.isis.core.metamodel.facets.collections.validate.CollectionValidateAddToFacet;
-import org.apache.isis.core.metamodel.facets.collections.validate.CollectionValidateRemoveFromFacet;
 import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
 import org.apache.isis.core.metamodel.facets.param.autocomplete.ActionParameterAutoCompleteFacet;
 import org.apache.isis.core.metamodel.facets.param.choices.ActionChoicesFacet;
@@ -69,7 +67,7 @@ public class DomainMemberDefault implements DomainMember {
     private final ObjectMember member;
     private ObjectAction action;
 
-    // to support JAX-B marshaling 
+    // to support JAX-B marshaling
     DomainMemberDefault(){
         throw _Exceptions.unexpectedCodeReach();
     }
@@ -209,7 +207,7 @@ public class DomainMemberDefault implements DomainMember {
                 addIfNotEmpty(interpretFacet(facet), interpretations);
             }
             return !interpretations.isEmpty()
-                    ? interpretations.stream().collect(Collectors.joining(";"))
+                    ? String.join(";", interpretations)
                             : interpretRowAndFacet(ActionDefaultsFacet.class);
         }
     }
@@ -219,10 +217,7 @@ public class DomainMemberDefault implements DomainMember {
         if(memberType == MemberType.PROPERTY) {
             return interpretRowAndFacet(PropertyValidateFacet.class);
         } else if(memberType == MemberType.COLLECTION) {
-            final SortedSet<String> interpretations = _Sets.newTreeSet();
-            addIfNotEmpty(interpretRowAndFacet(CollectionValidateAddToFacet.class), interpretations);
-            addIfNotEmpty(interpretRowAndFacet(CollectionValidateRemoveFromFacet.class), interpretations);
-            return interpretations.stream().collect(Collectors.joining(";"));
+            return String.join(";", _Sets.newTreeSet());
         } else {
             return interpretRowAndFacet(ActionValidationFacet.class);
         }
@@ -264,7 +259,7 @@ public class DomainMemberDefault implements DomainMember {
         if (ignore(name)) {
             return "";
         }
-        //[ahuber] not sure why abbreviated, so I disabled abbreviation        
+        //[ahuber] not sure why abbreviated, so I disabled abbreviation
         //        final String abbr = StringExtensions.toAbbreviation(name);
         //        return abbr.length()>0 ? abbr : name;
 
@@ -276,11 +271,11 @@ public class DomainMemberDefault implements DomainMember {
                 .contains(name);
     }
 
-    private static final Comparator<DomainMember> comparator = 
+    private static final Comparator<DomainMember> comparator =
             Comparator.comparing(DomainMember::getClassType)
             .thenComparing(DomainMember::getClassName)
             .thenComparing(DomainMember::getType, Comparator.reverseOrder()) // desc
             .thenComparing(DomainMember::getMemberName);
 
 
-}
\ No newline at end of file
+}
diff --git a/viewers/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java b/viewers/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java
index 42207b7..3e35181 100644
--- a/viewers/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java
+++ b/viewers/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java
@@ -25,8 +25,6 @@ import org.apache.isis.applib.util.Enums;
 import org.apache.isis.commons.internal.collections._Maps;
 import org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacet;
 import org.apache.isis.core.metamodel.facets.actions.validate.ActionValidationFacet;
-import org.apache.isis.core.metamodel.facets.collections.validate.CollectionValidateAddToFacet;
-import org.apache.isis.core.metamodel.facets.collections.validate.CollectionValidateRemoveFromFacet;
 import org.apache.isis.core.metamodel.facets.properties.update.clear.PropertyClearFacet;
 import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
 import org.apache.isis.core.metamodel.facets.properties.validating.PropertyValidateFacet;


[isis] 01/06: ISIS-2444: cleaning up domain event docs

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

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

commit 479692708083f7adf1f858b6beab0a565fee59ef
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Mar 3 06:44:19 2021 +0000

    ISIS-2444: cleaning up domain event docs
---
 .../applib-classes/pages/events/domainevent.adoc   |  51 ++++-----
 .../events/domainevent/AbstractDomainEvent.adoc    | 109 -------------------
 .../events/domainevent/ActionDomainEvent.adoc      |  49 ---------
 .../events/domainevent/CollectionDomainEvent.adoc  |  12 --
 .../applib/events/domain/AbstractDomainEvent.java  | 121 ++++++++++++++++-----
 .../applib/events/domain/ActionDomainEvent.java    | 105 ++++++++++++++----
 .../events/domain/CollectionDomainEvent.java       |  52 ++++++---
 .../applib/events/domain/PropertyDomainEvent.java  |   7 +-
 .../main/adoc/modules/metamodel/pages/about.adoc   |   2 +-
 persistence/jpa/adoc/modules/ROOT/pages/about.adoc |   2 +-
 security/adoc/modules/ROOT/pages/about.adoc        |   4 +-
 testing/adoc/modules/ROOT/pages/about.adoc         |   4 +-
 12 files changed, 240 insertions(+), 278 deletions(-)

diff --git a/antora/components/refguide/modules/applib-classes/pages/events/domainevent.adoc b/antora/components/refguide/modules/applib-classes/pages/events/domainevent.adoc
index 8be777f..a26d546 100644
--- a/antora/components/refguide/modules/applib-classes/pages/events/domainevent.adoc
+++ b/antora/components/refguide/modules/applib-classes/pages/events/domainevent.adoc
@@ -7,54 +7,43 @@
 This section catalogues the various domain event classes defined by Apache Isis.
 
 These events are broadcast on the xref:refguide:applib:index/services/eventbus/EventBusService.adoc[EventBusService].
-The domain events are broadcast as a result of being specified in the xref:refguide:applib:index/annotation/Action.adoc#domainEvent[@Action#domainEvent()],  xref:refguide:applib:index/annotation/Property.adoc#domainEvent[@Property#domainEvent()] or xref:refguide:applib:index/annotation/Collection.adoc#domainEvent[@Collection#domainEvent()] attributes.
+The domain events are broadcast as a result of being specified in the ,   or xref:refguide:applib:index/annotation/Collection.adoc#domainEvent[@Collection#domainEvent()] attributes.
 
 They are listed in the table below.
 
 .Domain Event Classes
-[cols="1a,2a,2a", options="header"]
+[cols="1a,2a,2a,2a", options="header"]
 |===
 
 |API
-|Implementation
-|Notes
+|Raised by
+|Fallback +
+Implementation
+|Published when
 
 
-|xref:applib-classes:events.adoc#AbstractDomainEvent[`o.a.i.applib.` +
-`AbstractDomainEvent`]
+|xref:refguide:applib:index/events/domain/AbstractDomainEvent.adoc[AbstractDomainEvent]
+|n/a
 |(abstract class)
 |Superclass of the other domain events, listed below in this table.
 
 
-|xref:applib-classes:events.adoc#ActionDomainEvent[`o.a.i.applib.` +
-`ActionDomainEvent`]
-|(abstract class). +
-`ActionDomainEvent.Default` is the concrete implementation used if no `@Action#domainEvent` attribute is specified
-|Broadcast whenever there is an interaction (hide/disable/validate/pre-execute/post-execute) with an object's action.
+|xref:refguide:applib:index/events/domain/ActionDomainEvent.adoc[ActionDomainEvent]
+|xref:refguide:applib:index/annotation/Action.adoc#domainEvent[@Action#domainEvent()]
+|`ActionDomainEvent.Default`
+|(hide/disable/validate/pre-execute/post-execute) with an object's action.
 
+|xref:refguide:applib:index/events/domain/CollectionDomainEvent.adoc[CollectionDomainEvent]
+|xref:refguide:applib:index/annotation/Collection.adoc#domainEvent[@Collection#domainEvent()]
+|`CollectionDomainEvent.Default`
+|hide an object's collection.
 
-|xref:applib-classes:events.adoc#CollectionDomainEvent[`o.a.i.applib.` +
-`CollectionDomainEvent`]
-|(abstract class). +
-`CollectionDomainEvent.Default` is the concrete implementation used if no `@Collection#domainEvent` attribute
-is specified.
-|Broadcast whenever there is an interaction (hide/disable/validate/access) with an object's collection.
 
-
-|xref:applib-classes:events.adoc#PropertyDomainEvent[`o.a.i.applib.` +
-`PropertyDomainEvent`]
-|(abstract class). +
-`PropertyDomainEvent.Default` is the concrete implementation used if no `@Propert#domainEvent` attribute is specified
-|Broadcast whenever there is an interaction (hide/disable/validate/access) with an object's property.
+|xref:refguide:applib:index/events/domain/PropertyDomainEvent.adoc[PropertyDomainEvent]
+|xref:refguide:applib:index/annotation/Property.adoc#domainEvent[@Property#domainEvent()]
+|`PropertyDomainEvent.Default`
+|hide/disable/validate/pre-edit/post-edit with an object's property.
 
 
 |===
 
-
-
-
-
-include::domainevent/AbstractDomainEvent.adoc[leveloffset=+1]
-include::domainevent/ActionDomainEvent.adoc[leveloffset=+1]
-include::domainevent/CollectionDomainEvent.adoc[leveloffset=+1]
-include::domainevent/PropertyDomainEvent.adoc[leveloffset=+1]
diff --git a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/AbstractDomainEvent.adoc b/antora/components/refguide/modules/applib-classes/pages/events/domainevent/AbstractDomainEvent.adoc
deleted file mode 100644
index a20d5d8..0000000
--- a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/AbstractDomainEvent.adoc
+++ /dev/null
@@ -1,109 +0,0 @@
-[[AbstractDomainEvent]]
-= `AbstractDomainEvent`
-
-: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 [...]
-:page-partial:
-
-
-This class is the superclass for all domain events that are raised by the framework when interacting with actions, properties or collections.
-
-Its immediate subclasses are:
-
-* xref:applib-classes:events.adoc#ActionDomainEvent[ActionDomainEvent]
-* xref:applib-classes:events.adoc#PropertyDomainEvent[PropertyDomainEvent]
-* xref:applib-classes:events.adoc#CollectionDomainEvent[CollectionDomainEvent]
-
-The main purpose of the class is to define the protocol by which subscribers can influence an interaction (eg hide a collection, disable a property, validate action arguments).
-It class also provides a simple mechanism to allow adhoc sharing of user data between different phases.
-
-== API
-
-The API of the class is:
-
-// TODO: v2: use include::[]
-
-[source,java]
-----
-public abstract class AbstractDomainEvent<S> extends java.util.EventObject {
-
-    public S getSource();                                           // <.>
-    public Object getMixedIn();                                     // <.>
-    public Object getSubject();                                     // <.>
-
-    public Identifier getIdentifier();                              // <.>
-
-    public Phase getEventPhase();                                   // <.>
-
-    public void hide();                                             // <.>
-    public boolean isHidden();                                      // <.>
-
-    public void disable(final String reason);                       // <.>
-    public void disable(final TranslatableString reason);
-    public String getDisabledReason();                              // <.>
-    public TranslatableString getDisabledReasonTranslatable();
-    public boolean isDisabled();
-
-    public void invalidate(final String reason);                    // <.>
-    public void invalidate(final TranslatableString reason);
-    public String getInvalidityReason();                            // <.>
-    public TranslatableString getInvalidityReasonTranslatable();
-    public boolean isInvalid();
-
-    public void veto(final String reason, final Object... args);    // <.>
-    public void veto(final TranslatableString translatableReason);
-
-    public Object get(Object key);                                  // <.>
-    public void put(Object key, Object value);
-}
-----
-
-<.> The domain object raising this event.
-+
-For a "regular" action, property or collection then this will be the target domain object.
-But for a "mixin" action, this will be an instance of the mixin itself.
-
-<.> For a "mixin", this will be the target object that is being contributed to.
-+
-For a "regular" action, this will return `null`.
-
-<.> Returns the domain object being interacted with, irrespective of whether this is a "regular" action/property/collection or a "mixin".
-+
-* For a regular member, this will return the same as `getSource()`.
-+
-* For a mixin, this will return the same as `getMixedIn()`.
-
-<.> Identifier of the action, property or collection being interacted with.
-
-<.> Whether the framework is checking visibility, enablement, validity or actually executing (invoking action, editing property), as per the `Phase` enum (defined below).
-
-<.> API for subscribers to hide the member
-
-<.> Used by the framework to determine if the member should be hidden (not rendered)
-
-<.> API for subscribers to disable the member, specifying the reason why (possibly translated)
-
-<.> Used by the framework to determine whether the member should be disabled (greyed out) when rendered.
-
-<.> API for subscribers to invalidate an interaction, eg invalid arguments to an action
-
-<.> Used by the framework to determine whether the interaction is invalid and should be blocked (eg pressing OK shows message)
-
-<.> Convenience API for subscribers to veto; will automatically call either `hide()`, `disable(...)` or `invalidate(...)` based on the phase
-
-<.> Mechanism to allow subscribers to share arbitrary information between phases.
-One event instance is used for both the hide and disable phases, and a different event instance is shared between validate/pre-execute/post-execute.
-
-The referenced `Phase` enum is in turn:
-
-[source,java]
-----
-public enum Phase {
-    HIDE,
-    DISABLE,
-    VALIDATE,
-    EXECUTING,
-    EXECUTED;
-    public boolean isValidatingOrLater();    // <.>
-}
-----
-<.> The significance being that at this point the proposed values/arguments are known, and so the event can be fully populated.
diff --git a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/ActionDomainEvent.adoc b/antora/components/refguide/modules/applib-classes/pages/events/domainevent/ActionDomainEvent.adoc
deleted file mode 100644
index d647dcf..0000000
--- a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/ActionDomainEvent.adoc
+++ /dev/null
@@ -1,49 +0,0 @@
-[[ActionDomainEvent]]
-= `ActionDomainEvent`
-
-: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 [...]
-:page-partial:
-
-
-Subclass of xref:applib-classes:events.adoc#AbstractDomainEvent[AbstractDomainEvent] for actions.
-
-The class has a number of responsibilities (in addition to those it inherits):
-
-* capture the target object being interacted with
-* capture the arguments for each of the action's parameters
-* provide selected metadata about the action parameters from the metamodel (names, types)
-
-The class itself is instantiated automatically by the framework whenever interacting with a rendered object's action.
-
-== API
-
-The API of the class is:
-
-// TODO: v2: use include::[]
-
-[source,java]
-----
-public abstract class ActionDomainEvent<S> extends AbstractDomainEvent<S> {
-
-    public static class Default extends ActionDomainEvent<Object> { }   // <.>
-    public static class Noop extends ActionDomainEvent<Object> { }      // <.>
-    public static class Doop extends ActionDomainEvent<Object> { }      // <.>
-
-    public SemanticsOf getSemantics();
-
-    public List<String> getParameterNames();
-    public List<Class<?>> getParameterTypes();
-
-    public List<Object> getArguments();                                 // <.>
-    public Object getReturnValue();                                     // <.>
-    public void setReturnValue();                                       // <.>
-}
-----
-<.> The `Default` nested static class is the default for the xref:refguide:applib:index/annotation/Action.adoc#domainEvent[@Action#domainEvent()]
-annotation attribute.
-Whether this raises an event or not depends upon the `isis.reflector.facet.actionAnnotation.domainEvent.postForDefault` configuration property.
-<.> The `Noop` class is provided as a convenience to indicate that an event should _not_ be posted (irrespective of the configuration property setting).
-<.> Similarly, the `Doop` class is provided as a convenience to indicate that an event _should_ be raised (irrespective of the configuration property setting).
-<.> The arguments being used to invoke the action; populated during validate phase and subsequent phases.
-<.> The value returned by the action; populated only in the executed phase.
-<.> Allows the subscriber to effectively change the value returned by the action; may only be called in the executed phase.
diff --git a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/CollectionDomainEvent.adoc b/antora/components/refguide/modules/applib-classes/pages/events/domainevent/CollectionDomainEvent.adoc
index 02826ac..e35af06 100644
--- a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/CollectionDomainEvent.adoc
+++ b/antora/components/refguide/modules/applib-classes/pages/events/domainevent/CollectionDomainEvent.adoc
@@ -5,18 +5,6 @@
 :page-partial:
 
 
-Subclass of xref:applib-classes:events.adoc#AbstractDomainEvent[AbstractDomainEvent] for collections.
-
-The class has a couple of responsibilities (in addition to those it inherits):
-
-* capture the target object being interacted with
-
-* indicate whether the interaction is to add or remove an object from the collection (or simply to indicate that the collection is being accessed/read)
-
-* capture the object reference being added or removed
-
-
-The class itself is instantiated automatically by the framework whenever interacting with a rendered object's collection.
 
 == API
 
diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/AbstractDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/AbstractDomainEvent.java
index 08ddedf..2bfa27e 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/AbstractDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/AbstractDomainEvent.java
@@ -21,6 +21,8 @@ package org.apache.isis.applib.events.domain;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.annotation.Nullable;
+
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.applib.events.EventObjectBase;
 import org.apache.isis.applib.services.i18n.TranslatableString;
@@ -31,6 +33,24 @@ import org.apache.isis.commons.internal.exceptions._Exceptions;
 import lombok.Getter;
 
 /**
+ * Superclass for all domain events that are raised by the framework when
+ * interacting with actions, properties or collections.
+ *
+ * <p>
+ *     The main purpose of the class is to define the protocol by which
+ *     subscribers can influence an interaction (eg hide a collection,
+ *     disable a property, validate action arguments).
+ * </p>
+ *
+ * <p>
+ *     The class also provides a simple mechanism to allow adhoc sharing of
+ *     user data between different phases.
+ * </p>
+ *
+ * @see ActionDomainEvent
+ * @see PropertyDomainEvent
+ * @see CollectionDomainEvent
+ *
  * @since 1.x {@index}
  */
 public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
@@ -55,7 +75,31 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
     }
 
     /**
-     * Populated only for mixins; holds the underlying domain object that the mixin contributes to.
+     * The domain object raising this event.
+     *
+     * <p>
+     * For a "regular" action, property or collection then this will be the
+     * target domain object.
+     * </p>
+     *
+     * <p>
+     *     But for a "mixin" action, this will be an instance of the mixin
+     *     itself.
+     * </p>
+     */
+    @Nullable
+    @Override
+    public S getSource() {
+        return super.getSource();
+    }
+
+    /**
+     * Populated only for mixins; holds the underlying domain object that the
+     * mixin contributes to.
+     *
+     * <p>
+     * For a "regular" action, this will return <code>null</code>.
+     * </p>
      */
     @Getter
     private Object mixedIn;
@@ -69,7 +113,8 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
 
 
     /**
-     * The subject of the event, which will be either the {@link #getSource() source} for a regular action, or the
+     * The subject of the event, which will be either the
+     * {@link #getSource() source} for a regular action, or the
      * {@link #getMixedIn() mixed-in} domain object for a mixin.
      */
     public Object getSubject() {
@@ -77,6 +122,10 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
         return mixedIn != null ? mixedIn : getSource();
     }
 
+    /**
+     *
+     * {@index}
+     */
     public enum Phase {
 
         HIDE,
@@ -132,7 +181,8 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
     }
 
     /**
-     * If the no-arg constructor is used, then the framework will populate this field reflectively.
+     * Identifier of the action, property or collection being interacted with.
+     *
      */
     @Getter
     private Identifier identifier;
@@ -144,21 +194,25 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
         this.identifier = identifier;
     }
 
+    /**
+     * Used by the framework to determine if the member should be hidden (not
+     * rendered).
+     */
     @Getter
     private boolean hidden;
 
     /**
+     * API for subscribers to hide the member.
+     *
      * @see #veto(String, Object...)
      */
     public void hide() {
-
         this.hidden = true;
-
-        // ...
     }
 
     /**
-     * If {@link #isDisabled() disabled}, then either this method returns non-null or {@link #getDisabledReasonTranslatable()} will.
+     * If {@link #isDisabled() disabled}, then either this method returns
+     * non-null or {@link #getDisabledReasonTranslatable()} will.
      */
     @Getter
     private String disabledReason;
@@ -175,36 +229,47 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
 
 
     /**
+     * API for subscribers to disable the member, specifying the reason why.
+     *
      * @see #disable(org.apache.isis.applib.services.i18n.TranslatableString)
      * @see #veto(String, Object...)
      */
     public void disable(final String reason) {
-
         this.disabledReason = reason;
-
-        // ...
     }
 
     /**
+     * API for subscribers to disable the member, specifying the reason why as
+     * a {@link TranslatableString}.
+     *
      * @see #disable(java.lang.String)
      * @see #veto(org.apache.isis.applib.services.i18n.TranslatableString)
      */
     public void disable(final TranslatableString reason) {
-
         this.disabledReasonTranslatable = reason;
-
-        // ...
     }
 
 
     /**
-     * If {@link #isInvalid() invalid}, then either this method returns non-null or {@link #getInvalidityReasonTranslatable()} will.
+     * Used by the framework to determine whether the interaction is invalid
+     * and should be blocked (eg pressing OK shows message).
+     *
+     * <p>
+     * If {@link #isInvalid() invalid}, then either this method returns
+     * non-null or {@link #getInvalidityReasonTranslatable()} will.
+     * </p>
      */
     @Getter
     private String invalidityReason;
 
     /**
-     * If {@link #isInvalid() invalid}, then either this method returns non-null or {@link #getInvalidityReason()} will.
+     * Used by the framework to determine whether the interaction is invalid
+     * and should be blocked (eg pressing OK shows message).
+     *
+     * <p>
+     * If {@link #isInvalid() invalid}, then either this method returns non-null
+     * or {@link #getInvalidityReason()} will.
+     * </p>
      */
     @Getter
     private TranslatableString invalidityReasonTranslatable;
@@ -214,36 +279,38 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
     }
 
     /**
+     * API for subscribers to invalidate an interaction, eg invalid arguments
+     * to an action.
+     *
      * @see #invalidate(org.apache.isis.applib.services.i18n.TranslatableString)
      * @see #veto(String, Object...)
      */
     public void invalidate(final String reason) {
-
         this.invalidityReason = reason;
-
-        // ...
     }
 
     /**
+     * API for subscribers to invalidate an interaction, specifying the reason
+     * as a {@link TranslatableString}.
+     *
      * @see #invalidate(String)
      * @see #veto(org.apache.isis.applib.services.i18n.TranslatableString)
      */
     public void invalidate(final TranslatableString reason) {
-
         this.invalidityReasonTranslatable = reason;
-
-        // ...
     }
 
     /**
-     * Use instead of {@link #hide()}, {@link #disable(String)} and {@link #invalidate(String)}; just delegates to
+     * Use instead of {@link #hide()}, {@link #disable(String)} and
+     * {@link #invalidate(String)}; just delegates to
      * appropriate vetoing method based upon the {@link #getEventPhase() phase}.
      *
      * <p>
      *     If hiding, just pass <tt>null</tt> for the parameter.
      * </p>
      *
-     * @param reason - reason why the interaction is being invalidated (ignored if in {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hide} phase).
+     * @param reason - reason why the interaction is being invalidated (ignored
+     *              if in {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hide} phase).
      * @param args
      *
      * @see #veto(org.apache.isis.applib.services.i18n.TranslatableString)
@@ -272,8 +339,6 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
         default:
             throw _Exceptions.unmatchedCase(getEventPhase());
         }
-
-        // ...
     }
 
     /**
@@ -306,8 +371,6 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
         default:
             throw _Exceptions.unmatchedCase(getEventPhase());
         }
-
-        // ...
     }
 
     /**
@@ -323,6 +386,10 @@ public abstract class AbstractDomainEvent<S> extends EventObjectBase<S> {
     }
 
     /**
+     * Mechanism to allow subscribers to share arbitrary information between
+     * phases. One event instance is used for both the hide and disable phases,
+     * and a different event instance is shared between validate/pre-execute/post-execute.
+     *
      * Set user-data, for the use of a subsequent {@link #getEventPhase() phase}.
      */
     public void put(Object key, Object value) {
diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/ActionDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/ActionDomainEvent.java
index a327141..983b711 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/ActionDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/ActionDomainEvent.java
@@ -20,6 +20,7 @@ package org.apache.isis.applib.events.domain;
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Action;
 import org.apache.isis.applib.annotation.SemanticsOf;
 import org.apache.isis.applib.util.ObjectContracts;
 import org.apache.isis.applib.util.ToString;
@@ -28,47 +29,97 @@ import lombok.Getter;
 import lombok.Setter;
 
 /**
+ * Subclass of {@link AbstractDomainEvent} for actions.
+ *
+ * <p>
+ * The class has a number of responsibilities (in addition to those it inherits):
+ * </p>
+ *
+ * <ul>
+ *     <li>
+ *          capture the target object being interacted with
+ *     </li>
+ *     <li>
+ *          capture the arguments for each of the action's parameters
+ *     </li>
+ *     <li>
+ *          provide selected metadata about the action parameters from the
+ *          metamodel (names, types)
+ *     </li>
+ * </ul>
+ *
+ * <p>
+ * The class itself is instantiated automatically by the framework whenever
+ * interacting with a rendered object's action.
+ * </p>
+ *
  * @since 1.x {@index}
  */
 public abstract class ActionDomainEvent<S> extends AbstractDomainEvent<S> {
 
     /**
      * This class is the default for the
-     * {@link org.apache.isis.applib.annotation.Action#domainEvent()} annotation attribute.  Whether this
-     * raises an event or not depends upon the 
+     * {@link org.apache.isis.applib.annotation.Action#domainEvent()} annotation attribute.
+     *
+     * <p>
+     * Whether this raises an event or not depends upon the
      * <tt>isis.core.meta-model.annotation.action.domain-event.post-for-default</tt>
      * configuration property.
+     * </p>
      */
     public static class Default extends ActionDomainEvent<Object> {}
 
     /**
-     * Convenience class to use indicating that an event should <i>not</i> be posted 
-     * (irrespective of the configuration property setting for the {@link Default} event.
+     * Convenience class to use indicating that an event should <i>not</i> be
+     * posted (irrespective of the configuration property setting for the
+     * {@link Default} event.
      */
     public static class Noop extends ActionDomainEvent<Object> {}
 
     /**
-     * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
-     * property setting for the {@link Default} event..
+     * Convenience class meaning that an event <i>should</i> be posted
+     * (irrespective of the configuration property setting for the
+     * {@link Default} event..
      */
     public static class Doop extends ActionDomainEvent<Object> {}
 
     /**
-     * If used then the framework will set state via (non-API) setters.
-     *
-     * <p>
-     *     Recommended because it reduces the amount of boilerplate in the domain object classes.
-     * </p>
+     * Subtypes can define a no-arg constructor; the framework sets state
+     * via (non-API) setters.
      */
     public ActionDomainEvent() {
     }
 
+    /**
+     * The semantics of the action being invoked.
+     *
+     * <p>
+     *     Copied over from {@link Action#semantics()}
+     * </p>
+     */
     @Getter
     private SemanticsOf semantics;
 
+    /**
+     * The names of the parameters of the actions.
+     *
+     * @see #getParameterTypes()
+     * @see #getArguments()
+     */
     @Getter
     private List<String> parameterNames;
 
+    /**
+     * The types of the parameters of the actions.
+     *
+     * <p>
+     *     The {@link #getArguments() arguments} will be castable to the
+     *     parameter types here.
+     * </p>
+     *
+     * @see #getParameterNames()
+     * @see #getArguments()
+     */
     @Getter
     private List<Class<?>> parameterTypes;
 
@@ -79,17 +130,23 @@ public abstract class ActionDomainEvent<S> extends AbstractDomainEvent<S> {
     private Object mixedIn;
 
     /**
-     * The arguments being used to invoke the action;
-     * populated at {@link AbstractDomainEvent.Phase#VALIDATE} and subsequent phases
-     * (but null for {@link AbstractDomainEvent.Phase#HIDE hidden} and 
+     * The arguments being used to invoke the action.
+     *
+     * <p>
+     * Populated at {@link AbstractDomainEvent.Phase#VALIDATE} and subsequent
+     * phases (but null for {@link AbstractDomainEvent.Phase#HIDE hidden} and
      * {@link AbstractDomainEvent.Phase#DISABLE disable} phases).
+     * </p>
      *
      * <p>
      *     The argument values can also be modified by event handlers
-     *     during the {@link AbstractDomainEvent.Phase#EXECUTING} phase. The new value must be
-     *     the same type as the expected value; the framework performs
-     *     no sanity checks.
+     *     during the {@link AbstractDomainEvent.Phase#EXECUTING} phase. The
+     *     new value must be the same type as the expected value; the framework
+     *     performs no sanity checks.
      * </p>
+     *
+     * @see #getParameterNames()
+     * @see #getParameterTypes()
      */
     @Getter @Setter
     private List<Object> arguments;
@@ -108,33 +165,35 @@ public abstract class ActionDomainEvent<S> extends AbstractDomainEvent<S> {
     /**
      * Set by the framework.
      *
-     * Event subscribers can replace the value with some other value if they wish, though only in the
-     * {@link AbstractDomainEvent.Phase#EXECUTED} phase.
+     * <p>
+     * Event subscribers can replace the value with some other value if they
+     * wish, though only in the {@link AbstractDomainEvent.Phase#EXECUTED} phase.
+     * </p>
      */
     public void setReturnValue(final Object returnValue) {
         this.returnValue = returnValue;
     }
 
     /**
-     * Not API - set by the framework.
+     * @apiNote : NOT API, set by the framework
      */
     public void setSemantics(SemanticsOf semantics) {
         this.semantics = semantics;
     }
     /**
-     * Not API - set by the framework.
+     * @apiNote : NOT API, set by the framework
      */
     public void setParameterNames(final List<String> parameterNames) {
         this.parameterNames = parameterNames;
     }
     /**
-     * Not API - set by the framework.
+     * @apiNote : NOT API, set by the framework
      */
     public void setParameterTypes(final List<Class<?>> parameterTypes) {
         this.parameterTypes = parameterTypes;
     }
     /**
-     * Not API - set by the framework.
+     * @apiNote : NOT API, set by the framework
      */
     @Override
     public void setMixedIn(final Object mixedIn) {
diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
index 8b843e6..6d4c57c 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
@@ -24,37 +24,59 @@ import org.apache.isis.applib.util.ToString;
 import lombok.Getter;
 
 /**
+ * Subclass of {@link AbstractDomainEvent} for collections.
+ *
+ * <p>
+ * The class has a couple of responsibilities (in addition to those it
+ * inherits):
+ * </p>
+ *
+ * <ul>
+ *     <li>
+ *      capture the target object being interacted with
+ *     </li>
+ * </ul>
+ *
+ * <p>
+ * The class itself is instantiated automatically by the framework whenever
+ * interacting with a rendered object's collection.
+ * </p>
+ *
  * @since 1.x {@index}
  */
 public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S> {
 
     /**
      * This class is the default for the
-     * {@link org.apache.isis.applib.annotation.Collection#domainEvent()} annotation attribute.  Whether this
-     * raises an event or not depends upon the <tt>isis.core.meta-model.annotation.collection.domain-event.post-for-default</tt>
+     * {@link org.apache.isis.applib.annotation.Collection#domainEvent()}
+     * annotation attribute.
+     *
+     * <p>
+     * Whether this raises an event or not depends upon the
+     * <tt>isis.core.meta-model.annotation.collection.domain-event.post-for-default</tt>
      * configuration property.
+     * </p>
      */
     public static class Default extends CollectionDomainEvent<Object, Object> { }
 
     /**
-     * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
-     * property setting for the {@link Default} event.
+     * Convenience class to use indicating that an event should <i>not</i> be
+     * posted (irrespective of the configuration property setting for the
+     * {@link Default} event.
      */
     public static class Noop extends CollectionDomainEvent<Object, Object> {}
 
     /**
-     * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
-     * property setting for the {@link Default} event..
+     * Convenience class meaning that an event <i>should</i> be posted
+     * (irrespective of the configuration property setting for the
+     * {@link Default} event.
      */
     public static class Doop extends CollectionDomainEvent<Object, Object> {}
 
 
     /**
-     * If used then the framework will set state via (non-API) setters.
-     *
-     * <p>
-     *     Recommended because it reduces the amount of boilerplate in the domain object classes.
-     * </p>
+     * Subtypes can define a no-arg constructor; the framework sets state
+     * via (non-API) setters.
      */
     public CollectionDomainEvent() {
     }
@@ -62,10 +84,10 @@ public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S>
 
 
     /**
-     * The proposed reference to either add or remove (per {@link #getOf()}), populated at 
+     * The proposed reference to either add or remove (per {@link #getOf()}), populated at
      * {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE}
-     * and subsequent phases (is null for 
-     * {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden} 
+     * and subsequent phases (is null for
+     * {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden}
      * and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable} phases).
      */
     @Getter
@@ -105,7 +127,7 @@ public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S>
         this.value = value;
     }
     /**
-     * Not API; updates from {@link Of#ACCESS} to either {@link Of#ADD_TO} 
+     * Not API; updates from {@link Of#ACCESS} to either {@link Of#ADD_TO}
      * or {@link Of#REMOVE_FROM} when hits the
      * {@link AbstractDomainEvent.Phase#VALIDATE validation phase}.
      */
diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/PropertyDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/PropertyDomainEvent.java
index 43c390f..2801a66 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/PropertyDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/PropertyDomainEvent.java
@@ -50,11 +50,8 @@ public abstract class PropertyDomainEvent<S,T> extends AbstractDomainEvent<S> {
     public static class Doop extends PropertyDomainEvent<Object, Object> {}
 
     /**
-     * If used then the framework will set state via (non-API) setters.
-     *
-     * <p>
-     *     Recommended because it reduces the amount of boilerplate in the domain object classes.
-     * </p>
+     * Subtypes can define a no-arg constructor; the framework sets state
+     * via (non-API) setters.
      */
     public PropertyDomainEvent() {
     }
diff --git a/legacy/extensions/core/metamodel/src/main/adoc/modules/metamodel/pages/about.adoc b/legacy/extensions/core/metamodel/src/main/adoc/modules/metamodel/pages/about.adoc
index 8c28ea0..1bf059a 100644
--- a/legacy/extensions/core/metamodel/src/main/adoc/modules/metamodel/pages/about.adoc
+++ b/legacy/extensions/core/metamodel/src/main/adoc/modules/metamodel/pages/about.adoc
@@ -2,5 +2,5 @@
 
 :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: v2: placeholder for documentation about legacy/metamodel
+WARNING: TODO: v2: to document
 
diff --git a/persistence/jpa/adoc/modules/ROOT/pages/about.adoc b/persistence/jpa/adoc/modules/ROOT/pages/about.adoc
index ecb2a85..b977118 100644
--- a/persistence/jpa/adoc/modules/ROOT/pages/about.adoc
+++ b/persistence/jpa/adoc/modules/ROOT/pages/about.adoc
@@ -4,5 +4,5 @@
 
 :page-toc: ~
 
-WARNING: TODO: v2 - in development.
+WARNING: TODO: v2 - to document.
 
diff --git a/security/adoc/modules/ROOT/pages/about.adoc b/security/adoc/modules/ROOT/pages/about.adoc
index 0905a6b..b48aa37 100644
--- a/security/adoc/modules/ROOT/pages/about.adoc
+++ b/security/adoc/modules/ROOT/pages/about.adoc
@@ -70,11 +70,11 @@ The framework provides a "bypass" implementation, useful for quick-n-dirty proto
 
 === KeyCloak
 
-WARNING: TODO: v2 - not yet documented.
+WARNING: TODO: v2 - to document.
 
 === Spring
 
-WARNING: TODO: v2 - WIP, not yet documented.
+WARNING: TODO: v2 - WIP, to document
 
 == SecMan
 
diff --git a/testing/adoc/modules/ROOT/pages/about.adoc b/testing/adoc/modules/ROOT/pages/about.adoc
index 6c3897e..a1074c0 100644
--- a/testing/adoc/modules/ROOT/pages/about.adoc
+++ b/testing/adoc/modules/ROOT/pages/about.adoc
@@ -131,12 +131,10 @@ Apache Isis provides the xref:testing:fakedata:about.adoc[Fake Data] library to
 Using fake data works very well with fixture scripts; the fixture script can invoke the business action with sensible (fake/random) defaults, and only require that the essential information is passed into it by the test.
 ====
 
-
 == Feature Toggles
 
 Writing automated tests is just good development practice.
-Also good practice is developing on the mainline (master, trunk); so that your continuous integration system really is integrating all code.
-Said another way: link:http://martinfowler.com/bliki/FeatureBranch.html[don't use branches]!
+Also good practice is developing on the mainline (main, trunk); so that your continuous integration system really is integrating all code.
 
 Sometimes, though, a feature will take longer to implement than your iteration cycle.
 In such a case, how do you use continuous integration to keep everyone working on the mainline without revealing a half-implemented feature on your releases?


[isis] 05/06: ISIS-2444: more on domain event docs

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

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

commit 8973bc29c81f7ca4d612d8fa575979dfedde26b3
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Mar 3 07:22:48 2021 +0000

    ISIS-2444: more on domain event docs
---
 .../applib-classes/pages/events/domainevent.adoc   |  4 +-
 .../events/domainevent/CollectionDomainEvent.adoc  | 50 ---------------
 .../events/domainevent/PropertyDomainEvent.adoc    | 46 --------------
 .../applib/events/domain/ActionDomainEvent.java    | 19 +++---
 .../events/domain/CollectionDomainEvent.java       | 13 ++--
 .../applib/events/domain/PropertyDomainEvent.java  | 73 +++++++++++++++++-----
 6 files changed, 80 insertions(+), 125 deletions(-)

diff --git a/antora/components/refguide/modules/applib-classes/pages/events/domainevent.adoc b/antora/components/refguide/modules/applib-classes/pages/events/domainevent.adoc
index a26d546..8dcc604 100644
--- a/antora/components/refguide/modules/applib-classes/pages/events/domainevent.adoc
+++ b/antora/components/refguide/modules/applib-classes/pages/events/domainevent.adoc
@@ -6,10 +6,8 @@
 
 This section catalogues the various domain event classes defined by Apache Isis.
 
-These events are broadcast on the xref:refguide:applib:index/services/eventbus/EventBusService.adoc[EventBusService].
-The domain events are broadcast as a result of being specified in the ,   or xref:refguide:applib:index/annotation/Collection.adoc#domainEvent[@Collection#domainEvent()] attributes.
+These events are broadcast through the xref:refguide:applib:index/services/eventbus/EventBusService.adoc[EventBusService] whenever the framework interacts with the domain object members
 
-They are listed in the table below.
 
 .Domain Event Classes
 [cols="1a,2a,2a,2a", options="header"]
diff --git a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/CollectionDomainEvent.adoc b/antora/components/refguide/modules/applib-classes/pages/events/domainevent/CollectionDomainEvent.adoc
deleted file mode 100644
index e35af06..0000000
--- a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/CollectionDomainEvent.adoc
+++ /dev/null
@@ -1,50 +0,0 @@
-[[CollectionDomainEvent]]
-= `CollectionDomainEvent`
-
-: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 [...]
-:page-partial:
-
-
-
-== API
-
-The API of the class is:
-
-// TODO: v2: use include::[]
-
-[source,java]
-----
-public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S> {
-
-    public static class Default                                 // <.>
-        extends CollectionDomainEvent<Object, Object> { }
-    public static class Noop                                    // <.>
-        extends CollectionDomainEvent<Object, Object> { }
-    public static class Doop                                    // <.>
-        extends CollectionDomainEvent<Object, Object> { }
-
-    public T getValue();                                        // <.>
-    public Of getOf();                                          // <.>
-}
-----
-<1> The `Default` nested static class is the default for the xref:refguide:applib:index/annotation/Collection.adoc#domainEvent[@Collection#domainEvent()] annotation attribute.
-Whether this raises an event or not depends upon the
-`isis.reflector.facet.collectionAnnotation.domainEvent.postForDefault` configuration property.
-<2> The `Noop` class is provided as a convenience to indicate that an event should _not_ be posted (irrespective of the configuration property setting).
-<3> Similarly, the `Doop` class is provided as a convenience to indicate that an event _should_ be raised (irrespective of the configuration property setting).
-<4> the object being added or removed
-<5> whether this is to add or to remove
-
-where the `Of` enum indicates in turn how the collection is being interacted with:
-
-[source,java]
-----
-public static enum Of {
-    ACCESS,         // <1>
-    ADD_TO,         // <2>
-    REMOVE_FROM     // <3>
-}
-----
-<1> collection is being rendered; set during for hide and disable phases
-<2> collection is being added to; set for validate, executing and executed phases
-<3> or, collection is being removed from; set for validate, executing and executed phases
diff --git a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/PropertyDomainEvent.adoc b/antora/components/refguide/modules/applib-classes/pages/events/domainevent/PropertyDomainEvent.adoc
deleted file mode 100644
index 6f37046..0000000
--- a/antora/components/refguide/modules/applib-classes/pages/events/domainevent/PropertyDomainEvent.adoc
+++ /dev/null
@@ -1,46 +0,0 @@
-[[PropertyDomainEvent]]
-= `PropertyDomainEvent`
-
-: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 [...]
-:page-partial:
-
-
-Subclass of xref:applib-classes:events.adoc#AbstractDomainEvent[AbstractDomainEvent] for properties.
-
-The class has a couple of responsibilities (in addition to those it inherits):
-
-* capture the target object being interacted with
-
-* capture the old and new values of the property
-
-
-The class itself is instantiated automatically by the framework whenever interacting with a rendered object's property.
-
-== API
-
-The API of the class is:
-
-// TODO: v2: use include::[]
-
-[source,java]
-----
-public abstract class PropertyDomainEvent<S,T> extends AbstractDomainEvent<S> {
-
-    public static class Default                                 // <.>
-        extends PropertyDomainEvent<Object, Object> { }
-    public static class Noop                                    // <.>
-        extends PropertyDomainEvent<Object, Object> { }
-    public static class Doop                                    // <.>
-        extends PropertyDomainEvent<Object, Object> { }
-
-    public T getOldValue();                                     // <.>
-    public T getNewValue();                                     // <.>
-}
-----
-<1> The `Default` nested static class is the default for the xref:refguide:applib:index/annotation/Property.adoc#domainEvent[@Property#domainEvent()] annotation attribute.
-Whether this raises an event or not depends upon the
-`isis.reflector.facet.propertyAnnotation.domainEvent.postForDefault` configuration property.
-<2> The `Noop` class is provided as a convenience to indicate that an event should _not_ be posted (irrespective of the configuration property setting).
-<3> Similarly, the `Doop` class is provided as a convenience to indicate that an event _should_ be raised (irrespective of the configuration property setting).
-<4> The pre-modification value of the property; populated at validate and subsequent phases.
-<5> The proposed (post-modification) value of the property; populated at validate and subsequent phases
diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/ActionDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/ActionDomainEvent.java
index 983b711..fb21014 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/ActionDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/ActionDomainEvent.java
@@ -29,17 +29,20 @@ import lombok.Getter;
 import lombok.Setter;
 
 /**
- * Subclass of {@link AbstractDomainEvent} for actions.
+ * Fired whenever the framework interacts with a domain object's action.
  *
  * <p>
- * The class has a number of responsibilities (in addition to those it inherits):
+ * This is the specialization of {@link AbstractDomainEvent}, for actions,
+ * which should then be further subclassed by domain application.
+ * </p>
+ *
+ * <p>
+ * The class has a number of responsibilities (in addition to those it
+ * inherits):
  * </p>
  *
  * <ul>
  *     <li>
- *          capture the target object being interacted with
- *     </li>
- *     <li>
  *          capture the arguments for each of the action's parameters
  *     </li>
  *     <li>
@@ -49,8 +52,8 @@ import lombok.Setter;
  * </ul>
  *
  * <p>
- * The class itself is instantiated automatically by the framework whenever
- * interacting with a rendered object's action.
+ * The class itself is instantiated automatically by the framework using a
+ * no-arg constructor; fields are set reflectively.
  * </p>
  *
  * @since 1.x {@index}
@@ -63,7 +66,7 @@ public abstract class ActionDomainEvent<S> extends AbstractDomainEvent<S> {
      *
      * <p>
      * Whether this raises an event or not depends upon the
-     * <tt>isis.core.meta-model.annotation.action.domain-event.post-for-default</tt>
+     * <tt>isis.applib.annotation.action.domain-event.post-for-default</tt>
      * configuration property.
      * </p>
      */
diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
index a126c76..91ee8b8 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
@@ -24,11 +24,16 @@ import org.apache.isis.applib.util.ToString;
 import lombok.Getter;
 
 /**
- * Subclass of {@link AbstractDomainEvent} for collections.
+ * Fired whenever the framework interacts with a domain object's collection.
  *
  * <p>
- * The class itself is instantiated automatically by the framework whenever
- * interacting with a rendered object's collection.
+ * This is the specialization of {@link AbstractDomainEvent}, for collections,
+ *  * which should then be further subclassed by domain application. .
+ * </p>
+ *
+ * <p>
+ * The class itself is instantiated automatically by the framework using a
+ * no-arg constructor; fields are set reflectively.
  * </p>
  *
  * @since 1.x {@index}
@@ -42,7 +47,7 @@ public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S>
      *
      * <p>
      * Whether this raises an event or not depends upon the
-     * <tt>isis.core.meta-model.annotation.collection.domain-event.post-for-default</tt>
+     * <tt>isis.applib.annotation.collection.domain-event.post-for-default</tt>
      * configuration property.
      * </p>
      */
diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/PropertyDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/PropertyDomainEvent.java
index 2801a66..5886dfa 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/PropertyDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/PropertyDomainEvent.java
@@ -25,27 +25,57 @@ import lombok.Getter;
 import lombok.Setter;
 
 /**
+ * Fired whenever the framework interacts with a domain object's property.
+ *
+ * <p>
+ * This is the specialization of {@link AbstractDomainEvent}, for properties,
+ *  * which should then be further subclassed by domain application.
+ * </p>
+ *
+ * <p>
+ * The class has a number of responsibilities (in addition to those it
+ * inherits):
+ * </p>
+ *
+ * <ul>
+ *     <li>
+ *          capture the old and new values of the property
+ *     </li>
+ * </ul>
+ *
+ * <p>
+ * The class itself is instantiated automatically by the framework using a
+ * no-arg constructor; fields are set reflectively.
+ * </p>
+ *
  * @since 1.x {@index}
  */
 public abstract class PropertyDomainEvent<S,T> extends AbstractDomainEvent<S> {
 
     /**
      * This class is the default for the
-     * {@link org.apache.isis.applib.annotation.Property#domainEvent()} annotation attribute.  Whether this
-     * raises an event or not depends upon the <tt>isis.core.meta-model.annotation.property.domain-event.post-for-default</tt>
+     * {@link org.apache.isis.applib.annotation.Property#domainEvent()}
+     * annotation attribute.
+     *
+     * <p>
+     * Whether this raises an event or not depends upon the
+     * <tt>isis.applib.annotation.property.domain-event.post-for-default</tt>
      * configuration property.
+     * </p>
      */
     public static class Default extends PropertyDomainEvent<Object, Object> {}
 
     /**
-     * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
-     * property setting for the {@link Default} event.
+     * Convenience class to use indicating that an event should <i>not</i> be
+     * posted (irrespective of the configuration property setting for the
+     * {@link Default} event.
      */
     public static class Noop extends PropertyDomainEvent<Object, Object> {}
 
     /**
-     * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
-     * property setting for the {@link Default} event..
+     * Convenience class meaning that an event <i>should</i> be posted
+     * (irrespective of the configuration property setting for the
+     * {@link Default} event..
      */
     public static class Doop extends PropertyDomainEvent<Object, Object> {}
 
@@ -57,21 +87,37 @@ public abstract class PropertyDomainEvent<S,T> extends AbstractDomainEvent<S> {
     }
 
     /**
-     * The current (pre-modification) value of the property; populated at {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE} and subsequent phases
-     * (but null for {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable} phases).
+     * The current (pre-modification) value of the property.
+     *
+     * <p>
+     * Populated at {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE} and subsequent
+     * phases (but null for
+     * {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden}
+     * and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable}
+     * phases).
+     * </p>
      */
     @Getter @Setter
     private T oldValue;
 
     /**
-     * The proposed (post-modification) value of the property; populated at {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE} and subsequent phases
-     * (but null for {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable} phases).
+     * The proposed (post-modification) value of the property.
+     *
+     * <p>
+     * Populated at
+     * {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE}
+     * and subsequent phases (but null for
+     * {@link Phase#HIDE hidden}
+     * and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable}
+     * phases).
+     * </p>
      *
      * <p>
      *     The proposed new value can also be modified by event handlers
-     *     during the {@link Phase#EXECUTING} phase.  The new value must be
-     *     the same type as the expected value; the framework performs
-     *     no sanity checks.
+     *     during the
+     *     {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#EXECUTING executing}
+     *     phase.  The new value must be the same type as the expected value;
+     *     the framework performs no sanity checks.
      * </p>
      */
     @Getter @Setter
@@ -79,7 +125,6 @@ public abstract class PropertyDomainEvent<S,T> extends AbstractDomainEvent<S> {
 
 
 
-
     private static final ToString<PropertyDomainEvent<?,?>> toString =
             ObjectContracts.<PropertyDomainEvent<?,?>>
     toString("source", PropertyDomainEvent::getSource)


[isis] 03/06: ISIS-439: further work removing dead code re: mutable collections

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

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

commit 50d7ae317b0b8e5d280c2b9275e7942d1068a2d1
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Mar 3 07:04:12 2021 +0000

    ISIS-439: further work removing dead code re: mutable collections
---
 .../events/domain/CollectionDomainEvent.java       |  35 -------
 .../core/metamodel/facets/DomainEventHelper.java   | 110 ++++++++-------------
 .../modify/CollectionDomainEventFacetAbstract.java |   2 -
 ...HelperTest_newCollectionDomainEvent_forAdd.java |   6 +-
 ...perTest_newCollectionDomainEvent_forRemove.java |   6 +-
 5 files changed, 49 insertions(+), 110 deletions(-)

diff --git a/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java b/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
index 6d4c57c..7b1c489 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/events/domain/CollectionDomainEvent.java
@@ -93,32 +93,6 @@ public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S>
     @Getter
     private T value;
 
-    public static enum Of {
-        /**
-         * The collection is being accessed
-         * ({@link AbstractDomainEvent.Phase#HIDE hide} and
-         * {@link AbstractDomainEvent.Phase#DISABLE disable}) checks.
-         */
-        ACCESS,
-
-        /**
-         * The collection is being added to
-         * ({@link AbstractDomainEvent.Phase#VALIDATE validity} check and
-         * {@link AbstractDomainEvent.Phase#EXECUTED execution}).
-         */
-        ADD_TO,
-
-        /**
-         * The collection is being removed from
-         * ({@link AbstractDomainEvent.Phase#VALIDATE validity} check and
-         * {@link AbstractDomainEvent.Phase#EXECUTED execution}).
-         */
-        REMOVE_FROM
-
-    }
-
-    @Getter
-    private Of of;
 
     /**
      * Not API, set by the framework.
@@ -126,14 +100,6 @@ public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S>
     public void setValue(T value) {
         this.value = value;
     }
-    /**
-     * Not API; updates from {@link Of#ACCESS} to either {@link Of#ADD_TO}
-     * or {@link Of#REMOVE_FROM} when hits the
-     * {@link AbstractDomainEvent.Phase#VALIDATE validation phase}.
-     */
-    public void setOf(Of of) {
-        this.of = of;
-    }
 
 
     private static final ToString<CollectionDomainEvent<?,?>> toString =
@@ -141,7 +107,6 @@ public abstract class CollectionDomainEvent<S,T> extends AbstractDomainEvent<S>
     toString("source", CollectionDomainEvent::getSource)
     .thenToString("identifier", CollectionDomainEvent::getIdentifier)
     .thenToString("eventPhase", CollectionDomainEvent::getEventPhase)
-    .thenToString("of", CollectionDomainEvent::getOf)
     .thenToString("value", CollectionDomainEvent::getValue)
     ;
 
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
index 8029c45..56cb6d6 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
@@ -67,7 +67,7 @@ public class DomainEventHelper {
     private final MetamodelEventService metamodelEventService;
 
     // -- postEventForAction
-    
+
     // variant using eventType and no existing event
     public ActionDomainEvent<?> postEventForAction(
             final AbstractDomainEvent.Phase phase,
@@ -77,12 +77,12 @@ public class DomainEventHelper {
             final InteractionHead head,
             final Can<ManagedObject> argumentAdapters,
             final ManagedObject resultAdapter) {
-        
-        return postEventForAction(phase, uncheckedCast(eventType), /*existingEvent*/null, 
-                objectAction, identified, 
+
+        return postEventForAction(phase, uncheckedCast(eventType), /*existingEvent*/null,
+                objectAction, identified,
                 head, argumentAdapters, resultAdapter);
     }
-    
+
     // variant using existing event and not eventType (is derived from event)
     public ActionDomainEvent<?> postEventForAction(
             final AbstractDomainEvent.Phase phase,
@@ -92,9 +92,9 @@ public class DomainEventHelper {
             final InteractionHead head,
             final Can<ManagedObject> argumentAdapters,
             final ManagedObject resultAdapter) {
-        
-        return postEventForAction(phase, 
-                uncheckedCast(existingEvent.getClass()), existingEvent, objectAction, identified, 
+
+        return postEventForAction(phase,
+                uncheckedCast(existingEvent.getClass()), existingEvent, objectAction, identified,
                 head, argumentAdapters, resultAdapter);
     }
 
@@ -107,7 +107,7 @@ public class DomainEventHelper {
             final InteractionHead head,
             final Can<ManagedObject> argumentAdapters,
             final ManagedObject resultAdapter) {
-        
+
         _Assert.assertTypeIsInstanceOf(eventType, ActionDomainEvent.class);
 
         try {
@@ -166,7 +166,7 @@ public class DomainEventHelper {
             final Class<? extends ActionDomainEvent<S>> type,
             final Identifier identifier,
             final S source,
-            final Object... arguments) 
+            final Object... arguments)
         throws IllegalArgumentException,
             NoSuchMethodException, SecurityException {
 
@@ -174,19 +174,19 @@ public class DomainEventHelper {
 
         val noArgConstructor = constructors.filter(paramCount(0)).getFirst().orElse(null);
         if(noArgConstructor!=null) {
-            
+
             final Object event = invokeConstructor(noArgConstructor);
             final ActionDomainEvent<S> ade = uncheckedCast(event);
-            
+
             ade.initSource(source);
             ade.setIdentifier(identifier);
             ade.setArguments(asList(arguments));
             return ade;
         }
-        
+
 
         // else
-        
+
         val updateEventConstructor = constructors
                 .filter(paramCount(3)
                         .and(paramAssignableFrom(0, source.getClass()))
@@ -195,12 +195,12 @@ public class DomainEventHelper {
                         )
                 .getFirst()
                 .orElse(null);
-        
+
         if(updateEventConstructor!=null) {
             val event = invokeConstructor(updateEventConstructor, source, identifier, arguments);
-            return uncheckedCast(event);    
+            return uncheckedCast(event);
         }
-        
+
         throw new NoSuchMethodException(type.getName()+".<init>(? super " + source.getClass().getName() + ", " + Identifier.class.getName() + ", [Ljava.lang.Object;)");
     }
 
@@ -221,7 +221,7 @@ public class DomainEventHelper {
             final InteractionHead head,
             final T oldValue,
             final T newValue) {
-        
+
         _Assert.assertTypeIsInstanceOf(eventType, PropertyDomainEvent.class);
 
         try {
@@ -232,10 +232,10 @@ public class DomainEventHelper {
                 event = existingEvent;
             } else {
                 // all other phases, create a new event
-                
+
                 final S source = uncheckedCast(UnwrapUtil.single(head.getTarget()));
                 final Identifier identifier = identified.getIdentifier();
-                
+
                 event = newPropertyDomainEvent(eventType, identifier, source, oldValue, newValue);
 
                 // copy over if have
@@ -271,7 +271,7 @@ public class DomainEventHelper {
         val constructors = _Reflect.getPublicConstructors(type);
 
         val noArgConstructors = constructors.filter(paramCount(0));
-        
+
         for (val constructor : noArgConstructors) {
             final Object event = invokeConstructor(constructor);
             final PropertyDomainEvent<S, T> pde = uncheckedCast(event);
@@ -292,7 +292,7 @@ public class DomainEventHelper {
                         .and(paramAssignableFromValue(2, oldValue))
                         .and(paramAssignableFromValue(3, newValue))
                         );
-        
+
         for (val constructor : updateEventConstructors) {
             val event = invokeConstructor(constructor, source, identifier, oldValue, newValue);
             return uncheckedCast(event);
@@ -308,14 +308,13 @@ public class DomainEventHelper {
     public <S, T> CollectionDomainEvent<S, T> postEventForCollection(
             AbstractDomainEvent.Phase phase,
             final Class<? extends CollectionDomainEvent<S, T>> eventType,
-                    final CollectionDomainEvent<S, T> existingEvent,
-                    final IdentifiedHolder identified,
-                    final InteractionHead head,
-                    final CollectionDomainEvent.Of of,
-                    final T reference) {
-        
+            final CollectionDomainEvent<S, T> existingEvent,
+            final IdentifiedHolder identified,
+            final InteractionHead head,
+            final T reference) {
+
         _Assert.assertTypeIsInstanceOf(eventType, CollectionDomainEvent.class);
-        
+
         try {
             final CollectionDomainEvent<S, T> event;
             if (existingEvent != null && phase.isExecuted()) {
@@ -325,7 +324,7 @@ public class DomainEventHelper {
                 // all other phases, create a new event
                 final S source = uncheckedCast(UnwrapUtil.single(head.getTarget()));
                 final Identifier identifier = identified.getIdentifier();
-                event = newCollectionDomainEvent(eventType, phase, identifier, source, of, reference);
+                event = newCollectionDomainEvent(eventType, phase, identifier, source, reference);
 
                 // copy over if have
                 head.getMixedIn()
@@ -344,72 +343,49 @@ public class DomainEventHelper {
 
     <S, T> CollectionDomainEvent<S, T> newCollectionDomainEvent(
             final Class<? extends CollectionDomainEvent<S, T>> type,
-                    final AbstractDomainEvent.Phase phase,
-                    final Identifier identifier,
-                    final S source,
-                    final CollectionDomainEvent.Of of,
-                    final T value)
-                            throws NoSuchMethodException, SecurityException, InstantiationException,
-                            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+            final AbstractDomainEvent.Phase phase,
+            final Identifier identifier,
+            final S source,
+            final T value)
+            throws NoSuchMethodException, SecurityException,
+            IllegalArgumentException {
 
         val constructors = _Reflect.getPublicConstructors(type);
 
         val noArgConstructors = constructors.filter(paramCount(0));
-        
+
         for (val constructor : noArgConstructors) {
             final Object event = invokeConstructor(constructor);
             final CollectionDomainEvent<S, T> cde = uncheckedCast(event);
 
             cde.initSource(source);
             cde.setIdentifier(identifier);
-            cde.setOf(of);
             cde.setValue(value);
             return cde;
         }
-        
+
         // else
         // search for constructor accepting source, identifier, type, value
         val updateEventConstructors = constructors
                 .filter(paramCount(4)
                         .and(paramAssignableFrom(0, source.getClass()))
                         .and(paramAssignableFrom(1, Identifier.class))
-                        .and(paramAssignableFrom(2, CollectionDomainEvent.Of.class))
-                        .and(paramAssignableFromValue(3, value))
+                        .and(paramAssignableFromValue(2, value))
                         );
-        
+
         for (val constructor : updateEventConstructors) {
-            val event = invokeConstructor(constructor, source, identifier, of, value);
+            val event = invokeConstructor(constructor, source, identifier, value);
             return uncheckedCast(event);
         }
-        
-        // else
 
-        if(phase == AbstractDomainEvent.Phase.EXECUTED) {
-            if(of == CollectionDomainEvent.Of.ADD_TO 
-                    || of == CollectionDomainEvent.Of.REMOVE_FROM) {
-                // support for annotations @PostsCollectionAddedTo and @PostsCollectionRemovedFrom:
-                // search for constructor accepting source, identifier, value
-                val eventConstructors = constructors
-                        .filter(paramCount(3)
-                                .and(paramAssignableFrom(0, source.getClass()))
-                                .and(paramAssignableFrom(1, Identifier.class))
-                                .and(paramAssignableFromValue(2, value))
-                                );
-                for (val constructor : eventConstructors) {
-                    val event = invokeConstructor(constructor, source, identifier, value);
-                    return uncheckedCast(event);
-                }
-            }
-        }
-        
         // else
         throw new NoSuchMethodException(type.getName()+".<init>(? super " + source.getClass().getName() + ", " + Identifier.class.getName() + ", java.lang.Object)");
     }
 
     private static <T> T invokeConstructor(
-            @NonNull final Constructor<T> constructor, 
+            @NonNull final Constructor<T> constructor,
             final Object... args){
-        
+
         try {
             return constructor.newInstance(args);
         } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
@@ -418,6 +394,6 @@ public class DomainEventHelper {
                     "failed to invoke constructor %s", constructor, e);
         }
     }
-    
+
 
 }
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
index d63ec04..e400f70 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
@@ -76,7 +76,6 @@ public abstract class CollectionDomainEventFacetAbstract
                         AbstractDomainEvent.Phase.HIDE,
                         getEventType(), null,
                         getIdentified(), ic.getHead(),
-                        CollectionDomainEvent.Of.ACCESS,
                         null);
         if (event != null && event.isHidden()) {
             return "Hidden by subscriber";
@@ -92,7 +91,6 @@ public abstract class CollectionDomainEventFacetAbstract
                         AbstractDomainEvent.Phase.DISABLE,
                         getEventType(), null,
                         getIdentified(), ic.getHead(),
-                        CollectionDomainEvent.Of.ACCESS,
                         null);
         if (event != null && event.isDisabled()) {
             final TranslatableString reasonTranslatable = event.getDisabledReasonTranslatable();
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
index d586a41..5ae89a1 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
@@ -48,7 +48,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<Object, Object> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                CollectionDomainEvent.Default.class, null, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
+                CollectionDomainEvent.Default.class, null, identifier, sdo, other);
         assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
@@ -63,7 +63,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<Object, Object> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
+                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
         assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
@@ -78,7 +78,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                SomeDomainObjectCollectionDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
+                SomeDomainObjectCollectionDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
         assertThat(ev.getSource(), is(sdo));
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
index b07c9e2..dc2c6d0 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
@@ -48,7 +48,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<Object, Object> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
+                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
         assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
@@ -63,7 +63,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<Object, Object> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
+                CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
         assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
@@ -78,7 +78,7 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
                 LogicalType.fqcn(SomeDomainObject.class), "references");
 
         final CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> ev = Utils.domainEventHelper().newCollectionDomainEvent(
-                SomeDomainObjectCollectionRemovedFromDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
+                SomeDomainObjectCollectionRemovedFromDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, other);
         assertThat(ev.getSource(), is(sdo));
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));


[isis] 06/06: ISIS-439: removes disabled interaction advisor reponsibility from CollectionDomainEventFacet (dead code)

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

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

commit 81b06c37361af4d777e4e7373389f68d69f1e267
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Mar 3 09:06:11 2021 +0000

    ISIS-439: removes disabled interaction advisor reponsibility from CollectionDomainEventFacet (dead code)
---
 .../modify/CollectionDomainEventFacet.java         |  2 +-
 .../modify/CollectionDomainEventFacetAbstract.java | 29 ----------------------
 2 files changed, 1 insertion(+), 30 deletions(-)

diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacet.java
index 6ebc17a..8d79acb 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacet.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacet.java
@@ -28,7 +28,7 @@ import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
  * Corresponds to <tt>@Collection(domainEvent=...)</tt> annotation in the Isis programming model.
  */
 public interface CollectionDomainEventFacet
-extends SingleClassValueFacet, HidingInteractionAdvisor, DisablingInteractionAdvisor {
+extends SingleClassValueFacet, HidingInteractionAdvisor {
 
 }
 
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
index 7046627..39c1bdc 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/modify/CollectionDomainEventFacetAbstract.java
@@ -21,14 +21,10 @@ package org.apache.isis.core.metamodel.facets.collections.collection.modify;
 
 import org.apache.isis.applib.events.domain.AbstractDomainEvent;
 import org.apache.isis.applib.events.domain.CollectionDomainEvent;
-import org.apache.isis.applib.services.i18n.TranslatableString;
-import org.apache.isis.applib.services.i18n.TranslationService;
 import org.apache.isis.commons.internal.base._Casts;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
 import org.apache.isis.core.metamodel.facets.DomainEventHelper;
 import org.apache.isis.core.metamodel.facets.SingleClassValueFacetAbstract;
-import org.apache.isis.core.metamodel.interactions.UsabilityContext;
 import org.apache.isis.core.metamodel.interactions.VisibilityContext;
 
 public abstract class CollectionDomainEventFacetAbstract
@@ -36,8 +32,6 @@ public abstract class CollectionDomainEventFacetAbstract
         implements CollectionDomainEventFacet {
 
     private final DomainEventHelper domainEventHelper;
-    private final TranslationService translationService;
-    private final String translationContext;
 
     public CollectionDomainEventFacetAbstract(
             final Class<? extends CollectionDomainEvent<?, ?>> eventType,
@@ -46,10 +40,6 @@ public abstract class CollectionDomainEventFacetAbstract
         super(CollectionDomainEventFacet.class, holder, eventType);
         this.eventType = eventType;
 
-        this.translationService = getTranslationService();
-        // sadness: same as in TranslationFactory
-        this.translationContext = ((IdentifiedHolder)holder).getIdentifier().getTranslationContext();
-
         domainEventHelper = DomainEventHelper.ofServiceRegistry(getServiceRegistry());
     }
 
@@ -83,23 +73,4 @@ public abstract class CollectionDomainEventFacetAbstract
         return null;
     }
 
-    @Override
-    public String disables(final UsabilityContext ic) {
-
-        final CollectionDomainEvent<?, ?> event =
-                domainEventHelper.postEventForCollection(
-                        AbstractDomainEvent.Phase.DISABLE,
-                        getEventType(),
-                        getIdentified(), ic.getHead()
-                );
-        if (event != null && event.isDisabled()) {
-            final TranslatableString reasonTranslatable = event.getDisabledReasonTranslatable();
-            if(reasonTranslatable != null) {
-                return reasonTranslatable.translate(translationService, translationContext);
-            }
-            return event.getDisabledReason();
-        }
-        return null;
-    }
-
 }