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 2016/02/24 07:29:38 UTC

[2/2] isis git commit: ISIS-1311: split out Persistable_datanucleusVersion mixin into two, one for timestamps and one for longs (per different VersionStrategy in JDO annotation).

ISIS-1311: split out Persistable_datanucleusVersion mixin into two, one for timestamps and one for longs (per different VersionStrategy in JDO annotation).

Also:
- remove the hideXxx() for Object_downloadLayoutXml mixin, will always be visible.


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

Branch: refs/heads/ISIS-993
Commit: 23f92334256fb76ee57d9f2807df2602cab60096
Parents: 97abf1b
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Feb 24 06:28:55 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Feb 24 06:28:55 2016 +0000

----------------------------------------------------------------------
 .../layout/Object_downloadLayoutXml.java        |  6 +-
 .../jdosupport/Persistable_datanucleusId.java   |  6 +-
 .../Persistable_datanucleusVersion.java         | 64 --------------------
 .../Persistable_datanucleusVersionLong.java     | 64 ++++++++++++++++++++
 ...Persistable_datanucleusVersionTimestamp.java | 64 ++++++++++++++++++++
 5 files changed, 132 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/23f92334/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java b/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
index eee95b0..0a0fb47 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
@@ -52,7 +52,7 @@ public class Object_downloadLayoutXml {
             cssClassFa = "fa-download",
             position = ActionLayout.Position.PANEL_DROPDOWN
     )
