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/05/25 17:49:25 UTC

[isis] branch master updated: ISIS-2631: add new logicalTypeName attribute to domain object annotations

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


The following commit(s) were added to refs/heads/master by this push:
     new a79c7d8  ISIS-2631: add new logicalTypeName attribute to domain object annotations
a79c7d8 is described below

commit a79c7d8a1ffea7a0c3553d9772226358500b2a6a
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue May 25 19:49:10 2021 +0200

    ISIS-2631: add new logicalTypeName attribute to domain object
    annotations
    
    also deprecating objectType
    
    also some java-doc polishing on BookmarkService and
    TableColumnOrderService
---
 .../isis/applib/annotation/DomainObject.java       | 25 ++++++++++++++-----
 .../isis/applib/annotation/DomainService.java      | 28 ++++++++++++++++------
 .../applib/services/bookmark/BookmarkService.java  | 15 +++++++-----
 .../services/tablecol/TableColumnOrderService.java |  8 +++----
 4 files changed, 53 insertions(+), 23 deletions(-)

diff --git a/api/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java b/api/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
index f977802..39c975e 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
@@ -37,6 +37,7 @@ import org.apache.isis.applib.events.lifecycle.ObjectPersistingEvent;
 import org.apache.isis.applib.events.lifecycle.ObjectRemovingEvent;
 import org.apache.isis.applib.events.lifecycle.ObjectUpdatedEvent;
 import org.apache.isis.applib.events.lifecycle.ObjectUpdatingEvent;
+import org.apache.isis.applib.services.bookmark.Bookmark;
 
 /**
  * Domain semantics for domain objects (entities and view models;
@@ -164,17 +165,29 @@ public @interface DomainObject {
             default Nature.NOT_SPECIFIED;
 
     /**
-     * Provides a unique abbreviation for the object type's, eg
-     * &quot;customer.Customer&quot; for Customer.
+     * Synonym for {@link #logicalTypeName()}.
      *
+     * @deprecated use {@link #logicalTypeName()} instead
+     *
+     * @see #logicalTypeName()
+     */
+    String objectType()
+            default "";
+
+    /**
+     * The logical name of this object's type, that uniquely and fully qualifies it.
+     * The logical name is analogous to - but independent of - the actual fully qualified class name.
+     * eg. {@code sales.Customer} for a class 'org.mycompany.dom.Customer'
      * <p>
-     * This value, if specified, is used in the serialized form of the object's OID.  An OID is
-     * used by the framework to unique identify an object over time (same concept as a URN).
+     * This value, if specified, is used in the serialized form of the object's {@link Bookmark}.
+     * A {@link Bookmark} is used by the framework to uniquely identify an object over time
+     * (same concept as a URN).
+     * Otherwise, if not specified, the fully qualified class name is used instead.
      * </p>
      *
-     * @see DomainService#objectType()
+     * @see DomainService#logicalTypeName()
      */
-    String objectType()
+    String logicalTypeName()
             default "";
 
 
diff --git a/api/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java b/api/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java
index 7d8a0be..8ea7c22 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java
@@ -29,6 +29,8 @@ import javax.inject.Singleton;
 
 import org.springframework.stereotype.Service;
 
+import org.apache.isis.applib.services.bookmark.Bookmark;
+
 /**
  * Indicates that the class should be automatically recognized as a domain service.
  *
@@ -63,18 +65,30 @@ public @interface DomainService {
             default NatureOfService.VIEW;
 
     /**
-     * Provides a unique abbreviation for the object type's, eg
-     * &quot;customer.CustomerService&quot; for CustomerService.
+     * Synonym for {@link #logicalTypeName()}.
+     *
+     * @deprecated use {@link #logicalTypeName()} instead
      *
+     * @see #logicalTypeName()
+     */
+    String objectType()
+            default "";
+
+    /**
+     * The logical name of this object's type, that uniquely and fully qualifies it.
+     * The logical name is analogous to - but independent of - the actual fully qualified class name.
+     * eg. {@code sales.CustomerService} for a class 'org.mycompany.services.CustomerService'
      * <p>
-     * This value, if specified, is used in the serialized form of the object's
-     * OID.  An OID is used by the framework to unique identify an object over
-     * time (same concept as a URN).
+     * This value, if specified, is used in the serialized form of the object's {@link Bookmark}.
+     * A {@link Bookmark} is used by the framework to uniquely identify an object over time
+     * (same concept as a URN).
+     * Otherwise, if not specified, the fully qualified class name is used instead.
      * </p>
      *
-     * @see DomainObject#objectType()
+     * @see DomainObject#logicalTypeName()
      */
