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 2015/02/07 17:38:44 UTC

[2/3] isis git commit: ISIS-1027: working towards removing deprecated annotations from Isis applib (Command service).

ISIS-1027: working towards removing deprecated annotations from Isis applib (Command service).

Also:
- tiny improvement for sign-in page for Wicket when there are metamodel validation errors.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/a05f8f01
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/a05f8f01
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/a05f8f01

Branch: refs/heads/master
Commit: a05f8f01b126312853c4f06f6c7eab8b55863076
Parents: 3888aec
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sat Feb 7 16:31:13 2015 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Sat Feb 7 16:31:13 2015 +0000

----------------------------------------------------------------------
 .../wicket/ui/pages/login/IsisSignInPanel.java  | 14 ++++++++++---
 .../applib/annotation/CommandPersistence.java   |  1 +
 .../isis/applib/services/command/Command.java   | 21 +-------------------
 .../applib/services/command/CommandDefault.java |  2 +-
 .../PropertyAnnotationFacetFactory.java         |  3 ++-
 5 files changed, 16 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/a05f8f01/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/IsisSignInPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/IsisSignInPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/IsisSignInPanel.java
index e6c22b9..9583424 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/IsisSignInPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/login/IsisSignInPanel.java
@@ -93,13 +93,21 @@ public class IsisSignInPanel extends SignInPanel {
             final String id,
             final PageType pageType,
             final boolean visibilityAllowed) {
-        final Class<? extends Page> signUpPageClass = pageClassRegistry.getPageClass(pageType);
-        final BookmarkablePageLink<Void> link = new BookmarkablePageLink<>(id, signUpPageClass);
 
-        if(!visibilityAllowed) {
+        final BookmarkablePageLink<Void> link;
+        if(pageClassRegistry != null) {
+            final Class<? extends Page> signUpPageClass = pageClassRegistry.getPageClass(pageType);
+            link = new BookmarkablePageLink<>(id, signUpPageClass);
+            if(!visibilityAllowed) {
+                link.setVisibilityAllowed(false);
+            }
+        } else {
+            // can happen if failed to bootstrap due to metamodel validation errors
+            link = new BookmarkablePageLink<>(id, null);
             link.setVisibilityAllowed(false);
         }
 
+
         getSignInForm().addOrReplace(link);
         return link;
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/a05f8f01/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java
index a09923c..5709af9 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java
@@ -59,6 +59,7 @@ public enum CommandPersistence {
     public static Command.Persistence from(final CommandPersistence commandPersistence) {
         if(commandPersistence == null) return null;
         if(commandPersistence == PERSISTED) return Command.Persistence.PERSISTED;
+        if(commandPersistence == NOT_PERSISTED) return Command.Persistence.NOT_PERSISTED;
         if(commandPersistence == IF_HINTED) return Command.Persistence.IF_HINTED;
         // shouldn't happen
         throw new IllegalArgumentException("Unrecognized : persistence" + commandPersistence);

http://git-wip-us.apache.org/repos/asf/isis/blob/a05f8f01/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
index f791ba9..275e78b 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
@@ -20,7 +20,6 @@ import java.sql.Timestamp;
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.applib.annotation.Command.ExecuteIn;
 import org.apache.isis.applib.annotation.Command.Persistence;
-import org.apache.isis.applib.annotation.Disabled;
 import org.apache.isis.applib.annotation.Optional;
 import org.apache.isis.applib.annotation.Programmatic;
 import org.apache.isis.applib.clock.Clock;
@@ -32,7 +31,6 @@ import org.apache.isis.applib.services.bookmark.BookmarkService;
 
 public interface Command extends HasTransactionId {
 
-    
     // //////////////////////////////////////
     // user (property)
     // //////////////////////////////////////
@@ -40,7 +38,7 @@ public interface Command extends HasTransactionId {
     /**
      * The user that initiated the action.
      */
-    @Disabled
+
     public abstract String getUser();
     /**
      * <b>NOT API</b>: intended to be called only by the framework.
@@ -57,7 +55,6 @@ public interface Command extends HasTransactionId {
     /**
      * The date/time at which this action was created.
      */
-    @Disabled
     public abstract Timestamp getTimestamp();
     /**
      * <b>NOT API</b>: intended to be called only by the framework.
@@ -79,7 +76,6 @@ public interface Command extends HasTransactionId {
      * <p>
      * Will only be populated if a {@link BookmarkService} has been configured.
      */
-    @Disabled
     public abstract Bookmark getTarget();
     /**
      * <b>NOT API</b>: intended to be called only by the framework.
@@ -103,7 +99,6 @@ public interface Command extends HasTransactionId {
      * consistency with other services (such as auditing and publishing) that may act on
      * properties rather than simply just actions.
      */
-    @Disabled
     public abstract String getMemberIdentifier();
 
     /**
@@ -121,7 +116,6 @@ public interface Command extends HasTransactionId {
     /**
      * A human-friendly description of the class of the target object.
      */
-    @Disabled
     public abstract String getTargetClass();
 
     /**
@@ -139,7 +133,6 @@ public interface Command extends HasTransactionId {
     /**
      * The human-friendly name of the action invoked on the target object.
      */
-    @Disabled
     public abstract String getTargetAction();
     
     /**
@@ -157,7 +150,6 @@ public interface Command extends HasTransactionId {
     /**
      * A human-friendly description of the arguments with which the action was invoked.
      */
-    @Disabled
     public String getArguments();
     
     /**
@@ -176,7 +168,6 @@ public interface Command extends HasTransactionId {
     /**
      * A formal (XML or similar) specification of the action to invoke/being invoked.
      */
-    @Disabled
     public String getMemento();
     
     /**
@@ -197,7 +188,6 @@ public interface Command extends HasTransactionId {
      * {@link ExecuteIn#FOREGROUND foreground}&quot; or is to be executed asynchronously &quot;in the 
      * {@link ExecuteIn#BACKGROUND background}&quot; through the {@link BackgroundCommandService}.
      */
-    @Disabled
     public ExecuteIn getExecuteIn();
     
     /**
@@ -245,7 +235,6 @@ public interface Command extends HasTransactionId {
      * </ul>
      * 
      */
-    @Disabled
     public Executor getExecutor();
 
     
@@ -270,7 +259,6 @@ public interface Command extends HasTransactionId {
      * {@link ExecuteIn#BACKGROUND background} actions, this will be populated only when the
      * action is executed by a background execution process.
      */
-    @Disabled
     public abstract Timestamp getStartedAt();
     
     /**
@@ -290,7 +278,6 @@ public interface Command extends HasTransactionId {
     /**
      * The date/time at which this action completed.
      */
-    @Disabled
     public abstract Timestamp getCompletedAt();
     
     /**
@@ -311,8 +298,6 @@ public interface Command extends HasTransactionId {
      * For actions created through the {@link BackgroundService} and {@link BackgroundCommandService},
      * captures the parent action.
      */
-    @Optional
-    @Disabled
     public Command getParent();
 
     /**
@@ -325,7 +310,6 @@ public interface Command extends HasTransactionId {
     // exception (property)
     // //////////////////////////////////////
 
-    @Disabled
     @Optional
     public String getException();
 
@@ -350,8 +334,6 @@ public interface Command extends HasTransactionId {
      * For <tt>void</tt> methods and for actions returning collections, the value
      * will be <tt>null</tt>.
      */
-    @Disabled
-    @Optional
     public Bookmark getResult();
     
     /**
@@ -386,7 +368,6 @@ public interface Command extends HasTransactionId {
      * {@link Command}.  The hinting mechanism allows the service to suggest that the parent command be persisted so
      * that the app can then provide a mechanism to find all child background commands for that original parent command.
      */
-    @Disabled
     public Persistence getPersistence();
     
     /**

http://git-wip-us.apache.org/repos/asf/isis/blob/a05f8f01/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
index ce0cdd4..e129023 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
@@ -425,7 +425,7 @@ public class CommandDefault implements Command2, Command3 {
 
     @Override
     public String toString() {
-        return ObjectContracts.toString(this, "startedAt,user,actionIdentifier,target,guid");
+        return ObjectContracts.toString(this, "startedAt,user,memberIdentifier,target,transactionId");
     }
     
     

http://git-wip-us.apache.org/repos/asf/isis/blob/a05f8f01/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
index c8bc1a2..cc02bfe 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
@@ -255,7 +255,8 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
 
         // check for deprecated @Disabled first
         final Disabled annotation = Annotations.getAnnotation(method, Disabled.class);
-        DisabledFacet facet = disabledValidator.flagIfPresent(DisabledFacetForDisabledAnnotationOnProperty.create(annotation, holder), processMethodContext);
+        final DisabledFacet disabledFacet = DisabledFacetForDisabledAnnotationOnProperty.create(annotation, holder);
+        DisabledFacet facet = disabledValidator.flagIfPresent(disabledFacet, processMethodContext);
 
         // else search for @Property(editing=...)
         final Property property = Annotations.getAnnotation(method, Property.class);