-    @MemberOrder(name = "Metadata", sequence = "550.1")
+    @MemberOrder(name = "Metadata", sequence = "700.1")
     public Object $$(
             @ParameterLayout(named = "File name")
             final String fileName,
@@ -67,10 +67,6 @@ public class Object_downloadLayoutXml {
         return new Clob(Util.withSuffix(fileName, style.name().toLowerCase() + ".xml"), "text/xml", xml);
     }
 
-    public boolean hide$$() {
-        // can use either style to determine whether this action should be hidden
-        return getGrid(GridService.Style.NORMALIZED) == null;
-    }
     public String default0$$() {
         return Util.withSuffix(object.getClass().getSimpleName(), "layout");
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/23f92334/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusId.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusId.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusId.java
index 15a7296..51041e6 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusId.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusId.java
@@ -53,7 +53,7 @@ public class Persistable_datanucleusId {
             hidden = Where.ALL_TABLES
     )
     @MemberOrder(name = "Metadata", sequence = "800.1")
-    public Long datanucleusId() {
+    public Long $$() {
         final Object objectId = JDOHelper.getObjectId(persistable);
         if(objectId instanceof DatastoreId) {
             final DatastoreId datastoreId = (DatastoreId) objectId;
@@ -63,8 +63,8 @@ public class Persistable_datanucleusId {
         return null;
     }
 
-    public boolean hideDatanucleusId() {
-        return datanucleusId() == null;
+    public boolean hide$$() {
+        return $$() == null;
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/23f92334/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersion.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersion.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersion.java
deleted file mode 100644
index 083ba86..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersion.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  Copyright 2015-2016 Eurocommercial Properties NV
- *
- *  Licensed 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.services.jdosupport;
-
-import javax.jdo.JDOHelper;
-
-import org.datanucleus.enhancement.Persistable;
-
-import org.apache.isis.applib.annotation.Action;
-import org.apache.isis.applib.annotation.ActionLayout;
-import org.apache.isis.applib.annotation.Contributed;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Mixin;
-import org.apache.isis.applib.annotation.PropertyLayout;
-import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.annotation.Where;
-
-@Mixin
-public class Persistable_datanucleusVersion {
-
-    private final Persistable persistable;
-
-    public Persistable_datanucleusVersion(final Persistable persistable) {
-        this.persistable = persistable;
-    }
-
-    public static class ActionDomainEvent extends org.apache.isis.applib.IsisApplibModule.ActionDomainEvent<Persistable_datanucleusVersion> {}
-
-    @Action(
-            domainEvent = ActionDomainEvent.class,
-            semantics = SemanticsOf.SAFE
-    )
-    @ActionLayout(
-            contributed = Contributed.AS_ASSOCIATION
-    )
-    @PropertyLayout(
-            named = "Version",
-            hidden = Where.ALL_TABLES
-    )
-    @MemberOrder(name = "Metadata", sequence = "800.2")
-    public Long datanucleusVersion() {
-        final Object version = JDOHelper.getVersion(persistable);
-        return version != null && version instanceof Long ? (Long) version : null;
-    }
-
-    public boolean hideDatanucleusVersion() {
-        return datanucleusVersion() == null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/23f92334/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersionLong.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersionLong.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersionLong.java
new file mode 100644
index 0000000..0bf2603
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersionLong.java
@@ -0,0 +1,64 @@
+/*
+ *  Copyright 2015-2016 Eurocommercial Properties NV
+ *
+ *  Licensed 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.services.jdosupport;
+
+import javax.jdo.JDOHelper;
+
+import org.datanucleus.enhancement.Persistable;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
+import org.apache.isis.applib.annotation.Contributed;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Mixin;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.annotation.Where;
+
+@Mixin
+public class Persistable_datanucleusVersionLong {
+
+    private final Persistable persistable;
+
+    public Persistable_datanucleusVersionLong(final Persistable persistable) {
+        this.persistable = persistable;
+    }
+
+    public static class ActionDomainEvent extends org.apache.isis.applib.IsisApplibModule.ActionDomainEvent<Persistable_datanucleusVersionLong> {}
+
+    @Action(
+            domainEvent = ActionDomainEvent.class,
+            semantics = SemanticsOf.SAFE
+    )
+    @ActionLayout(
+            contributed = Contributed.AS_ASSOCIATION
+    )
+    @PropertyLayout(
+            named = "Version",
+            hidden = Where.ALL_TABLES
+    )
+    @MemberOrder(name = "Metadata", sequence = "800.2")
+    public Long $$() {
+        final Object version = JDOHelper.getVersion(persistable);
+        return version != null && version instanceof Long ? (Long) version : null;
+    }
+
+    public boolean hide$$() {
+        return $$() == null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/23f92334/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersionTimestamp.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersionTimestamp.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersionTimestamp.java
new file mode 100644
index 0000000..24960a9
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/jdosupport/Persistable_datanucleusVersionTimestamp.java
@@ -0,0 +1,64 @@
+/*
+ *  Copyright 2015-2016 Eurocommercial Properties NV
+ *
+ *  Licensed 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.services.jdosupport;
+
+import javax.jdo.JDOHelper;
+
+import org.datanucleus.enhancement.Persistable;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
+import org.apache.isis.applib.annotation.Contributed;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Mixin;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.annotation.Where;
+
+@Mixin
+public class Persistable_datanucleusVersionTimestamp {
+
+    private final Persistable persistable;
+
+    public Persistable_datanucleusVersionTimestamp(final Persistable persistable) {
+        this.persistable = persistable;
+    }
+
+    public static class ActionDomainEvent extends org.apache.isis.applib.IsisApplibModule.ActionDomainEvent<Persistable_datanucleusVersionTimestamp> {}
+
+    @Action(
+            domainEvent = ActionDomainEvent.class,
+            semantics = SemanticsOf.SAFE
+    )
+    @ActionLayout(
+            contributed = Contributed.AS_ASSOCIATION
+    )
+    @PropertyLayout(
+            named = "Version",
+            hidden = Where.ALL_TABLES
+    )
+    @MemberOrder(name = "Metadata", sequence = "800.2")
+    public java.sql.Timestamp $$() {
+        final Object version = JDOHelper.getVersion(persistable);
+        return version != null && version instanceof java.sql.Timestamp ? (java.sql.Timestamp) version : null;
+    }
+
+    public boolean hide$$() {
+        return $$() == null;
+    }
+
+}