You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/01/31 08:52:02 UTC

[isis] 01/02: ISIS-2511: move Timestample and co-interfaces from

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

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

commit 10dcfa13e1a436df49cdacb79621eb07b596bd1f
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun Jan 31 09:44:44 2021 +0100

    ISIS-2511: move Timestample and co-interfaces from
    
    org.apache.isis.applib.mixins.timestamp
    
    to
    
    org.apache.isis.commons.having
    
    also rename to more canonical names
---
 .../modules/ROOT/pages/2020/2.0.0-M5/mignotes.adoc |  6 ++++
 .../applib/services/wrapper/WrapperFactory.adoc    |  2 +-
 .../having/HasUpdatedAt.adoc}                      |  4 +--
 .../having/HasUpdatedBy.adoc}                      |  4 +--
 .../xmlsnapshot/XmlSnapshotServiceDefault.adoc     | 33 ----------------------
 .../modules/generated/pages/system-overview.adoc   |  6 ++--
 .../isis/applib/mixins/timestamp/package-info.java | 25 ----------------
 .../apache/isis/commons/having/HasUpdatedAt.java   |  4 +--
 .../apache/isis/commons/having/HasUpdatedBy.java   |  4 +--
 .../isis/commons/having/HasUpdatedByAndAt.java     |  8 +++---
 .../changetracking/events/TimestampService.java    | 12 ++++----
 .../testdomain/jdo/entities/JdoProductComment.java |  4 +--
 .../testdomain/jpa/entities/JpaProductComment.java |  4 +--
 13 files changed, 32 insertions(+), 84 deletions(-)

diff --git a/antora/components/relnotes/modules/ROOT/pages/2020/2.0.0-M5/mignotes.adoc b/antora/components/relnotes/modules/ROOT/pages/2020/2.0.0-M5/mignotes.adoc
index f52aa96..b13d969 100644
--- a/antora/components/relnotes/modules/ROOT/pages/2020/2.0.0-M5/mignotes.adoc
+++ b/antora/components/relnotes/modules/ROOT/pages/2020/2.0.0-M5/mignotes.adoc
@@ -238,6 +238,12 @@ CommandServiceInternal -> CommandPublisher
 | FatalException (removed) 
 | removed, adds no new semantics compared to the already existing UnrecoverableException
 
+| HoldsUpdatedBy, HoldsUpdatedAt, Timestampable
+| moved to 'commons' and renamed:
+ HasUpdatedBy, 
+ HasUpdatedAt,
+ HasUpdatedByAndAt
+
 | IsisInteractionFactory
 | InteractionFactory
 
diff --git a/antora/components/system/modules/generated/pages/index/applib/services/wrapper/WrapperFactory.adoc b/antora/components/system/modules/generated/pages/index/applib/services/wrapper/WrapperFactory.adoc
index bf7e1da..8399284 100644
--- a/antora/components/system/modules/generated/pages/index/applib/services/wrapper/WrapperFactory.adoc
+++ b/antora/components/system/modules/generated/pages/index/applib/services/wrapper/WrapperFactory.adoc
@@ -1,7 +1,7 @@
 = WrapperFactory : _interface_
 :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 [...]
 
-Provides the ability to "wrap" of a domain object such that it can be interacted with while enforcing the hide/disable/validate rules implied by the Apache Isis programming model.
+Provides the ability to 'wrap' a domain object such that it can be interacted with while enforcing the hide/disable/validate rules implied by the Apache Isis programming model.
 
 The wrapper can alternatively also be used to execute the action asynchronously, through an _java.util.concurrent.ExecutorService_ . Any business rules will be invoked synchronously beforehand, however. hand
 
diff --git a/antora/components/system/modules/generated/pages/index/applib/mixins/timestamp/HoldsUpdatedAt.adoc b/antora/components/system/modules/generated/pages/index/commons/having/HasUpdatedAt.adoc
similarity index 93%
rename from antora/components/system/modules/generated/pages/index/applib/mixins/timestamp/HoldsUpdatedAt.adoc
rename to antora/components/system/modules/generated/pages/index/commons/having/HasUpdatedAt.adoc
index 83aafbb..997c098 100644
--- a/antora/components/system/modules/generated/pages/index/applib/mixins/timestamp/HoldsUpdatedAt.adoc
+++ b/antora/components/system/modules/generated/pages/index/commons/having/HasUpdatedAt.adoc
@@ -1,10 +1,10 @@
-= HoldsUpdatedAt : _interface_
+= HasUpdatedAt : _interface_
 :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 [...]
 
 .Java Sources
 [source,java]
 ----