-    String objectType()
+    String logicalTypeName()
             default "";
 
+
 }
diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/bookmark/BookmarkService.java b/api/applib/src/main/java/org/apache/isis/applib/services/bookmark/BookmarkService.java
index 35e8ad3..2873a9d 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/bookmark/BookmarkService.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/services/bookmark/BookmarkService.java
@@ -35,11 +35,11 @@ import lombok.NonNull;
 public interface BookmarkService {
 
     /**
-     * Optionally returns the {@link Bookmark} for the given domain object, 
+     * Optionally returns the {@link Bookmark} for the given domain object,
      * based on whether can create a bookmark for it.
      *
      * <p>
-     * <b>Note</b>: Not every domain object is bookmark-able: 
+     * <b>Note</b>: Not every domain object is bookmark-able:
      * only entities, view models and services (NOT values or collections)
      * </p>
      *
@@ -49,12 +49,15 @@ public interface BookmarkService {
     Optional<Bookmark> bookmarkFor(@Nullable Object domainObject);
 
     /**
-     * Optionally returns a {@link Bookmark} created from the constituent parts, 
+     * Optionally returns a {@link Bookmark} created from the constituent parts,
      * based on whether can create a bookmark from these.
+     * <p>
+     * With constituent parts a {@code type} and an {@code identifier} that uniquely
+     * identifies an instance of this type.
      *
      * @return - {@link Bookmark} for provided class and identifier
      */
-    Optional<Bookmark> bookmarkFor(@Nullable Class<?> cls, @Nullable String identifier);
+    Optional<Bookmark> bookmarkFor(@Nullable Class<?> type, @Nullable String identifier);
 
     /**
      * @see #lookup(Bookmark)
@@ -73,7 +76,7 @@ public interface BookmarkService {
     Optional<Object> lookup(@Nullable Bookmark bookmark);
 
     // -- SHORTCUTS
-    
+
     /**
      * As {@link #lookup(Bookmark)}, but down-casting to the specified type.
      */
@@ -81,7 +84,7 @@ public interface BookmarkService {
         return lookup(bookmark)
                 .map(t->cls.cast(t));
     }
-    
+
     /**
      * As per {@link #bookmarkFor(Object)}, but requires that a non-null {@link Bookmark} is returned.
      *
diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/tablecol/TableColumnOrderService.java b/api/applib/src/main/java/org/apache/isis/applib/services/tablecol/TableColumnOrderService.java
index a29af6c..4a8baaf 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/tablecol/TableColumnOrderService.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/services/tablecol/TableColumnOrderService.java
@@ -71,10 +71,10 @@ public interface TableColumnOrderService {
      * </p>
      *
      * @param parent
-     * @param collectionId
+     * @param collectionId - the logical member name that identifies the collection
+     *      within its domain object type
      * @param collectionType
      * @param propertyIds
-     * @return
      */
     List<String> orderParented(
             final Object parent,
@@ -92,8 +92,8 @@ public interface TableColumnOrderService {
      * </p>
      *
      * @param collectionType
-     * @param propertyIds
-     * @return
+     * @param propertyIds - the logical member names that identify the properties
+     *      within their domain object type
      */
     List<String> orderStandalone(
             final Class<?> collectionType,