-interface HoldsUpdatedAt {
+interface HasUpdatedAt {
 
   void setUpdatedAt(java.sql.Timestamp updatedAt)
 }
diff --git a/antora/components/system/modules/generated/pages/index/applib/mixins/timestamp/HoldsUpdatedBy.adoc b/antora/components/system/modules/generated/pages/index/commons/having/HasUpdatedBy.adoc
similarity index 93%
rename from antora/components/system/modules/generated/pages/index/applib/mixins/timestamp/HoldsUpdatedBy.adoc
rename to antora/components/system/modules/generated/pages/index/commons/having/HasUpdatedBy.adoc
index c5ab62e..5c72853 100644
--- a/antora/components/system/modules/generated/pages/index/applib/mixins/timestamp/HoldsUpdatedBy.adoc
+++ b/antora/components/system/modules/generated/pages/index/commons/having/HasUpdatedBy.adoc
@@ -1,10 +1,10 @@
-= HoldsUpdatedBy : _interface_
+= HasUpdatedBy : _interface_
 :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 [...]
 
 .Java Sources
 [source,java]
 ----
-interface HoldsUpdatedBy {
+interface HasUpdatedBy {
 
   void setUpdatedBy(String updatedBy)
 }
diff --git a/antora/components/system/modules/generated/pages/index/core/runtimeservices/xmlsnapshot/XmlSnapshotServiceDefault.adoc b/antora/components/system/modules/generated/pages/index/core/runtimeservices/xmlsnapshot/XmlSnapshotServiceDefault.adoc
deleted file mode 100644
index ab72329..0000000
--- a/antora/components/system/modules/generated/pages/index/core/runtimeservices/xmlsnapshot/XmlSnapshotServiceDefault.adoc
+++ /dev/null
@@ -1,33 +0,0 @@
-= XmlSnapshotServiceDefault : _class_
-: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 [...]
-
-This service allows an XML document to be generated capturing the data of a root entity and specified related entities. This XML can be used for various purposes, such as mail merge/reporting, or adhoc auditing.
-
-This implementation has no UI and there are no other implementations of the service API, and so it annotated with _org.apache.isis.applib.annotation.DomainService_ . Because this class is implemented in core, this means that it is automatically registered and available for use; no further configuration is required.
-
-.Java Sources
-[source,java]
-----
-class XmlSnapshotServiceDefault {
-
-  XmlSnapshotServiceDefault(final XmlService xmlService, final SpecificationLoader specificationLoader)
-
-  XmlSnapshotService.Snapshot snapshotFor(final Object domainObject) // <.>
-
-  Snapshot.Builder builderFor(final Object domainObject) // <.>
-
-  T getChildElementValue(final Element el, final String tagname, final Class<T> expectedCls)
-}
-----
-
-<.> `[teal]#*snapshotFor*#(Object domainObject)` : `xref:system:generated:index/applib/annotation/Snapshot.adoc[Snapshot]`
-+
---
-Creates a simple snapshot of the domain object.
---
-<.> `[teal]#*builderFor*#(Object domainObject)` : `Builder`
-+
---
-Creates a builder that allows a custom snapshot - traversing additional associated properties or collections (using _Snapshot.Builder#includePath(String)_ and _Snapshot.Builder#includePathAndAnnotation(String, String)_ ) - to be created.
---
-
diff --git a/antora/components/system/modules/generated/pages/system-overview.adoc b/antora/components/system/modules/generated/pages/system-overview.adoc
index d540db5..d8b3844 100644
--- a/antora/components/system/modules/generated/pages/system-overview.adoc
+++ b/antora/components/system/modules/generated/pages/system-overview.adoc
@@ -160,7 +160,7 @@ _Dependencies_
 
 _Document Index Entries_
 
-xref:system:generated:index/commons/functional/Result.adoc[Result], xref:system:generated:index/commons/having/HasUniqueId.adoc[HasUniqueId], xref:system:generated:index/commons/having/HasUsername.adoc[HasUsername], xref:system:generated:index/commons/resource/ResourceCoordinates.adoc[ResourceCoordinates]
+xref:system:generated:index/commons/functional/Result.adoc[Result], xref:system:generated:index/commons/having/HasUniqueId.adoc[HasUniqueId], xref:system:generated:index/commons/having/HasUpdatedAt.adoc[HasUpdatedAt], xref:system:generated:index/commons/having/HasUpdatedBy.adoc[HasUpdatedBy], xref:system:generated:index/commons/having/HasUsername.adoc[HasUsername], xref:system:generated:index/commons/resource/ResourceCoordinates.adoc[ResourceCoordinates]
 |===
 
 == Core
@@ -335,7 +335,7 @@ _Dependencies_
 
 _Document Index Entries_
 
-xref:system:generated:index/applib/AbstractViewModel.adoc[AbstractViewModel], xref:system:generated:index/applib/Identifier.adoc[Identifier], xref:system:generated:index/applib/RecreatableDomainObject.adoc[RecreatableDomainObject], xref:system:generated:index/applib/ViewModel.adoc[ViewModel], xref:system:generated:index/applib/adapters/AbstractValueSemanticsProvider.adoc[AbstractValueSemanticsProvider], xref:system:generated:index/applib/adapters/DefaultsProvider.adoc[DefaultsProvider],  [...]
+xref:system:generated:index/applib/AbstractViewModel.adoc[AbstractViewModel], xref:system:generated:index/applib/Identifier.adoc[Identifier], xref:system:generated:index/applib/RecreatableDomainObject.adoc[RecreatableDomainObject], xref:system:generated:index/applib/ViewModel.adoc[ViewModel], xref:system:generated:index/applib/adapters/AbstractValueSemanticsProvider.adoc[AbstractValueSemanticsProvider], xref:system:generated:index/applib/adapters/DefaultsProvider.adoc[DefaultsProvider],  [...]
 
 |Apache Isis Core - Code Gen (ByteBuddy)
 [source,yaml]
@@ -566,7 +566,7 @@ _Dependencies_
 
 _Document Index Entries_
 
-xref:system:generated:index/core/runtimeservices/recognizer/dae/impl/ExceptionRecognizerForOtherDataAccessProblem.adoc[ExceptionRecognizerForOtherDataAccessProblem], xref:system:generated:index/core/runtimeservices/transaction/TransactionServiceSpring.adoc[TransactionServiceSpring], xref:system:generated:index/core/runtimeservices/xml/XmlServiceDefault.adoc[XmlServiceDefault], xref:system:generated:index/core/runtimeservices/xmlsnapshot/XmlSnapshotServiceDefault.adoc[XmlSnapshotServiceDefault]
+xref:system:generated:index/core/runtimeservices/recognizer/dae/impl/ExceptionRecognizerForOtherDataAccessProblem.adoc[ExceptionRecognizerForOtherDataAccessProblem], xref:system:generated:index/core/runtimeservices/transaction/TransactionServiceSpring.adoc[TransactionServiceSpring], xref:system:generated:index/core/runtimeservices/xml/XmlServiceDefault.adoc[XmlServiceDefault]
 
 |Apache Isis Core - Security
 [source,yaml]
diff --git a/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/package-info.java b/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/package-info.java
deleted file mode 100644
index 09942ea..0000000
--- a/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/package-info.java
+++ /dev/null
@@ -1,25 +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.
- */
-
-/**
- * Defines a number of interfaces for mixins to contribute to.
- *
- * @see <a href="">Reference guide</a>
- */
-package org.apache.isis.applib.mixins.timestamp;
\ No newline at end of file
diff --git a/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/HoldsUpdatedAt.java b/commons/src/main/java/org/apache/isis/commons/having/HasUpdatedAt.java
similarity index 91%
rename from api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/HoldsUpdatedAt.java
rename to commons/src/main/java/org/apache/isis/commons/having/HasUpdatedAt.java
index a47b65a..98054e1 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/HoldsUpdatedAt.java
+++ b/commons/src/main/java/org/apache/isis/commons/having/HasUpdatedAt.java
@@ -16,12 +16,12 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.applib.mixins.timestamp;
+package org.apache.isis.commons.having;
 
 /**
  * @since 2.0 {@index}
  */
-public interface HoldsUpdatedAt {
+public interface HasUpdatedAt {
 
     void setUpdatedAt(java.sql.Timestamp updatedAt);
 
diff --git a/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/HoldsUpdatedBy.java b/commons/src/main/java/org/apache/isis/commons/having/HasUpdatedBy.java
similarity index 91%
rename from api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/HoldsUpdatedBy.java
rename to commons/src/main/java/org/apache/isis/commons/having/HasUpdatedBy.java
index 6348c51..fe95f0b 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/HoldsUpdatedBy.java
+++ b/commons/src/main/java/org/apache/isis/commons/having/HasUpdatedBy.java
@@ -16,12 +16,12 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.applib.mixins.timestamp;
+package org.apache.isis.commons.having;
 
 /**
  * @since 2.0 {@index}
  */
-public interface HoldsUpdatedBy {
+public interface HasUpdatedBy {
 
     void setUpdatedBy(String updatedBy);
 
diff --git a/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/Timestampable.java b/commons/src/main/java/org/apache/isis/commons/having/HasUpdatedByAndAt.java
similarity index 87%
rename from api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/Timestampable.java
rename to commons/src/main/java/org/apache/isis/commons/having/HasUpdatedByAndAt.java
index ed509bb..8ad59ef 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/mixins/timestamp/Timestampable.java
+++ b/commons/src/main/java/org/apache/isis/commons/having/HasUpdatedByAndAt.java
@@ -16,10 +16,10 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.applib.mixins.timestamp;
+package org.apache.isis.commons.having;
 
-public interface Timestampable 
+public interface HasUpdatedByAndAt 
 extends 
-    HoldsUpdatedBy, 
-    HoldsUpdatedAt {
+    HasUpdatedBy, 
+    HasUpdatedAt {
 }
diff --git a/core/transaction/src/main/java/org/apache/isis/core/transaction/changetracking/events/TimestampService.java b/core/transaction/src/main/java/org/apache/isis/core/transaction/changetracking/events/TimestampService.java
index 19cae74..4039b19 100644
--- a/core/transaction/src/main/java/org/apache/isis/core/transaction/changetracking/events/TimestampService.java
+++ b/core/transaction/src/main/java/org/apache/isis/core/transaction/changetracking/events/TimestampService.java
@@ -28,10 +28,10 @@ import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Service;
 
 import org.apache.isis.applib.annotation.OrderPrecedence;
-import org.apache.isis.applib.mixins.timestamp.HoldsUpdatedAt;
-import org.apache.isis.applib.mixins.timestamp.HoldsUpdatedBy;
 import org.apache.isis.applib.services.clock.ClockService;
 import org.apache.isis.applib.services.user.UserService;
+import org.apache.isis.commons.having.HasUpdatedAt;
+import org.apache.isis.commons.having.HasUpdatedBy;
 
 import lombok.val;
 
@@ -50,12 +50,12 @@ public class TimestampService {
 
         val persistableObject = event.getPersistableObject();
 
-        if(persistableObject instanceof HoldsUpdatedBy) {
-            ((HoldsUpdatedBy)persistableObject).setUpdatedBy(userService.currentUserNameElseNobody());
+        if(persistableObject instanceof HasUpdatedBy) {
+            ((HasUpdatedBy)persistableObject).setUpdatedBy(userService.currentUserNameElseNobody());
         }
         
-        if(persistableObject instanceof HoldsUpdatedAt) {
-            ((HoldsUpdatedAt)persistableObject).setUpdatedAt(clockService.getClock().javaSqlTimestamp());
+        if(persistableObject instanceof HasUpdatedAt) {
+            ((HasUpdatedAt)persistableObject).setUpdatedAt(clockService.getClock().javaSqlTimestamp());
         }
         
     }
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jdo/entities/JdoProductComment.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jdo/entities/JdoProductComment.java
index 23cb33d..0406a41 100644
--- a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jdo/entities/JdoProductComment.java
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jdo/entities/JdoProductComment.java
@@ -27,7 +27,7 @@ import javax.jdo.annotations.PersistenceCapable;
 
 import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.Property;
-import org.apache.isis.applib.mixins.timestamp.Timestampable;
+import org.apache.isis.commons.having.HasUpdatedByAndAt;
 
 import lombok.Getter;
 import lombok.Setter;
@@ -36,7 +36,7 @@ import lombok.Setter;
 @DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, column="id")
 @DomainObject(
         objectType = "testdomain.jdo.ProductComment")
-public class JdoProductComment implements Timestampable {
+public class JdoProductComment implements HasUpdatedByAndAt {
     
     @Property @Column(allowsNull = "false")
     @Getter @Setter private JdoProduct product;
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jpa/entities/JpaProductComment.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jpa/entities/JpaProductComment.java
index 67bad27..b98ad00 100644
--- a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jpa/entities/JpaProductComment.java
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jpa/entities/JpaProductComment.java
@@ -30,7 +30,7 @@ import javax.persistence.ManyToOne;
 
 import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.Property;
-import org.apache.isis.applib.mixins.timestamp.Timestampable;
+import org.apache.isis.commons.having.HasUpdatedByAndAt;
 
 import lombok.Getter;
 import lombok.Setter;
@@ -38,7 +38,7 @@ import lombok.Setter;
 @Entity
 @DomainObject(
         objectType = "testdomain.jpa.ProductComment")
-public class JpaProductComment implements Timestampable {
+public class JpaProductComment implements HasUpdatedByAndAt {
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)